Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gen_compile_commands.py: remove code for '\#' replacement

Since commit 9564a8cf422d ("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>

+4 -4
+4 -4
scripts/clang-tools/gen_compile_commands.py
··· 167 167 root_directory or file_directory. 168 168 """ 169 169 # 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)', '#') 174 174 175 175 # Return the canonical path, eliminating any symbolic links encountered in the path. 176 176 abs_path = os.path.realpath(os.path.join(root_directory, file_path))