cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] transforming arguments to statement macros?
@ 2020-01-02 22:03 David Young
  2020-01-03  6:32 ` Julia Lawall
  0 siblings, 1 reply; 11+ messages in thread
From: David Young @ 2020-01-02 22:03 UTC (permalink / raw)
  To: cocci

I have a semantic patch that renames parameters and local variables
called `index` to `idx`.  It renames most occurrences, however,
it does not know how to handle a macro that expands to a block:

#define HGOTO_ERROR(maj, min, ret_val, ...) {                           \
   do_something(maj, min, __VA_ARGS__);                                 \
   ret_value = ret_val;							\
   goto done;								\
}

I'd like for every occurrence of `index` in the HGOTO_ERROR() arguments
to change to `idx`, HGOTO_ERROR(..., index, ...) -> HGOTO_ERROR(..., idx, ...),
but spatch leaves those occurrences alone.

Can I write an isomorphism or something to force spatch to process each
occurrence of HGOTO_ERROR(...) as if it was either the function call
`hgoto_error(...);` or the block `{ (void)(...); goto done; }` ?


Dave

-- 
David Young
dyoung@pobox.com    Urbana, IL    (217) 721-9981
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-01-08 22:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 22:03 [Cocci] transforming arguments to statement macros? David Young
2020-01-03  6:32 ` Julia Lawall
2020-01-03 16:03   ` David Young
2020-01-05  9:47     ` Markus Elfring
2020-01-05 10:05       ` Julia Lawall
2020-01-05 11:32         ` Markus Elfring
2020-01-05 13:54         ` Markus Elfring
2020-01-06 12:07         ` [Cocci] Adding semicolons after macro calls Markus Elfring
2020-01-06 12:20           ` Julia Lawall
2020-01-06 12:48             ` [Cocci] Improving support for data processing around " Markus Elfring
2020-01-08 22:05     ` [Cocci] transforming arguments to statement macros? Julia Lawall

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