Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Luca Coelho <luca@coelho.fi>
Cc: Markus Elfring <Markus.Elfring@web.de>, cocci@inria.fr
Subject: Re: [cocci] Searching for special function implementations with SmPL
Date: Tue, 31 Jan 2023 17:20:14 +0100 (CET)	[thread overview]
Message-ID: <acfdb996-4976-b728-d330-c2684cdc624a@inria.fr> (raw)
In-Reply-To: <e907e583ef32ddeaccc5a016bfd3276a2fff6ed5.camel@coelho.fi>



On Tue, 31 Jan 2023, Luca Coelho wrote:

> On Tue, 2023-01-31 at 17:08 +0100, Julia Lawall wrote:
> >
> > On Tue, 31 Jan 2023, Luca Coelho wrote:
> >
> > > On Mon, 2023-01-30 at 12:59 +0200, Luca Coelho wrote:
> > > > On Mon, 2023-01-30 at 11:47 +0100, Julia Lawall wrote:
> > > > > It doesn't find the file with the definition.  You may need to give more
> > > > > paths.
> > > > >
> > > > > I have the impression that the result is improved with
> > > > >
> > > > > -I drivers/gpu/drm/i915
> > > > >
> > > > > Maybe -I drivers/gpu/drm/i915/display is necessary also.  If you add the
> > > > > argument --relax-include-path then just -I drivers/gpu/drm/i915 may be
> > > > > sufficient.  With that option, it will just hunt around in and under the
> > > > > various include paths for a unique file that has the required name.
> > > >
> > > > Alright! That _does_ improve things! Now I can see lots of DPLL matches
> > > > in that file!
> > >
> > > These files I'm trying to parse are so complex that I keep bumping into
> > > other parsing errors.  Here's one of them:
> > >
> > > parse error
> > >  = File "./drivers/gpu/drm/i915/i915_drv.h", line 385, column 1, charpos = 9644
> > >   around = 'for',
> > >   whole content =       for ((id__) = 0; \
> > > badcount: 7
> > > bad: }
> > > bad:
> > > bad: /* Simple iterator over all initialised engines */
> > > bad: #define for_each_engine(engine__, dev_priv__, id__) \
> > > BAD:!!!!!       for ((id__) = 0; \
> > > bad:         (id__) < I915_NUM_ENGINES; \
> > > bad:         (id__)++) \
> > > bad:            for_each_if ((engine__) = (dev_priv__)->engine[(id__)])
> > > ERROR-RECOV: found sync end of #define, line 395
> > >
> > >
> > > I believe the parser is getting confused by an iterator inside an
> > > iterator's definition... I already tried to add them both with the
> > > "iterator name" directive, but it didn't help...
> > >
> > > Any idea what I can do about this?
> >
> > If you don't care about finding things in this code, you can just ignore
> > it.
>
> I don't, but this seems to be included from intel_display_power.c and
> I'm not getting the matches I expect in this C file... Maybe there are
> other hints in the debugging output?

If you know a function that should be matched, then you can check if there
are bad/BAD comments in front of that function.  bad/BAD comments
elsewhere don't matter.

You can also use the --debug option and see if the macro name that you
expect is getting collected.

You can use the --verbose-includes option to see if the file that contains
the definition of the macro of interest is actually found and included.

julia

  reply	other threads:[~2023-01-31 16:20 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 17:07 [cocci] Nested macros Luca Coelho
2023-01-27 18:34 ` [cocci] Checking selected macro calls with SmPL Markus Elfring
2023-01-27 20:52 ` [cocci] Nested macros Julia Lawall
2023-01-27 22:00   ` Luca Coelho
2023-01-28  9:19     ` Julia Lawall
2023-01-28  9:25       ` Luca Coelho
2023-01-28  9:46     ` [cocci] Searching for special function implementations with SmPL Markus Elfring
2023-01-28  9:49       ` Julia Lawall
2023-01-28 10:03         ` Luca Coelho
2023-01-28 13:33           ` Julia Lawall
2023-01-29 16:39             ` Luca Coelho
2023-01-29 17:28               ` Julia Lawall
2023-01-29 17:55                 ` Luca Coelho
2023-01-29 19:15                   ` Luca Coelho
2023-01-29 20:09                     ` Julia Lawall
2023-01-30  6:32                       ` Luca Coelho
2023-01-30  8:37                         ` Julia Lawall
2023-01-30  8:50                           ` Luca Coelho
2023-01-30  8:56                             ` Julia Lawall
2023-01-30  9:05                               ` Luca Coelho
2023-01-30  9:34                             ` Markus Elfring
2023-01-30  9:41                               ` Luca Coelho
2023-01-30  9:50                                 ` Markus Elfring
2023-01-30  9:52                                   ` Luca Coelho
2023-01-30  9:55                                     ` Julia Lawall
2023-01-30 10:07                                     ` Markus Elfring
2023-01-30 10:47                                     ` Julia Lawall
2023-01-30 10:59                                       ` Luca Coelho
2023-01-30 11:25                                         ` Markus Elfring
2023-01-31 15:57                                         ` Luca Coelho
2023-01-31 15:59                                           ` Luca Coelho
2023-01-31 16:08                                           ` Julia Lawall
2023-01-31 16:10                                             ` Luca Coelho
2023-01-31 16:20                                               ` Julia Lawall [this message]
2023-01-29 18:01               ` [cocci] Adding a parameter for special macro calls " Markus Elfring
2023-01-29 19:11                 ` Luca Coelho
2023-01-28 13:43           ` [cocci] Searching for special function implementations " Markus Elfring
2023-01-29 16:41             ` Luca Coelho

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=acfdb996-4976-b728-d330-c2684cdc624a@inria.fr \
    --to=julia.lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=luca@coelho.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).