diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-15 21:57:54 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-15 21:57:54 +0100 |
commit | e0a575ffab61ef4702c3384a1379a32526f63cd3 (patch) | |
tree | 3927c071c279417ba6da71ec62c1b8168f4e595f /gcc/cp | |
parent | afbc5ae887b898d2a828d37e1dd8117a079e8243 (diff) | |
download | gcc-e0a575ffab61ef4702c3384a1379a32526f63cd3.tar.gz |
re PR bootstrap/68271 (Boostrap fails on x86_64-apple-darwin14 at r230084)
PR bootstrap/68271
* parser.h (cp_token): Remove pragma_kind field. Add comment
with number of unused bits.
* parser.c (eof_token): Remove pragma_kind field initializer.
(cp_lexer_get_preprocessor_token): Don't set pragma_kind
field, don't clear CPP_PRAGMA u.value.
(cp_parser_pragma_kind): New function.
(cp_parser_omp_sections_scope, cp_parser_oacc_kernels_parallel,
cp_parser_omp_construct, cp_parser_initial_pragma,
cp_parser_pragma): Use cp_parser_pragma_kind instead of accessing
pragma_kind field.
* c-pragma.c (c_register_pragma_1): Adjust comment to note that
C++ FE no longer has limit on number of pragmas.
From-SVN: r232451
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/parser.c | 35 | ||||
-rw-r--r-- | gcc/cp/parser.h | 3 |
3 files changed, 35 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0ad384a74ab..ba08d09297d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2016-01-15 Jakub Jelinek <jakub@redhat.com> + + PR bootstrap/68271 + * parser.h (cp_token): Remove pragma_kind field. Add comment + with number of unused bits. + * parser.c (eof_token): Remove pragma_kind field initializer. + (cp_lexer_get_preprocessor_token): Don't set pragma_kind + field, don't clear CPP_PRAGMA u.value. + (cp_parser_pragma_kind): New function. + (cp_parser_omp_sections_scope, cp_parser_oacc_kernels_parallel, + cp_parser_omp_construct, cp_parser_initial_pragma, + cp_parser_pragma): Use cp_parser_pragma_kind instead of accessing + pragma_kind field. + 2016-01-15 Jason Merrill <jason@redhat.com> PR c++/68847 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f2d49a1bbde..8dd7e498f7f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see static cp_token eof_token = { - CPP_EOF, RID_MAX, 0, PRAGMA_NONE, false, false, false, 0, { NULL } + CPP_EOF, RID_MAX, 0, false, false, false, 0, { NULL } }; /* The various kinds of non integral constant we encounter. */ @@ -782,7 +782,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) = c_lex_with_flags (&token->u.value, &token->location, &token->flags, lexer == NULL ? 0 : C_LEX_STRING_NO_JOIN); token->keyword = RID_MAX; - token->pragma_kind = PRAGMA_NONE; token->purged_p = false; token->error_reported = false; @@ -848,13 +847,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) default: token->keyword = C_RID_CODE (token->u.value); } } - else if (token->type == CPP_PRAGMA) - { - /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */ - token->pragma_kind = ((enum pragma_kind) - TREE_INT_CST_LOW (token->u.value)); - token->u.value = NULL_TREE; - } } /* Update the globals input_location and the input file stack from TOKEN. */ @@ -2689,6 +2681,18 @@ cp_parser_is_keyword (cp_token* token, enum rid keyword) return token->keyword == keyword; } +/* Return TOKEN's pragma_kind if it is CPP_PRAGMA, otherwise + PRAGMA_NONE. */ + +static enum pragma_kind +cp_parser_pragma_kind (cp_token *token) +{ + if (token->type != CPP_PRAGMA) + return PRAGMA_NONE; + /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */ + return (enum pragma_kind) TREE_INT_CST_LOW (token->u.value); +} + /* Helper function for cp_parser_error. Having peeked a token of kind TOK1_KIND that might signify a conflict marker, peek successor tokens to determine @@ -33937,7 +33941,8 @@ cp_parser_omp_sections_scope (cp_parser *parser) stmt = push_stmt_list (); - if (cp_lexer_peek_token (parser->lexer)->pragma_kind != PRAGMA_OMP_SECTION) + if (cp_parser_pragma_kind (cp_lexer_peek_token (parser->lexer)) + != PRAGMA_OMP_SECTION) { substmt = cp_parser_omp_structured_block (parser); substmt = build1 (OMP_SECTION, void_type_node, substmt); @@ -33952,7 +33957,7 @@ cp_parser_omp_sections_scope (cp_parser *parser) if (tok->type == CPP_EOF) break; - if (tok->pragma_kind == PRAGMA_OMP_SECTION) + if (cp_parser_pragma_kind (tok) == PRAGMA_OMP_SECTION) { cp_lexer_consume_token (parser->lexer); cp_parser_require_pragma_eol (parser, tok); @@ -35356,7 +35361,7 @@ cp_parser_oacc_kernels_parallel (cp_parser *parser, cp_token *pragma_tok, { omp_clause_mask mask; enum tree_code code; - switch (pragma_tok->pragma_kind) + switch (cp_parser_pragma_kind (pragma_tok)) { case PRAGMA_OACC_KERNELS: strcat (p_name, " kernels"); @@ -36572,7 +36577,7 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok) char p_name[sizeof "#pragma omp teams distribute parallel for simd"]; omp_clause_mask mask (0); - switch (pragma_tok->pragma_kind) + switch (cp_parser_pragma_kind (pragma_tok)) { case PRAGMA_OACC_ATOMIC: cp_parser_omp_atomic (parser, pragma_tok); @@ -36971,7 +36976,7 @@ cp_parser_initial_pragma (cp_token *first_token) tree name = NULL; cp_lexer_get_preprocessor_token (NULL, first_token); - if (first_token->pragma_kind != PRAGMA_GCC_PCH_PREPROCESS) + if (cp_parser_pragma_kind (first_token) != PRAGMA_GCC_PCH_PREPROCESS) return; cp_lexer_get_preprocessor_token (NULL, first_token); @@ -37046,7 +37051,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context) gcc_assert (pragma_tok->type == CPP_PRAGMA); parser->lexer->in_pragma = true; - id = pragma_tok->pragma_kind; + id = cp_parser_pragma_kind (pragma_tok); if (id != PRAGMA_OMP_DECLARE_REDUCTION && id != PRAGMA_OACC_ROUTINE) cp_ensure_no_omp_declare_simd (parser); switch (id) diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h index 4396e331287..ccbace9e0bf 100644 --- a/gcc/cp/parser.h +++ b/gcc/cp/parser.h @@ -47,8 +47,6 @@ struct GTY (()) cp_token { ENUM_BITFIELD (rid) keyword : 8; /* Token flags. */ unsigned char flags; - /* Identifier for the pragma. */ - ENUM_BITFIELD (pragma_kind) pragma_kind : 8; /* True if this token is from a context where it is implicitly extern "C" */ BOOL_BITFIELD implicit_extern_c : 1; /* True if an error has already been reported for this token, such as a @@ -59,6 +57,7 @@ struct GTY (()) cp_token { it is no longer a valid token and it should be considered deleted. */ BOOL_BITFIELD purged_p : 1; + /* 5 unused bits. */ /* The location at which this token was found. */ location_t location; /* The value associated with this token, if any. */ |