diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-12-29 10:15:00 +0100 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-01-22 15:43:33 +0100 |
commit | 92215e7a801da7b89037a185c98f5ebb86a415b9 (patch) | |
tree | 3c1547bd8226598cc84cbeaa351f84d86ef6badf /scripts/clang-tools | |
parent | kbuild: make W=1 warn files that are tracked but ignored by git (diff) | |
download | linux-92215e7a801da7b89037a185c98f5ebb86a415b9.tar.xz linux-92215e7a801da7b89037a185c98f5ebb86a415b9.zip |
kbuild: rename cmd_$@ to savedcmd_$@ in *.cmd files
The cmd-check macro compares $(cmd_$@) and $(cmd_$1), but a pitfall is
that you cannot use cmd_<target> as the variable name for the command.
For example, the following code will not work in the top Makefile
or ./Kbuild.
quiet_cmd_foo = GEN $@
cmd_foo = touch $@
targets += foo
foo: FORCE
$(call if_changed,foo)
In this case, both $@ and $1 are expanded to 'foo', so $(cmd_check)
is always empty.
We do not need to use the same prefix for cmd_$@ and cmd_$1.
Rename the former to savedcmd_$@.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/clang-tools')
-rwxr-xr-x | scripts/clang-tools/gen_compile_commands.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index 0227522959a4..15ba56527acd 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' _FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^cmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # The tools/ directory adopts a different build system, and produces .cmd # files in a different format. Do not support it. |