[Bug c/79708] New: -Wlogical-op with duplicate errno symbols
peter at eisentraut dot org
gcc-bugzilla@gcc.gnu.org
Fri Feb 24 18:44:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79708
Bug ID: 79708
Summary: -Wlogical-op with duplicate errno symbols
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: peter at eisentraut dot org
Target Milestone: ---
This is an attempt to write portable code:
#include <errno.h>
int
main()
{
if (errno == EWOULDBLOCK || errno == EAGAIN)
return 1;
return 0;
}
At some point, gcc -Wlogical-op started warning about this with:
test.c:6:27: warning: logical ‘or’ of equal expressions [-Wlogical-op]
This is unfortunate, because I find -Wlogical-op useful otherwise.
Could the warning be modified to realize when the duplicate values are from
macros expansion? (I'm aware of the difference between preprocessor and
compiler and that this might be difficult.)
More information about the Gcc-bugs
mailing list