diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-08 23:23:10 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-08 23:23:10 +0000 |
commit | 17d0d0d7caed146e047e1442c816ee93fb691bf7 (patch) | |
tree | eb2e091e01ec011e2b9afecae3c86b7b4cfce0da | |
parent | b3eef68111ffc220e449be96da1747998c057790 (diff) |
Place warning about 'readonly' property attributes which
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
-rw-r--r-- | Driver/clang.cpp | 8 | ||||
-rw-r--r-- | test/SemaObjC/property-10.m | 2 | ||||
-rw-r--r-- | test/SemaObjC/property-12.m | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 1b29671aa9..77fb3c8f01 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -646,6 +646,10 @@ 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, diff --git a/test/SemaObjC/property-10.m b/test/SemaObjC/property-10.m index 866fd37490..26fde7bbf1 100644 --- a/test/SemaObjC/property-10.m +++ b/test/SemaObjC/property-10.m @@ -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. diff --git a/test/SemaObjC/property-12.m b/test/SemaObjC/property-12.m index 659ffa1d05..b6ac1b7c42 100644 --- a/test/SemaObjC/property-12.m +++ b/test/SemaObjC/property-12.m @@ -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}} |