aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-pragma.c5
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/parser.c35
-rw-r--r--gcc/cp/parser.h3
5 files changed, 45 insertions, 20 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 45ed356..595b92f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,4 +1,10 @@
-2015-01-14 Ryan Burn <contact@rnburn.com>
+2016-01-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/68271
+ * c-pragma.c (c_register_pragma_1): Adjust comment to note that
+ C++ FE no longer has limit on number of pragmas.
+
+2015-01-14 Ryan Burn <contact@rnburn.com>
PR c++/69048
* cilk.c (create_cilk_wrapper_body): Call fold_build_cleanup_point_expr
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index b873664..4e72f65 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -1372,8 +1372,9 @@ c_register_pragma_1 (const char *space, const char *name,
id = registered_pragmas.length ();
id += PRAGMA_FIRST_EXTERNAL - 1;
- /* The C++ front end allocates 8 bits in cp_token; the C front end
- allocates 8 bits in c_token. At present this is sufficient. */
+ /* The C front end allocates 8 bits in c_token. The C++ front end
+ keeps the pragma kind in the form of INTEGER_CST, so no small
+ limit applies. At present this is sufficient. */
gcc_assert (id < 256);
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0ad384a..ba08d09 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 f2d49a1..8dd7e49 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 4396e33..ccbace9 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. */