Add test (and fix) for a function argument of a macro that expands with a comma.
authorCarl Worth <cworth@cworth.org>
Thu, 20 May 2010 19:06:33 +0000 (12:06 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 20 May 2010 19:06:33 +0000 (12:06 -0700)
The fix here is quite simple (and actually only deletes code). When
expanding a macro, we don't return a ',' as a unique token type, but
simply let it fall through to the generic case.

glcpp-parse.y
tests/039-func-arg-obj-macro-with-comma.c [new file with mode: 0644]

index c9edc5c..773db93 100644 (file)
@@ -779,8 +779,6 @@ glcpp_parser_lex (glcpp_parser_t *parser)
                return '(';
        else if (strcmp (replacements->value, ")") == 0)
                return ')';
-       else if (strcmp (replacements->value, ",") == 0)
-               return ',';
 
        yylval.str = xtalloc_strdup (parser, replacements->value);
 
diff --git a/tests/039-func-arg-obj-macro-with-comma.c b/tests/039-func-arg-obj-macro-with-comma.c
new file mode 100644 (file)
index 0000000..0f7fe63
--- /dev/null
@@ -0,0 +1,3 @@
+#define foo(a) (a)
+#define bar two,words
+foo(bar)