aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-03-03 22:14:08 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-03-03 22:14:08 +0000
commite8408f251a70640dcc208877ef3122efd5b7e824 (patch)
tree7dc28de2225965477d01df8a6de99ec5755e2829 /gcc/cppmacro.c
parent20f9202d81c1a89a0cb65a6ef260101a8ee8822b (diff)
downloadgcc-e8408f251a70640dcc208877ef3122efd5b7e824.zip
gcc-e8408f251a70640dcc208877ef3122efd5b7e824.tar.gz
gcc-e8408f251a70640dcc208877ef3122efd5b7e824.tar.bz2
cpplex.c (_cpp_lex_token): Don't warn about directives in macro arguments when looking for the '('.
* cpplex.c (_cpp_lex_token): Don't warn about directives in macro arguments when looking for the '('. * cppmacro.c (funlike_invocation_p): Set parsing_args to 2 when really parsing arguments; 1 when looking for '('. Always restore the lexer position. * gcc.dg/cpp/cppmacro7.c: New test. From-SVN: r40223
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index d424a41..2390ee4 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -602,6 +602,7 @@ funlike_invocation_p (pfile, node, list)
cpp_start_lookahead (pfile);
cpp_get_token (pfile, &maybe_paren);
cpp_stop_lookahead (pfile, maybe_paren.type == CPP_OPEN_PAREN);
+ pfile->state.parsing_args = 2;
if (maybe_paren.type == CPP_OPEN_PAREN)
args = parse_args (pfile, node);
@@ -615,11 +616,12 @@ funlike_invocation_p (pfile, node, list)
pfile->state.prevent_expansion--;
pfile->state.parsing_args = 0;
+ /* Reset the position in case of failure. If success, the macro's
+ expansion appears where the name would have. */
+ pfile->lexer_pos = macro_pos;
+
if (args)
{
- /* The macro's expansion appears where the name would have. */
- pfile->lexer_pos = macro_pos;
-
if (node->value.macro->paramc > 0)
{
/* Don't save tokens during pre-expansion. */