From: Jason Merrill Date: Sat, 9 May 2015 04:50:15 +0000 (-0400) Subject: c.opt (Wc++11-compat): Make primary. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=765189ff60c25e93d65f8c202afc893ea8cef220;p=gcc.git c.opt (Wc++11-compat): Make primary. gcc/c-family/ * c.opt (Wc++11-compat): Make primary. Rename var warn_cxx11_compat. * c-opts.c: Adjust. gcc/cp/ * cp-gimplify.c, parser.c: Adjust. From-SVN: r222962 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 17fb72f8797..1019aeae740 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,8 @@ 2015-05-08 Jason Merrill + * c.opt (Wc++11-compat): Make primary. Rename var warn_cxx11_compat. + * c-opts.c: Adjust. + * c.opt (Wc++0x-compat): Also set cpp_warn_cxx11_compat. 2015-05-08 Marek Polacek diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index a61d6a857d8..8b1767414b9 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -900,7 +900,7 @@ c_common_post_options (const char **pfilename) { /* If we're allowing C++0x constructs, don't warn about C++98 identifiers which are keywords in C++0x. */ - warn_cxx0x_compat = 0; + warn_cxx11_compat = 0; if (warn_narrowing == -1) warn_narrowing = 1; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 8f48d84e93e..e244a6db06e 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -312,11 +312,10 @@ C ObjC Var(warn_cxx_compat) CPP(warn_cxx_operator_names) CppReason(CPP_W_CXX_OPE Warn about C constructs that are not in the common subset of C and C++ Wc++0x-compat -C++ ObjC++ Var(warn_cxx0x_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Init(0) CPP(cpp_warn_cxx11_compat) CppReason(CPP_W_CXX11_COMPAT) -Deprecated in favor of -Wc++11-compat +C++ ObjC++ Warning Alias(Wc++11-compat) Undocumented Wc++11-compat -C++ ObjC++ Warning Alias(Wc++0x-compat) +C++ ObjC++ Var(warn_cxx11_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Init(0) CPP(cpp_warn_cxx11_compat) CppReason(CPP_W_CXX11_COMPAT) Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011 Wc++14-compat @@ -627,7 +626,7 @@ C ObjC C++ ObjC++ CPP(warn_multichar) CppReason(CPP_W_MULTICHAR) Var(cpp_warn_mu Warn about use of multi-character character constants Wnarrowing -C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1) LangEnabledBy(C++ ObjC++,Wall || Wc++0x-compat) +C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1) LangEnabledBy(C++ ObjC++,Wall || Wc++11-compat) Warn about narrowing conversions within { } that are ill-formed in C++11 Wnested-externs diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0910549098c..e776b00f5d8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-05-08 Jason Merrill + + * cp-gimplify.c, parser.c: Adjust to -Wc++11-compat replacing + -Wc++0x-compat. + 2015-05-08 Jason Merrill * decl2.c (mangling_aliases): New variable. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 35749efa38b..d5a64fc667f 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1231,13 +1231,13 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) } else { - if (warn_cxx0x_compat && cxx_dialect < cxx11 + if (warn_cxx11_compat && cxx_dialect < cxx11 && DECL_DESTRUCTOR_P (current_function_decl) && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)) == NULL_TREE) && (get_defaulted_eh_spec (current_function_decl) == empty_except_spec)) - warning_at (loc, OPT_Wc__0x_compat, + warning_at (loc, OPT_Wc__11_compat, "in C++11 this throw will terminate because " "destructors default to noexcept"); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3d165da708f..6f746a1d362 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -802,13 +802,13 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) } else { - if (warn_cxx0x_compat + if (warn_cxx11_compat && C_RID_CODE (token->u.value) >= RID_FIRST_CXX0X && C_RID_CODE (token->u.value) <= RID_LAST_CXX0X) { /* Warn about the C++0x keyword (but still treat it as an identifier). */ - warning (OPT_Wc__0x_compat, + warning (OPT_Wc__11_compat, "identifier %qE is a keyword in C++11", token->u.value); @@ -8162,11 +8162,11 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, /* Get an operator token. */ token = cp_lexer_peek_token (parser->lexer); - if (warn_cxx0x_compat + if (warn_cxx11_compat && token->type == CPP_RSHIFT && !parser->greater_than_is_operator_p) { - if (warning_at (token->location, OPT_Wc__0x_compat, + if (warning_at (token->location, OPT_Wc__11_compat, "%<>>%> operator is treated" " as two right angle brackets in C++11")) inform (token->location, @@ -11873,7 +11873,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, /* Complain about `auto' as a storage specifier, if we're complaining about C++0x compatibility. */ - warning_at (token->location, OPT_Wc__0x_compat, "%" + warning_at (token->location, OPT_Wc__11_compat, "%" " changes meaning in C++11; please remove it"); /* Set the storage class anyway. */