summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-12-08 19:28:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-12-08 19:28:10 +0000
commit3edadfc7308d812da767fc2d9987035c7a3470c8 (patch)
tree8e24f0dad04cf6af509e9f1db81df164bd0ad5fa
parent3685995d2ce4b7a7cda5143d536777d152566434 (diff)
downloadbcm5719-llvm-3edadfc7308d812da767fc2d9987035c7a3470c8.tar.gz
bcm5719-llvm-3edadfc7308d812da767fc2d9987035c7a3470c8.zip
Changed 'readonly' 'retain/copy' diagnostics into
warning as it is allowed in gcc and will break projects. llvm-svn: 60710
-rw-r--r--clang/include/clang/Basic/DiagnosticKinds.def2
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp5
-rw-r--r--clang/test/SemaObjC/property-12.m6
3 files changed, 8 insertions, 5 deletions
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def
index 03787dfa62e..20337f0aed6 100644
--- a/clang/include/clang/Basic/DiagnosticKinds.def
+++ b/clang/include/clang/Basic/DiagnosticKinds.def
@@ -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,
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 828e1fc8c61..5e9e2b21e2d 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -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.
diff --git a/clang/test/SemaObjC/property-12.m b/clang/test/SemaObjC/property-12.m
index bdd026d32fc..659ffa1d050 100644
--- a/clang/test/SemaObjC/property-12.m
+++ b/clang/test/SemaObjC/property-12.m
@@ -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
OpenPOWER on IntegriCloud