Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2026 15:29:05 +0330
From:      Faraz Vahedi <kfv@kfv.io>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, Mark Millard <marklmi@yahoo.com>, Warner Losh <imp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Nuno Teixeira <eduardo@freebsd.org>
Subject:   Re: git: 28cecfe27964 - main - libc: Restrict ATOMIC_VAR_INIT for C23 conformance
Message-ID:  <F4C6FE9A-025A-4A6B-9262-6946AA9D3AE8@kfv.io>
In-Reply-To: <864iiusvc9.fsf@ltc.des.dev>
References:  <6a35ddd3.22963.721d614@gitrepo.freebsd.org> <4e902fcf-e79c-47b5-a51f-4881c09f7528@yahoo.com> <CANCZdfpo0mECxiLM9mFV7=6yNZgspcbvzFYyE2hsHeQ1X8p_eA@mail.gmail.com> <94E5F613-3930-464B-AC10-4943230C2025@kfv.io> <86bjd3rmpr.fsf@ltc.des.dev> <20418B20-C033-4360-B5F9-0BA39609FA4D@kfv.io> <864iiusvc9.fsf@ltc.des.dev>

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

[-- Attachment #1 --]
First, let me add that in case we decide to keep the __BSD_VISIBLE gate, the
condition needs to be reconsidered entirely, since __BSD_VISIBLE is 1 in the
default environment and makes the __ISO_C_VISIBLE check unreachable in the
common case. Ergo, with no explicit feature-test macros, __BSD_VISIBLE is 1
unconditionally and the condition __BSD_VISIBLE || __ISO_C_VISIBLE < 2023
erroneously exposes ATOMIC_VAR_INIT even when compiled with -std=c23,
which the C23 standard explicitly removed.

__STDC_VERSION__ < 202311L does not have this problem. It correctly hides
ATOMIC_VAR_INIT in C23 and later modes only, and exposes it otherwise in all
prior modes, regardless of what __BSD_VISIBLE is set to.

> No.  Using __STDC_VERSION__ here would mean “this library feature only
> works when compiled by a certain compiler” which is not the case.


To the concern about what __STDC_VERSION__ signals, it reflects the language
standard mode (e.g. -std=c23, if supported), not the implementation per se. Any
C23-conforming compiler will set it to 202311L per the standard.

The removal of ATOMIC_VAR_INIT is a language-mode-specific event that would
only target C23 and later modes as it happened in C23. So I do still believe that
the gate belongs on __STDC_VERSION__, not on the API exposure policy.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEnunneCmADnpNx8ZMLdpU9MVz/74FAmo5I4kACgkQLdpU9MVz
/76MOw//aQtcRnBM//JtDC49o7UmVQbz/S1hxk4x7ORmsCnG++/cqLCM4/V5pCbp
pDLsv/9LjWJ+LzoyM1pkFUrYOXlByKhhuHCCE8ymWAj6qKMlF88ibwaKSEJNg7Os
Td0HDQGX4+sIgZj+tW7O74Ccvc54uWDhIEM2IokX1zs3TI9bkbv62YmJLv3dP9tO
y7OoX82mtHJF8nriDMUMTxSS/w48kXjEgxSsC/k7+nqZIpkSwP8yKaaKESymBHiR
4b3a9IxkFc3agD7PzGLQViDAvcgs+VQme4YEfWSd447+VpAQL0LgqyIL2U7SauXE
PtDE+iFSnIFf+HmEGr2d+8y5LaAITma7T5x7tBYmZvnM99w2swh1aJNgFx11vgIz
PVaZVEueks/vHVxq631EbsAjPYDqV+Q0UkSTDqyA9Tcy+Rv0Wu67k6hKor1tqDN9
zECH8dEaMDa//HCVRHbykCdBgWncnsDuEJ4y4l7QMDOQBZHVqFWAqWQ0ATYbleDM
NbVisQA9TcASfocx3b5iZF35iDzK1zh+I16GjPOt3hjDFdieqdRL6pNzl7e11cLh
veiEARMiJrGGjM+3et0qKwWpYs5KKyHjnyoO70gOjkSbTvYR0/MSKPUISgme/daX
jp3E49PwqXwaA/sg4UFp5I0eDBGEPEdFR/cGyEdwO60NBZ9aKdw=
=8QjO
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F4C6FE9A-025A-4A6B-9262-6946AA9D3AE8>