Skip to content

Commit 90efe2b

Browse files
committed
gen_compile_commands.py: remove code for '\#' replacement
Since commit 9564a8c ("Kbuild: fix # escaping in .cmd files for future Make"), '#' in the build command is replaced with $(pound) rather than '\#'. Calling .replace(r'\#', '#') is only necessary when this tool is used to parse .*.cmd files generated by Linux 4.16 or earlier, which is unlikely to happen. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
1 parent e966ad0 commit 90efe2b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

scripts/clang-tools/gen_compile_commands.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ def process_line(root_directory, command_prefix, file_path):
167167
root_directory or file_directory.
168168
"""
169169
# The .cmd files are intended to be included directly by Make, so they
170-
# escape the pound sign '#', either as '\#' or '$(pound)' (depending on the
171-
# kernel version). The compile_commands.json file is not interepreted
172-
# by Make, so this code replaces the escaped version with '#'.
173-
prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#')
170+
# escape the pound sign '#' as '$(pound)'. The compile_commands.json file
171+
# is not interepreted by Make, so this code replaces the escaped version
172+
# with '#'.
173+
prefix = command_prefix.replace('$(pound)', '#')
174174

175175
# Return the canonical path, eliminating any symbolic links encountered in the path.
176176
abs_path = os.path.realpath(os.path.join(root_directory, file_path))

0 commit comments

Comments
 (0)