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: "filbranden at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 11 Jun 2015 06:45:59 +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
--- Comment #9 from Filipe Brandenburger <filbranden at google dot com> ---
Or, conversely, please explain to me how changing the behavior (to allow a
void-cast to silent the warning on a call to a warn_unused_result function)
would actually affect anyone today...
If it's a project that's actually using -Wunused-result (and they actually look
at those warnings and care about them), then they're not really using a
void-cast to ignore the return value, otherwise they would get a warning. Would
the change of behavior really affect them? Not really.
If they're using -Wunused-result but do not care about the warnings, well, do
we really care? If anything (perhaps if they were adding void-casts for linters
and other static analysis tools) it's possible that a lot of suprious warnings
will be suppressed and they'll be left with a more manageable list and possibly
start to actually look at those and fix them (since there's an easy way to
explicitly say they should be ignored.)
If they're using -Wno-unused-result, then the change of behavior doesn't affect
them. If anything, if this *BUG* is fixed, they might actually reconsider and
re-enable it.
So please explain to me why sticking to the current unhelpful behavior is
really that important.