* [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
@ 2024-10-09 10:27 Masahiro Yamada
2024-10-09 12:02 ` Alice Ryhl
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-10-09 10:27 UTC (permalink / raw)
To: linux-kbuild
Cc: Miguel Ojeda, Matthew Maurer, Alice Ryhl, rust-for-linux,
Masahiro Yamada, Alex Gaynor, Andreas Hindborg, Benno Lossin,
Björn Roy Baron, Boqun Feng, Gary Guo, Nathan Chancellor,
Nicolas Schier, Trevor Gross, linux-kernel
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>
---
This avoids applying similar fixes to rustc-option and rustc-option-yn.
scripts/Makefile.compiler | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 057305eae85c..73d611d383b2 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -53,13 +53,11 @@ cc-option = $(call __cc-option, $(CC),\
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
-cc-option-yn = $(call try-run,\
- $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
+cc-option-yn = $(if $(call cc-option,$1),y,n)
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
-cc-disable-warning = $(call try-run,\
- $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1))
# gcc-min-version
# Usage: cflags-$(call gcc-min-version, 70100) += -foo
@@ -85,5 +83,4 @@ rustc-option = $(call __rustc-option, $(RUSTC),\
# rustc-option-yn
# Usage: flag := $(call rustc-option-yn,-Cinstrument-coverage)
-rustc-option-yn = $(call try-run,\
- $(RUSTC) $(KBUILD_RUSTFLAGS) $(1) --crate-type=rlib /dev/null --out-dir=$$TMPOUT -o "$$TMP",y,n)
+rustc-option-yn = $(if $(call rustc-option,$1),y,n)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
2024-10-09 10:27 [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros Masahiro Yamada
@ 2024-10-09 12:02 ` Alice Ryhl
2024-10-09 18:27 ` Nathan Chancellor
2024-10-14 21:56 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Alice Ryhl @ 2024-10-09 12:02 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Miguel Ojeda, Matthew Maurer, rust-for-linux,
Alex Gaynor, Andreas Hindborg, Benno Lossin, Björn Roy Baron,
Boqun Feng, Gary Guo, Nathan Chancellor, Nicolas Schier,
Trevor Gross, linux-kernel
On Wed, Oct 9, 2024 at 12:28 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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>
> ---
>
> This avoids applying similar fixes to rustc-option and rustc-option-yn.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
2024-10-09 10:27 [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros Masahiro Yamada
2024-10-09 12:02 ` Alice Ryhl
@ 2024-10-09 18:27 ` Nathan Chancellor
2024-10-14 21:56 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2024-10-09 18:27 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Miguel Ojeda, Matthew Maurer, Alice Ryhl,
rust-for-linux, Alex Gaynor, Andreas Hindborg, Benno Lossin,
Björn Roy Baron, Boqun Feng, Gary Guo, Nicolas Schier,
Trevor Gross, linux-kernel
On Wed, Oct 09, 2024 at 07:27:37PM +0900, Masahiro Yamada wrote:
> 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>
Neat!
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> This avoids applying similar fixes to rustc-option and rustc-option-yn.
>
> scripts/Makefile.compiler | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> index 057305eae85c..73d611d383b2 100644
> --- a/scripts/Makefile.compiler
> +++ b/scripts/Makefile.compiler
> @@ -53,13 +53,11 @@ cc-option = $(call __cc-option, $(CC),\
>
> # cc-option-yn
> # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
> -cc-option-yn = $(call try-run,\
> - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
> +cc-option-yn = $(if $(call cc-option,$1),y,n)
>
> # cc-disable-warning
> # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
> -cc-disable-warning = $(call try-run,\
> - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
> +cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1))
>
> # gcc-min-version
> # Usage: cflags-$(call gcc-min-version, 70100) += -foo
> @@ -85,5 +83,4 @@ rustc-option = $(call __rustc-option, $(RUSTC),\
>
> # rustc-option-yn
> # Usage: flag := $(call rustc-option-yn,-Cinstrument-coverage)
> -rustc-option-yn = $(call try-run,\
> - $(RUSTC) $(KBUILD_RUSTFLAGS) $(1) --crate-type=rlib /dev/null --out-dir=$$TMPOUT -o "$$TMP",y,n)
> +rustc-option-yn = $(if $(call rustc-option,$1),y,n)
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
2024-10-09 10:27 [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros Masahiro Yamada
2024-10-09 12:02 ` Alice Ryhl
2024-10-09 18:27 ` Nathan Chancellor
@ 2024-10-14 21:56 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2024-10-14 21:56 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Miguel Ojeda, Matthew Maurer, Alice Ryhl,
rust-for-linux, Alex Gaynor, Andreas Hindborg, Benno Lossin,
Björn Roy Baron, Boqun Feng, Gary Guo, Nathan Chancellor,
Nicolas Schier, Trevor Gross, linux-kernel
On Wed, Oct 9, 2024 at 12:28 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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>
Applied to `rust-fixes` as a prerequisite for the `rustc-option` fix
-- thanks everyone!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-14 21:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 10:27 [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros Masahiro Yamada
2024-10-09 12:02 ` Alice Ryhl
2024-10-09 18:27 ` Nathan Chancellor
2024-10-14 21:56 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).