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/7 Regression] over-ambitious logical-op warning on EAGAIN vs EWOULDBLOCK


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

--- Comment #15 from Eric Blake <eblake at redhat dot com> ---
(In reply to Martin Sebor from comment #14)
> I would suggest to keep the warning simple and avoid overdesigning it with
> workarounds for this case.  The solution in comment #12 (copied below) seems
> like a good approach for avoiding the duplication and the warning.  It's
> already commonly used to deal with non-standard implementation-specific
> macros that portable programs cannot otherwise rely on.
> 
>  	1149	    if (   cchRead < 0 
>  	1150	        && (   errno == EAGAIN 
>  	1151	#if EAGAIN != EWOULDBLOCK 
>  	1152	            || errno == EWOULDBLOCK 
>  	1153	#endif 
>  	1154	            ))

Yuck. Mid-expression #ifdefs are awful - I much prefer it when #ifdefs can be
limited to a per-statement or per-function scope.  You're seriously proposing
forcing software to uglify their code with mid-expression warnings to shut up
compiler warnings that only occur on platforms where the two values are
synonyms, and which can't even be portably seen as necessary when testing as
platforms where the two values are distinct?

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