Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2026 11:04:48 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        Enji Cooper <ngie@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: d1f1402dff63 - main - libnetbsd: import `__CTASSERT(..)` macros
Message-ID:  <c1290a5c-b617-4a8a-a8eb-0c9b35931110@FreeBSD.org>
In-Reply-To: <6998e4cc.32d8e.74c069d@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

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 <ngie@FreeBSD.org>
> AuthorDate: 2026-02-20 20:24:46 +0000
> Commit:     Enji Cooper <ngie@FreeBSD.org>
> 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



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c1290a5c-b617-4a8a-a8eb-0c9b35931110>