Page MenuHomeFreeBSD

libc: Restore prior C23 include guards
ClosedPublic

Authored by kfv on Tue, Aug 18, 12:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Aug 26, 7:02 PM
Unknown Object (File)
Wed, Aug 26, 3:52 PM
Unknown Object (File)
Wed, Aug 26, 11:32 AM
Unknown Object (File)
Tue, Aug 25, 9:26 AM
Unknown Object (File)
Mon, Aug 24, 11:13 PM
Unknown Object (File)
Mon, Aug 24, 7:01 PM
Unknown Object (File)
Mon, Aug 24, 6:42 PM
Unknown Object (File)
Mon, Aug 24, 6:42 PM
Subscribers

Details

Summary

This patch restores the old include guards that were removed in favour of the newly added C23 feature-test macros, per the discussion on the commit email for cd0727ec709b and the accompanying bug report against math/gmp.

The feature-test macros were being used as substitutes for the traditional include guards. I am convinced that that is a POLA violation for software that (albeit mistakenly, but in practice) relies on those reserved and internal identifiers (per the standard, §6.4.2.1) still being defined even. Therefore, this patch reverts to the traditional guards to avoid breaking that assumption.

<stdbit.h> and <stdckdint.h> are exempt: since both headers are new, there is no pre-C23 usage to preserve compatibility, so guarding them with the feature-test macros is absolutely safe. Separately, if we want to standardise on an internal style for include guards going forward (and document it in style(9) for instance) the same treatment could be applied to those two headers as well, for consistency. Let me know if that's desired and I'll take care of it.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable