]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stdbit-h: <stddef.h> namespace cleanup
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 29 Apr 2026 22:11:50 +0000 (15:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 29 Apr 2026 22:12:20 +0000 (15:12 -0700)
* lib/stdbit.in.h: Include <stddef.h> only if the stdc_memreverse8
module is also used, since it’s the only one that needs size_t.
Define __need_size_t before including <stddef.h>, so that <stddef.h>
defines only size_t on GNU platforms.

ChangeLog
lib/stdbit.in.h

index 6033ba825902f476e66b1415806ae30ae8b4a8d2..86585c6ff67354279c45a7e3d9ea722a05f0beaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2026-04-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+       stdbit-h: <stddef.h> namespace cleanup
+       * lib/stdbit.in.h: Include <stddef.h> only if the stdc_memreverse8
+       module is also used, since it’s the only one that needs size_t.
+       Define __need_size_t before including <stddef.h>, so that <stddef.h>
+       defines only size_t on GNU platforms.
+
        stdbit-h: include <stdint.h> only on module req
        This is another attempt to tighten up the <stdbit.h> namespace
        on GNU platforms, and follows up on previous C++ fixes here.
index 6be873260a21e8632f87293230978ba7cbb0d900..04a9dfd183dad81ac33e20eec5cef65d403abe0e 100644 (file)
  #error "Please include config.h first."
 #endif
 
-#if (!@HAVE_STDBIT_H@ || @GNULIB_STDC_MEMREVERSE8@ \
-     || (defined __cplusplus && defined __INTEL_CLANG_COMPILER))
-/* Get size_t.  */
+/* If needed for APIs, get size_t, avoiding namespace pollution on GNU.  */
+#if (@GNULIB_STDC_MEMREVERSE8@ \
+     && (!@HAVE_STDBIT_H@ \
+         || (defined __cplusplus && defined __INTEL_CLANG_COMPILER)))
+# define __need_size_t
 # include <stddef.h>
 #endif