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

From: Faraz Vahedi <kfv_at_kfv.io>
Date: Mon, 22 Jun 2026 10:35:35 UTC
Hey,

> No, __STDC_VERSION__ is defined by the compiler and is used to determine
> which language version the compiler provides, while __ISO_C_VISIBLE is
> defined by us and is used to decide which interfaces to expose to the
> application based on what the application requested.  If you scan
> through src/include, you'll note that __STDC_VERSION__ is only used
> there when what matters is whether a certain keyword is provided by the
> compiler, which is not the case here.

That distinction is well understood, but I think removals tied to a specific standard
version are cases worth considering separately.

In this case for example, ATOMIC_VAR_INIT is only removed from C23, so the
relevant question is not which interfaces we choose to expose, but rather whether
the compiler is operating in C23 mode. I agree that for internally adopted
exposure policies we should generally avoid gating on __STDC_VERSION__, but
removal is a different case and when tied to a specific standard version, it is a
language-mode-specific matter, not something governed by internal exposure
policies.

Gating on __STDC_VERSION__ ties the removal directly to the language mode
in use, which seems more semantically accurate here than __ISO_C_VISIBLE,
whose role is API exposure policy rather than tracking language-level removals.

Assume the default standard mode of a compiler is C17, internal visibility policy
is set to C23, this is absolutely expected to have, say ATOMIC_VAR_INIT (that
has been deprecated since C17 but remained available until removed in C23,)
if not explicitly compiled for C23. This is the duty of a gate that can check what
mode the compiler is compiling for, not what is visible and provided by the OS.

Yours,
Faraz