From nobody Sun Nov 30 19:22:09 2025 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 4dKH3P54vkz6Jgqy for ; Sun, 30 Nov 2025 19:22:09 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dKH3P3yG4z3g10 for ; Sun, 30 Nov 2025 19:22:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764530529; 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=acYkyxmloCP4E4jbY0zm5K754UcSaNoDXa8Htnsr5mM=; b=xSw0ss2bT+uIWrcaxc5fU1jZVst2t9IENUiVop+uNywkGIgDOJ9xYHBfMffs/wxRy69PeP yIpKooAf+QHbfU07xdfkcbkp/DxSGy3TzH8ZDboPZ1Y52BNS2QWkGhh/Z3722u2R8ZFqId 64qB5gE4p93GZxWhX5n+B/Hh1RJUUzYxg6fqi/flTCaFFQpdlKOW90LuqAqpCO1SABoiO2 uGV3kWmgYYbd9EhH63UBJteJopMF4ypRmAmVrV+Px1c11eXhoIRR7M/KffukdiwMBGC9MY +YBLMlfQ+C1ogTQ546OakAxrzU0ptXruOpslyyFHS0+OmNehqANbCgaia8TwnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764530529; 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=acYkyxmloCP4E4jbY0zm5K754UcSaNoDXa8Htnsr5mM=; b=c2y60PQ299V09LjCqyiFBfLym5OspPmuyvGXS817ME0swmhzTM8Mf4CEpOwTygtc6RNtq4 W3JQ6r7pbFaq0jevjP+8YfzJa3ohFwqkqJUI4MCgAaR/WT+UChPJJYHP51aOUSW7tC+Kxl z1h+KnmZzkDUd5zz4+8DFP3JlyP6KmZp6DXDRpIHba0hk2DOBf9AuaRBoFQWwREA6Sz4/j Ui7ljoJ4MeHES3zhD98raSYZAzKfcHS7+scNWWPo2FM1snqD/Ne0ioQKeqtKihniu3m3ds 5usBoSzv5rTDFNZez7bsOnkPXkv4hJoXEAzsVCPw8JRkzAh6hXYwVd7BGfo4Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764530529; a=rsa-sha256; cv=none; b=QlcGRaEJ8yMW9RYxCkJmq+NHk34rVzZteTahfYClzfZ7VV/48dn8JhDkzUmSK14U3rEOuu KKs3Hf2pJsEcGFqke57HSU3/acuYSmHu5Gy5NE3lCOuEUv3j2vqTdiEDoj9cZedOrHAD2g v0qWoRl2PBVKTalLOuaUpiyr0ZxejqwHuOjvhire679vKdS6pcr8hwbjLT+R6yqHF3yoTs vpxEVbVUKSSwSsRLSHk25WjHuBLlklSHMETx9+78v+AX4IW5fNWVk2BgY7cz0E1KQq9y7X fd0kTVuf8Nay5rT/6Aa30xEIDZLr3WPGSdPRci6PUuCpiDqlKQLBoc6tZSD1SQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dKH3P3VCDzpVr for ; Sun, 30 Nov 2025 19:22:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26e23 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 30 Nov 2025 19:22:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 7998a82d2f99 - main - sys/stdint.h: add C23 _WIDTH macros 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7998a82d2f99a00086baf64b2a3343ba10f8806d Auto-Submitted: auto-generated Date: Sun, 30 Nov 2025 19:22:09 +0000 Message-Id: <692c9961.26e23.67d8f161@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=7998a82d2f99a00086baf64b2a3343ba10f8806d commit 7998a82d2f99a00086baf64b2a3343ba10f8806d Author: Robert Clausecker AuthorDate: 2025-11-19 18:53:07 +0000 Commit: Robert Clausecker CommitDate: 2025-11-30 19:21:51 +0000 sys/stdint.h: add C23 _WIDTH macros The platform-dependent macros are added to the various _stdint.h headers, those that are always the same are added directly to _stdint.h. We may want to move the definitions for WCHAR_* and WINT_* out of the platform header files as those are always the same. Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53830 --- sys/arm/include/_stdint.h | 23 +++++++++++++++++++++++ sys/arm64/include/_stdint.h | 23 +++++++++++++++++++++++ sys/powerpc/include/_stdint.h | 33 +++++++++++++++++++++++++++++++++ sys/riscv/include/_stdint.h | 23 +++++++++++++++++++++++ sys/sys/stdint.h | 29 +++++++++++++++++++++++++++++ sys/x86/include/_stdint.h | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 164 insertions(+) diff --git a/sys/arm/include/_stdint.h b/sys/arm/include/_stdint.h index 9931f8b56ef5..2ebc6ea4f89f 100644 --- a/sys/arm/include/_stdint.h +++ b/sys/arm/include/_stdint.h @@ -153,6 +153,29 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#define INTPTR_WIDTH INT32_WIDTH +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#define PTRDIFF_WIDTH INT32_WIDTH +#define SIG_ATOMIC_WIDTH INT32_WIDTH +#define SIZE_WIDTH INT32_WIDTH +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/arm64/include/_stdint.h b/sys/arm64/include/_stdint.h index 0c183bd60dca..0b360b8ab460 100644 --- a/sys/arm64/include/_stdint.h +++ b/sys/arm64/include/_stdint.h @@ -155,6 +155,29 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#define INTPTR_WIDTH INT64_WIDTH +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#define PTRDIFF_WIDTH INT64_WIDTH +#define SIG_ATOMIC_WIDTH INT64_WIDTH +#define SIZE_WIDTH INT64_WIDTH +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/powerpc/include/_stdint.h b/sys/powerpc/include/_stdint.h index 67719432259d..983db38ccf25 100644 --- a/sys/powerpc/include/_stdint.h +++ b/sys/powerpc/include/_stdint.h @@ -195,6 +195,39 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#ifdef __LP64__ +#define INTPTR_WIDTH INT64_WIDTH +#else +#define INTPTR_WIDTH INT32_WIDTH +#endif +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#ifdef __LP64__ +#define PTRDIFF_WIDTH INT64_WIDTH +#define SIG_ATOMIC_WIDTH INT64_WIDTH +#define SIZE_WIDTH INT64_WIDTH +#else +#define PTRDIFF_WIDTH INT32_WIDTH +#define SIG_ATOMIC_WIDTH INT32_WIDTH +#define SIZE_WIDTH INT32_WIDTH +#endif +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/riscv/include/_stdint.h b/sys/riscv/include/_stdint.h index 4e032c8b0a1d..9df000b0eac4 100644 --- a/sys/riscv/include/_stdint.h +++ b/sys/riscv/include/_stdint.h @@ -151,6 +151,29 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#define INTPTR_WIDTH INT64_WIDTH +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#define PTRDIFF_WIDTH INT64_WIDTH +#define SIG_ATOMIC_WIDTH INT64_WIDTH +#define SIZE_WIDTH INT64_WIDTH +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h index f82e391c9e41..77f469f3c2a3 100644 --- a/sys/sys/stdint.h +++ b/sys/sys/stdint.h @@ -73,4 +73,33 @@ typedef __uint_fast64_t uint_fast64_t; #endif #endif /* __EXT1_VISIBLE */ +#if __ISO_C_VISIBLE >= 2023 +#define INT8_WIDTH 8 +#define UINT8_WIDTH 8 +#define INT_LEAST8_WIDTH 8 +#define UINT_LEAST8_WIDTH 8 +#define UINT_FAST8_WIDTH INT_FAST8_WIDTH + +#define INT16_WIDTH 16 +#define UINT16_WIDTH 16 +#define INT_LEAST16_WIDTH 16 +#define UINT_LEAST16_WIDTH 16 +#define UINT_FAST16_WIDTH INT_FAST16_WIDTH + +#define INT32_WIDTH 32 +#define UINT32_WIDTH 32 +#define INT_LEAST32_WIDTH 32 +#define UINT_LEAST32_WIDTH 32 +#define UINT_FAST32_WIDTH INT_FAST32_WIDTH + +#define INT64_WIDTH 64 +#define UINT64_WIDTH 64 +#define INT_LEAST64_WIDTH 64 +#define UINT_LEAST64_WIDTH 64 +#define UINT_FAST64_WIDTH INT_FAST64_WIDTH + +#define UINTMAX_WIDTH INTMAX_WIDTH +#define UINTPTR_WIDTH INTPTR_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !_SYS_STDINT_H_ */ diff --git a/sys/x86/include/_stdint.h b/sys/x86/include/_stdint.h index 59aab4b39c0c..1b8523bf656b 100644 --- a/sys/x86/include/_stdint.h +++ b/sys/x86/include/_stdint.h @@ -184,6 +184,39 @@ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX +#if __ISO_C_VISIBLE >= 2023 +/* + * ISO/IEC 9899:2023 + * 7.22.2 Widths of specified-width integer types + */ +#define INT_FAST8_WIDTH INT32_WIDTH +#define INT_FAST16_WIDTH INT32_WIDTH +#define INT_FAST32_WIDTH INT32_WIDTH +#define INT_FAST64_WIDTH INT64_WIDTH +#ifdef __LP64__ +#define INTPTR_WIDTH INT64_WIDTH +#else +#define INTPTR_WIDTH INT32_WIDTH +#endif +#define INTMAX_WIDTH INT64_WIDTH + +/* + * ISO/IEC 9899:2023 + * 7.22.3 Width of other integer types + */ +#ifdef __LP64__ +#define PTRDIFF_WIDTH INT64_WIDTH +#define SIG_ATOMIC_WIDTH INT64_WIDTH +#define SIZE_WIDTH INT64_WIDTH +#else +#define PTRDIFF_WIDTH INT32_WIDTH +#define SIG_ATOMIC_WIDTH INT32_WIDTH +#define SIZE_WIDTH INT32_WIDTH +#endif +#define WCHAR_WIDTH INT32_WIDTH +#define WINT_WIDTH INT32_WIDTH +#endif /* __ISO_C_VISIBLE >= 2023 */ + #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ #endif /* !_MACHINE__STDINT_H_ */