From: Julia Lawall <julia.lawall@lip6.fr>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] spatch inserting the following rule into the patch
Date: Sat, 20 Jul 2019 18:39:45 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1907201832170.2558@hadrien> (raw)
In-Reply-To: <e499e369-c5fc-2d3d-12f8-51ae103c5bc9@linbit.com>
[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]
On Fri, 19 Jul 2019, Christoph Böhmwalder wrote:
> Hi,
>
> I believe I've stumbled upon a bug here:
>
> repro.cocci
> -------------------
> @@
> @@
> - COCCI_REPLACE_THIS();
> + int x __attribute__((some_attr));
>
> @@
> @@
> - foo();
> + f(g());
>
>
> repro.c
> -------------------
> int main()
> {
> COCCI_REPLACE_THIS();
> }
>
>
> spatch --sp-file repro.cocci repro.c
> -------------------
> init_defs_builtins: /usr/lib/coccinelle/standard.h
> HANDLING: repro.c
> diff =
> --- repro.c
> +++ /tmp/cocci-output-4924-2aa580-repro.c
> @@ -1,4 +1,9 @@
> int main()
> {
> - COCCI_REPLACE_THIS();
> + int x__attribute__((some_attr));
> +
> +@@
> +@@
> +- foo();
> ++ f(g());
> }
>
>
> Apparently this requires the __attribute__ in the first rule *and* the function
> call as an argument in the second rule, if I remove either of those the patch
> works as intended.
What version of Coccinelle of do you have? I get the correct output on
this example:
diff =
--- attr.c
+++ /tmp/cocci-output-153931-8de7ba-attr.c
@@ -1,4 +1,4 @@
int main()
{
- COCCI_REPLACE_THIS();
+ int x__attribute__((some_attr));
}
julia
>
> Regards,
> Christoph
>
> --
> Christoph Böhmwalder
> LINBIT | Keeping the Digital World Running
> DRBD HA — Disaster Recovery — Software defined Storage
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-07-20 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 7:01 [Cocci] spatch inserting the following rule into the patch Christoph Böhmwalder
2019-07-20 16:39 ` Julia Lawall [this message]
2019-07-22 8:04 ` Christoph Böhmwalder
2019-07-22 14:54 ` Himanshu Jha
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=alpine.DEB.2.21.1907201832170.2558@hadrien \
--to=julia.lawall@lip6.fr \
--cc=christoph.boehmwalder@linbit.com \
--cc=cocci@systeme.lip6.fr \
/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).