]> granicus.if.org Git - clang/commitdiff
GCC overloads -Wwrite-strings just to make it extra confusing. While it
authorChandler Carruth <chandlerc@gmail.com>
Sat, 23 Apr 2011 06:54:44 +0000 (06:54 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 23 Apr 2011 06:54:44 +0000 (06:54 +0000)
changes language semantics in C and ObjC (which Clang has supported for
a while), in C++ it's the name used for Clang's
-Wdeprecated-writable-strings.

Clang's name is at least less overloaded if still confusing (the string
isn't writable, we just allow converting to a non-const pointer without
warning), so I've left it in place and made the GCC name an alias for
compatibility.

With this I've implemented all the aspects of GCC's -Wwrite-strings I've
encountered which didn't work with Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130052 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
test/SemaCXX/writable-strings-deprecated.cpp

index 15f3dbd4640d397b89ab6bd56890906726d9dde9..dfce059dbe988a84690c45e35d16f696a8acd033 100644 (file)
@@ -173,7 +173,10 @@ def VariadicMacros : DiagGroup<"variadic-macros">;
 def VectorConversions : DiagGroup<"vector-conversions">;      // clang specific
 def VLA : DiagGroup<"vla">;
 def VolatileRegisterVar : DiagGroup<"volatile-register-var">;
-def : DiagGroup<"write-strings">;
+
+// GCC calls -Wdeprecated-writable-strings -Wwrite-strings.
+def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>;
+
 def CharSubscript : DiagGroup<"char-subscripts">;
 def LargeByValueCopy : DiagGroup<"large-by-value-copy">;
 def DuplicateArgDecl : DiagGroup<"duplicate-method-arg">;
index 66b59947981789d1bd04105d759c26cda26dd5ca..829540149563b1f40aea7f5381f2d9696d1a7beb 100644 (file)
@@ -1,5 +1,6 @@
 // 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
 // rdar://8827606
 
 char *fun(void)