Re: [PATCH] gen_compile_commands: include targets not end with .o

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 14, 2023 at 3:19 AM Hu Weiwen <huww98@xxxxxxxxxxx> wrote:
>
> From: Hu Weiwen <sehuww@xxxxxxxxxxxxxxxx>

Hi Hu,
Sorry, for the delay. I'm usually faster to respond to patches. It was
my mistake this fell through the cracks, and thank you for the patch.

I received this email from <huww98@xxxxxxxxxxx>. Do you mind resending
with your signed off by tag set to the email address from which you
are sending patches?  This patch looks benign to me, but it makes me a
little uneasy when author != sender.

Please also cc
- Masahiro Yamada <masahiroy@xxxxxxxxxx>
- linux-kbuild@xxxxxxxxxxxxxxx

As this would go in via the kbuild tree.

>
> Currently, we only extract commands for targets end with '.o'. But we

s/end/ending/


With this patch applies\d, I get the same word count for
compile_commands.json when running:
$ make LLVM=1 -j128 defconfig compile_commands.json

on my x86_64 host. Is that expected?  Is there a specific arch or set
of configs for which such .c files produce executables directly?

> 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.
>
> Signed-off-by: Hu Weiwen <sehuww@xxxxxxxxxxxxxxxx>
> ---
>  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
>
>


-- 
Thanks,
~Nick Desaulniers




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux