Re: git: 8d29d2429649 - main - libc: Restore prior C23 include guards

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
Date: Mon, 24 Aug 2026 14:22:35 UTC
Warner Losh <imp@bsdimp.com> writes:
> Dag-Erling Smørgrav <des@freebsd.org> writes:
> > Shouldn't these be conditional on the visibility macros?
> Seems fine to me since it's in the implementation namespace.  Maybe
> you could share your reasoning.

Imagine a library which is is written to be backward compatible with C99
but offers additional functionality which requires a C23 compiler and
uses one of these __STDC_VERSION_* macros to control its visibility in
the header.  An application written in C99 uses this library and builds
with -std=c99.  Because we set __STDC_VERSION_* unconditionally, the
library now exposes C23-only code to the C99 program, which therefore
fails to build.  Therefore, these macros should only be defined if
__BSD_VISIBLE || __ISO_C_VISIBLE >= 2023.

DES
-- 
Dag-Erling Smørgrav - des@FreeBSD.org