Re: [cocci] Reconsidering source code search challenges for nested compound statements
Markus Elfring <[email protected]> Sun, 8 Mar 2026 18:35:36 +0100
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
>> Can you see concrete change opportunities from my recent test results? >> >> 1. Inappropriate difference output >> https://lore.kernel.org/cocci/[email protected]/ >> https://sympa.inria.fr/sympa/arc/cocci/2026-03/msg00004.html > There is a problem here. Thanks for such a feedback finally. >> 2. Questionable hierarchy level >> https://lore.kernel.org/cocci/[email protected]/ >> https://sympa.inria.fr/sympa/arc/cocci/2026-03/msg00015.html > This is the message I was referring to. I have no idea what you expect as > the output. I presented another test result for further development considerations. > I don't know why it is so hard to provide that information. I imagine that corresponding case distinctions can become also more interesting. A) C++ test variant: Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --c++ 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; } Should declarations belong also to statements then? https://en.cppreference.com/w/cpp/language/statements.html#Declaration_statements https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/233b5ceb1d5a701fb270ebdf0a9bd6be0a6ce53b/docs/manual/cocci_syntax.tex#L348-350 B) SmPL script variant: @display2@ declaration d; statement list sl; @@ { d *sl } Questionable test result: Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_compound_statements2.cocci … minus: parse error: File "show_compound_statements2.cocci", line 7, column 2, charpos = 56 around = 'sl', whole content = *sl How should this implementation detail be improved anyhow? Regards, Markus