All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: 胡玮文 <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: Fri, 2 Jun 2023 18:38:03 +0900	[thread overview]
Message-ID: <CAK7LNAR1m2_mjRMp0nk+7CQUCefPdY-+rAZo4SNBAL5C+MJVNQ@mail.gmail.com> (raw)
In-Reply-To: <TYCP286MB2066563135B12E064AA59976C04B9@TYCP286MB2066.JPNP286.PROD.OUTLOOK.COM>

On Tue, May 30, 2023 at 6:04 PM 胡玮文 <huww98@outlook.com> 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@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?
>
> 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

      reply	other threads:[~2023-06-02  9:38 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
2023-05-30  9:04     ` 胡玮文
2023-06-02  9:38       ` Masahiro Yamada [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=CAK7LNAR1m2_mjRMp0nk+7CQUCefPdY-+rAZo4SNBAL5C+MJVNQ@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.