git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] cocci: avoid normalization rules for memcpy
Date: Sun, 10 Jul 2022 18:32:07 +0200	[thread overview]
Message-ID: <220710.86a69g9b3e.gmgdl@evledraar.gmail.com> (raw)
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:

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

  reply	other threads:[~2022-07-10 16:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  2:02 [PATCH] builtin/mv.c: use correct type to compute size of an array element Junio C Hamano
2022-07-07  5:52 ` [PATCH v2] builtin/mv.c: use the MOVE_ARRAY() macro instead of memmove() Junio C Hamano
2022-07-10  1:33   ` [PATCH v3] " Junio C Hamano
2022-07-18 20:30     ` Derrick Stolee
2022-07-07 12:11 ` [PATCH] builtin/mv.c: use correct type to compute size of an array element Ævar Arnfjörð Bjarmason
2022-07-07 18:10   ` Junio C Hamano
2022-07-07 19:11     ` René Scharfe
2022-07-09  8:16       ` René Scharfe
2022-07-10  5:38         ` Junio C Hamano
2022-07-10 10:05           ` [PATCH] cocci: avoid normalization rules for memcpy René Scharfe
2022-07-10 14:45             ` Ævar Arnfjörð Bjarmason
2022-07-10 16:32               ` Ævar Arnfjörð Bjarmason [this message]
2022-07-10 19:30               ` Junio C Hamano
2022-07-11 17:11               ` René Scharfe
2022-07-11 20:05                 ` Ævar Arnfjörð Bjarmason
2022-07-07 18:27   ` [PATCH] builtin/mv.c: use correct type to compute size of an array element René Scharfe
2022-07-07 18:42 ` Jeff King
2022-07-07 20:25   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220710.86a69g9b3e.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).