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

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

 



On Tue, May 30, 2023 at 6:04 PM 胡玮文 <huww98@xxxxxxxxxxx> wrote:
>
> On Mon, May 29, 2023 at 07:13:46PM +0900, Masahiro Yamada wrote:
> > On Thu, May 25, 2023 at 9:21 PM Hu Weiwen <huww98@xxxxxxxxxxx> 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?
>
> Examples:
> - drivers/scsi/scsi_devinfo_tbl.c: generated by
>   sed -n 's/.*define *BLIST_\\([A-Z0-9_]*\\) *.*/BLIST_FLAG_NAME(\\1),/p' include/scsi/scsi_devinfo.h > drivers/scsi/scsi_devinfo_tbl.c
>
> - arch/x86/entry/vdso/vdso-image-32.c: generated by
>   arch/x86/entry/vdso/vdso2c arch/x86/entry/vdso/vdso32.so.dbg arch/x86/entry/vdso/vdso32.so arch/x86/entry/vdso/vdso-image-32.c
>
> I think only .c file targets would have false matching, because the cmd
> must ends with '.c' to be matched.

I see.


>
> >
> > 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.
>
> We are already parsing cmd files for those before this patch.

True, but they are excluded by _LINE_PATTERN.


> I use more
> strict `_FILENAME_PATTERN'. But it may be hard to exclude all of these
> by filename.

I think so.


> Should we use a more strict `_LINE_PATTERN'? e.g., require the cmd to
> begin with a compiler, not `sed' or something else. But we don't know
> the compiler name, adding a parameter for compiler name may break the
> existing usage.


Standalone executables are host programs.
I do not think it is worthwhile complicating the code.




-- 
Best Regards
Masahiro Yamada




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

  Powered by Linux