Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros

cc-option-yn and cc-disable-warning duplicate the compile command seen
a few lines above. These can be defined based on cc-option.

I also refactored rustc-option-yn in the same way, although there are
currently no users of it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20241009102821.2675718-1-masahiroy@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Masahiro Yamada and committed by
Miguel Ojeda
b55da847 ab885143

+3 -6
+3 -6
scripts/Makefile.compiler
··· 53 53 54 54 # cc-option-yn 55 55 # Usage: flag := $(call cc-option-yn,-march=winchip-c6) 56 - cc-option-yn = $(call try-run,\ 57 - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) 56 + cc-option-yn = $(if $(call cc-option,$1),y,n) 58 57 59 58 # cc-disable-warning 60 59 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) 61 - cc-disable-warning = $(call try-run,\ 62 - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) 60 + cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1)) 63 61 64 62 # gcc-min-version 65 63 # Usage: cflags-$(call gcc-min-version, 70100) += -foo ··· 83 85 84 86 # rustc-option-yn 85 87 # Usage: flag := $(call rustc-option-yn,-Cinstrument-coverage) 86 - rustc-option-yn = $(call try-run,\ 87 - $(RUSTC) $(KBUILD_RUSTFLAGS) $(1) --crate-type=rlib /dev/null --out-dir=$$TMPOUT -o "$$TMP",y,n) 88 + rustc-option-yn = $(if $(call rustc-option,$1),y,n)