From: Nathan Chancellor <nathan@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
llvm@lists.linux.dev
Subject: Re: [PATCH] gen_compile_commands.py: remove code for '\#' replacement
Date: Fri, 7 Feb 2025 14:34:39 -0700 [thread overview]
Message-ID: <20250207213439.GA661404@ax162> (raw)
In-Reply-To: <20250205171811.3471289-1-masahiroy@kernel.org>
On Thu, Feb 06, 2025 at 02:18:02AM +0900, Masahiro Yamada wrote:
> 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 happen.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> scripts/clang-tools/gen_compile_commands.py | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
> index e4fb686dfaa9..96e6e46ad1a7 100755
> --- a/scripts/clang-tools/gen_compile_commands.py
> +++ b/scripts/clang-tools/gen_compile_commands.py
> @@ -167,10 +167,10 @@ def process_line(root_directory, command_prefix, file_path):
> root_directory or file_directory.
> """
> # The .cmd files are intended to be included directly by Make, so they
> - # 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(r'\#', '#').replace('$(pound)', '#')
> + # escape the pound sign '#' as '$(pound)'. The compile_commands.json file
> + # is not interepreted by Make, so this code replaces the escaped version
> + # with '#'.
> + prefix = command_prefix.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
>
prev parent reply other threads:[~2025-02-07 21:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 17:18 [PATCH] gen_compile_commands.py: remove code for '\#' replacement Masahiro Yamada
2025-02-07 21:34 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250207213439.GA661404@ax162 \
--to=nathan@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=morbo@google.com \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox