diff options
author | Carl Worth <cworth@cworth.org> | 2010-05-26 08:01:42 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-05-26 08:01:42 -0700 |
commit | c0607d573e04846a23c3162901aabd7fc40ebc61 (patch) | |
tree | 328ff6115bac1e62c814e036c805014ed8fc0906 /glcpp-parse.y | |
parent | 039739b2da0ce8496f6e8d38127c0b3793607afa (diff) |
Check active expansions before expanding a function-like macro invocation.
With this fix, test 32 no longer recurses infinitely, but now passes.
Diffstat (limited to 'glcpp-parse.y')
-rw-r--r-- | glcpp-parse.y | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/glcpp-parse.y b/glcpp-parse.y index 60eaf215b8..a2bff6e0ad 100644 --- a/glcpp-parse.y +++ b/glcpp-parse.y @@ -654,11 +654,6 @@ _glcpp_parser_print_expanded_token (glcpp_parser_t *parser, return 0; } - /* For function-like macros return 1 for further processing. */ - if (macro->is_function) { - return 1; - } - /* Finally, don't expand this macro if we're already actively * expanding it, (to avoid infinite recursion). */ if (_string_list_contains (parser->active, identifier, NULL)) { @@ -666,6 +661,11 @@ _glcpp_parser_print_expanded_token (glcpp_parser_t *parser, return 0; } + /* For function-like macros return 1 for further processing. */ + if (macro->is_function) { + return 1; + } + _string_list_push (parser->active, identifier); _glcpp_parser_print_expanded_token_list (parser, macro->replacements); |