From: Masahiro Yamada <masahiroy@kernel.org>
To: Hu Weiwen <huww98@outlook.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>,
Tom Rix <trix@redhat.com>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH v2] gen_compile_commands: include targets not ending with .o
Date: Mon, 29 May 2023 19:13:46 +0900 [thread overview]
Message-ID: <CAK7LNATz8xDmf5SuApGnrbkxvWPJNG1HTuQSrw2v_Ox5sXQO2A@mail.gmail.com> (raw)
In-Reply-To: <OSZP286MB20611C35BF36F4EB69FD3DF6C0469@OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM>
On Thu, May 25, 2023 at 9:21 PM Hu Weiwen <huww98@outlook.com> wrote:
>
> Currently, we only extract commands for targets ending with '.o'. But we
> also have many standalone executables built in-tree.
>
> Remove this restriction. And to avoid some false matching, exclude
> targets end with '.c' or '.h' when directly walking the directory.
Can you give me some examples of false matching?
Also, this patch would pick up *.i, *.s, *.lst, etc.
Does it make sense to parse cmd files for those?
I guess the answer is no.
>
> To really generate compile_commands.json that includes such target, call
> this script directly with no arguments. `make compile_commands.json`
> will not include them.
>
> Signed-off-by: Hu Weiwen <huww98@outlook.com>
> ---
> Since V1: Only commit message is updated.
>
> scripts/clang-tools/gen_compile_commands.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py
> index 15ba56527acd..6e88c7e166fc 100755
> --- a/scripts/clang-tools/gen_compile_commands.py
> +++ b/scripts/clang-tools/gen_compile_commands.py
> @@ -18,8 +18,8 @@ import sys
> _DEFAULT_OUTPUT = 'compile_commands.json'
> _DEFAULT_LOG_LEVEL = 'WARNING'
>
> -_FILENAME_PATTERN = r'^\..*\.cmd$'
> -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'
> +_FILENAME_PATTERN = r'^\..*(?<!\.(c|h))\.cmd$'
> +_LINE_PATTERN = r'^savedcmd_[^ ]* := (.* )([^ ]*\.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.
> --
> 2.25.1
>
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2023-05-29 10:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-14 10:19 [PATCH] gen_compile_commands: include targets not end with .o Hu Weiwen
2023-05-24 19:10 ` Nick Desaulniers
2023-05-25 9:52 ` 胡玮文
2023-05-25 12:20 ` [PATCH v2] gen_compile_commands: include targets not ending " Hu Weiwen
2023-05-29 10:13 ` Masahiro Yamada [this message]
2023-05-30 9:04 ` 胡玮文
2023-06-02 9:38 ` Masahiro Yamada
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=CAK7LNATz8xDmf5SuApGnrbkxvWPJNG1HTuQSrw2v_Ox5sXQO2A@mail.gmail.com \
--to=masahiroy@kernel.org \
--cc=huww98@outlook.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.