diff options
Diffstat (limited to 'lib/stddef.in.h')
-rw-r--r-- | lib/stddef.in.h | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/lib/stddef.in.h b/lib/stddef.in.h index fa8998d9..e39268c6 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -27,13 +27,21 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_wchar_t || defined __need_size_t \ - || defined __need_ptrdiff_t || defined __need_NULL \ - || defined __need_wint_t +#if (defined __need_wchar_t || defined __need_size_t \ + || defined __need_ptrdiff_t || defined __need_NULL \ + || defined __need_wint_t) \ + /* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \ + in Fedora 40 with gcc 14.0.1. \ + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870>. */ \ + && !@STDDEF_NOT_IDEMPOTENT@ /* Special invocation convention inside gcc header files. In - particular, gcc provides a version of <stddef.h> that blindly - redefines NULL even when __need_wint_t was defined, even though - wint_t is not normally provided by <stddef.h>. Hence, we must + particular, <stddef.h> in some ancient versions of GCC blindly + redefined NULL when __need_wint_t was defined, even though wint_t + is not normally provided by <stddef.h>. + (FIXME: It's not clear what GCC versions those were - perhaps so + ancient that we can stop worrying about this?) + Although glibc 2.26 (2017) and later do not use __need_wint_t, + for portability to macOS, Cygwin, Haiku, and older Glibc + GCC, remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ @@ -52,6 +60,13 @@ # endif #else +/* For @STDDEF_NOT_IDEMPOTENT@. */ +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t + /* Normal invocation convention. */ # ifndef _@GUARD_PREFIX@_STDDEF_H @@ -74,6 +89,12 @@ typedef long max_align_t; # endif # endif +# if !defined _GCC_NULLPTR_T && !@NULLPTR_T_NEEDS_STDDEF@ + /* Suppress unwanted nullptr_t typedef. See + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869>. */ +# define _GCC_NULLPTR_T +# endif + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -110,7 +131,7 @@ typedef long max_align_t; */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -128,11 +149,6 @@ typedef long max_align_t; # endif #endif -/* Some platforms lack wchar_t. */ -#if !@HAVE_WCHAR_T@ -# define wchar_t int -#endif - /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is a hack in case the configure-time test was done with g++ even though we are currently compiling with gcc. @@ -178,7 +194,7 @@ typedef union # ifndef _GL_HAS_BUILTIN_UNREACHABLE # if defined __clang_major__ && __clang_major__ < 5 # define _GL_HAS_BUILTIN_UNREACHABLE 0 -# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) +# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__ # define _GL_HAS_BUILTIN_UNREACHABLE 1 # elif defined __has_builtin # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) |