cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Matching against a declarer macro
Date: Fri, 27 Mar 2020 16:47:31 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.2003271645370.2709@hadrien> (raw)
In-Reply-To: <b86347f3-69d3-0801-c91f-87c3424e71dc@linbit.com>

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



On Fri, 27 Mar 2020, Christoph Böhmwalder wrote:

> Hi again,
>
> I'm having a little trouble matching against this line of code:
>
> RB_DECLARE_CALLBACKS_MAX(static, augment_callbacks, struct
> drbd_interval, rb, sector_t, end, NODE_END);
>
> This is especially tricky because it contains a lot of macro magic.
> I think the biggest problem is the first argument, which is the keyword
> "static". What do I use to match against this? expression? identifier?
> symbol?
>
> Also, the "augment_callbacks" is not really an identifier either, it
> just gets used to generate the function names. But what is it? An
> expression?
>
> @@
> typedef sector_t;
> declarer name RB_DECLARE_CALLBACKS_MAX;
>
> identifier augment_callbacks;
> identifier rb;
> identifier end;
> identifier NODE_END;
> @@
> -RB_DECLARE_CALLBACKS_MAX(static, augment_callbacks, struct
> drbd_interval, rb, sector_t, end, NODE_END);
>
> Nothing I have tried has made it match yet.
>
> Any ideas on how to solve this would be appreciated, thanks!

Are you sure that the C code is parsed successfully?  I'm not at all sure
that static is allowed in an argument list.  Types are allowed, bu static
is only part of a type.

For augment_callbacks, either identifier or expression would be fine.
Coccinelle has no idea what is going to happen to augment_callbacks
afterwards.  It just sees a sequence of characters and classifies it as an
identifier.

julia

>
> --
> Christoph Böhmwalder
> LINBIT | Keeping the Digital World Running
> DRBD HA —  Disaster Recovery — Software defined Storage
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

[-- 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-03-27 15:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 15:42 [Cocci] Matching against a declarer macro Christoph Böhmwalder
2020-03-27 15:47 ` Julia Lawall [this message]
2020-03-27 16:02   ` Christoph Böhmwalder
2020-03-27 16:15     ` Julia Lawall
2020-03-29  8:48       ` Christoph Böhmwalder
2020-03-29  9:20         ` Julia Lawall
2020-03-29 11:16           ` Christoph Böhmwalder
2020-03-29 11:24             ` Julia Lawall
2020-03-29 11:50               ` Christoph Böhmwalder

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.2003271645370.2709@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=christoph.boehmwalder@linbit.com \
    --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).