Re: [cocci] Reconsidering source code search challenges for nested compound statements
Markus Elfring <[email protected]> Sat, 7 Mar 2026 11:15:07 +0100
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
> * How should the data processing be improved in more desirable ways?
I constructed another source file example together with a corresponding SmPL script.
void my_test(void)
{
int item;
if (1)
{
item = 1;
}
item = 2;
}
@display@
@@
if (...)
*{ item = 1; }
*item = 2;
Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch test-item_assignments.c show_selected_assignments_after_compound_statements3.cocci
…
@@ -3,9 +3,5 @@ void my_test(void)
int item;
if (1)
- {
- item = 1;
- }
- item = 2;
}
Can it be achieved that the source code search pattern will work also
after the omission of the filter “if (...)”?
Regards,
Markus