Use arg_expression instead of expression when printing the arguments of a macro
declaration. This will ensure that a comma separating two arguments will be
followed by a space.

The 'structfoo' test for example illustrates this issue. Without this patch the
result will be "FOO(1,2)" with this patch it will be "FOO(1, 2)".

Signed-off-by: Lars-Peter Clausen <[email protected]>
---
 parsing_c/unparse_cocci.ml |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index bdcc21f..62fce0e 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -647,11 +647,11 @@ and declaration d =
       mcode print_string sem
   | Ast.MacroDecl(name,lp,args,rp,sem) ->
       ident name; mcode print_string_box lp;
-      dots (function _ -> ()) expression args;
+      dots (function _ -> ()) arg_expression args;
       close_box(); mcode print_string rp; mcode print_string sem
   | Ast.MacroDeclInit(name,lp,args,rp,eq,ini,sem) ->
       ident name; mcode print_string_box lp;
-      dots (function _ -> ()) expression args;
+      dots (function _ -> ()) arg_expression args;
       close_box(); mcode print_string rp;
       pr_space(); mcode print_string eq;
       pr_space(); initialiser true ini; mcode print_string sem
-- 
1.7.2.5

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to