Date: Tue, 24 Feb 2026 09:54:55 -0800 From: Gleb Smirnoff <glebius@freebsd.org> To: "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, Enji Cooper <ngie@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: d1f1402dff63 - main - libnetbsd: import `__CTASSERT(..)` macros Message-ID: <aZ3l73N1ANH36P8n@cell.glebi.us> In-Reply-To: <2D23AD65-FC83-486F-99BD-1C2DAF6BCE05@gmail.com> References: <6998e4cc.32d8e.74c069d@gitrepo.freebsd.org> <c1290a5c-b617-4a8a-a8eb-0c9b35931110@FreeBSD.org> <2D23AD65-FC83-486F-99BD-1C2DAF6BCE05@gmail.com>
index | next in thread | previous in thread | raw e-mail
On Sat, Feb 21, 2026 at 09:53:14AM -0800, Enji Cooper (yaneurabeya) wrote: E> > FYI, _Static_assert is not a FreeBSD-ism, it's part of C11. Our old CTASSERT is E> > a FreeBSD-ism that this extends, but really, these should be implemented in E> > terms of _Static_assert when possible. Something like: E> > E> > #if is_c11 E> > #define __CTASSERT(x) __Static_assert(x) E> > #else E> > /* all the rest */ E> > #endif E> > E> > If __CTASSERT0 is used directly anywhere, you could emulate it via something like E> > E> > #define __CTASSERT0(x, y, z) __Static_assert(x, __STRING(y) "_" __STRING(z)) E> > E> > (Note that we build all of userspace as C17 by default in 15.0 and later.) E> E> E> Hi jhb@! E> E> Excellent points. Incorporating our macros/adaptations can cause grief sometimes and I don’t want to porting more code than necessary, so I have incorporated these macros (and a few others) wholesale from NetBSD (I got these from [1]). E> E> -Enji E> E> 1. https://github.com/NetBSD/src/blob/c26cc77b3a0b26b95a2df2e0154e2b2f7292ab20/sys/sys/cdefs.h#L168-L182 I don't expect any grief if __CTASSERT() is implemented via __Static_assert(). -- Gleb Smirnoffhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aZ3l73N1ANH36P8n>
