Expand macro arguments before performing argument substitution.
authorCarl Worth <cworth@cworth.org>
Wed, 26 May 2010 15:09:29 +0000 (08:09 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 26 May 2010 15:09:29 +0000 (08:09 -0700)
As required by the C99 specification of the preprocessor.

With this fix, tests 33 through 36 now pass.

glcpp-parse.y

index e25cfa92142f398853b6596ae7ae6cdfde7bddd6..3b736f8e64df072f26eaafa6f9c44c792bd2785f 100644 (file)
@@ -854,10 +854,11 @@ _glcpp_parser_expand_function_onto (glcpp_parser_t *parser,
                        token_list_t *argument;
                        argument = _argument_list_member_at (arguments,
                                                             parameter_index);
-                       for (j = argument->head; j; j = j->next)
-                       {
-                               _token_list_append (substituted, j->token);
-                       }
+                       /* Before substituting, we expand the argument
+                        * tokens. */
+                       _glcpp_parser_expand_token_list_onto (parser,
+                                                             argument,
+                                                             substituted);
                } else {
                        _token_list_append (substituted, i->token);
                }