]> granicus.if.org Git - clang/commitdiff
Downgrade error about nonnull attribute bbeing applied to a function without point...
authorDouglas Gregor <dgregor@apple.com>
Thu, 12 Aug 2010 18:48:43 +0000 (18:48 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 12 Aug 2010 18:48:43 +0000 (18:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110939 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/nonnull.m

index f6987e8e3af3cbb9c845ec02f5e2391a1c7b3b7c..a9e976f434ace0337932e58c25c67ebd9dd1000c 100644 (file)
@@ -845,7 +845,7 @@ def err_attribute_argument_out_of_bounds : Error<
   "'%0' attribute parameter %1 is out of bounds">;
 def err_attribute_requires_objc_interface : Error<
   "attribute may only be applied to an Objective-C interface">;
-def err_nonnull_pointers_only : Error<
+def warn_nonnull_pointers_only : Warning<
   "nonnull attribute only applies to pointer arguments">;
 def err_ownership_type : Error<
   "%0 attribute only applies to %1 arguments">;
index 54ffa95ce1bbd4a57b33ae664c2b37f9c534637c..b26fd64719d893173016bd7ed3d167535c6728dd 100644 (file)
@@ -321,7 +321,7 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {
     QualType T = getFunctionOrMethodArgType(d, x);
     if (!T->isAnyPointerType() && !T->isBlockPointerType()) {
       // FIXME: Should also highlight argument in decl.
-      S.Diag(Attr.getLoc(), diag::err_nonnull_pointers_only)
+      S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only)
         << "nonnull" << Ex->getSourceRange();
       continue;
     }
index 642f50f9e4d6782ba7d84f8322e9117a19ff40d5..15fee74a3b5f8fbfe9bc307ec715cad33fd7ba9c 100644 (file)
@@ -43,3 +43,5 @@ foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
   func6((NSObject*) 0); // no-warning
   func7((NSObject*) 0); // no-warning
 }
+
+void func5(int) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}