NetBSD Problem Report #57807

From www@netbsd.org  Mon Jan  1 19:33:37 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 3DED81A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Jan 2024 19:33:37 +0000 (UTC)
Message-Id: <20240101193335.D77B01A9239@mollari.NetBSD.org>
Date: Mon,  1 Jan 2024 19:33:35 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
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
>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!

NetBSD Home
NetBSD PR Database Search

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