]> granicus.if.org Git - clang/commitdiff
Place warning about 'readonly' property attributes which
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 8 Jan 2009 23:23:10 +0000 (23:23 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 8 Jan 2009 23:23:10 +0000 (23:23 +0000)
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

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

Driver/clang.cpp
test/SemaObjC/property-10.m
test/SemaObjC/property-12.m

index 1b29671aa94f6d1173ce61d63e148b33931898fc..77fb3c8f01701178653250a8120858f26b823b85 100644 (file)
@@ -645,6 +645,10 @@ static llvm::cl::opt<bool>
 WarnFloatEqual("Wfloat-equal",
    llvm::cl::desc("Warn about equality comparisons of floating point values"));
 
+static llvm::cl::opt<bool>
+WarnPropertyReadonlyAttrs("Wreadonly-setter-attrs",
+   llvm::cl::desc("Warn about readonly properties with writable attributes"));
+
 static llvm::cl::opt<bool>
 WarnNoFormatNonLiteral("Wno-format-nonliteral",
    llvm::cl::desc("Do not warn about non-literal format strings"));
@@ -681,6 +685,10 @@ static void InitializeDiagnostics(Diagnostic &Diags) {
   if (!WarnFloatEqual)
     Diags.setDiagnosticMapping(diag::warn_floatingpoint_eq, diag::MAP_IGNORE);
 
+  if (!WarnPropertyReadonlyAttrs)
+    Diags.setDiagnosticMapping(diag::warn_objc_property_attr_mutually_exclusive,
+      diag::MAP_IGNORE);
+
   // Silence "format string is not a string literal" warnings if requested
   if (WarnNoFormatNonLiteral)
     Diags.setDiagnosticMapping(diag::warn_printf_not_string_constant,
index 866fd37490eb6ec5dd43bda816cdbfd12c31a925..26fde7bbf19fd8cec87ee6d73328c9d435ca3889 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s  -fblocks
+// RUN: clang -fsyntax-only -Wreadonly-setter-attrs -verify %s  -fblocks
 
 // Check property attribute consistency.
 
index 659ffa1d050526b5f523fa8dfaddb73f8823f860..b6ac1b7c420dceec2df29f06c7faadd6980cca53 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -Wreadonly-setter-attrs -verify %s
 
 @protocol P0
 @property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}