Re: [cocci] Reconsidering source code search challenges for nested compound statements
Markus Elfring <[email protected]> Sun, 8 Mar 2026 14:00:22 +0100
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
> I constructed another source file example together with a corresponding SmPL script.
@display@
statement list sl;
@@
*{ sl }
Compound statements are often used in known programming languages.
https://en.cppreference.com/w/c/language/statements.html#Compound_statements
Another test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch test-item_assignments.c ../janitor/show_compound_statements.cocci
…
@@ -3,9 +3,6 @@ void my_test(void)
int item;
if (1)
- {
- item = 1;
- }
item = 2;
}
The source code search pattern looks promising (in principle).
But it can be ambiguous in its minimal form.
Thus further case distinctions would occasionally be helpful.
Additional context information can become relevant then.
How would you prefer to handle control flow recursion in safer ways here?
Regards,
Markus