]> granicus.if.org Git - clang/commitdiff
Changed 'readonly' 'retain/copy' diagnostics into
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 8 Dec 2008 19:28:10 +0000 (19:28 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 8 Dec 2008 19:28:10 +0000 (19:28 +0000)
warning as it is allowed in gcc and will break projects.

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

include/clang/Basic/DiagnosticKinds.def
lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/property-12.m

index 03787dfa62effd50da7dbba6e167fc802a9a3e6a..20337f0aed683e24b92f858ac6edaa826c756085 100644 (file)
@@ -448,6 +448,8 @@ DIAG(err_objc_unexpected_attr, ERROR,
      "prefix attribute must be followed by an interface or protocol")
 DIAG(err_objc_property_attr_mutually_exclusive, ERROR,
      "property attributes '%0' and '%1' are mutually exclusive")
+DIAG(warn_objc_property_attr_mutually_exclusive, WARNING,
+     "property attributes '%0' and '%1' are mutually exclusive")
 DIAG(warn_objc_property_no_assignment_attribute, WARNING,
      "no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed")
 DIAG(warn_objc_property_default_assign_on_object, WARNING,
index 828e1fc8c612d113e7f94d3f815b4a2b572c8148..5e9e2b21e2d8ea640f06dd5996c55e25f6b37ae9 100644 (file)
@@ -1299,9 +1299,10 @@ void Sema::CheckObjCPropertyAttributes(QualType PropertyTy,
                          (Attributes & ObjCDeclSpec::DQ_PR_copy) ?
                           "copy" : "retain";
                          
-    Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
+    Diag(Loc, (Attributes & (ObjCDeclSpec::DQ_PR_readwrite)) ? 
+                 diag::err_objc_property_attr_mutually_exclusive :
+                 diag::warn_objc_property_attr_mutually_exclusive)
       << "readonly" << which;
-    return;
   }
 
   // Check for copy or retain on non-object types.
index bdd026d32fc182b743e07bebb0bb5f8fe3a26fba..659ffa1d050526b5f523fa8dfaddb73f8823f860 100644 (file)
@@ -1,15 +1,15 @@
 // RUN: clang -fsyntax-only -verify %s
 
 @protocol P0
-@property(readonly,assign) id X; // expected-error {{property attributes 'readonly' and 'assign' are mutually exclusive}}
+@property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}
 @end
 
 @protocol P1
-@property(readonly,retain) id X; // expected-error {{property attributes 'readonly' and 'retain' are mutually exclusive}}
+@property(readonly,retain) id X; // expected-warning {{property attributes 'readonly' and 'retain' are mutually exclusive}}
 @end
 
 @protocol P2
-@property(readonly,copy) id X; // expected-error {{property attributes 'readonly' and 'copy' are mutually exclusive}}
+@property(readonly,copy) id X; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
 @end
 
 @protocol P3