Re: [cocci] Moving string literals with SmPL?

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

> On 10 Nov 2025, at 10:10, Markus Elfring <[email protected]> wrote:
> 
> Hello,
> 
> I would appreciate if another source code transformation can be achieved
> also by the means of the semantic patch language.
> Thus I tried the following SmPL script variant out.
> 
> // See also:
> // crypto_rng_show()
> // https://elixir.bootlin.com/linux/v6.18-rc4/source/crypto/rng.c#L82-L86
> @adjustment@
> constant char[] last_literal, literal;
> expression context;
> @@
> -seq_printf(context, literal);
> seq_printf(context,
> +           literal

Why is there no comma after literal?

>            last_literal,
>            ...);
> 
> 
> Unfortunately, I am wondering about the following information.
> 
> Questionable test result (according to the software combination “Coccinelle 1.3.0”):
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci combine_selected_seq_printf_calls.cocci
> …
> plus: parse error:
>  File "combine_selected_seq_printf_calls.cocci", line 11, column 12, charpos = 267
>  around = 'last_literal',
>  whole content =             last_literal,
> 
> 
> Under which circumstances will such data processing become better supported?
> http://www.en.cppreference.com/w/c/language/string_literal.html
> 
> 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.