diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -502,6 +502,25 @@ * Our macros begin with two underscores to avoid namespace screwage. */ +/* + * Cope with a now-common error: users defined __BSD_VISIBLE bogusly in the + * absence of clear advice during the years FreeBSD didn't have people watching + * the namespace and practices well. This will eventually be a #error + */ +#ifdef __BSD_VISIBLE +#undef __BSD_VISIBLE +#undef _BSD_SOURCE +#define _BSD_SOURCE +#endif + +#ifdef _BSD_SOURCE +#define __POSIX_VISIBLE 202405 +#define __XSI_VISIBLE 800 +#define __BSD_VISIBLE 1 +#define __ISO_C_VISIBLE 2023 +#define __EXT1_VISIBLE 1 +#else /* for review I've not indented the #if mandness below */ + /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ @@ -653,6 +672,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ +#endif /* ! _BSD_SOURCE */ /* * Nullability qualifiers: currently only supported by Clang. */