From: Richard Smith Date: Thu, 14 Nov 2013 22:22:31 +0000 (+0000) Subject: Add -Wdeprecated-writable-string in C++ to -Wc++11-compat, since it's ill-formed... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e05372a773e3c8c9a606af9ee6bc9ee4fc103804;p=clang Add -Wdeprecated-writable-string in C++ to -Wc++11-compat, since it's ill-formed in C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194736 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index a590ae8ea6..bf527ce503 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -66,11 +66,15 @@ def GNUStringLiteralOperatorTemplate : def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor">; def AbstractFinalClass : DiagGroup<"abstract-final-class">; +def CXX11CompatDeprecatedWritableStr : + DiagGroup<"c++11-compat-deprecated-writable-strings">; + def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">; def DeprecatedImplementations :DiagGroup<"deprecated-implementations">; def DeprecatedIncrementBool : DiagGroup<"deprecated-increment-bool">; def DeprecatedRegister : DiagGroup<"deprecated-register">; -def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings">; +def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings", + [CXX11CompatDeprecatedWritableStr]>; // FIXME: Why are DeprecatedImplementations and DeprecatedWritableStr // not in this group? def Deprecated : DiagGroup<"deprecated", [DeprecatedDeclarations, @@ -143,6 +147,7 @@ def ReservedUserDefinedLiteral : def CXX11Compat : DiagGroup<"c++11-compat", [CXX11Narrowing, CXX11CompatReservedUserDefinedLiteral, + CXX11CompatDeprecatedWritableStr, CXXPre1yCompat]>; def : DiagGroup<"c++0x-compat", [CXX11Compat]>; def CXX11CompatPedantic : DiagGroup<"c++11-compat-pedantic", diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d9b0a01ea5..23bc87fc99 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -4499,7 +4499,8 @@ def ext_array_init_parens : ExtWarn< "parenthesized initialization of a member array is a GNU extension">, InGroup>, DefaultError; def warn_deprecated_string_literal_conversion : Warning< - "conversion from string literal to %0 is deprecated">, InGroup; + "conversion from string literal to %0 is deprecated">, + InGroup; def warn_deprecated_string_literal_conversion_c : Warning< "dummy warning to enable -fconst-strings">, InGroup, DefaultIgnore; def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp index 8295401495..b8f605b63d 100644 --- a/test/SemaCXX/writable-strings-deprecated.cpp +++ b/test/SemaCXX/writable-strings-deprecated.cpp @@ -1,11 +1,15 @@ // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s // RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s // RUN: %clang_cc1 -fsyntax-only -Wno-write-strings -verify %s +// RUN: %clang_cc1 -fsyntax-only -Werror=c++11-compat -verify %s -DERROR // rdar://8827606 char *fun(void) { return "foo"; +#ifdef ERROR + // expected-error@-2 {{deprecated}} +#endif } void test(bool b)