linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gen_compile_commands: fix invalid escape sequence
@ 2024-02-13  1:20 Andrew Ballance
  2024-02-13  1:48 ` Masahiro Yamada
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Ballance @ 2024-02-13  1:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: masahiroy, nathan, nicolas, ndesaulniers, morbo, justinstitt,
	linux-kbuild, llvm, skhan, linux-kernel-mentees, Andrew Ballance

this fixes the error, "SyntaxWarning: invalid escape sequence '\#'"

the error can be recreated by running
    make CC=clang compile_commands.json

Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
---
 scripts/clang-tools/gen_compile_commands.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
index 5dea4479240b..93f64095fda9 100755
--- a/scripts/clang-tools/gen_compile_commands.py
+++ b/scripts/clang-tools/gen_compile_commands.py
@@ -170,7 +170,7 @@ def process_line(root_directory, command_prefix, file_path):
     # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the
     # kernel version). The compile_commands.json file is not interepreted
     # by Make, so this code replaces the escaped version with '#'.
-    prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#')
+    prefix = command_prefix.replace('\\#', '#').replace('$(pound)', '#')
 
     # Return the canonical path, eliminating any symbolic links encountered in the path.
     abs_path = os.path.realpath(os.path.join(root_directory, file_path))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-14 21:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13  1:20 [PATCH] gen_compile_commands: fix invalid escape sequence Andrew Ballance
2024-02-13  1:48 ` Masahiro Yamada
2024-02-13  2:25   ` [PATCH v2] gen_compile_commands: fix invalid escape sequence warning Andrew Ballance
2024-02-13 20:00     ` Nicolas Schier
2024-02-14  0:31       ` Justin Stitt
2024-02-14  1:23         ` [PATCH v3 0/1] " Andrew Ballance
2024-02-14  1:23           ` [PATCH v3 1/1] " Andrew Ballance
2024-02-14 18:28             ` Justin Stitt
2024-02-14 21:27             ` Masahiro Yamada
2024-02-14  0:40     ` [PATCH v2] " Justin Stitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).