diff options
author | Neil Booth <neil@cat.daikokuya.demon.co.uk> | 2001-07-26 06:02:47 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-07-26 06:02:47 +0000 |
commit | cef0d199d24feb707b86db0ad2991823b276cd1a (patch) | |
tree | caee9edc9501482aa583e1040604f6f2a4d52aba /gcc/cpplex.c | |
parent | 2e824adbe44a946c91c1ff94815963fd2bec93be (diff) | |
download | gcc-cef0d199d24feb707b86db0ad2991823b276cd1a.zip gcc-cef0d199d24feb707b86db0ad2991823b276cd1a.tar.gz gcc-cef0d199d24feb707b86db0ad2991823b276cd1a.tar.bz2 |
cpphash.h (struct_lexer_state): Delete was_skipping.
* cpphash.h (struct_lexer_state): Delete was_skipping.
Move skipping here from struct cpp_reader.
* cpplex.c (parse_identifier): Update.
(_cpp_lex_token): Don't skip tokens in a directive.
* cpplib.c (struct if_stack): Update.
(start_directive, end_directive): Don't change skipping state.
(_cpp_handle_directive): Update.
(do_ifdef, do_ifndef, do_if, do_elif): Similarly.
(do_else, do_endif): Update; only check for excess tokens if not
in a skipped conditional block.
(push_conditional): Update for new struct if_stack.
* gcc.dg/cpp/extratokens.c: Fix.
* gcc.dg/cpp/skipping2.c: New tests.
From-SVN: r44380
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 7424827..4821745 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -509,7 +509,7 @@ parse_identifier (pfile, c) /* $ is not a identifier character in the standard, but is commonly accepted as an extension. Don't warn about it in skipped conditional blocks. */ - if (saw_dollar && CPP_PEDANTIC (pfile) && ! pfile->skipping) + if (saw_dollar && CPP_PEDANTIC (pfile) && ! pfile->state.skipping) cpp_pedwarn (pfile, "'$' character(s) in identifier"); /* Identifiers are null-terminated. */ @@ -521,7 +521,7 @@ parse_identifier (pfile, c) ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED); /* Some identifiers require diagnostics when lexed. */ - if (result->flags & NODE_DIAGNOSTIC && !pfile->skipping) + if (result->flags & NODE_DIAGNOSTIC && !pfile->state.skipping) { /* It is allowed to poison the same identifier twice. */ if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok) @@ -888,7 +888,7 @@ _cpp_lex_token (pfile, result) if (pfile->lexer_pos.col != 0 && !bol && !buffer->from_stage3) cpp_pedwarn (pfile, "no newline at end of file"); pfile->state.next_bol = 1; - pfile->skipping = 0; /* In case missing #endif. */ + pfile->state.skipping = 0; /* In case missing #endif. */ result->type = CPP_EOF; /* Don't do MI optimisation. */ return; @@ -915,7 +915,7 @@ _cpp_lex_token (pfile, result) buffer->read_ahead = c; pfile->state.next_bol = 1; result->type = CPP_EOF; - /* Don't break; pfile->skipping might be true. */ + /* Don't break; pfile->state.skipping might be true. */ return; case '?': @@ -1261,7 +1261,7 @@ _cpp_lex_token (pfile, result) break; } - if (pfile->skipping) + if (!pfile->state.in_directive && pfile->state.skipping) goto skip; /* If not in a directive, this token invalidates controlling macros. */ |