Re: [cocci] Can we match a known macro by macro name instead of expanded function name?
Markus Elfring <[email protected]>
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
>> The problem is that the code won't parse with the conventional macro
>> name. Maybe you could change the macro definition in standard.h to put eg
>> __SYSCALL_DEFINE0 in front of the function name? That would be considered
>> to be an attribute and then you could put __SYSCALL_DEFINE0 as an
>> attribute name in your semantic patch.
>
> sorry for having to ask again. Your suggestion sounds very reasonable.
Please take also another look at a corresponding information source.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/4c9d00ae071800cb447efaffd753f3bb2be28800/docs/manual/cocci_syntax.tex#L255-256
> But I couldn't figure out how to match on attributes. I guessed it would be something like this
>
> @r@
> attribute a;
> identifier fn;
> @@
>
> a fn(...) { ... }
>
> But that gives a .cocci parse error:
You might point remaining improvement possibilities out for this evolving software.
How do you think about to try the metavariable type “attribute name” out
for the mentioned source code search approach?
Regards,
Markus