From: Nathan Chancellor <nathan@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
"Matthew Maurer" <mmaurer@google.com>,
"Alice Ryhl" <aliceryhl@google.com>,
rust-for-linux@vger.kernel.org,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Benno Lossin" <benno.lossin@proton.me>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Nicolas Schier" <nicolas@fjasle.eu>,
"Trevor Gross" <tmgross@umich.edu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: refactor cc-option-yn, cc-disable-warning, rust-option-yn macros
Date: Wed, 9 Oct 2024 11:27:09 -0700 [thread overview]
Message-ID: <20241009182709.GA3274931@thelio-3990X> (raw)
In-Reply-To: <20241009102821.2675718-1-masahiroy@kernel.org>
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
>
next prev parent reply other threads:[~2024-10-09 18:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-10-14 21:56 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241009182709.GA3274931@thelio-3990X \
--to=nathan@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mmaurer@google.com \
--cc=nicolas@fjasle.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox