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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 10 2022, Ævar Arnfjörð Bjarmason wrote:

> On Sun, Jul 10 2022, René Scharfe wrote:

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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux