[PATCH] Switching attribute warning diagnostic groups

Aaron Ballman aaron at aaronballman.com
Thu Jan 23 09:35:02 PST 2014


PR4860 points out an inconsistency with how clang behaves compared to
gcc in terms of -Wno-attributes. GCC's documentation says
(http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html):

-Wno-attributesDo not warn if an unexpected __attribute__ is used,
such as unrecognized attributes, function attributes applied to
variables, etc. This does not stop errors for incorrect use of
supported attributes.

While I personally find it bizarre that "function attributes applied
to variables" is not an example of "incorrect use of supported
attributes", it turns out that GCC really honors this.

__attribute__((__warn_unused_result__)) int x;

When compiled with -Wno-attributes does not warn in gcc, but does
currently warn in clang. This patch addresses that, but since it's
switching diagnostic groups, I figured it might warrant a bit of
discussion.

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wno-attributes.patch
Type: application/octet-stream
Size: 689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140123/319e11db/attachment.obj>


More information about the cfe-commits mailing list