diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 35 |
1 files changed, 20 insertions, 15 deletions
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) |