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

Julia Lawall
2025-07-01T12:09:23Z

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

On Tue, 1 Jul 2025, Markus Elfring wrote:

> > May I expect that a function like usb_ss_max_streams() can be found with the help
> > of the following source code search pattern?
>
> Another SmPL script example:
> @display2@
> statement list sl;
> identifier i;
> type t;
> @@
> <+...
> *t i;
> ...+>
> sl
>
>
> Should any diff output be produced accordingly?

Probably not. Statement list metavariables only match the list of
statements that occur at top level within {}.

julia

>
> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --no-loops …/show_variable_declarations_before_statements.cocci include/uapi/linux/usb/ch9.h
> …
> real 0m0,138s
> user 0m0,101s
> sys 0m0,035s
>
>
> Regards,
> Markus
>