This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/69602] [6 Regression] over-ambitious logical-op warning on EAGAIN vs EWOULDBLOCK


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]