Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2026 14:05:35 +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:  <20418B20-C033-4360-B5F9-0BA39609FA4D@kfv.io>
In-Reply-To: <86bjd3rmpr.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>

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

[-- Attachment #1 --]
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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEnunneCmADnpNx8ZMLdpU9MVz/74FAmo5D/cACgkQLdpU9MVz
/74vdBAAgrteJheUqGFJ4btxspG2L27bD8aURBwuc5q621piNoW1US0MCtOPy9OJ
J/hui8obXqjVseHpqQQNfYxmn1l4bb7dSYezGFv39IlPyvnNY3u2FoK7IpTuh9rj
2nFYwABemif4sFFJ3UlZLxwCs1xFku6TkNnV969Qhn4kjB320lN8ZMM4E/FlW4en
68/CsBjShxND//9MBbTcX6NSCFIcbaeh7VVVNk52QrqT8ThyEIZz4ZFlMNGxv4Y2
rGnLBoco71UAIjodNvdnr2JpEvzWBoGk+a4SvFJMjtxQCz4kQAp9Nl84tJqlYh9d
jQUghxh7nu711hXK2NPMkZ7hB47KPLl8OtuyQphCejMdBOsmQNaoX5wJUSUgRziq
SvdupTHKSIfdYUfgpbhFfS686SZngBjYRzVPCnjl0zDMEDWpupEGpKRuQ3ibApn0
Ce6sEtfAW3zlfDCS0yd33Ud8Z5PvlhKesA6WPzzNxlwOIlOS/+tnhppoWHqYKF2a
baylU/9v8EL3C/riZr4OOFu35GwSNIT/H8c1NlO9U/6XbgLY/Aedwdn+qRDMLDqa
h0vgPU6J9QiFZ+NONm6FmFEHbtouU0hM1cBcgfthCawgjbtNCCKpZIM1Gnt2dr6Q
seqaN9e4CPbuj1STyf1ofR0hyaEQKV87yUx6xh35w45ExIdGUNY=
=gkmb
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20418B20-C033-4360-B5F9-0BA39609FA4D>