]> granicus.if.org Git - clang/commitdiff
-fwritable-strings should silence warnings about the deprecated string
authorDouglas Gregor <dgregor@apple.com>
Mon, 14 Mar 2011 16:13:32 +0000 (16:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 14 Mar 2011 16:13:32 +0000 (16:13 +0000)
-literal to char* conversion. Make it so.

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

lib/Sema/SemaExprCXX.cpp
test/SemaCXX/writable-strings-deprecated.cpp

index ea93449d7b816a6c5edc9d741ddbc83aae28610e..5701835c1a52a903ddbf61d89131b27cd0c16b70 100644 (file)
@@ -2273,7 +2273,8 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
     ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
                       CK_NoOp, VK);
 
-    if (SCS.DeprecatedStringLiteralToCharPtr)
+    if (SCS.DeprecatedStringLiteralToCharPtr &&
+        !getLangOptions().WritableStrings)
       Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion)
         << ToType.getNonReferenceType();
 
index c89c88256426a8996b899044a7204d21c5c1d266..66b59947981789d1bd04105d759c26cda26dd5ca 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
 // rdar://8827606
 
 char *fun(void)