linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: shorten the temporary directory name for cc-option
@ 2022-07-19  2:35 Masahiro Yamada
  2022-07-19  3:59 ` Nicolas Schier
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2022-07-19  2:35 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The cc-option macro creates the temporary directory, .tmp_$$$$, which
is expanded into .tmp_<PID><PID>, but the second <PID> is redundant.
(<PID> is the process ID of the sub-shell)

If it were the Makefile code, .tmp_$$$$ would be the correct code.
(see the TMPOUT macro in scripts/Malefile.compiler)

In Makefile, '$$' is an escape sequence of '$'. Make expands '$$$$'
into '$$', then shell expands it into the process ID.

This does not apply to Kconfig because Kconfig requires variable
references to be enclosed by curly braces, like ${variable}.
The '$' that is not followed by '{' loses its special function.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/Kconfig.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 0496efd6e117..c1f4222d223d 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
 
 # $(cc-option,<flag>)
 # Return y if the compiler supports <flag>, n otherwise
-cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o)
+cc-option = $(success,mkdir .tmp_$$; trap "rm -rf .tmp_$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o)
 
 # $(ld-option,<flag>)
 # Return y if the linker supports <flag>, n otherwise
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kconfig: shorten the temporary directory name for cc-option
  2022-07-19  2:35 [PATCH] kconfig: shorten the temporary directory name for cc-option Masahiro Yamada
@ 2022-07-19  3:59 ` Nicolas Schier
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Schier @ 2022-07-19  3:59 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel

On Tue 19 Jul 2022 11:35:39 +0900 Masahiro Yamada wrote:
> Date:   Tue, 19 Jul 2022 11:35:39 +0900
> From: Masahiro Yamada <masahiroy@kernel.org>
> To: linux-kbuild@vger.kernel.org
> Cc: Masahiro Yamada <masahiroy@kernel.org>, linux-kernel@vger.kernel.org
> Subject: [PATCH] kconfig: shorten the temporary directory name for cc-option
> Message-Id: <20220719023539.2199045-1-masahiroy@kernel.org>
> X-Mailer: git-send-email 2.34.1
> X-Mailing-List: linux-kbuild@vger.kernel.org
> 
> The cc-option macro creates the temporary directory, .tmp_$$$$, which
> is expanded into .tmp_<PID><PID>, but the second <PID> is redundant.
> (<PID> is the process ID of the sub-shell)
> 
> If it were the Makefile code, .tmp_$$$$ would be the correct code.
> (see the TMPOUT macro in scripts/Malefile.compiler)

Typo: Malefile -> Makefile

> 
> In Makefile, '$$' is an escape sequence of '$'. Make expands '$$$$'
> into '$$', then shell expands it into the process ID.
> 
> This does not apply to Kconfig because Kconfig requires variable
> references to be enclosed by curly braces, like ${variable}.
> The '$' that is not followed by '{' loses its special function.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Tested-by: Nicolas Schier <nicolas@fjasle.eu>

> 
>  scripts/Kconfig.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
> index 0496efd6e117..c1f4222d223d 100644
> --- a/scripts/Kconfig.include
> +++ b/scripts/Kconfig.include
> @@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
>  
>  # $(cc-option,<flag>)
>  # Return y if the compiler supports <flag>, n otherwise
> -cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o)
> +cc-option = $(success,mkdir .tmp_$$; trap "rm -rf .tmp_$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o)
>  
>  # $(ld-option,<flag>)
>  # Return y if the linker supports <flag>, n otherwise
> -- 
> 2.34.1

-- 
epost|xmpp: nicolas@fjasle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-19  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19  2:35 [PATCH] kconfig: shorten the temporary directory name for cc-option Masahiro Yamada
2022-07-19  3:59 ` Nicolas Schier

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).