Re: [cocci] Can we match a known macro by macro name instead of expanded function name?
Julia Lawall <[email protected]>
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 29 Nov 2025, Markus Elfring wrote:
> >> How else to look for functions with attributes then?
> > The return type for the function is required in this case:
> >
> > @r@
> > attribute a;
> > identifier fn;
> > types t;
> > @@
> >
> > * t a fn(...) { ... }
>
> Would a similar source code search approach become interesting
> for further clarifications?
>
> Exclude macro calls from searches for function implementations
> 2024-10-28
> https://github.com/coccinelle/coccinelle/issues/381
Coccinelle expands macros when it has them available and when it is not
able to parse the code without doing the expansion. This is not
controllable by the user. The only thing you can do it perhaps provide a
different definition of the macro that better corresponds to the results
you hope for (or just remove the definition of the macro entirely, which
will cause a parse failure and thus no results for the affected code).
julia