From nobody Mon Jan 13 00:41:47 2025 X-Original-To: dev-commits-src-main@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 4YWYNq6fxVz5k8Wb; Mon, 13 Jan 2025 00:41:47 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWYNq683Fz417L; Mon, 13 Jan 2025 00:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728907; 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=nGoDvMa6WzpN4Mx2g7ByFlzYlaLt64c4N/Lz1v6J8/I=; b=AjmIRk/UmRNCpYhthRKgBzHceJoaCQMOr1vFKTx/WMbssRDcmDNpM2YhXtgGXRKXaAsfnb d5Q6u+rzUcGtg5cCj/Z9tvBaksUO8K8xzdWhcEKXkoXz/0o0QHl1iT+QDFwZAbFS4ZL4fV GVGSgw4xxelVBfhbml1tK/dP84NgwIRFg28N1TC+A7CVEExXddzz402zq9iS2V9DTwNEe0 x2+RgtCN13gxbDY96r1SjBywwP35s1f5tKcuSCRxDp7rF/iZWEixtK3cGmZklHi8uVToaB kvfU4r1wH29+BxPVQKorgcFac4ombo8rlLWtGGNvtTcnSpHaYSZPmkxGANB3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728907; 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=nGoDvMa6WzpN4Mx2g7ByFlzYlaLt64c4N/Lz1v6J8/I=; b=r/ktsIYSC+JUsT69UyCJBoA0/UB8TcTOW4rKY/RTWl4aV6tSQd38n0+YRXWTcoSnuTQCbP AIIyXDxIkOs2L35iuvEm7lpEEt2z/CjNTfGvdPRqV9L4cCwegdOwPQol6/sSVWg1DO3YVM bRFrLyTWYnjvf2SuEHROvGKoCa1Tza9CTfstrT5oSet+UUnS3UztLAoyOmMwtPm7OTtmZM o+5aFDPEd3/0J7eS6DMl++bTOq+41Md3+YxbZt6Yc167XsxcnjI+XLjpGG/7jFFKwnFV78 VxKhVbcXWbUy08LtS4X8K+ftRHds4EpGygCjR9E8PF/yH57ArjpQrsSLxMNsrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736728907; a=rsa-sha256; cv=none; b=G/BzOdYCetX4DLxZAXBXNGNEDQJbBIVgcvbyo5/TJfSYIjOy2Ssw2f4BUjTbS7DqFSkTUx RlQb5dxOJzHyFqIw+Uo20CwL0cuq3cOF8Muq85je+4IsYBRmjV7mFodwBrqy5wL78usREF n0CiqtvuMk45fqyOovsiZWGCNHnXV4U5urOnp8MM9x/3ouSWxxp251lGkDx1hjiPdE8PCY kzFrzPojz47cWT95EpyAmoYSMbbsb+BrdE6IzEr0MYkgZJiF8gc9DW8dZVBG/4ICxU/bKO CzZn/UyqmiebnJQBEk/F4NCObW0ON/zZSAH3pe4EIp/QNSekC2STBdZCrbRiGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YWYNq5d89z16y0; Mon, 13 Jan 2025 00:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50D0flAe032958; Mon, 13 Jan 2025 00:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D0flxp032955; Mon, 13 Jan 2025 00:41:47 GMT (envelope-from git) Date: Mon, 13 Jan 2025 00:41:47 GMT Message-Id: <202501130041.50D0flxp032955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 712f81feea41 - main - include: add a userland version of __assert_unreachable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 712f81feea416e9f8aaf040173883876a50a7d34 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=712f81feea416e9f8aaf040173883876a50a7d34 commit 712f81feea416e9f8aaf040173883876a50a7d34 Author: Kyle Evans AuthorDate: 2025-01-13 00:41:25 +0000 Commit: Kyle Evans CommitDate: 2025-01-13 00:41:37 +0000 include: add a userland version of __assert_unreachable The kernel has had a version of this since c79cee71363d ("kernel: provide panicky version of __unreachable"), and userland can benefit from the same. __unreachable is largely inadequate because it's *not* an assertion of any sort, so we're not really alerted to a problem that we could've anticipated. Reviewed by: emaste, imp, jhb, olce Differential Revision: https://reviews.freebsd.org/D48077 --- include/assert.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/assert.h b/include/assert.h index cc2a5f8b9e64..a3dbe933e18f 100644 --- a/include/assert.h +++ b/include/assert.h @@ -43,15 +43,22 @@ #undef assert #undef _assert +#undef __assert_unreachable #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) +#if __BSD_VISIBLE +#define __assert_unreachable() __unreachable() +#endif /* __BSD_VISIBLE */ #else #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) +#if __BSD_VISIBLE +#define __assert_unreachable() assert(0 && "unreachable segment reached") +#endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ #ifndef _ASSERT_H_