Since this warning was generalized, it was also given a sensible warning group flag and the corresponding test was updated to reflect this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198053
91177308-0d34-0410-b5e6-
96231b3b80d8
"%0 attribute parameter %1 is out of bounds">;
def err_attribute_uuid_malformed_guid : Error<
"uuid attribute contains a malformed GUID">;
-def warn_nonnull_pointers_only : Warning<
- "nonnull attribute only applies to pointer arguments">;
+def warn_attribute_pointers_only : Warning<
+ "%0 attribute only applies to pointer arguments">,
+ InGroup<IgnoredAttributes>;
def err_attribute_pointers_only : Error<
"%0 attribute only applies to pointer arguments">;
def err_attribute_no_member_pointers : Error<
if (!T->isAnyPointerType() && !T->isBlockPointerType()) {
// FIXME: Should also highlight argument in decl.
- S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only)
- << "nonnull" << Ex->getSourceRange();
+ S.Diag(Attr.getLoc(), diag::warn_attribute_pointers_only)
+ << Attr.getName() << Ex->getSourceRange();
continue;
}
The list of warnings below should NEVER grow. It should gradually shrink to 0.
-CHECK: Warnings without flags (133):
+CHECK: Warnings without flags (132):
CHECK-NEXT: ext_delete_void_ptr_operand
CHECK-NEXT: ext_expected_semi_decl_list
CHECK-NEXT: ext_explicit_specialization_storage_class
CHECK-NEXT: warn_missing_whitespace_after_macro_name
CHECK-NEXT: warn_multiple_method_decl
CHECK-NEXT: warn_no_constructor_for_refconst
-CHECK-NEXT: warn_nonnull_pointers_only
CHECK-NEXT: warn_not_compound_assign
CHECK-NEXT: warn_objc_property_copy_missing_on_block
CHECK-NEXT: warn_objc_protocol_qualifier_missing_id
}
void foo(const char *str) __attribute__((nonnull("foo"))); // expected-error{{'nonnull' attribute requires parameter 1 to be an integer constant}}
+void bar(int i) __attribute__((nonnull(1))); // expected-warning {{'nonnull' attribute only applies to pointer arguments}} expected-warning {{'nonnull' attribute applied to function with no pointer arguments}}