This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/69602] [6 Regression] over-ambitious logical-op warning on EAGAIN vs EWOULDBLOCK
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Feb 2016 12:41:37 +0000
- Subject: [Bug c/69602] [6 Regression] over-ambitious logical-op warning on EAGAIN vs EWOULDBLOCK
- Auto-submitted: auto-generated
- References: <bug-69602-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #7)
> (In reply to Eric Blake from comment #0)
> > However, as shown by the sample code below, gcc 6.0's new warning is
> > over-ambitious, and is likely to _cause_ rather than cure user bugs, when
> > uninformed users unaware that Linux has the two errno values equal dumb down
> > the code to silence the warning, but in the process break their code on
> > other platforms where it is important to check for both values.
>
> As a work-around, something like:
>
> if (0 || errno == EAGAIN || errno == EWOULDBLOCK)
>
> silences the warning (although it should not).
That is something that should be fixed.
But
if (errno == EAGAIN || (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK))
could be better workaround.