From: Carl Worth Date: Wed, 26 May 2010 15:01:42 +0000 (-0700) Subject: Check active expansions before expanding a function-like macro invocation. X-Git-Tag: 062012170305~10660^2~625^2~100^2~10^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0607d573e04846a23c3162901aabd7fc40ebc61;p=profile%2Fivi%2Fmesa.git Check active expansions before expanding a function-like macro invocation. With this fix, test 32 no longer recurses infinitely, but now passes. --- diff --git a/glcpp-parse.y b/glcpp-parse.y index 60eaf21..a2bff6e 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);