Re: [cocci] Searching for switch statements with SmPL?
Julia Lawall <[email protected]>
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
> On 8 Nov 2025, at 08:30, Markus Elfring <[email protected]> wrote: > > Hello, > > I would appreciate if another source code analysis can be achieved > also by the means of the semantic patch language. > Thus I tried the following SmPL script variant out. > > @display@ > constant c; > expression e; > statement s; > @@ > (switch (e) > { > <+... case c: ... break; ...+> > } > | > *switch (...) s > ) > > > Unfortunately, I am wondering about the following information. > > Questionable test result (according to the software combination “Coccinelle 1.3.0”): > Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_switch_without_break2.cocci > … > minus: parse error: > File "show_switch_without_break2.cocci", line 8, column 1, charpos = 68 > around = '<+...', > whole content = <+... case c: ... break; ...+> > > > Under which circumstances will such data processing become better supported? None. All cases are directly attached to the { of the switch, like if branches are attached to an if header. So the nest doesn’t make sense. > > Regards, > Markus