Commit 8aaef6e0 by Neil Booth Committed by Neil Booth

cppmacro.c (funlike_invocation_p): Re-disable macros enabled by contexts drops…

cppmacro.c (funlike_invocation_p): Re-disable macros enabled by contexts drops AFTER argument pre-expansion...

        * cppmacro.c (funlike_invocation_p): Re-disable macros enabled
        by contexts drops AFTER argument pre-expansion, so that they
        remain enabled during argument pre-expansion.
        (_cpp_pop_context): Unconditionally re-enable a macro when
        dropping a context level.

From-SVN: r37971
parent 94a3d3b9
2000-12-03 Neil Booth <neilb@earthling.net>
* cppmacro.c (funlike_invocation_p): Re-disable macros enabled
by contexts drops AFTER argument pre-expansion, so that they
remain enabled during argument pre-expansion.
(_cpp_pop_context): Unconditionally re-enable a macro when
dropping a context level.
2000-12-03 Manfred Hollstein <manfredh@redhat.com> 2000-12-03 Manfred Hollstein <manfredh@redhat.com>
* arm/t-linux (MULTILIB_OPTIONS): Comment. * arm/t-linux (MULTILIB_OPTIONS): Comment.
......
...@@ -606,7 +606,7 @@ funlike_invocation_p (pfile, node, list) ...@@ -606,7 +606,7 @@ funlike_invocation_p (pfile, node, list)
const cpp_hashnode *node; const cpp_hashnode *node;
struct toklist *list; struct toklist *list;
{ {
cpp_context *orig_context; cpp_context *orig, *final;
cpp_token maybe_paren; cpp_token maybe_paren;
macro_arg *args = 0; macro_arg *args = 0;
cpp_lexer_pos macro_pos; cpp_lexer_pos macro_pos;
...@@ -614,7 +614,7 @@ funlike_invocation_p (pfile, node, list) ...@@ -614,7 +614,7 @@ funlike_invocation_p (pfile, node, list)
macro_pos = pfile->lexer_pos; macro_pos = pfile->lexer_pos;
pfile->state.parsing_args = 1; pfile->state.parsing_args = 1;
pfile->state.prevent_expansion++; pfile->state.prevent_expansion++;
orig_context = pfile->context; orig = pfile->context;
cpp_start_lookahead (pfile); cpp_start_lookahead (pfile);
cpp_get_token (pfile, &maybe_paren); cpp_get_token (pfile, &maybe_paren);
...@@ -628,7 +628,8 @@ funlike_invocation_p (pfile, node, list) ...@@ -628,7 +628,8 @@ funlike_invocation_p (pfile, node, list)
node->name); node->name);
/* Restore original context. */ /* Restore original context. */
pfile->context = orig_context; final = pfile->context;
pfile->context = orig;
pfile->state.prevent_expansion--; pfile->state.prevent_expansion--;
pfile->state.parsing_args = 0; pfile->state.parsing_args = 0;
...@@ -648,6 +649,13 @@ funlike_invocation_p (pfile, node, list) ...@@ -648,6 +649,13 @@ funlike_invocation_p (pfile, node, list)
free (args); free (args);
} }
/* Re-disable macros *after* pre-expansion. */
while (final != orig)
{
final = final->next;
final->macro->disabled = 1;
}
return args != 0; return args != 0;
} }
...@@ -885,13 +893,12 @@ _cpp_pop_context (pfile) ...@@ -885,13 +893,12 @@ _cpp_pop_context (pfile)
cpp_context *context = pfile->context; cpp_context *context = pfile->context;
pfile->context = context->prev; pfile->context = context->prev;
/* Re-enable a macro and free resources when leaving its expansion. */ if (!pfile->context->prev && !pfile->state.parsing_args)
if (!pfile->state.parsing_args) unlock_pools (pfile);
{
if (!pfile->context->prev) /* Re-enable a macro, temporarily if parsing_args, when leaving its
unlock_pools (pfile); expansion. */
context->macro->disabled = 0; context->macro->disabled = 0;
}
} }
/* Eternal routine to get a token. Also used nearly everywhere /* Eternal routine to get a token. Also used nearly everywhere
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment