Check active expansions before expanding a function-like macro invocation.

With this fix, test 32 no longer recurses infinitely, but now passes.
This commit is contained in:
Carl Worth
2010-05-26 08:01:42 -07:00
parent 039739b2da
commit c0607d573e
+5 -5
View File
@@ -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);