Skip to contentSkip to conversation

kconfig: shorten the temporary directory name for cc-option

PATCH In review Masahiro Yamada 2 participants 2 messages Jul 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: shorten the temporary directory name for cc-option

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.

---

 scripts/Kconfig.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Kconfig.include +1 -1
index 0496efd6e117..c1f4222d223d 100644
@@ -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
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Tue 19 Jul 2022 11:35:39 +0900 Masahiro Yamada wrote:

Date: Tue, 19 Jul 2022 11:35:39 +0900
From: Masahiro Yamada <[email protected]>
To: [email protected]
Cc: Masahiro Yamada <[email protected]>, [email protected]
Subject: [PATCH] kconfig: shorten the temporary directory name for cc-option
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.34.1
X-Mailing-List: [email protected]

Quoted 6 lines

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

Quoted 10 lines

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.

---

Quoted 19 lines
 scripts/Kconfig.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Kconfig.include +1 -1
index 0496efd6e117..c1f4222d223d 100644
@@ -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
Signature · 1 line
2.34.1
Signature · 3 lines
epost|xmpp: [email protected]          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --