Re: [cocci] [RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL?

From: Julia Lawall

Date: Wed Oct 29 2025 - 17:24:08 EST




On Wed, 29 Oct 2025, Markus Elfring wrote:

> Hello,
>
> I got into the mood to try another simple source code transformation out which
> can be achieved also by the means of the semantic patch language.
>
> @replacement@
> expression object, size, source, target;
> @@
> target =
> - object;
> memcpy(
> - target
> + object
> , source,
> size);
>
>
> Test result (according to the software combination “Coccinelle 1.3.0”):
> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --max-width 100 --timeout 23 -j4 --chunksize 1 --no-loops -dir . …/Projekte/Coccinelle/janitor/use_memcpy_assignment.cocci > …/Projekte/Bau/Linux/scripts/Coccinelle/use_memcpy_assignment-no_loops-20251029.diff 2> …/Projekte/Bau/Linux/scripts/Coccinelle/use_memcpy_assignment-no_loops-errors-20251029.txt
> real 5m35,579s
> user 20m20,037s
> sys 0m14,467s
>
>
> It can be determined then from the generated diff file that mentioned
> implementation details can be transformed in 304 source files at the moment.
> Thus I became curious if it would be supported to adjust any places there
> according to (Linux) coding style preferences.

If you have a concern, you have to say what it is. It doesn't seem it is
about the running time, so why do you include that information?

I should not have to repeat your experiment to figure out what you are
asking about.

julia