> Macros are supposed to be written on one line.

I guess that you refer to a logical source line.
https://en.cppreference.com/w/c/language/translation_phases#Phase_2

I am looking for better support around changing contents from physical text 
lines
also by the means of the semantic patch language.


> Anyway, to my understanding the goal was not to modify the #define part,
> but rather only the code part.

The following transformation approach can produce an usable result
together with another small source file example.

@replacement@
expression buffer, x;
identifier macro;
@@
-#define macro(name) snprintf(buffer, PAGE_SIZE, "%u\n", (x)->name)
+#define macro(name) spgprintf_d(buffer, (x)->name)


Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to