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 <[email protected]>       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
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to