Re: [cocci] [RFC] Detecting unchecked return values (with SmPL)?

From: Markus Elfring

Date: Mon Nov 30 2026 - 09:01:31 EST


>> 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.

Would you find the following SmPL script variant more appropriate for
efficient source code searches?


@display2@
expression e;
identifier i;
@@
(e = i(...)
|
*i(...)
);


Would you be looking for more advanced data constraints here?

Regards,
Markus