NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/57807: #include <arpa/inet.h> spuriously defines le32enc/be32enc/... under _XOPEN_SOURCE=700



>Number:         57807
>Category:       standards
>Synopsis:       #include <arpa/inet.h> spuriously defines le32enc/be32enc/... under _XOPEN_SOURCE=700
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 01 19:35:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        9
>Organization:
The NetBE16 Foundation
>Environment:
>Description:
In an attempt to work around PR standards/57806, I tried defining _XOPEN_SOURCE=700 instead of _POSIX_C_SOURCE=200809L.  But although this exposes ntohl/ntohs/htonl/htons, it _also_ exposes the nonstandard NetBSDisms be32enc and similar, which should be suppressed except if _NETBSD_SOURCE is also defined.
>How-To-Repeat:
$ cat pr.c
#define	_XOPEN_SOURCE	700
#include <arpa/inet.h>
void be32dec(void) {}
$ make pr.o
cc -O2   -c pr.c
pr.c:3:6: error: conflicting types for ?be32dec?
 void be32dec(void) {}
      ^~~~~~~
In file included from /usr/include/amd64/endian.h:3:0,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/arpa/inet.h:67,
                 from pr.c:2:
/usr/include/sys/endian.h:221:1: note: previous definition of ?be32dec? was here
 __GEN_ENDIAN_DEC(32, be)
 ^
*** Error code 1

Stop.
make: stopped in /tmp/riastradh
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index