[PATCH v2] docs: kconfig: fix shell function syntax in caveats
From: Erkan Erdem
Date: Mon Sep 07 2026 - 06:43:48 EST
Kconfig separates a function name from its arguments with a comma, but
the caveats section uses Make-style whitespace in its shell calls.
These expressions expand as undefined variables rather than invoking
the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG
example fails to parse.
Add the missing commas to the shell calls in this section. Keep the
Make examples unchanged.
Fixes: 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by: LLM
Signed-off-by: Erkan Erdem <hexvalid@xxxxxxxxx>
---
Changes in v2, addressing Julian Braha's review:
- Remove whitespace after the comma in the three remaining shell calls.
v1: https://lore.kernel.org/all/20260905124045.42713-1-hexvalid@xxxxxxxxx/
The issue, patch and changelog were prepared with an AI coding assistant.
The assistant also prepared the v2 revision and ran the checks below.
Validation:
- Re-ran the documented working CC_HAS_ENDIAN_FLAG example using the
Kconfig conf tool built with Clang on macOS. With a test helper returning
y for either endian flag, the original example fails to parse; v2
executes both probes and sets CC_HAS_ENDIAN_FLAG=y for both endiannesses.
- Rebuilt the changed page alone with Sphinx, treating warnings as errors.
- The complete kernel documentation set and kernel were not built.
Documentation/kbuild/kconfig-macro-language.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/kbuild/kconfig-macro-language.rst b/Documentation/kbuild/kconfig-macro-language.rst
index 6163467f6..c427bece3 100644
--- a/Documentation/kbuild/kconfig-macro-language.rst
+++ b/Documentation/kbuild/kconfig-macro-language.rst
@@ -225,7 +225,7 @@ not work::
$(MY_TYPE) "foo"
default y
-Obviously from the design, $(shell command) is expanded in the textual
+Obviously from the design, $(shell,command) is expanded in the textual
substitution phase. You cannot pass symbols to the 'shell' function.
The following does not work as expected::
@@ -236,12 +236,12 @@ The following does not work as expected::
default "-mlittle-endian" if CPU_LITTLE_ENDIAN
config CC_HAS_ENDIAN_FLAG
- def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
+ def_bool $(shell,$(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
Instead, you can do like follows so that any function call is statically
expanded::
config CC_HAS_ENDIAN_FLAG
bool
- default $(shell $(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
- default $(shell $(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN
+ default $(shell,$(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
+ default $(shell,$(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN
base-commit: 4d7d9486c04d917265f64c55bd23b2cc4fe7749c
--
2.50.1 (Apple Git-155)