Re: [PATCH] gen_compile_commands: add assembly files to compilation database

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

 



On Wed, Jul 19, 2023 at 01:19:12PM +1000, Benjamin Gray wrote:
> Like C source files, tooling can find it useful to have the assembly
> source file compilation recorded.
> 
> The .S extension appears to used across all architectures.
> 
> Signed-off-by: Benjamin Gray <bgray@xxxxxxxxxxxxx>
> 
> ---
> 
> For example, I'm prototyping adding ASM support to clangd. It can use
> this information to determine the architecture, macros definitions,
> include paths, etc. on a per-file basis. I can capture this during
> compilation with tools like bear, but given this script exists and the

Right, this script was written specifically to avoid relying on external
dependencies to generate a compile_commands file, so modifying this
script is definitely the right thing to allow this to work for anyone
working on the kernel and using the built-in kbuild targets for the
static analyzer and compile_commands.json.

> change is trivial it seems like a good idea to adjust this script too.

Thanks for the patch, this seems reasonable.

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

> ---
>  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 15ba56527acd..a84cc5737c2c 100755
> --- a/scripts/clang-tools/gen_compile_commands.py
> +++ b/scripts/clang-tools/gen_compile_commands.py
> @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json'
>  _DEFAULT_LOG_LEVEL = 'WARNING'
>  
>  _FILENAME_PATTERN = r'^\..*\.cmd$'
> -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'
> +_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.[cS]) *(;|$)'
>  _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.41.0
> 
> 



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

  Powered by Linux