diff options
author | Neil Booth <neilb@earthling.net> | 2000-11-12 11:46:21 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-11-12 11:46:21 +0000 |
commit | b528a07e0e5693ec33b7e77c600c0b32117f7742 (patch) | |
tree | f74638e6668fd7907064468bc11254a90aefe287 /gcc/cpplex.c | |
parent | 46bdc296a8c34fb42a934e21878817970541560e (diff) | |
download | gcc-b528a07e0e5693ec33b7e77c600c0b32117f7742.zip gcc-b528a07e0e5693ec33b7e77c600c0b32117f7742.tar.gz gcc-b528a07e0e5693ec33b7e77c600c0b32117f7742.tar.bz2 |
cppexp.c: Don't worry about pfile->skipping.
* cppexp.c: Don't worry about pfile->skipping.
* cpplib.c (struct if_stack): Make was_skipping unsigned char.
(cpp_handle_directive): Save pfile->skipping in struct cpp_buffer
for handled directives.
(skip_rest_of_line): Use _cpp_lex_token after popping contexts
and releasing lookaheads.
(do_ifdef, do_ifndef, do_if): Use buffer->was_skipping.
(do_else, do_elif, push_conditional): Update logic.
(do_endif): Set buffer->was_skipping rather than pfile->skipping.
(unwind_if_stack): Inline into cpp_pop_buffer.
(cpp_push_buffer): Clear ifs->was_skipping for cpp_handle_directive.
* cpplex.c (_cpp_lex_token): Clear skipping on EOF. Handle
multiple-include optimisation.
* cpplib.h (struct cpp_buffer): New member was_skipping.
* cppmacro.c (_cpp_get_token): Loop whilst pfile->skipping. This
works because skipping == 0 in directives.
(_cpp_release_lookahead): Renamed from release_lookahead.
(cpp_get_token): No need to check skipping as _cpp_get_token does
this for us. No need to handle MI optimisation.
From-SVN: r37404
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 5c7edcd..75d094d 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -874,6 +874,7 @@ _cpp_lex_token (pfile, result) if (pfile->lexer_pos.col != 0 && !buffer->from_stage3) cpp_pedwarn (pfile, "no newline at end of file"); pfile->state.next_bol = 1; + pfile->skipping = 0; /* In case missing #endif. */ result->type = CPP_EOF; break; @@ -1270,6 +1271,12 @@ _cpp_lex_token (pfile, result) result->val.c = c; break; } + + /* Non-comment tokens invalidate any controlling macros. */ + if (result->type != CPP_COMMENT + && result->type != CPP_EOF + && !pfile->state.in_directive) + pfile->mi_state = MI_FAILED; } /* An upper bound on the number of bytes needed to spell a token, |