Commit 765189ff by Jason Merrill Committed by Jason Merrill

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
parent fe191308
2015-05-08 Jason Merrill <jason@redhat.com> 2015-05-08 Jason Merrill <jason@redhat.com>
* 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. * c.opt (Wc++0x-compat): Also set cpp_warn_cxx11_compat.
2015-05-08 Marek Polacek <polacek@redhat.com> 2015-05-08 Marek Polacek <polacek@redhat.com>
......
...@@ -900,7 +900,7 @@ c_common_post_options (const char **pfilename) ...@@ -900,7 +900,7 @@ c_common_post_options (const char **pfilename)
{ {
/* If we're allowing C++0x constructs, don't warn about C++98 /* If we're allowing C++0x constructs, don't warn about C++98
identifiers which are keywords in C++0x. */ identifiers which are keywords in C++0x. */
warn_cxx0x_compat = 0; warn_cxx11_compat = 0;
if (warn_narrowing == -1) if (warn_narrowing == -1)
warn_narrowing = 1; warn_narrowing = 1;
......
...@@ -312,11 +312,10 @@ C ObjC Var(warn_cxx_compat) CPP(warn_cxx_operator_names) CppReason(CPP_W_CXX_OPE ...@@ -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++ Warn about C constructs that are not in the common subset of C and C++
Wc++0x-compat 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) C++ ObjC++ Warning Alias(Wc++11-compat) Undocumented
Deprecated in favor of -Wc++11-compat
Wc++11-compat 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 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011
Wc++14-compat Wc++14-compat
...@@ -627,7 +626,7 @@ C ObjC C++ ObjC++ CPP(warn_multichar) CppReason(CPP_W_MULTICHAR) Var(cpp_warn_mu ...@@ -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 Warn about use of multi-character character constants
Wnarrowing 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 Warn about narrowing conversions within { } that are ill-formed in C++11
Wnested-externs Wnested-externs
......
2015-05-08 Jason Merrill <jason@redhat.com> 2015-05-08 Jason Merrill <jason@redhat.com>
* cp-gimplify.c, parser.c: Adjust to -Wc++11-compat replacing
-Wc++0x-compat.
2015-05-08 Jason Merrill <jason@redhat.com>
* decl2.c (mangling_aliases): New variable. * decl2.c (mangling_aliases): New variable.
(note_mangling_alias, generate_mangling_aliases): New. (note_mangling_alias, generate_mangling_aliases): New.
(cp_write_global_declarations): Call generate_mangling_aliases. (cp_write_global_declarations): Call generate_mangling_aliases.
......
...@@ -1231,13 +1231,13 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -1231,13 +1231,13 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
} }
else else
{ {
if (warn_cxx0x_compat && cxx_dialect < cxx11 if (warn_cxx11_compat && cxx_dialect < cxx11
&& DECL_DESTRUCTOR_P (current_function_decl) && DECL_DESTRUCTOR_P (current_function_decl)
&& (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)) && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl))
== NULL_TREE) == NULL_TREE)
&& (get_defaulted_eh_spec (current_function_decl) && (get_defaulted_eh_spec (current_function_decl)
== empty_except_spec)) == 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 " "in C++11 this throw will terminate because "
"destructors default to noexcept"); "destructors default to noexcept");
} }
......
...@@ -802,13 +802,13 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) ...@@ -802,13 +802,13 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
} }
else 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_FIRST_CXX0X
&& C_RID_CODE (token->u.value) <= RID_LAST_CXX0X) && C_RID_CODE (token->u.value) <= RID_LAST_CXX0X)
{ {
/* Warn about the C++0x keyword (but still treat it as /* Warn about the C++0x keyword (but still treat it as
an identifier). */ an identifier). */
warning (OPT_Wc__0x_compat, warning (OPT_Wc__11_compat,
"identifier %qE is a keyword in C++11", "identifier %qE is a keyword in C++11",
token->u.value); token->u.value);
...@@ -8162,11 +8162,11 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, ...@@ -8162,11 +8162,11 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p,
/* Get an operator token. */ /* Get an operator token. */
token = cp_lexer_peek_token (parser->lexer); token = cp_lexer_peek_token (parser->lexer);
if (warn_cxx0x_compat if (warn_cxx11_compat
&& token->type == CPP_RSHIFT && token->type == CPP_RSHIFT
&& !parser->greater_than_is_operator_p) && !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" "%<>>%> operator is treated"
" as two right angle brackets in C++11")) " as two right angle brackets in C++11"))
inform (token->location, inform (token->location,
...@@ -11873,7 +11873,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -11873,7 +11873,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
/* Complain about `auto' as a storage specifier, if /* Complain about `auto' as a storage specifier, if
we're complaining about C++0x compatibility. */ we're complaining about C++0x compatibility. */
warning_at (token->location, OPT_Wc__0x_compat, "%<auto%>" warning_at (token->location, OPT_Wc__11_compat, "%<auto%>"
" changes meaning in C++11; please remove it"); " changes meaning in C++11; please remove it");
/* Set the storage class anyway. */ /* Set the storage class anyway. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment