From nobody Mon May 06 16:44:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VY6gZ07Zhz5KYvQ; Mon, 06 May 2024 16:44:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VY6gY6X5yz4dQF; Mon, 6 May 2024 16:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715013849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ttis8co9wZDPZiDuocX375qcDjCoUeE0I3D+spOFHBI=; b=SdX7m1iTPVuE+8ZrcwyWREAWcxjik/qVc3+dIe8NSV3EpSvvf06e0pcrKU/AVtQId8WtIa e1iqzvCJqmZ26jsFueodiERyVa3mG1WCLJLvMS2BXHrb1g4mg9Xy8DKQSKprKSaVDzGEXt JqSUuTZzB8JvDFnv7oIroRResUsh0aWX/XS4+px19faNL7k0frXGpOwxBBn+s4t+JAKkhv B8cQeQwrUN42e7x+ZKHz5XdmU3ZUTbaFlY4oyed95XHipvO/GbARlREB2QQ5NfTCUisU3k vUM7LR9joeC+Y1cDciJWsNZuscsMtYuGNws3EuU7i4673uT2gv6d6FDMm/1Ezw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715013849; a=rsa-sha256; cv=none; b=qZyNd+Fr/KxAPkcCNBQPIFWtQF53pnT4czRNCM23vTpe/AwRVZGUofU5m77jFRiAtWAEzv rKXvvMrAnWqGBT+fIqT5e3y/9GOBeSEPYN0+ORac0a8lqaR8EiS8kfYBJipKNPS38EiA9U fFA294sP/n1hA0sI1megbtZMdNjBDqIiRZAJh0PPxqpYWUdmxNFFdf1andfPhMdX5d6xDp 9Bhyvbiu6TfDCcft/0FgJDnkOvOE9C0AbEL4fvkMuQuTe1J6Dlp0YvtJiRRq2q0qyJ9C5G IZAT0nP5SQt+mH9lyqXjHN+2i1J+PsTJRpkReAEu1a234ixM74KCvohmEc62rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715013849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ttis8co9wZDPZiDuocX375qcDjCoUeE0I3D+spOFHBI=; b=PCvxJJaSx+EnyB5jINMuWORYWAcGe41+Bt0cEqguo9faUKbFhqcdHWiYhi+crJTvo6jO9k oVZzVd2/D5d2uKB90jwO77olIrg7FJN8MUW4xhQW8Mk2SnWhgP6v+ni4U74iUtYJWXKCJ6 XQsZjUYCNPDMucvW5w2kKXO7FIsBv+HMx4l+uKwwJPnya9rF0WH0LARA4ERtqU6Nsyhfai 82H5jLkMgpGqwvttHA41/qWN8bbieKFKW3jT1U6LWa5PHwZOigX66Kkg90OYIIHQCdGKaB YucccF3qzHXBsnUsyIxp5kA484wm7EQ6vIidLsYxRueeX86BY1McwENjllbl1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VY6gY66SZz14jJ; Mon, 6 May 2024 16:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 446Gi9g3071973; Mon, 6 May 2024 16:44:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446Gi9Co071970; Mon, 6 May 2024 16:44:09 GMT (envelope-from git) Date: Mon, 6 May 2024 16:44:09 GMT Message-Id: <202405061644.446Gi9Co071970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1314d14c3271 - main - endian.h: Define uint{16,32,64}_t List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1314d14c32713b448738cc821c04a5e7482bb4af Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1314d14c32713b448738cc821c04a5e7482bb4af commit 1314d14c32713b448738cc821c04a5e7482bb4af Author: Warner Losh AuthorDate: 2024-05-06 15:10:46 +0000 Commit: Warner Losh CommitDate: 2024-05-06 16:43:14 +0000 endian.h: Define uint{16,32,64}_t The Draft Posix Issue 8 standard requires that these be defined. Define them in the usual way that lets multiple headers define them. Opted to not just use #include , allowed by the draft, to be conservative. Add notes about how we comply with Issue 8, and that we've opted to define these only as macros, though the standard allows functions, macros or both. Sponsored by: Netflix --- include/endian.h | 26 +++++++++++++++++++++++++- sys/sys/_endian.h | 6 ++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/endian.h b/include/endian.h index eb25cedf0bef..87ec7866c791 100644 --- a/include/endian.h +++ b/include/endian.h @@ -11,9 +11,33 @@ #ifndef _ENDIAN_H_ #define _ENDIAN_H_ +/* + * POSIX Issue 8 requires that endian.h define uint{16,32,64}_t. Although POSIX + * allows stdint.h symbols here, be conservative and only define there required + * ones. FreeBSD's sys/_endian.h doesn't need to expose those types since it + * implements all the [bl]eXtoh hto[bl]eX interfaces as macros calling builtin + * functions. POSIX allows functions, macros or both. We opt for macros only. + */ +#include + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINT64_T_DECLARED +typedef __uint64_t uint64_t; +#define _UINT64_T_DECLARED +#endif + /* * FreeBSD's sys/_endian.h is very close to the interface provided on Linux by - * glibc's endian.h. + * glibc's endian.h as well as POSIX Issue 8's endian.h. */ #include diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h index 8d1eb3f3f3df..d0ffd87efa11 100644 --- a/sys/sys/_endian.h +++ b/sys/sys/_endian.h @@ -69,8 +69,10 @@ /* * POSIX Issue 8 will require these for endian.h. Define them there and in the - * traditional BSD compilation environment. Since issue 8 doesn't yet have an - * assigned date, use strictly greater than issue 7's date. + * traditional BSD compilation environment. PDP_ENDIAN isn't strictly in Issue + * 8, but is allowed as implementations can define any *_ENDIAN symbol. Since + * issue 8 doesn't yet have an assigned date, use strictly greater than issue + * 7's date. */ #if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 #define LITTLE_ENDIAN _LITTLE_ENDIAN