Being noisy when ignoring unknown attributes is important because it can be very difficult for a user to tell the difference between silently ignoring an attribute and accepting an attribute that doesn't have observable semantics for a particular compiland. However, there are times when the user has a code base with vendor-scoped attributes the implementation doesn't support -- for instance, a static analyzer may add a bunch of [[analyzer::attr]] attributes that Clang doesn't know about.
To support this scenario, this patch allows you to ignore unknown attributes only when the attribute is a scoped attribute in a namespace for which Clang does not support any attributes. It is expected to be used as -Wno-unknown-attributes -Wunknown-attribute-namespaces so that unknown attribute warnings are disabled except for unknown attributes in unknown namespaces. Note that attributes in the standards namespace are considered to always be known to Clang and thus will still be warned on even when passing -Wunknown-attribute-namespaces this way. e.g.,
[[gnu::unknown]] int I; // Still diagnosed because we support other attributes in the gnu namespace. [[unknown::unknown]] int J; // Is not diagnosed because we do not support any attributes in the unknown namespace. [[unknown]] int K; // Still diagnosed because Clang should know about all attributes in the global attribute namespace.
If there is a better way to surface the warning flags, I'm happy to explore it.