Page MenuHomeFreeBSD

D47576.diff
No OneTemporary

D47576.diff

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -567,14 +567,21 @@
#define __POSIX_VISIBLE 198808
#define __ISO_C_VISIBLE 0
#endif /* _POSIX_C_SOURCE */
+
/*
- * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or
- * when compiling with -stdc=c11. A strict reading of the standard would suggest
- * doing it only for the former. However, a strict reading also requires C99
- * mode only, so building with C11 is already undefined. Follow glibc's and
- * OpenBSD's lead for this non-standard configuration for maximum compatibility.
+ * When we've explicitly asked for a newer C version, make the C variable
+ * visible by default. Also honor the glibc _ISOC{11,23}_SOURCE macros
+ * extensions. Both glibc and OpenBSD do this, even when a more strict
+ * _POSIX_C_SOURCE has been requested, and it makes good sense (especially for
+ * pre POSIX 2024, since C11 is much nicer than the old C99 base). Continue the
+ * practice with C23, though don't do older standards. Also, GLIBC doesn't have
+ * a _ISOC17_SOURCE, so it's not implemented here. glibc has earlier ISOCxx defines,
+ * but we don't implement those as they are not relevant enough.
*/
-#if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
+#if _ISOC23_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
+#undef __ISO_C_VISIBLE
+#define __ISO_C_VISIBLE 2023
+#elif _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
#undef __ISO_C_VISIBLE
#define __ISO_C_VISIBLE 2011
#endif

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 4:20 AM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14651215
Default Alt Text
D47576.diff (1 KB)

Event Timeline