aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c62
1 files changed, 28 insertions, 34 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 6afe3eb..d588797 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -1076,7 +1076,11 @@ disable_extension_diagnostics (void)
/* warn_c90_c99_compat has three states: -1/0/1, so we must
play tricks to properly restore it. */
| ((warn_c90_c99_compat == 1) << 7)
- | ((warn_c90_c99_compat == -1) << 8));
+ | ((warn_c90_c99_compat == -1) << 8)
+ /* Similarly for warn_c99_c11_compat. */
+ | ((warn_c99_c11_compat == 1) << 9)
+ | ((warn_c99_c11_compat == -1) << 10)
+ );
cpp_opts->cpp_pedantic = pedantic = 0;
warn_pointer_arith = 0;
cpp_opts->cpp_warn_traditional = warn_traditional = 0;
@@ -1085,6 +1089,7 @@ disable_extension_diagnostics (void)
warn_cxx_compat = 0;
warn_overlength_strings = 0;
warn_c90_c99_compat = 0;
+ warn_c99_c11_compat = 0;
return ret;
}
@@ -1103,6 +1108,7 @@ restore_extension_diagnostics (int flags)
warn_overlength_strings = (flags >> 6) & 1;
/* See above for why is this needed. */
warn_c90_c99_compat = (flags >> 7) & 1 ? 1 : ((flags >> 8) & 1 ? -1 : 0);
+ warn_c99_c11_compat = (flags >> 9) & 1 ? 1 : ((flags >> 10) & 1 ? -1 : 0);
}
/* Possibly kinds of declarator to parse. */
@@ -2009,15 +2015,12 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
gcc_assert (c_parser_next_token_is_keyword (parser, RID_STATIC_ASSERT));
assert_loc = c_parser_peek_token (parser)->location;
- if (!flag_isoc11)
- {
- if (flag_isoc99)
- pedwarn (assert_loc, OPT_Wpedantic,
+ if (flag_isoc99)
+ pedwarn_c99 (assert_loc, OPT_Wpedantic,
"ISO C99 does not support %<_Static_assert%>");
- else
- pedwarn (assert_loc, OPT_Wpedantic,
+ else
+ pedwarn_c99 (assert_loc, OPT_Wpedantic,
"ISO C90 does not support %<_Static_assert%>");
- }
c_parser_consume_token (parser);
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return;
@@ -2382,15 +2385,12 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
correct lvalue-to-rvalue conversions. */
if (flag_openmp)
sorry ("%<_Atomic%> with OpenMP");
- if (!flag_isoc11)
- {
- if (flag_isoc99)
- pedwarn (loc, OPT_Wpedantic,
+ if (flag_isoc99)
+ pedwarn_c99 (loc, OPT_Wpedantic,
"ISO C99 does not support the %<_Atomic%> qualifier");
- else
- pedwarn (loc, OPT_Wpedantic,
+ else
+ pedwarn_c99 (loc, OPT_Wpedantic,
"ISO C90 does not support the %<_Atomic%> qualifier");
- }
attrs_ok = true;
tree value;
value = c_parser_peek_token (parser)->value;
@@ -3055,15 +3055,12 @@ c_parser_alignas_specifier (c_parser * parser)
location_t loc = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS));
c_parser_consume_token (parser);
- if (!flag_isoc11)
- {
- if (flag_isoc99)
- pedwarn (loc, OPT_Wpedantic,
+ if (flag_isoc99)
+ pedwarn_c99 (loc, OPT_Wpedantic,
"ISO C99 does not support %<_Alignas%>");
- else
- pedwarn (loc, OPT_Wpedantic,
+ else
+ pedwarn_c99 (loc, OPT_Wpedantic,
"ISO C90 does not support %<_Alignas%>");
- }
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return ret;
if (c_parser_next_tokens_start_typename (parser, cla_prefer_id))
@@ -6579,14 +6576,14 @@ c_parser_alignof_expression (c_parser *parser)
/* A diagnostic is not required for the use of this identifier in
the implementation namespace; only diagnose it for the C11
spelling because of existing code using the other spellings. */
- if (!flag_isoc11 && is_c11_alignof)
+ if (is_c11_alignof)
{
if (flag_isoc99)
- pedwarn (loc, OPT_Wpedantic, "ISO C99 does not support %qE",
- alignof_spelling);
+ pedwarn_c99 (loc, OPT_Wpedantic, "ISO C99 does not support %qE",
+ alignof_spelling);
else
- pedwarn (loc, OPT_Wpedantic, "ISO C90 does not support %qE",
- alignof_spelling);
+ pedwarn_c99 (loc, OPT_Wpedantic, "ISO C90 does not support %qE",
+ alignof_spelling);
}
c_parser_consume_token (parser);
c_inhibit_evaluation_warnings++;
@@ -6745,15 +6742,12 @@ c_parser_generic_selection (c_parser *parser)
gcc_assert (c_parser_next_token_is_keyword (parser, RID_GENERIC));
generic_loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
- if (!flag_isoc11)
- {
- if (flag_isoc99)
- pedwarn (generic_loc, OPT_Wpedantic,
+ if (flag_isoc99)
+ pedwarn_c99 (generic_loc, OPT_Wpedantic,
"ISO C99 does not support %<_Generic%>");
- else
- pedwarn (generic_loc, OPT_Wpedantic,
+ else
+ pedwarn_c99 (generic_loc, OPT_Wpedantic,
"ISO C90 does not support %<_Generic%>");
- }
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
return error_expr;