From nobody Thu Dec 4 23:28:28 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 4dMrKn6wCpz6Jwl7 for ; Thu, 04 Dec 2025 23:28:29 +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 4dMrKm61V3z4Mwv for ; Thu, 04 Dec 2025 23:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764890909; 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=L0tVdJLNRBgALsvX1fUuTE5BATBg1GApviLhSyoTD4o=; b=bVvpFyP2fssMaFV0sKF8SYBKRI/J3i4VmyhuCNSeSWSJmnKLeF8hUIzNVzhVv8+0YjqrZ0 d2T4f2NinvQy7J2bb/8wKEn1Ub8G3R81WOSpL2r7TQ2Cp52IL5YB0GK+QtMJfAUqdODGzt zmdWc/NlYBp/RmgpMrLhUoxpXaJRzbp0pDLXfqMA262bIi5BMpRfyMKFXfsVmADdB2Zk2A UfgxHH25GU3qD1H8u+KEaGON3v1XgNSX2RBAzf+E1HBRswk//uQBvsSZjWa0mAm2EPlYNd BTVifxAp/GrQqdh6OHThF4DbIBs3ESr94um9AuS3Ksl4vTpyKR14kKkrCqs6Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764890908; 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=L0tVdJLNRBgALsvX1fUuTE5BATBg1GApviLhSyoTD4o=; b=h+xKUiCUixu2Vkhq+sXbO2LVyEic7OSpqXZvlPn/7KIO/7Y1XMbY087Dqes5ePt2gX4i1M 91fDVkzBbMm9S/u9MyEFTOS5xrRMHdWYFTxXDocdRZP1Kf7Rbm5XZq63Gv3623LLdpvVcs 0rwJh5RK2qW5XrxQlcBOKI0BH3W9fkqhWnw1ZRHp0oVSgz5255d9VIId2LxshMrQlVqUAo ry/FIDNOknRW7cs2ZUe3/y+Nb4x4tRmajAnqJme2jsbJoHbVxo9LDuffbAhEH7N9osVbAE 5lfyzSqbNZdRM/kuHB57ZienPNLRa553nMeM4gny+nuHYTzw4TIk/eseHk1IXw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764890908; a=rsa-sha256; cv=none; b=el+xyY5zuNwKfJbsReV8rxXRCLln7ywfQuLSESI5GzihwgRaiq3PrKqYbfnuuVFjYgGRis gQ49d0XXfonpvwmFf5KQ6zhPjoqXEcid/Wa0ewb9wAFlrtIka006j19jGbJEa4bE7wyUAB oOAMjR0+mqEDG2OODyBd/TRTkcCCyNh22ViUFkiImBXZuMw0nbwIHSmUA9FxbF9uuNVVsU WttVQUtP/eZ4iFDyEY7Lsru+fQCywmRIbrJab2AuFRR+Oc0f0rtd1Ij/+qTfbZ15RUJ/F8 WmQMOA3A46y40G4AYxuqfctp84+M2oGQxnfR1U+W7UJ+wOy2DQa/SdTvxalOJQ== 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 4dMrKm5dCyzktq for ; Thu, 04 Dec 2025 23:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 974e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 04 Dec 2025 23:28:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: fc88be257e30 - main - Revert "stddef.h: add unreachable() for C23 compliance" 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: fc88be257e30c3e3c01f25ec3a3a6e7933b40c54 Auto-Submitted: auto-generated Date: Thu, 04 Dec 2025 23:28:28 +0000 Message-Id: <6932191c.974e.6390bbba@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=fc88be257e30c3e3c01f25ec3a3a6e7933b40c54 commit fc88be257e30c3e3c01f25ec3a3a6e7933b40c54 Author: Robert Clausecker AuthorDate: 2025-12-04 23:25:10 +0000 Commit: Robert Clausecker CommitDate: 2025-12-04 23:25:10 +0000 Revert "stddef.h: add unreachable() for C23 compliance" Seems like a number of ports are *really* unhappy with this new macro. These ports will have to be fixed and the patch reworked to perhaps not affect C++ (see D54041). A general discussion on how we expose new language features may also need to take place. Reported by: many people Approved by: markj (mentor) This reverts commit b381d0980221b476cadbef862a8e5973d675fb7a. --- include/stddef.h | 4 -- share/man/man3/Makefile | 3 +- share/man/man3/assert.3 | 5 +-- share/man/man3/unreachable.3 | 90 -------------------------------------------- 4 files changed, 3 insertions(+), 99 deletions(-) diff --git a/include/stddef.h b/include/stddef.h index 2ac8e9fe3f77..3ba9a9946b01 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -61,10 +61,6 @@ typedef __max_align_t max_align_t; #endif #endif -#if __ISO_C_VISIBLE >= 2023 -#define unreachable(x) __unreachable(x) -#endif - #ifndef offsetof #define offsetof(type, field) __builtin_offsetof(type, field) #endif diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 3fd819814f77..8e4aadc460a6 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -36,8 +36,7 @@ MAN= alloca.3 \ sysexits.3 \ tgmath.3 \ timeradd.3 \ - tree.3 \ - unreachable.3 + tree.3 MLINKS= arb.3 ARB8_ENTRY.3 \ arb.3 ARB8_HEAD.3 \ diff --git a/share/man/man3/assert.3 b/share/man/man3/assert.3 index cbaedb49010a..f219aa1d6743 100644 --- a/share/man/man3/assert.3 +++ b/share/man/man3/assert.3 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 27, 2025 +.Dd April 20, 2021 .Dt ASSERT 3 .Os .Sh NAME @@ -118,8 +118,7 @@ constraint and includes the provided string literal: If none is provided, it only points at the constraint. .Sh SEE ALSO .Xr abort2 2 , -.Xr abort 3 , -.Xr unreachable 3 +.Xr abort 3 .Sh STANDARDS The .Fn assert diff --git a/share/man/man3/unreachable.3 b/share/man/man3/unreachable.3 deleted file mode 100644 index 9dd7da806d42..000000000000 --- a/share/man/man3/unreachable.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\" -.\" Copyright (c) 2025 Robert Clausecker -.\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" -.Dd November 27, 2025 -.Dt UNREACHABLE 3 -.Os -.Sh NAME -.Nm unreachable -.Nd the unreachable macro -.Sh SYNOPSIS -.In stddef.h -.Fd #define unreachable() -.Sh DESCRIPTION -If the -.Fn unreachable -macro is reached during execution, behavior is undefined. -This can be useful to hint to the compiler that some invariant is guaranteed to -hold or that some case cannot occur. -.Sh EXAMPLES -Suppose a floating-point number -.Va x -is to be classified using the -.Xr fpclassify 3 -macro and a different action is to be taken based on the result of the -classification. -As the set of possible return values is known, the -.Fn unreachable -macro can be used to hint to the compiler that it can omit checks for -other possible return values: -.Bd -literal -offset 3n -#include -#include -#include - -void print_classification(double x) -{ - printf("%f: ", x); - - switch (fpclassify(x)) { - case FP_INFINITE: - puts("infinite"); - break; - - case FP_NAN: - puts("not a number"); - break; - - case FP_NORMAL: - puts("normal"); - break; - - case FP_SUBNORMAL: - puts("subnormal"); - break; - - case FP_ZERO: - puts("zero"); - break; - - default: - unreachable(); - } -} -.Ed -.Sh SEE ALSO -.Xr assert 3 -.Sh STANDARDS -The -.Fn unreachable -macro conforms to -.St -isoC-2023 . -.Sh HISTORY -A -.Dv /*NOTREACHED*/ -conventional comment was supported by the historical -.Xr lint 1 -utility to suppress warnings about unreachable statements during static -analysis. -The -.Fn unreachable -macro was added in -.Fx 15.1 -based on the earlier private -.Fn __unreachable -macro for compliance with -.St -isoC-2023 . -.Sh AUTHOR -.Ah Robert Clausecker Aq Mt fuz@FreeBSD.org