git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] cocci: avoid normalization rules for memcpy

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 10, 2022, 16:32 UTC
Message-ID
<220710.86a69g9b3e.gmgdl@evledraar.gmail.com>
In-Reply-To
<220710.86ilo580mb.gmgdl@evledraar.gmail.com>
On Sun, Jul 10 2022, Ævar Arnfjörð Bjarmason wrote:
> On Sun, Jul 10 2022, René Scharfe wrote:
Show 6 quoted lines
> Isn't there a way to avoid this by simply wrapping this across lines, I
> didn't test, but I think you can do this sort of thing in the cocci
> grammar:
>
> - memcpy(
> - COPY_ARRAY(
Oops, typo!

I just manually typed this out, so I meant "+ COPY_ARRAY(" here, in case it wasn't clear.

To elaborate: Here's an example in the cocci repository: https://github.com/coccinelle/coccinelle/blob/master/tests/pcim.cocci

You can also use "..." elides, but I didn't check if that works for the start of an argument list (but it should, I think), here's an example with it at the end: https://github.com/coccinelle/coccinelle/blob/master/scripts/coccicheck/cocci/kc.cocci

So I think rules like:
- memcpy(
+ COPY_ARRAY(
  ...,
- A
+ B
  );

Are possible, and something you can use in this case (I have "5.1 Basic Transformations" from cocci_spatch_grammar.pdf in front of me).

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 12 of 18 in “builtin/mv.c: use correct type to compute size of an array element”
  1. builtin/mv.c: use correct type to compute size of an array elementJunio C Hamano, Jul 7, 2022
  2. builtin/mv.c: use the MOVE_ARRAY() macro instead of memmove()Junio C Hamano, Jul 7, 2022
  3. builtin/mv.c: use the MOVE_ARRAY() macro instead of memmove()Junio C Hamano, Jul 10, 2022
  4. Derrick StoleeJul 18, 2022
  5. Ævar Arnfjörð BjarmasonJul 7, 2022
  6. Junio C HamanoJul 7, 2022
  7. René ScharfeJul 7, 2022
  8. René ScharfeJul 9, 2022
  9. Junio C HamanoJul 10, 2022
  10. cocci: avoid normalization rules for memcpyRené Scharfe, Jul 10, 2022
  11. Ævar Arnfjörð BjarmasonJul 10, 2022
  12. Ævar Arnfjörð BjarmasonJul 10, 2022
  13. Junio C HamanoJul 10, 2022
  14. René ScharfeJul 11, 2022
  15. Ævar Arnfjörð BjarmasonJul 11, 2022
  16. René ScharfeJul 7, 2022
  17. Jeff KingJul 7, 2022
  18. Junio C HamanoJul 7, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.