Warning flag for attribute warnings

I’ve added a new warning for an OpenCL attribute and it needs to go under a flag. I noticed that in the Misc/warning-flags.c test there are a bunch of attribute warnings that do not have flags.

I think that the group “IgnoredAttribute” would apply to the warning I added and the following below as most are because the attribute is incorrectly applied and therefore ignored.

Please let me know what you think and I’ll go clean these up.

Here is the warning I added:


Here is the list:

CHECK-NEXT: warn_attribute_ibaction
CHECK-NEXT: warn_attribute_iboutlet
CHECK-NEXT: warn_attribute_ignored
CHECK-NEXT: warn_attribute_ignored_for_field_of_type
CHECK-NEXT: warn_attribute_malloc_pointer_only
CHECK-NEXT: warn_attribute_nonnull_no_pointers
CHECK-NEXT: warn_attribute_precede_definition
CHECK-NEXT: warn_attribute_sentinel_named_arguments
CHECK-NEXT: warn_attribute_sentinel_not_variadic
CHECK-NEXT: warn_attribute_type_not_supported
CHECK-NEXT: warn_attribute_unknown_visibility
CHECK-NEXT: warn_attribute_void_function_method
CHECK-NEXT: warn_attribute_weak_import_invalid_on_definition
CHECK-NEXT: warn_attribute_weak_on_field
CHECK-NEXT: warn_attribute_weak_on_local
CHECK-NEXT: warn_attribute_wrong_decl_type

CHECK-NEXT: warn_function_attribute_wrong_type
CHECK-NEXT: warn_gnu_inline_attribute_requires_inline

CHECK-NEXT: warn_ns_attribute_wrong_parameter_type
CHECK-NEXT: warn_ns_attribute_wrong_return_type
CHECK-NEXT: warn_objc_object_attribute_wrong_type

CHECK-NEXT: warn_pointer_attribute_wrong_type

CHECK-NEXT: warn_transparent_union_attribute_field_size_align
CHECK-NEXT: warn_transparent_union_attribute_floating
CHECK-NEXT: warn_transparent_union_attribute_not_definition
CHECK-NEXT: warn_transparent_union_attribute_zero_fields


I think we’d benefit from a distinction between “your code is broken: the attribute is ignored because it is being used incorrectly” and “we think your code is fine but we do not support this attribute here” – but we don’t currently have such a distinction so I think the change you’re proposing is fine.

I agree with Richard on both counts, though the only true "ignored" (and not invalid) attribute warning I see is warn_unhandled_ms_attribute_ignored. So I think we can stick with IgnoredAttributes for now.

Thank you for finding all the similar ignored/invalid attribute warnings!

Ok, with two votes in favor of doing this, I will prepare a patch for review.

Thank you,