<div dir="auto"><div><div class="gmail_quote"><div dir="auto"><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That's correct, but it's useful beyond just detecting typos. Different<br>
vendors support different sets of attributes and this diagnostic is<br>
how a developer can tell whether Clang is ignoring a given attribute<br>
or not. It can be very difficult to tell the difference between<br>
"parsed and silently ignoring this attribute" and "parsed attribute<br>
and it functions as designed" depending on the attribute without this<br>
diagnostic. For example, in order to tell whether<br>
__attribute__((deprecated)) is supported, you would have to alter code<br>
to see that it's behaving by design; otherwise, the declarations are<br>
just silently marked as deprecated.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Indeed, which is why I want the warning turned on by default (not that it's a default compiler warning, but that it's on for all attributes "by default" when the warning is turned on).</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> To solve this, I propose that we add the ability to specify attributes to ignore for -Wunknown-attributes. In other words, something like this: '-Wignore-unknown-attribute=some_ns::some_attribute'.<br>
<br>
What issue is being solved, though? If the user wishes to ignore a<br>
specific attribute on Clang because it's not known to the<br>
implementation, the better solution is to use the preprocessor to<br>
provide decent fallback behavior for the attribute. This is why<br>
__has_attribute and friends exist. Is there a different problem that<br>
this new warning flag behavior solves?<br>
<br>
~Aaron<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No, this problem is not solved by the preprocessor. Yes, most C++ code bases today use the preprocessor to hack around this, but IMO, this is a broken solution. C++17 states that unknown attributes should be ignored, not warned on (although I believe the compiler is within its rights to warn). I strongly feel that users should be able to use attributes without macros, otherwise C++11 attributes lose a lot of their appeal, almost to the point where vendor-specific attribute syntaxes should have continued as the way forward.</div><div dir="auto"><br></div><div dir="auto">In short, I would argue that the preprocessor is a worse solution, as requiring it blocks the perfectly valid syntax of using a C++11 attribute, and using it requires a lot more work to set up the macro.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Justin</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</div></div></div>