diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-04-07 21:09:51 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-04-07 21:09:51 +0000 |
commit | f787c583ae1966a61ae9e1e8b5645ec5834de1ac (patch) | |
tree | 1cdc2119b4eff8f84b844f88f3a85efa4575cb1e /gcc/cpplib.c | |
parent | fbc18d1984e7b4c919f7e5a3aa05e0287270785a (diff) | |
download | gcc-f787c583ae1966a61ae9e1e8b5645ec5834de1ac.zip gcc-f787c583ae1966a61ae9e1e8b5645ec5834de1ac.tar.gz gcc-f787c583ae1966a61ae9e1e8b5645ec5834de1ac.tar.bz2 |
cpplib.c (do_elif): Skip the rest of the line if we're not going to bother evaluating it.
* cpplib.c (do_elif): Skip the rest of the line if we're
not going to bother evaluating it.
(skip_if_group): Clear pfile->only_seen_white. Reorder loop
to avoid pointless calls to the lexer.
* gcc.dg/cpp-mi2.c: New test.
* gcc.dg/cpp-mi2[abc].h: New files.
From-SVN: r33008
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 52e83ba..babd20e 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -1266,7 +1266,10 @@ do_elif (pfile) } if (pfile->if_stack->if_succeeded) - return skip_if_group (pfile); + { + _cpp_skip_rest_of_line (pfile); + return skip_if_group (pfile); + } if (_cpp_parse_expr (pfile) == 0) return skip_if_group (pfile); @@ -1498,11 +1501,24 @@ skip_if_group (pfile) long old_written; int ret = 0; + /* We are no longer at the start of the file. */ + pfile->only_seen_white = 0; + old_written = CPP_WRITTEN (pfile); pfile->no_macro_expand++; CPP_OPTION (pfile, no_line_commands)++; for (;;) { + /* We are at the end of a line. Only cpp_get_token knows how to + advance the line number correctly. */ + token = cpp_get_token (pfile); + if (token == CPP_POP) + break; /* Caller will issue error. */ + + else if (token != CPP_VSPACE) + cpp_ice (pfile, "cpp_get_token returned %d in skip_if_group", token); + CPP_SET_WRITTEN (pfile, old_written); + token = _cpp_get_directive_token (pfile); if (token == CPP_DIRECTIVE) @@ -1514,16 +1530,6 @@ skip_if_group (pfile) if (token != CPP_VSPACE) _cpp_skip_rest_of_line (pfile); - - /* Only cpp_get_token knows how to advance the line number - properly. */ - token = cpp_get_token (pfile); - if (token == CPP_POP) - break; /* Caller will issue error. */ - - else if (token != CPP_VSPACE) - cpp_ice (pfile, "cpp_get_token returned %d in skip_if_group", token); - CPP_SET_WRITTEN (pfile, old_written); } CPP_SET_WRITTEN (pfile, old_written); pfile->no_macro_expand--; |