[cfe-commits] r60710 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDeclObjC.cpp test/SemaObjC/property-12.m

Fariborz Jahanian fjahanian at apple.com
Mon Dec 8 11:28:11 PST 2008


Author: fjahanian
Date: Mon Dec  8 13:28:10 2008
New Revision: 60710

URL: http://llvm.org/viewvc/llvm-project?rev=60710&view=rev
Log:
Changed 'readonly' 'retain/copy' diagnostics into
warning as it is allowed in gcc and will break projects.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=60710&r1=60709&r2=60710&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Mon Dec  8 13:28:10 2008
@@ -448,6 +448,8 @@
      "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,

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=60710&r1=60709&r2=60710&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Dec  8 13:28:10 2008
@@ -1299,9 +1299,10 @@
                          (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.

Modified: cfe/trunk/test/SemaObjC/property-12.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-12.m?rev=60710&r1=60709&r2=60710&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/property-12.m (original)
+++ cfe/trunk/test/SemaObjC/property-12.m Mon Dec  8 13:28:10 2008
@@ -1,15 +1,15 @@
 // RUN: clang -fsyntax-only -verify %s
 
 @protocol P0
- at property(readonly,assign) id X; // expected-error {{property attributes 'readonly' and 'assign' are mutually exclusive}}
+ at property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}
 @end
 
 @protocol P1
- at property(readonly,retain) id X; // expected-error {{property attributes 'readonly' and 'retain' are mutually exclusive}}
+ at property(readonly,retain) id X; // expected-warning {{property attributes 'readonly' and 'retain' are mutually exclusive}}
 @end
 
 @protocol P2
- at property(readonly,copy) id X; // expected-error {{property attributes 'readonly' and 'copy' are mutually exclusive}}
+ at property(readonly,copy) id X; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
 @end
 
 @protocol P3





More information about the cfe-commits mailing list