]> granicus.if.org Git - clang/commitdiff
Put warning about makeing a string writable into
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 6 Jan 2011 18:45:19 +0000 (18:45 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 6 Jan 2011 18:45:19 +0000 (18:45 +0000)
its own deprecated diagnostics group so it can be
turned off selectively. // rdar://8827606

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

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/SemaCXX/writable-strings-deprecated.cpp [new file with mode: 0644]

index 7b8dd93eb9958334a2b7bc29d5ada3ceaa69bcc4..897ccf957f144a5ba50a5789a96a294bc8554efb 100644 (file)
@@ -35,6 +35,7 @@ def : DiagGroup<"declaration-after-statement">;
 def GNUDesignator : DiagGroup<"gnu-designator">;
 
 def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
+def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings">;
 def Deprecated : DiagGroup<"deprecated", [ DeprecatedDeclarations] >,
                  DiagCategory<"Deprecations">;
 
index 01ea337392be914fcd245da56997723b45daf278..56ee876724f91a8214d70f7995885a6dd3287e8b 100644 (file)
@@ -2340,7 +2340,7 @@ def err_array_init_not_init_list : Error<
   "array initializer must be an initializer "
   "list%select{| or string literal}0">;
 def warn_deprecated_string_literal_conversion : Warning<
-  "conversion from string literal to %0 is deprecated">, InGroup<Deprecated>;
+  "conversion from string literal to %0 is deprecated">, InGroup<DeprecatedWritableStr>;
 def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
 def err_typecheck_sclass_fscope : Error<
   "illegal storage class on file-scoped variable">;
diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp
new file mode 100644 (file)
index 0000000..c89c882
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// rdar://8827606
+
+char *fun(void)
+{
+   return "foo";
+}
+
+void test(bool b)
+{
+  ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
+}