Re: [cocci] [RFC] Detecting unchecked return values (with SmPL)?
From: Julia Lawall
Date: Mon Nov 30 2026 - 08:52:41 EST
On Mon, 30 Nov 2026, Markus Elfring wrote:
> > > Macro and function calls for which a return value is not assigned to a variable
> > > can be found also by a script (like the following) for the semantic patch language.
> > >
> > > @display@
> > > identifier i;
> > > statement s;
> > > @@
> > > (
> > > *i(...);
> > > &s
> >
> > &s seems totally unnecessary.
>
> Can the code for the SmPL asterisk alone represent also a source code search
> for a call where a variable assignment would be attempted?
No. Not with the ;. Coccinelle parses the code. It doesn't search for
substrings.
julia
>
> Or:
> Do you expect to specify the variable assignment exclusion in any other ways?
>
> Regards,
> Markus
>