+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
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. */
= 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;
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. */
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
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);
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);
{
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");
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);
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);
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)