[Bug c++/60978] -Wenum-compare warns too eagerly
ppluzhnikov at google dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 2 22:11:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60978
--- Comment #9 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
(In reply to Jason Merrill from comment #8)
> You shouldn't get the warning about IPPROTO_ICMP vs IPPROTO_ICMPV66, as they
> are members of the same anonymous enum.
They are?
In glibc-2.19, include/netinet/in.h:
/* Standard well-defined IP protocols. */
enum
{
IPPROTO_IP = 0, /* Dummy protocol for TCP. */
#define IPPROTO_IP IPPROTO_IP
IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
#define IPPROTO_ICMP IPPROTO_ICMP
...
};
/* If __USE_KERNEL_IPV6_DEFS is defined then the user has included the kernel
network headers first and we should use those ABI-identical definitions
instead of our own. */
#ifndef __USE_KERNEL_IPV6_DEFS
enum
{
IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
...
IPPROTO_ICMPV6 = 58, /* ICMPv6. */
...
};
Looks like different anonymous enums to me.
More information about the Gcc-bugs
mailing list