Re: [cocci] Searching function implementations with variable declarations and statements?

Markus Elfring
2025-07-01T12:42:41Z

> Should any diff output be produced accordingly?

Would you occasionally really find a source code search approach like the following
more appropriate?

Another SmPL script example:
@display3@
statement s;
identifier i;
type t;
@@
t i;
<+...
*s
...+>

Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --no-loops …/Projekte/Coccinelle/janitor/show_statements_after_variable_declaration2.cocci include/
…
@@ -668,7 +668,6 @@ usb_endpoint_maxp_mult(const struct usb_
…
@@ -723,17 +722,10 @@ usb_ss_max_streams(const struct usb_ss_e
…
real 0m0,243s
user 0m0,199s
sys 0m0,042s

Is there a need to reconsider the handling of curly brackets (for compound statements)?

Regards,
Markus