On 2/20/26 17:48, Enji Cooper wrote:
The branch main has been updated by ngie:
URL:
https://cgit.FreeBSD.org/src/commit/?id=d1f1402dff63dd163d4ba4ac65f7f2ffd00c5e08
commit d1f1402dff63dd163d4ba4ac65f7f2ffd00c5e08
Author: Enji Cooper <[email protected]>
AuthorDate: 2026-02-20 20:24:46 +0000
Commit: Enji Cooper <[email protected]>
CommitDate: 2026-02-20 22:45:06 +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`.
FYI, _Static_assert is not a FreeBSD-ism, it's part of C11. Our old CTASSERT is
a FreeBSD-ism that this extends, but really, these should be implemented in
terms of _Static_assert when possible. Something like:
#if is_c11
#define __CTASSERT(x) __Static_assert(x)
#else
/* all the rest */
#endif
If __CTASSERT0 is used directly anywhere, you could emulate it via something
like
#define __CTASSERT0(x, y, z) __Static_assert(x, __STRING(y) "_" __STRING(z))
(Note that we build all of userspace as C17 by default in 15.0 and later.)
--
John Baldwin