NetBSD Problem Report #57807

From  Mon Jan  1 19:33:37 2024
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 3DED81A9238
	for <>; Mon,  1 Jan 2024 19:33:37 +0000 (UTC)
Message-Id: <>
Date: Mon,  1 Jan 2024 19:33:35 +0000 (UTC)
Subject: #include <arpa/inet.h> spuriously defines le32enc/be32enc/... under _XOPEN_SOURCE=700
X-Send-Pr-Version: www-1.0

>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
The NetBE16 Foundation
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.
$ 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

make: stopped in /tmp/riastradh
Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.