Re: [cocci] Checking SmPL support for two special expressions

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

On Tue, 11 Nov 2025, Markus Elfring wrote:

> Hello,
>
> I constructed another SmPL script variant. It exported some data from
> selected function implementations which were found in header files.
> Data processing difficulties were detected then.
>
> See also:
> https://elixir.bootlin.com/linux/v6.18-rc5/source/include/drm/drm_crtc.h#L48-L55
>
> It seems that contents can usually be handled from such a file.
>
> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> /usr/bin/spatch --parse-c include/drm/drm_crtc.h
> …
> nb good = 1344,  nb bad = 0 =========> 100.00% good or passed
>
>
> Two SmPL rules were generated accordingly.
> Unfortunately, I am wondering about the following information.
> Questionable test results (according to the software combination “Coccinelle 1.3.0”):
>
> A)
> @r26@
> expression val;
> @@
> -( uint64_t ) * ( ( uint64_t * ) & val )
> +I642U64(val)
>
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-cocci drm_crtc-I642U64-20251111.cocci
> …
> minus: parse error:
>   File "drm_crtc-I642U64-20251111.cocci", line 4, column 31, charpos = 56
>   around = ')',
>   whole content = -( uint64_t ) * ( ( uint64_t * ) & val )
>
> B)
> @r27@
> expression val;
> @@
> -( int64_t ) * ( ( int64_t * ) & val )
> +U642I64(val)
>
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-cocci drm_crtc-U642I64-20251111.cocci
> …
> minus: parse error:
>   File "drm_crtc-U642I64-20251111.cocci", line 4, column 29, charpos = 54
>   around = ')',
>   whole content = -( int64_t ) * ( ( int64_t * ) & val )
>
>
> Under which circumstances will such data processing become better supported?

Coccinelle doesn't know these types.  You have to declare them with
typedef.

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