Re: [cocci] Question regarding Coccinelle

Julia Lawall <[email protected]> Tue, 26 May 2026 12:08:31 +0200 (CEST)
Newsgroups fr.inria.cocci
Message-ID <[email protected]>

On Tue, 26 May 2026, Pierrick Philippe wrote:

> On 5/26/26 11:00, Julia Lawall wrote:
>
> On Tue, 26 May 2026, Pierrick Philippe wrote:
>
> I think I understand, also I do have a question regarding the `declaration` keyword of the grammar.
> Is there any way to access inner information of the declaration? Such as the type or the presence of an initializer or not?
> For example in a python or a ocaml script?
>
>
> Not sure what you mean.  There is a metavariable of type declaration taht
> will take the whole declaration at once.  If you also want the pieces you
> can write:
>
> (
> d
> &
> T x = ...; // matches the case with and without an initializer
> )
>
> This is exactly what I meant, thank you.
> Though it confuses me why the `...` operator works here but not in the `memcmp` call statement.

Here it matches a complete expression.  You hoped it would map "x =" (I
don't remember the exact code) which is not a non terminal in the
language.

julia