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]> |
> What seems to happen with --dir and using the following rule
>
> @r@
> typedef syscall_define_t;
> identifier fn;
> @@
> syscall_define_t fn(...) {...}
>
> is that spatch filters .c files early by raw text search for "syscall_define_t", before it actually processes patterns.
Would you find another SmPL code variant helpful?
@display@
typedef syscall_define_t;
identifier fn;
@@
syscall_define_t
*fn(...)
{
...
}
Did you notice any hints from a test of a known program parameter?
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-cocci example_for_Tobias_Deiminger-20251201.cocci
…
Grep query
syscall_define_t
> is that spatch filters .c files early by raw text search for "syscall_define_t", before it actually processes patterns.
See also once more:
coccigrep
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/4c9d00ae071800cb447efaffd753f3bb2be28800/docs/manual/spatch_options.tex#L235-245
https://github.com/coccinelle/coccinelle/blob/4c9d00ae071800cb447efaffd753f3bb2be28800/docs/manual/spatch_options.tex#L235-L245
Regards,
Markus