Re: [cocci] Checking data structure member accesses after function return value assignments?

Julia Lawall <[email protected]>
Newsgroups fr.inria.cocci
Message-ID <[email protected]>

On Mon, 19 Jan 2026, Markus Elfring wrote:

> …
> >> May I expect that the same data processing result can be achieved together with
> >> the application of an SmPL nest construct?
> …
> > Since you haven't told me what happens when you run this, I don't know
> > what the issue is.
>
> I assume that you can try to reproduce a questionable test result also with
> your current development software version.
>
>
> > But it may work better with () around the <+... ...+>, to avoid a parsing conflict.
>
> Why are you looking for extra parentheses there?

As I already said it is to avoid a parser conflict.  Both statements and
expressions can start with <+... ...+>.  But if there is a (), it can only
be an expression.

>
> Another SmPL script example:
> // See also:
> // [PATCH] regulator: fp9931: Add missing memory allocation check
> // https://lore.kernel.org/lkml/[email protected]/
> // https://lkml.org/lkml/2026/1/18/129
> @display@
> expression action, pointer;
> identifier member;
> @@
> *pointer = action(...);
> *<+... (pointer)->member ...+>
>  ;
>
>
> Questionable test result:
> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --no-loops /home/altes_Heim2/elfring/Projekte/Coccinelle/janitor/show_questionable_statement_combination3.cocci drivers/regulator/fp9931.c
> [no diff output]

OK, then I don't know.  It seems like it was possible to parse trhe
semantic patch.

julia

>
> real    0m0,108s
> user    0m0,086s
> sys     0m0,015s
>
>
> Regards,
> Markus
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.