Re: [cocci] Reconsidering source code search challenges for nested compound statements

Julia Lawall <[email protected]> Sun, 8 Mar 2026 19:20:34 +0100 (CET)
Newsgroups fr.inria.cocci
Message-ID <[email protected]>

On Sun, 8 Mar 2026, Markus Elfring wrote:

> >> @display2@
> >> declaration d;
> >> statement list sl;
> >> @@
> >>  {
> >>  d
> >> *sl
> >>  }
> >>
> >>
> >> Another questionable test result:
> >> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch test-item_assignments.c ../janitor/show_compound_statements2.cocci
> >
> > And I should know what test-item_assignments.c is?
>
> Reminder:
> This can be possible.
> https://lore.kernel.org/cocci/[email protected]/
> https://sympa.inria.fr/sympa/arc/cocci/2026-03/msg00014.html
>
>
> void my_test(void)
> {
>  int item;
>
>  if (1)
>  {
>     item = 1;
>  }
>
>  item = 2;
> }

A statement list metavariable only matches the code starting right after a
{.  It can't start in random places.  Nothing is going to chenge here.

julia

>
>
> Regards,
> Markus
>