https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

--- Comment #16 from Martin Sebor <msebor at gcc dot gnu.org> ---
There are straightforward ways to avoid interspersing code with preprocessor
conditionals:

  #if EAGAIN == EWOULDBLOCK 
  #  #define EAGAIN_OR_WOULDBLOCK(e) (e == EAGAIN)
  #else
  #  #define EAGAIN_OR_WOULDBLOCK(e) (e == EAGAIN || e == EWOULDBLOCK)
  #endif

  ...

  if (cchRead < 0 && EAGAIN_OR_WOULDBLOCK (errno))

The point is that the warning is simple and works as designed.  As others have
noted, handling this case is non-trivial and as with any non-trivial solution
could easily have unforeseen side-effects and even lead to bugs (at a minimum,
likely false negatives).  I ended up here because I've been researching just
such a problem.  So unless the idiom in comment #0 is pervasive and leads to
many warnings I would suggest to leave it to programs to deal with.  Marek and
Jakub will likely have an idea of how common it is once they rebuild Fedora
with GCC 7.  If you have data of your own that might be helpful as well.

Reply via email to