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.

llvm-svn: 130052
This commit is contained in:
Chandler Carruth 2011-04-23 06:54:44 +00:00
parent b009b14971
commit 153329dad7
2 changed files with 5 additions and 1 deletions

View 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">;

View 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)