<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 23, 2014 at 9:35 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">PR4860 points out an inconsistency with how clang behaves compared to<br>
gcc in terms of -Wno-attributes. GCC's documentation says<br>
(<a href="http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html</a>):<br>
<br>
-Wno-attributesDo not warn if an unexpected __attribute__ is used,<br>
such as unrecognized attributes, function attributes applied to<br>
variables, etc. This does not stop errors for incorrect use of<br>
supported attributes.<br>
<br>
While I personally find it bizarre that "function attributes applied<br>
to variables" is not an example of "incorrect use of supported<br>
attributes", it turns out that GCC really honors this.<br>
<br>
__attribute__((__warn_unused_result__)) int x;<br>
<br>
When compiled with -Wno-attributes does not warn in gcc, but does<br>
currently warn in clang. This patch addresses that, but since it's<br>
switching diagnostic groups, I figured it might warrant a bit of<br>
discussion.</blockquote><div><br></div><div>I don't think the GCC position of differentiating "incorrect use of supported attributes" from "attributes applied to the wrong kind of entity" makes much sense. Having taken a brief look over our -Wignored-attributes warning, I have a slightly different suggestion:</div>
<div><br></div><div>Rename the UnknownAttributes group to -Wunknown-attributes, and add a new -Wattributes group containing both IgnoredAttributes and UnknownAttributes. (That is, make -Wignored-attributes continue to be "we know what this attribute name means, but it didn't apply here", make -Wunknown-attributes continue to be "we don't know what this attribute name means", and make -Wattributes cover both.)</div>
</div></div></div>