Like previous fix, but for object-like macros (and add a test).
authorCarl Worth <cworth@cworth.org>
Wed, 19 May 2010 14:57:03 +0000 (07:57 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 19 May 2010 14:57:03 +0000 (07:57 -0700)
The support for an object-like amcro within a macro-invocation
argument was also implemented at one level too high in the
grammar. Fortunately, this is a very simple fix.

glcpp-parse.y
tests/036-define-func-non-macro-multi-token-argument.c [new file with mode: 0644]

index 400f138d17eb1c5a8a4bbbfba6e79a428c56f1f6..647532f209dc8eecd099072a02520ff36a055bbe 100644 (file)
@@ -169,9 +169,6 @@ argument:
                $$ = _string_list_create (parser);
                _string_list_append_item ($$, $1);
        }
-|      macro {
-               $$ = _string_list_create (parser);
-       }
 |      argument argument_word {
                _string_list_append_item ($1, $2);
                talloc_free ($2);
@@ -189,6 +186,7 @@ argument_word:
        IDENTIFIER { $$ = $1; }
 |      TOKEN { $$ = $1; }
 |      FUNC_MACRO { $$ = $1; }
+|      macro { $$ = xtalloc_strdup (parser, ""); }
 ;
 
 
diff --git a/tests/036-define-func-non-macro-multi-token-argument.c b/tests/036-define-func-non-macro-multi-token-argument.c
new file mode 100644 (file)
index 0000000..b21ff33
--- /dev/null
@@ -0,0 +1,3 @@
+#define bar success
+#define foo(x) x
+foo(more bar)