Pretty-printing problems are unlikely to be anything that you can do
something about. I will look into it tomorrow.
julia
On Fri, 10 Feb 2012, Terry Wilson wrote:
I'm having trouble with Coccinelle changing the whitespace in a macro call that
is un-related to the spatch. For example:
test.c
------
#define LIST(name, type) \
struct name { \
struct type *first; \
struct type *last; \
}
struct foo {
char *x;
LIST(, foo) thing;
};
test.cocci
----------
@s@
identifier x;
@@
struct foo {
...
char *x;
...
};
@@
identifier s.x;
@@
struct foo {
...
- char *x;
+ const char *x;
...
};
Produces the patch:
--- test.c
+++ /tmp/cocci-output-30072-a1d799-test.c
@@ -5,6 +5,6 @@ struct name { \
}
struct foo {
- char *x;
- LIST(, foo) thing;
+ const char *x;
+ LIST(,foo) thing;
};
Notice that the LIST macro has the space after the comma removed. A similar
macro is used 100s of times throughout my codebase and I always end up having
to fix it by hand when I make a change. I've tried playing around with
-macro_file, etc. but no luck in keeping this from happening. Is this a bug, or
is it something I should be able to work around myself?
Thanks,
Terry
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)