This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/79708] New: -Wlogical-op with duplicate errno symbols
- From: "peter at eisentraut dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 24 Feb 2017 18:44:41 +0000
- Subject: [Bug c/79708] New: -Wlogical-op with duplicate errno symbols
- Auto-submitted: auto-generated
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.)