Re: git: 28cecfe27964 - main - libc: Restrict ATOMIC_VAR_INIT for C23 conformance

From: Faraz Vahedi <kfv_at_kfv.io>
Date: Mon, 22 Jun 2026 11:59:05 UTC
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.