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
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci