cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Searching for global items in the source code
Date: Sat, 2 May 2020 09:05:29 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2005020904160.2538@hadrien> (raw)
In-Reply-To: <96ecd52e-ffa6-87a3-ad45-79ad6ec6176e@web.de>

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]



On Sat, 2 May 2020, Markus Elfring wrote:

> >> @display@
> >> identifier action;
> >> type return_type;
> >> @@
> >> *return_type action(...)
> >>  {
> >>  ...
> >>  }
> >>  EXPORT_SYMBOL(action);
> …
> > In this case, the problem entirely on your side.  You should separate the
> > two top-level declarations into two separate rules, just like any other
> > two top-level declarations you would like to match.
>
> My SmPL script example affects the understanding of the software behaviour
> also around the following information.
> https://github.com/coccinelle/coccinelle/blob/a549b9f0a20e14fe9c36f45990b40dc5708ef8f2/docs/manual/cocci_syntax.tex#L1649
>
> “…
> All matching done by a SmPL rule is done intraprocedurally.
> …”
>
>
> * How are items represented from the global name space?
>
> * Would the interpretation of the situation be adjusted if a macro call
>   and a function implementation would be moved into an other usage context
>   like a C++ class (or an enclosing function implementation)?

I don't understand any of the above.


>
>
> > You also need a
> >
> > declarer name EXPORT_SYMBOL;
> >
> > in the rule that you need to create for matching that part of the code.
>
> Can it become interesting to match a macro call (or a similar annotation/attribute)
> also without the declaration of such a metavariable?
> https://github.com/coccinelle/coccinelle/blob/a549b9f0a20e14fe9c36f45990b40dc5708ef8f2/docs/manual/cocci_syntax.tex#L310

It has nothing to do with EXPORT_SYMBOL being a macro.  The declaration is
needed to tell Coccinelle to look for the thing at top level.  Otherwise
EXPORT_SYMBOL(...); looks like a function call.

julia

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2020-05-02  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 11:43 [Cocci] Searching for exported Linux functions Markus Elfring
     [not found] ` <alpine.DEB.2.21.2005011348250.2504@hadrien>
2020-05-01 12:36   ` Markus Elfring
2020-05-02  5:56   ` [Cocci] Searching for global items in the source code Markus Elfring
2020-05-02  7:05     ` Julia Lawall [this message]
2020-05-02  7:43       ` Markus Elfring

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=alpine.DEB.2.21.2005020904160.2538@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    /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 NNTP newsgroup(s).