From nobody Sat Apr 25 16:32:20 2026 X-Original-To: dev-commits-src-branches@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 4g2wN50DGZz6bm9l for ; Sat, 25 Apr 2026 16:32:21 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g2wN4503Kz46Zp for ; Sat, 25 Apr 2026 16:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777134740; 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=5Drf73g+F6ZC40iMgy4OL3JpZFzW72z9D6qUxdJmc9E=; b=T2l7D1vORri6wGhDc/d5w3dRSYZ85j4n4Ab0n5L5/SaEDa3jgQQKSA5/q6PnSAN64PXmmp pD34x3t4Z//YSVINLx48GIxZ8a1xOTwlwiwTHEQY9X552crrvB7Hqhk3vUXTSqissa9okd Joua1btSu13YVXfZc+VviQxNV36c55QV+TZVexFG6a8kV+BobcwLZdspVm4dRcUfXHaPlb emn4uQbcr1zVX9dkXNi/lN3yL9rgY7qjjYT1ZQv6TMm8GUKIj3bjniJcohNMMOqLyPypbZ FC3Hn/TrE1Bz2LHKMA4/B87vVkFcbIaQZum8zwbh25uUVpygDmE95wp4ibUWpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777134740; a=rsa-sha256; cv=none; b=Ch8tzbgMHj5VOJO1et/2Bh0adg5fvvPbd+BqEWwiPrvbIe+rGU37nZWsv/8bX1WmJoi1Dy E0XqWQJwSfpbSat0hG75YOVk46ZXnkyrlmnwmXR8RmQCWHYvwgVOJxWAb7mntVmQY/k8cI A5QLBOmY04VfMDyV5CuXGrC5l0ovUg4UN2WjQhqcrLbVaWKioYKTSXeopYXEeJH/UUb2XA iRJL2Em8dIq0hOHig+JJJCKKx2/43U6nm42/4CND6yCLezovhUM19Wq2EEeG9yaI9m4eA1 uVlkdODc9IntoKjRXORMnSnV7lIIcBlkTL0gYTlDDo7uccwQ5vPB07AmNXgpwQ== 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=1777134740; 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=5Drf73g+F6ZC40iMgy4OL3JpZFzW72z9D6qUxdJmc9E=; b=LKYtpDkDu4LMbvv3wurpBnLtOKtt7aKn6jqfpHiCkxvbm9w1GxIzITy7tm4mzkVA6BzZFG 8rIXtqJXt9nN9dhi3GuV3FEjANj1mFJU09NcQOFY+Cvf5xd9uHVzaBduX5V+hWSWZsvtDQ pL//S8iysqefqVxYWkEVYG9VEXaNQy+hL0q9DNOgbm7D5ekKT7S5qiPKmPA7h6yyalNd2O k3CzfkAMODJFnHdFp2Hjnqx+yLM8Xfx63dLOAkvRZdUo/0mhtlO7Pf/1ZEDvwlY7oYOqNm fvqN/Ais+jCAPNdVXfb6gR6ouwdfIEWZgPLpJcycPc5nqER3NPXU/86bAEHZWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g2wN44GkFzhb2 for ; Sat, 25 Apr 2026 16:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45bf0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 25 Apr 2026 16:32:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Enji Cooper Subject: git: 0b97aba5c25b - stable/15 - libnetbsd: import `__CTASSERT(..)` macros List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ngie X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 0b97aba5c25be8a76cca6f77a40a972a7e70a98f Auto-Submitted: auto-generated Date: Sat, 25 Apr 2026 16:32:20 +0000 Message-Id: <69ecec94.45bf0.e4a75be@gitrepo.freebsd.org> The branch stable/15 has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=0b97aba5c25be8a76cca6f77a40a972a7e70a98f commit 0b97aba5c25be8a76cca6f77a40a972a7e70a98f Author: Enji Cooper AuthorDate: 2026-02-20 20:24:46 +0000 Commit: Enji Cooper CommitDate: 2026-04-25 16:32:11 +0000 libnetbsd: import `__CTASSERT(..)` macros These compile-time assert macros are similar to `Static_assert` on FreeBSD. These macros are in use in newer versions of `contrib/netbsd-tests`. Obtained from: https://github.com/NetBSD/src (c26cc77b3a0b26b95a2) MFC after: 1 week (cherry picked from commit d1f1402dff63dd163d4ba4ac65f7f2ffd00c5e08) --- lib/libnetbsd/sys/cdefs.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/libnetbsd/sys/cdefs.h b/lib/libnetbsd/sys/cdefs.h index d0e06e46d241..e4ff4a516519 100644 --- a/lib/libnetbsd/sys/cdefs.h +++ b/lib/libnetbsd/sys/cdefs.h @@ -54,6 +54,22 @@ #define ___STRING(x) __STRING(x) #define ___CONCAT(x,y) __CONCAT(x,y) +/* + * Compile Time Assertion. + */ +#ifdef __COUNTER__ +#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__) +#else +#define __CTASSERT(x) __CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__) +#define __CTASSERT99(x, a, b) __CTASSERT0(x, __CONCAT(__ctassert,a), \ + __CONCAT(_,b)) +#endif +#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z) +#define __CTASSERT1(x, y, z) \ + struct y ## z ## _struct { \ + unsigned int y ## z : /*CONSTCOND*/(x) ? 1 : -1; \ + } + /* * The following macro is used to remove const cast-away warnings * from gcc -Wcast-qual; it should be used with caution because it