[cfe-commits] r130052 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td test/SemaCXX/writable-strings-deprecated.cpp

Chandler Carruth chandlerc at gmail.com
Fri Apr 22 23:54:44 PDT 2011


Author: chandlerc
Date: Sat Apr 23 01:54:44 2011
New Revision: 130052

URL: http://llvm.org/viewvc/llvm-project?rev=130052&view=rev
Log:
GCC overloads -Wwrite-strings just to make it extra confusing. While it
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.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=130052&r1=130051&r2=130052&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Sat Apr 23 01:54:44 2011
@@ -173,7 +173,10 @@
 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">;

Modified: cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp?rev=130052&r1=130051&r2=130052&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp Sat Apr 23 01:54:44 2011
@@ -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)





More information about the cfe-commits mailing list