cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Max <msuraev@sysmocom.de>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] replacing defines
Date: Thu, 13 Dec 2018 20:56:57 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1812132056230.2465@hadrien> (raw)
In-Reply-To: <768d794a-e7a6-b011-f9af-5bb5a38b3c4a@sysmocom.de>

[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]



On Thu, 13 Dec 2018, Max wrote:

> Here it is:
>
> ________________________
>
> @@
> expression a, b, c;
> @@
> - old_junk(a, b, c);
> + if (!new_stuff(a, b, c))
> +  abort();
>
> @@
> identifier x, y, z;
> @@
> - #define old_junk(x, y, z)
> +
> ________________________
>
> This result in Failure("nothing to attach pragma to") - I've tried
> variants with "- #define old_junk(x, y, z) ..." and using "identifier
> old_junk" and "function old_junk" with the same result.
>
> Is there some syntax for "remove line which starts from this prefix"
> which works with multilne defines which use "\"?
>
> It seems like the "#" symbol is causing the trouble but I'm not sure if
> I should escape it somehow or there's specific declaration for macros
> which I should use.
>
> What would be the right approach to get rid of
>
> ________________________
>
>
> #define old_junk(a, b, c) if (c) \
>
>                                            printf(a); \
>
>                                           else \
>
>                                            { printf(b); }
>
> ________________________
>
> with the help of spatch?

@@
@@

- #define old_junk(a,b,c) ...

julia

>
> --
> - Max Suraev <msuraev@sysmocom.de>       http://www.sysmocom.de/
> =======================================================================
> * sysmocom - systems for mobile communications GmbH
> * Alt-Moabit 93
> * 10559 Berlin, Germany
> * Sitz / Registered office: Berlin, HRB 134158 B
> * Geschaeftsfuehrer / Managing Directors: Harald Welte
>
> _______________________________________________
> 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

  reply	other threads:[~2018-12-13 19:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 12:17 [Cocci] replacing defines Max
2018-12-12 12:26 ` Julia Lawall
2018-12-12 18:00   ` Max
     [not found]     ` <alpine.DEB.2.21.1812130723160.2458@hadrien>
2018-12-13 16:16       ` Max
2018-12-13 19:56         ` Julia Lawall [this message]
2018-12-14 11:31           ` Max
2018-12-18 15:25             ` Max
2018-12-18 15:34               ` Julia Lawall
2018-12-18 15:48                 ` Max
2018-12-18 16:10                   ` Julia Lawall
2018-12-18 16:26                     ` Max

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.1812132056230.2465@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=msuraev@sysmocom.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).