I wrote: > > +# define __gl_stdc_rotate_left __builtin_stdc_rotate_left > > Please don't use identifiers that start with '__gl'. Identifiers that > start with '__' belong to the system (= compiler + libc). At most one > leading underscore is OK, though.
There's apparently too much precedent of this bad practice. Fixed as follows: 2026-03-08 Bruno Haible <[email protected]> acl-permissions: Don't stump on the system namespace. * lib/acl.h (struct aclinfo): Rename field __gl_acl_ch to _gl_acl_ch. * lib/file-has-acl.c (get_aclinfo, aclinfo_free, fdfile_has_aclinfo): Update. binary-io: Don't stump on the system namespace. * lib/binary-io.h (_gl_set_fd_mode): Renamed from __gl_setmode. * lib/binary-io.c (set_binary_mode): Update. error-h: Don't stump on the system namespace. * lib/error.in.h (_gl_error_call1): Renamed from __gl_error_call1. (_gl_error_call): Renamed from __gl_error_call. stdbit-h: Don't stump on the system namespace. * lib/stdbit.in.h (_gl_stdbit_clz): Renamed from __gl_stdbit_clz. (_gl_stdbit_clzl): Renamed from __gl_stdbit_clzl. (_gl_stdbit_clzll): Renamed from __gl_stdbit_clzll. (_gl_stdbit_ctz): Renamed from __gl_stdbit_ctz. (_gl_stdbit_ctzl): Renamed from __gl_stdbit_ctzl. (_gl_stdbit_ctzll): Renamed from __gl_stdbit_ctzll. (_gl_stdbit_popcount): Renamed from __gl_stdbit_popcount. (_gl_stdbit_popcountl): Renamed from __gl_stdbit_popcountl. (_gl_stdbit_popcountll): Renamed from __gl_stdbit_popcountll. (_gl_stdbit_popcount_wide): Renamed from __gl_stdbit_popcount_wide. (_gl_stdbit_popcount_support): Renamed from __gl_stdbit_popcount_support. (_gl_stdbit_popcount_supported): Renamed from _gl_stdbit_popcount_supported. * lib/stdc_count_ones.c: Update.
>From 244366039a3ca6371ef186a567ca7da7add39fb7 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Sun, 8 Mar 2026 15:24:28 +0100 Subject: [PATCH 1/4] stdbit-h: Don't stump on the system namespace. * lib/stdbit.in.h (_gl_stdbit_clz): Renamed from __gl_stdbit_clz. (_gl_stdbit_clzl): Renamed from __gl_stdbit_clzl. (_gl_stdbit_clzll): Renamed from __gl_stdbit_clzll. (_gl_stdbit_ctz): Renamed from __gl_stdbit_ctz. (_gl_stdbit_ctzl): Renamed from __gl_stdbit_ctzl. (_gl_stdbit_ctzll): Renamed from __gl_stdbit_ctzll. (_gl_stdbit_popcount): Renamed from __gl_stdbit_popcount. (_gl_stdbit_popcountl): Renamed from __gl_stdbit_popcountl. (_gl_stdbit_popcountll): Renamed from __gl_stdbit_popcountll. (_gl_stdbit_popcount_wide): Renamed from __gl_stdbit_popcount_wide. (_gl_stdbit_popcount_support): Renamed from __gl_stdbit_popcount_support. (_gl_stdbit_popcount_supported): Renamed from _gl_stdbit_popcount_supported. * lib/stdc_count_ones.c: Update. --- ChangeLog | 19 +++++++ lib/stdbit.in.h | 114 +++++++++++++++++++++--------------------- lib/stdc_count_ones.c | 2 +- 3 files changed, 77 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2517a3b951..cb1c7e1322 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2026-03-08 Bruno Haible <[email protected]> + + stdbit-h: Don't stump on the system namespace. + * lib/stdbit.in.h (_gl_stdbit_clz): Renamed from __gl_stdbit_clz. + (_gl_stdbit_clzl): Renamed from __gl_stdbit_clzl. + (_gl_stdbit_clzll): Renamed from __gl_stdbit_clzll. + (_gl_stdbit_ctz): Renamed from __gl_stdbit_ctz. + (_gl_stdbit_ctzl): Renamed from __gl_stdbit_ctzl. + (_gl_stdbit_ctzll): Renamed from __gl_stdbit_ctzll. + (_gl_stdbit_popcount): Renamed from __gl_stdbit_popcount. + (_gl_stdbit_popcountl): Renamed from __gl_stdbit_popcountl. + (_gl_stdbit_popcountll): Renamed from __gl_stdbit_popcountll. + (_gl_stdbit_popcount_wide): Renamed from __gl_stdbit_popcount_wide. + (_gl_stdbit_popcount_support): Renamed from + __gl_stdbit_popcount_support. + (_gl_stdbit_popcount_supported): Renamed from + _gl_stdbit_popcount_supported. + * lib/stdc_count_ones.c: Update. + 2026-03-08 Bruno Haible <[email protected]> stdbit-h: Use idioms for handling multiple gnulib-tool invocations. diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h index 93d9a605d9..60b7b54981 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -135,17 +135,17 @@ extern "C" { /* Count leading 0 bits of N, even if N is 0. */ #ifdef _GL_STDBIT_HAS_BUILTIN_CLZ _GL_STDBIT_INLINE int -__gl_stdbit_clz (unsigned int n) +_gl_stdbit_clz (unsigned int n) { return n ? __builtin_clz (n) : 8 * sizeof n; } _GL_STDBIT_INLINE int -__gl_stdbit_clzl (unsigned long int n) +_gl_stdbit_clzl (unsigned long int n) { return n ? __builtin_clzl (n) : 8 * sizeof n; } _GL_STDBIT_INLINE int -__gl_stdbit_clzll (unsigned long long int n) +_gl_stdbit_clzll (unsigned long long int n) { return n ? __builtin_clzll (n) : 8 * sizeof n; } @@ -161,32 +161,32 @@ extern unsigned char _BitScanReverse64 (unsigned long *, unsigned long long); # endif _GL_STDBIT_INLINE int -__gl_stdbit_clzl (unsigned long int n) +_gl_stdbit_clzl (unsigned long int n) { unsigned long int r; return 8 * sizeof n - (_BitScanReverse (&r, n) ? r + 1 : 0); } _GL_STDBIT_INLINE int -__gl_stdbit_clz (unsigned int n) +_gl_stdbit_clz (unsigned int n) { - return __gl_stdbit_clzl (n) - 8 * (sizeof 0ul - sizeof n); + return _gl_stdbit_clzl (n) - 8 * (sizeof 0ul - sizeof n); } _GL_STDBIT_INLINE int -__gl_stdbit_clzll (unsigned long long int n) +_gl_stdbit_clzll (unsigned long long int n) { # ifdef _M_X64 unsigned long int r; return 8 * sizeof n - (_BitScanReverse64 (&r, n) ? r + 1 : 0); # else unsigned long int hi = n >> 32; - return __gl_stdbit_clzl (hi ? hi : n) + (hi ? 0 : 32); + return _gl_stdbit_clzl (hi ? hi : n) + (hi ? 0 : 32); # endif } #else /* !_MSC_VER */ _GL_STDBIT_INLINE int -__gl_stdbit_clzll (unsigned long long int n) +_gl_stdbit_clzll (unsigned long long int n) { int r = 0; for (int i = 8 * sizeof n >> 1; 1 << 6 <= i; i >>= 1) @@ -200,31 +200,31 @@ __gl_stdbit_clzll (unsigned long long int n) return (8 * sizeof n - (1 << 2) - r) + ((0x11112234ull >> (n << 2)) & 0xf); } _GL_STDBIT_INLINE int -__gl_stdbit_clz (unsigned int n) +_gl_stdbit_clz (unsigned int n) { - return __gl_stdbit_clzll (n) - 8 * (sizeof 0ull - sizeof 0u); + return _gl_stdbit_clzll (n) - 8 * (sizeof 0ull - sizeof 0u); } _GL_STDBIT_INLINE int -__gl_stdbit_clzl (unsigned long int n) +_gl_stdbit_clzl (unsigned long int n) { - return __gl_stdbit_clzll (n) - 8 * (sizeof 0ull - sizeof 0ul); + return _gl_stdbit_clzll (n) - 8 * (sizeof 0ull - sizeof 0ul); } #endif /* Count trailing 0 bits of N, even if N is 0. */ #ifdef _GL_STDBIT_HAS_BUILTIN_CTZ _GL_STDBIT_INLINE int -__gl_stdbit_ctz (unsigned int n) +_gl_stdbit_ctz (unsigned int n) { return n ? __builtin_ctz (n) : 8 * sizeof n; } _GL_STDBIT_INLINE int -__gl_stdbit_ctzl (unsigned long int n) +_gl_stdbit_ctzl (unsigned long int n) { return n ? __builtin_ctzl (n) : 8 * sizeof n; } _GL_STDBIT_INLINE int -__gl_stdbit_ctzll (unsigned long long int n) +_gl_stdbit_ctzll (unsigned long long int n) { return n ? __builtin_ctzll (n) : 8 * sizeof n; } @@ -240,56 +240,56 @@ extern unsigned char _BitScanForward64 (unsigned long *, unsigned long long); # endif _GL_STDBIT_INLINE int -__gl_stdbit_ctzl (unsigned long int n) +_gl_stdbit_ctzl (unsigned long int n) { unsigned long int r; return _BitScanForward (&r, n) ? r : 8 * sizeof n; } _GL_STDBIT_INLINE int -__gl_stdbit_ctz (unsigned int n) +_gl_stdbit_ctz (unsigned int n) { - return __gl_stdbit_ctzl (n | (1ul << (8 * sizeof n - 1) << 1)); + return _gl_stdbit_ctzl (n | (1ul << (8 * sizeof n - 1) << 1)); } _GL_STDBIT_INLINE int -__gl_stdbit_ctzll (unsigned long long int n) +_gl_stdbit_ctzll (unsigned long long int n) { # ifdef _M_X64 unsigned long int r; return _BitScanForward64 (&r, n) ? r : 8 * sizeof n; # else unsigned int lo = n; - return __gl_stdbit_ctzl (lo ? lo : n >> 32) + (lo ? 0 : 32); + return _gl_stdbit_ctzl (lo ? lo : n >> 32) + (lo ? 0 : 32); # endif } #else /* !_MSC_VER */ _GL_STDBIT_INLINE int -__gl_stdbit_ctz (unsigned int n) +_gl_stdbit_ctz (unsigned int n) { - return 8 * sizeof n - (n ? __gl_stdbit_clz (n & -n) + 1 : 0); + return 8 * sizeof n - (n ? _gl_stdbit_clz (n & -n) + 1 : 0); } _GL_STDBIT_INLINE int -__gl_stdbit_ctzl (unsigned long int n) +_gl_stdbit_ctzl (unsigned long int n) { - return 8 * sizeof n - (n ? __gl_stdbit_clzl (n & -n) + 1 : 0); + return 8 * sizeof n - (n ? _gl_stdbit_clzl (n & -n) + 1 : 0); } _GL_STDBIT_INLINE int -__gl_stdbit_ctzll (unsigned long long int n) +_gl_stdbit_ctzll (unsigned long long int n) { - return 8 * sizeof n - (n ? __gl_stdbit_clzll (n & -n) + 1 : 0); + return 8 * sizeof n - (n ? _gl_stdbit_clzll (n & -n) + 1 : 0); } #endif #if @GNULIB_STDC_COUNT_ONES@ /* Count 1 bits in N. */ # ifdef _GL_STDBIT_HAS_BUILTIN_POPCOUNT -# define __gl_stdbit_popcount __builtin_popcount -# define __gl_stdbit_popcountl __builtin_popcountl -# define __gl_stdbit_popcountll __builtin_popcountll +# define _gl_stdbit_popcount __builtin_popcount +# define _gl_stdbit_popcountl __builtin_popcountl +# define _gl_stdbit_popcountll __builtin_popcountll # else _GL_STDC_COUNT_ONES_INLINE int -__gl_stdbit_popcount_wide (unsigned long long int n) +_gl_stdbit_popcount_wide (unsigned long long int n) { if (sizeof n & (sizeof n - 1)) { @@ -356,12 +356,12 @@ __popcnt64 (unsigned long long int n) # endif /* 1 if supported, -1 if not, 0 if unknown. */ -extern signed char __gl_stdbit_popcount_support; +extern signed char _gl_stdbit_popcount_support; _GL_STDC_COUNT_ONES_INLINE bool -__gl_stdbit_popcount_supported (void) +_gl_stdbit_popcount_supported (void) { - if (!__gl_stdbit_popcount_support) + if (!_gl_stdbit_popcount_support) { /* Do as described in <https://docs.microsoft.com/en-us/cpp/intrinsics/popcnt16-popcnt-popcnt64> @@ -369,35 +369,35 @@ __gl_stdbit_popcount_supported (void) we'll be more cautious. */ int cpu_info[4]; __cpuid (cpu_info, 1); - __gl_stdbit_popcount_support = cpu_info[2] & 1 << 23 ? 1 : -1; + _gl_stdbit_popcount_support = cpu_info[2] & 1 << 23 ? 1 : -1; } - return 0 < __gl_stdbit_popcount_support; + return 0 < _gl_stdbit_popcount_support; } _GL_STDC_COUNT_ONES_INLINE int -__gl_stdbit_popcount (unsigned int n) +_gl_stdbit_popcount (unsigned int n) { - return (__gl_stdbit_popcount_supported () + return (_gl_stdbit_popcount_supported () ? __popcnt (n) - : __gl_stdbit_popcount_wide (n)); + : _gl_stdbit_popcount_wide (n)); } _GL_STDC_COUNT_ONES_INLINE int -__gl_stdbit_popcountl (unsigned long int n) +_gl_stdbit_popcountl (unsigned long int n) { - return (__gl_stdbit_popcount_supported () + return (_gl_stdbit_popcount_supported () ? __popcnt (n) - : __gl_stdbit_popcount_wide (n)); + : _gl_stdbit_popcount_wide (n)); } _GL_STDC_COUNT_ONES_INLINE int -__gl_stdbit_popcountll (unsigned long long int n) +_gl_stdbit_popcountll (unsigned long long int n) { - return (__gl_stdbit_popcount_supported () + return (_gl_stdbit_popcount_supported () ? __popcnt64 (n) - : __gl_stdbit_popcount_wide (n)); + : _gl_stdbit_popcount_wide (n)); } # else /* !_MSC_VER */ -# define __gl_stdbit_popcount __gl_stdbit_popcount_wide -# define __gl_stdbit_popcountl __gl_stdbit_popcount_wide -# define __gl_stdbit_popcountll __gl_stdbit_popcount_wide +# define _gl_stdbit_popcount _gl_stdbit_popcount_wide +# define _gl_stdbit_popcountl _gl_stdbit_popcount_wide +# define _gl_stdbit_popcountll _gl_stdbit_popcount_wide # endif # endif #endif @@ -410,7 +410,7 @@ __gl_stdbit_popcountll (unsigned long long int n) _GL_STDC_LEADING_ZEROS_INLINE unsigned int stdc_leading_zeros_ui (unsigned int n) { - return __gl_stdbit_clz (n); + return _gl_stdbit_clz (n); } _GL_STDC_LEADING_ZEROS_INLINE unsigned int @@ -428,13 +428,13 @@ stdc_leading_zeros_us (unsigned short int n) _GL_STDC_LEADING_ZEROS_INLINE unsigned int stdc_leading_zeros_ul (unsigned long int n) { - return __gl_stdbit_clzl (n); + return _gl_stdbit_clzl (n); } _GL_STDC_LEADING_ZEROS_INLINE unsigned int stdc_leading_zeros_ull (unsigned long long int n) { - return __gl_stdbit_clzll (n); + return _gl_stdbit_clzll (n); } # define stdc_leading_zeros(n) \ @@ -498,7 +498,7 @@ stdc_leading_ones_ull (unsigned long long int n) _GL_STDC_TRAILING_ZEROS_INLINE unsigned int stdc_trailing_zeros_ui (unsigned int n) { - return __gl_stdbit_ctz (n); + return _gl_stdbit_ctz (n); } _GL_STDC_TRAILING_ZEROS_INLINE unsigned int @@ -516,13 +516,13 @@ stdc_trailing_zeros_us (unsigned short int n) _GL_STDC_TRAILING_ZEROS_INLINE unsigned int stdc_trailing_zeros_ul (unsigned long int n) { - return __gl_stdbit_ctzl (n); + return _gl_stdbit_ctzl (n); } _GL_STDC_TRAILING_ZEROS_INLINE unsigned int stdc_trailing_zeros_ull (unsigned long long int n) { - return __gl_stdbit_ctzll (n); + return _gl_stdbit_ctzll (n); } # define stdc_trailing_zeros(n) \ @@ -802,7 +802,7 @@ stdc_first_trailing_one_ull (unsigned long long int n) _GL_STDC_COUNT_ONES_INLINE unsigned int stdc_count_ones_ui (unsigned int n) { - return __gl_stdbit_popcount (n); + return _gl_stdbit_popcount (n); } _GL_STDC_COUNT_ONES_INLINE unsigned int @@ -820,13 +820,13 @@ stdc_count_ones_us (unsigned short int n) _GL_STDC_COUNT_ONES_INLINE unsigned int stdc_count_ones_ul (unsigned long int n) { - return __gl_stdbit_popcountl (n); + return _gl_stdbit_popcountl (n); } _GL_STDC_COUNT_ONES_INLINE unsigned int stdc_count_ones_ull (unsigned long long int n) { - return __gl_stdbit_popcountll (n); + return _gl_stdbit_popcountll (n); } # define stdc_count_ones(n) \ diff --git a/lib/stdc_count_ones.c b/lib/stdc_count_ones.c index bcb4d6c296..1a75445c82 100644 --- a/lib/stdc_count_ones.c +++ b/lib/stdc_count_ones.c @@ -19,5 +19,5 @@ #include <stdbit.h> #if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64) -signed char __gl_stdbit_popcount_support; +signed char _gl_stdbit_popcount_support; #endif -- 2.52.0
>From 3210d2f2c6413c55e0791f5c30402b91d94a292b Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Sun, 8 Mar 2026 15:27:28 +0100 Subject: [PATCH 2/4] error-h: Don't stump on the system namespace. * lib/error.in.h (_gl_error_call1): Renamed from __gl_error_call1. (_gl_error_call): Renamed from __gl_error_call. --- ChangeLog | 4 ++++ lib/error.in.h | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb1c7e1322..568d597de1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2026-03-08 Bruno Haible <[email protected]> + error-h: Don't stump on the system namespace. + * lib/error.in.h (_gl_error_call1): Renamed from __gl_error_call1. + (_gl_error_call): Renamed from __gl_error_call. + stdbit-h: Don't stump on the system namespace. * lib/stdbit.in.h (_gl_stdbit_clz): Renamed from __gl_stdbit_clz. (_gl_stdbit_clzl): Renamed from __gl_stdbit_clzl. diff --git a/lib/error.in.h b/lib/error.in.h index 3355fb3b24..95ed6d8312 100644 --- a/lib/error.in.h +++ b/lib/error.in.h @@ -59,7 +59,7 @@ #if defined __GNUC__ || defined __clang__ /* Use 'gl_unreachable' to tell the compiler when the function call does not return. */ -# define __gl_error_call1(function, status, ...) \ +# define _gl_error_call1(function, status, ...) \ ((function) (status, __VA_ARGS__), \ (status) != 0 ? gl_unreachable () : (void) 0) /* If STATUS is a not a constant, the function call may or may not return; @@ -69,16 +69,16 @@ would trigger a -Wimplicit-fallthrough warning even when STATUS is != 0, when not optimizing. This causes STATUS to be evaluated twice, but that's OK since it does not have side effects. */ -# define __gl_error_call(function, status, ...) \ - (__builtin_constant_p (status) \ - ? __gl_error_call1 (function, status, __VA_ARGS__) \ - : __extension__ \ - ({ \ - int const __errstatus = status; \ - __gl_error_call1 (function, __errstatus, __VA_ARGS__); \ +# define _gl_error_call(function, status, ...) \ + (__builtin_constant_p (status) \ + ? _gl_error_call1 (function, status, __VA_ARGS__) \ + : __extension__ \ + ({ \ + int const __errstatus = status; \ + _gl_error_call1 (function, __errstatus, __VA_ARGS__); \ })) #else -# define __gl_error_call(function, status, ...) \ +# define _gl_error_call(function, status, ...) \ (function) (status, __VA_ARGS__) #endif @@ -103,7 +103,7 @@ _GL_CXXALIAS_RPL (error, void, # ifndef _GL_NO_INLINE_ERROR # undef error # define error(status, ...) \ - __gl_error_call (rpl_error, status, __VA_ARGS__) + _gl_error_call (rpl_error, status, __VA_ARGS__) # endif #else # if ! @HAVE_ERROR@ @@ -131,11 +131,11 @@ _gl_inline_error (int __status, int __errnum, const char *__format, ...) # pragma GCC diagnostic pop # undef error # define error(status, ...) \ - __gl_error_call (_gl_inline_error, status, __VA_ARGS__) + _gl_error_call (_gl_inline_error, status, __VA_ARGS__) # endif # else # define error(status, ...) \ - __gl_error_call (error, status, __VA_ARGS__) + _gl_error_call (error, status, __VA_ARGS__) # endif # endif #endif @@ -161,7 +161,7 @@ _GL_CXXALIAS_RPL (error_at_line, void, # ifndef _GL_NO_INLINE_ERROR # undef error_at_line # define error_at_line(status, ...) \ - __gl_error_call (rpl_error_at_line, status, __VA_ARGS__) + _gl_error_call (rpl_error_at_line, status, __VA_ARGS__) # endif #else # if ! @HAVE_ERROR_AT_LINE@ @@ -193,11 +193,11 @@ _gl_inline_error_at_line (int __status, int __errnum, const char *__filename, # pragma GCC diagnostic pop # undef error_at_line # define error_at_line(status, ...) \ - __gl_error_call (_gl_inline_error_at_line, status, __VA_ARGS__) + _gl_error_call (_gl_inline_error_at_line, status, __VA_ARGS__) # endif # else # define error_at_line(status, ...) \ - __gl_error_call (error_at_line, status, __VA_ARGS__) + _gl_error_call (error_at_line, status, __VA_ARGS__) # endif # endif #endif @@ -216,7 +216,7 @@ extern void verror (int __status, int __errnum, const char *__format, #ifndef _GL_NO_INLINE_ERROR # ifndef verror # define verror(status, ...) \ - __gl_error_call (verror, status, __VA_ARGS__) + _gl_error_call (verror, status, __VA_ARGS__) # define GNULIB_defined_verror 1 # endif #endif @@ -236,7 +236,7 @@ extern void verror_at_line (int __status, int __errnum, const char *__fname, #ifdef _GL_NO_INLINE_ERROR # ifndef verror_at_line # define verror_at_line(status, ...) \ - __gl_error_call (verror_at_line, status, __VA_ARGS__) + _gl_error_call (verror_at_line, status, __VA_ARGS__) # define GNULIB_defined_verror_at_line 1 # endif #endif -- 2.52.0
>From a1f9e9d40561ff117b5cd9e2f4723e4c4ec86979 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Sun, 8 Mar 2026 15:30:20 +0100 Subject: [PATCH 3/4] binary-io: Don't stump on the system namespace. * lib/binary-io.h (_gl_set_fd_mode): Renamed from __gl_setmode. * lib/binary-io.c (set_binary_mode): Update. --- ChangeLog | 4 ++++ lib/binary-io.c | 2 +- lib/binary-io.h | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 568d597de1..70284b3723 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2026-03-08 Bruno Haible <[email protected]> + binary-io: Don't stump on the system namespace. + * lib/binary-io.h (_gl_set_fd_mode): Renamed from __gl_setmode. + * lib/binary-io.c (set_binary_mode): Update. + error-h: Don't stump on the system namespace. * lib/error.in.h (_gl_error_call1): Renamed from __gl_error_call1. (_gl_error_call): Renamed from __gl_error_call. diff --git a/lib/binary-io.c b/lib/binary-io.c index 45060f689c..d465eb4707 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -32,7 +32,7 @@ set_binary_mode (int fd, int mode) with console input or console output. */ return O_TEXT; else - return __gl_setmode (fd, mode); + return _gl_set_fd_mode (fd, mode); } #endif diff --git a/lib/binary-io.h b/lib/binary-io.h index 37eb3c4bb1..bc001a71c0 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -38,9 +38,9 @@ _GL_INLINE_HEADER_BEGIN #if O_BINARY # if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ # include <io.h> /* declares setmode() */ -# define __gl_setmode setmode +# define _gl_set_fd_mode setmode # else -# define __gl_setmode _setmode +# define _gl_set_fd_mode _setmode # undef fileno # define fileno _fileno # endif @@ -49,7 +49,7 @@ _GL_INLINE_HEADER_BEGIN /* Use a function rather than a macro, to avoid gcc warnings "warning: statement with no effect". */ BINARY_IO_INLINE int -__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode) +_gl_set_fd_mode (_GL_UNUSED int fd, _GL_UNUSED int mode) { return O_BINARY; } @@ -72,7 +72,7 @@ extern int set_binary_mode (int fd, int mode); BINARY_IO_INLINE int set_binary_mode (int fd, int mode) { - return __gl_setmode (fd, mode); + return _gl_set_fd_mode (fd, mode); } #endif -- 2.52.0
>From 6e5dfec64941bbd4529b2780b99a843ab225ee91 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Sun, 8 Mar 2026 15:33:53 +0100 Subject: [PATCH 4/4] acl-permissions: Don't stump on the system namespace. * lib/acl.h (struct aclinfo): Rename field __gl_acl_ch to _gl_acl_ch. * lib/file-has-acl.c (get_aclinfo, aclinfo_free, fdfile_has_aclinfo): Update. --- ChangeLog | 5 +++++ lib/acl.h | 4 ++-- lib/file-has-acl.c | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70284b3723..48500da1f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2026-03-08 Bruno Haible <[email protected]> + acl-permissions: Don't stump on the system namespace. + * lib/acl.h (struct aclinfo): Rename field __gl_acl_ch to _gl_acl_ch. + * lib/file-has-acl.c (get_aclinfo, aclinfo_free, fdfile_has_aclinfo): + Update. + binary-io: Don't stump on the system namespace. * lib/binary-io.h (_gl_set_fd_mode): Renamed from __gl_setmode. * lib/binary-io.c (set_binary_mode): Update. diff --git a/lib/acl.h b/lib/acl.h index 85453217c6..4ac25fe226 100644 --- a/lib/acl.h +++ b/lib/acl.h @@ -48,7 +48,7 @@ struct aclinfo { /* If 'size' is nonnegative, a buffer holding the concatenation of extended attribute names, each terminated by NUL - (either u.__gl_acl_ch, or heap-allocated). */ + (either u._gl_acl_ch, or heap-allocated). */ char *buf; /* The number of useful bytes at the start of buf, counting trailing NULs. @@ -72,7 +72,7 @@ struct aclinfo trivial NFSv4 ACL (a size used by file-has-acl.c in 2023-2024 but no longer relevant now), and a different value might be better once experience is gained. For internal use only. */ - char __gl_acl_ch[152]; + char _gl_acl_ch[152]; } u; }; diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index 3269d7f71b..8b9bb0468f 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -160,8 +160,8 @@ aclinfo_has_xattr (struct aclinfo const *ai, char const *xattr) static void get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags) { - ai->buf = ai->u.__gl_acl_ch; - ssize_t acl_alloc = sizeof ai->u.__gl_acl_ch; + ai->buf = ai->u._gl_acl_ch; + ssize_t acl_alloc = sizeof ai->u._gl_acl_ch; if (! (USE_ACL || flags & ACL_GET_SCONTEXT)) ai->size = 0; @@ -194,10 +194,10 @@ get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags) /* Grow allocation to at least 'size'. Grow it by a nontrivial amount, to defend against denial of service by an adversary that fiddles with ACLs. */ - if (ai->buf != ai->u.__gl_acl_ch) + if (ai->buf != ai->u._gl_acl_ch) { free (ai->buf); - ai->buf = ai->u.__gl_acl_ch; + ai->buf = ai->u._gl_acl_ch; } if (ckd_add (&acl_alloc, acl_alloc, acl_alloc >> 1)) acl_alloc = SSIZE_MAX; @@ -297,7 +297,7 @@ aclinfo_scontext_free (char *scontext) void aclinfo_free (struct aclinfo *ai) { - if (ai->buf != ai->u.__gl_acl_ch) + if (ai->buf != ai->u._gl_acl_ch) free (ai->buf); aclinfo_scontext_free (ai->scontext); } @@ -510,7 +510,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd, #else /* !USE_LINUX_XATTR */ - ai->buf = ai->u.__gl_acl_ch; + ai->buf = ai->u._gl_acl_ch; ai->size = -1; ai->u.err = ENOTSUP; ai->scontext = (char *) UNKNOWN_SECURITY_CONTEXT; -- 2.52.0
