summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-20 12:06:33 -0700
committerCarl Worth <cworth@cworth.org>2010-05-20 12:06:33 -0700
commit805ea6afe66f52476094256914b7319b29972a16 (patch)
treefb15b03b43d96838eee7f21af3b15fd5bb1546c3
parent9f3d2c4e3dff3eb4f5820a034426056bf66b3015 (diff)
Add test (and fix) for a function argument of a macro that expands with a comma.
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.
-rw-r--r--glcpp-parse.y2
-rw-r--r--tests/039-func-arg-obj-macro-with-comma.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/glcpp-parse.y b/glcpp-parse.y
index c9edc5c304..773db93e54 100644
--- a/glcpp-parse.y
+++ b/glcpp-parse.y
@@ -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
index 0000000000..0f7fe632b5
--- /dev/null
+++ b/tests/039-func-arg-obj-macro-with-comma.c
@@ -0,0 +1,3 @@
+#define foo(a) (a)
+#define bar two,words
+foo(bar)