From cef0d199d24feb707b86db0ad2991823b276cd1a Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 26 Jul 2001 06:02:47 +0000 Subject: 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 --- gcc/cpplex.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/cpplex.c') 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. */ -- cgit v1.1