diff options
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index e32bf04..ca8577c 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1072,7 +1072,8 @@ disable_extension_diagnostics (void) | (flag_iso << 3) | (warn_long_long << 4) | (warn_cxx_compat << 5) - | (warn_overlength_strings << 6)); + | (warn_overlength_strings << 6) + | (warn_c90_c99_compat << 7)); cpp_opts->cpp_pedantic = pedantic = 0; warn_pointer_arith = 0; cpp_opts->cpp_warn_traditional = warn_traditional = 0; @@ -1080,6 +1081,7 @@ disable_extension_diagnostics (void) cpp_opts->cpp_warn_long_long = warn_long_long = 0; warn_cxx_compat = 0; warn_overlength_strings = 0; + warn_c90_c99_compat = 0; return ret; } @@ -1096,6 +1098,7 @@ restore_extension_diagnostics (int flags) cpp_opts->cpp_warn_long_long = warn_long_long = (flags >> 4) & 1; warn_cxx_compat = (flags >> 5) & 1; warn_overlength_strings = (flags >> 6) & 1; + warn_c90_c99_compat = (flags >> 7) & 1; } /* Possibly kinds of declarator to parse. */ @@ -2545,8 +2548,9 @@ c_parser_enum_specifier (c_parser *parser) } if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE)) { - if (seen_comma && !flag_isoc99) - pedwarn (comma_loc, OPT_Wpedantic, "comma at end of enumerator list"); + if (seen_comma) + pedwarn_c90 (comma_loc, OPT_Wpedantic, + "comma at end of enumerator list"); c_parser_consume_token (parser); break; } @@ -4348,9 +4352,9 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) { if (c_parser_next_token_is (parser, CPP_EQ)) { - if (!flag_isoc99) - pedwarn (des_loc, OPT_Wpedantic, - "ISO C90 forbids specifying subobject to initialize"); + pedwarn_c90 (des_loc, OPT_Wpedantic, + "ISO C90 forbids specifying subobject " + "to initialize"); c_parser_consume_token (parser); } else @@ -4566,10 +4570,9 @@ c_parser_compound_statement_nostart (c_parser *parser) c_parser_declaration_or_fndef (parser, true, true, true, true, true, NULL, vNULL); if (last_stmt) - pedwarn_c90 (loc, - (pedantic && !flag_isoc99) - ? OPT_Wpedantic - : OPT_Wdeclaration_after_statement, + pedwarn_c90 (loc, (pedantic && !flag_isoc99) + ? OPT_Wpedantic + : OPT_Wdeclaration_after_statement, "ISO C90 forbids mixed declarations and code"); last_stmt = false; } @@ -4598,8 +4601,8 @@ c_parser_compound_statement_nostart (c_parser *parser) restore_extension_diagnostics (ext); if (last_stmt) pedwarn_c90 (loc, (pedantic && !flag_isoc99) - ? OPT_Wpedantic - : OPT_Wdeclaration_after_statement, + ? OPT_Wpedantic + : OPT_Wdeclaration_after_statement, "ISO C90 forbids mixed declarations and code"); last_stmt = false; } @@ -7401,9 +7404,8 @@ c_parser_postfix_expression (c_parser *parser) expr.value = error_mark_node; break; } - if (!flag_isoc99) - pedwarn (loc, OPT_Wpedantic, - "ISO C90 does not support complex types"); + pedwarn_c90 (loc, OPT_Wpedantic, + "ISO C90 does not support complex types"); expr.value = build2 (COMPLEX_EXPR, build_complex_type (TYPE_MAIN_VARIANT @@ -7607,8 +7609,7 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser, type = error_mark_node; } - if (!flag_isoc99) - pedwarn (start_loc, OPT_Wpedantic, "ISO C90 forbids compound literals"); + pedwarn_c90 (start_loc, OPT_Wpedantic, "ISO C90 forbids compound literals"); non_const = ((init.value && TREE_CODE (init.value) == CONSTRUCTOR) ? CONSTRUCTOR_NON_CONST (init.value) : init.original_code == C_MAYBE_CONST_EXPR); |