Do not pollute <wchar.h> includers with <string.h> names on GCC-compatible platforms. * lib/wchar.in.h (_GL_WCHAR_MEMSET) [@GNULIB_MBSZERO@]: New macro. (mbszero): Use it. --- ChangeLog | 8 ++++++++ lib/wchar.in.h | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index cbadb6f687..3d5eeade61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2026-04-23 Paul Eggert <[email protected]> + + wchar-h: <string.h> namespace cleanup + Do not pollute <wchar.h> includers with <string.h> names + on GCC-compatible platforms. + * lib/wchar.in.h (_GL_WCHAR_MEMSET) [@GNULIB_MBSZERO@]: New macro. + (mbszero): Use it. + 2026-04-19 Jim Meyering <[email protected]> maint.mk: fix sc_Wundef_boolean race with parallel syntax-check diff --git a/lib/wchar.in.h b/lib/wchar.in.h index a60a4dfc67..29ecd92f5c 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -258,8 +258,15 @@ _GL_EXTERN_C void free (void *); #if @GNULIB_MBSZERO@ -/* Get memset(). */ -# include <string.h> +# ifdef __has_builtin +# if __has_builtin (__builtin_memset) +# define _GL_WCHAR_MEMSET __builtin_memset +# endif +# endif +# ifndef _GL_WCHAR_MEMSET +# include <string.h> +# define _GL_WCHAR_MEMSET memset +# endif #endif @@ -587,7 +594,7 @@ _GL_INLINE _GL_ARG_NONNULL ((1)) void mbszero (mbstate_t *ps) { - memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); + _GL_WCHAR_MEMSET (ps, 0, _GL_MBSTATE_ZERO_SIZE); } # define GNULIB_defined_mbszero 1 # endif -- 2.53.0
