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

From: Julia Lawall

Date: Mon Nov 30 2026 - 08:06:05 EST




On Mon, 30 Nov 2026, Markus Elfring wrote:

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

julia

> )
>
>
> Some developers and software reviewers care for a corresponding topic.
>
> CWE-252: Unchecked Return Value
> https://cwe.mitre.org/data/definitions/252.html
>
>
> Thus I suggest to refine case distinctions accordingly.
>
> 1. Identifiers can eventually be excluded if they would denote items
> with the return type “void”.
>
> 2. Identifiers can eventually be restricted to names that would denote items
> according to non-void return types.
>
>
> Which structures would you choose for such data processing purposes?
>
> Regards,
> Markus
>
>