This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66425] (void) cast doesn't suppress __attribute__((warn_unused_result))
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 11 Jun 2015 05:39:53 +0000
- Subject: [Bug c/66425] (void) cast doesn't suppress __attribute__((warn_unused_result))
- Auto-submitted: auto-generated
- References: <bug-66425-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Filipe Brandenburger from comment #2)
> It turns out clang from LLVM seems to do the right thing here...
There is no right thing here. In fact some could argue that clang is doing the
wrong thing here. GCC originally added this attribute and made the decision
then that void would not suppress the attribute.
There are even tests in the GCC testsuite testing that.
https://gcc.gnu.org/ml/gcc-patches/2003-09/msg00851.html
Also unlike most other extensions this one is well documented and even
documents that it warns for this case.
I am going to say people are mis-using this attribute and clang's attribute
does not match up with GCC's attribute. Just the way life is.