From: Paul Eggert Date: Wed, 29 Apr 2026 22:11:50 +0000 (-0700) Subject: stdbit-h: namespace cleanup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f5a8cfeb6f79991303e35a2d12790547709c170;p=thirdparty%2Fgnulib.git stdbit-h: namespace cleanup * lib/stdbit.in.h: Include 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 , so that defines only size_t on GNU platforms. --- diff --git a/ChangeLog b/ChangeLog index 6033ba8259..86585c6ff6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2026-04-29 Paul Eggert + stdbit-h: namespace cleanup + * lib/stdbit.in.h: Include 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 , so that + defines only size_t on GNU platforms. + stdbit-h: include only on module req This is another attempt to tighten up the namespace on GNU platforms, and follows up on previous C++ fixes here. diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h index 6be873260a..04a9dfd183 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -37,9 +37,11 @@ #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 #endif