On 5/6/25 11:08, Bruno Haible wrote:
obstack: Fix library namespacing (regression yesterday).
Thanks for finding and fixing that.As I'm still a bit concerned that glibc reviewers will object to removing the "ifndef __obstack_free" I installed the attached further patch. This further patch affects only people not using Gnulib (i.e., they're using glibc) and who have already #define'd __obstack_free to some other name (presumably their own oddball code), in which case we'll now continue to do what glibc currently does. As you say, we don't know anybody who still does that, but if they exist they'll likelier be happier this way.
From acaa6c07d85fa5eeadae4e60b717fb25c919c23d Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Tue, 6 May 2025 15:09:02 -0700 Subject: [PATCH] obstack: let glibc user #define __obstack_free * lib/obstack.in.h (__obstack_free) [! (__GL_GNULIB_HEADER && __GL_REPLACE_OBSTACK__)]: Allow glibc user to #define __obstack_free. Although this vestigial feature is not useful any more, it is one less change to current glibc usage and so should make it a bit easier to merge with glibc. --- ChangeLog | 8 ++++++++ lib/obstack.in.h | 25 ++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index d60a9e5658..ac06e3520c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2025-05-06 Paul Eggert <egg...@cs.ucla.edu> + obstack: let glibc user #define __obstack_free + * lib/obstack.in.h (__obstack_free) + [! (__GL_GNULIB_HEADER && __GL_REPLACE_OBSTACK__)]: + Allow glibc user to #define __obstack_free. Although this + vestigial feature is not useful any more, it is one less change to + current glibc usage and so should make it a bit easier to merge + with glibc. + obstack: don’t assume INT_MAX < SIZE_MAX This for clarity and to document the overflow checking better; I think no current Gnulib or glibc targets have SIZE_MAX <= INTMAX, diff --git a/lib/obstack.in.h b/lib/obstack.in.h index 85252ff430..174cab9d0a 100644 --- a/lib/obstack.in.h +++ b/lib/obstack.in.h @@ -233,20 +233,19 @@ struct obstack /* control current object in current chunk */ /* Declare the external functions we use; they are in obstack.c. */ -#if defined __GL_GNULIB_HEADER /* Symbol mapping for gnulib. */ -# if defined __GL_REPLACE_OBSTACK__ -# define _obstack_newchunk rpl_obstack_newchunk -# define __obstack_free rpl_obstack_free -# define _obstack_begin rpl_obstack_begin -# define _obstack_begin_1 rpl_obstack_begin_1 -# define _obstack_memory_used rpl_obstack_memory_used -# define _obstack_allocated_p rpl_obstack_allocated_p -# else -# define __obstack_free _obstack_free -# endif -#else -/* Symbol mapping for glibc. */ +#if defined __GL_GNULIB_HEADER && defined __GL_REPLACE_OBSTACK__ +# define _obstack_newchunk rpl_obstack_newchunk +# define __obstack_free rpl_obstack_free +# define _obstack_begin rpl_obstack_begin +# define _obstack_begin_1 rpl_obstack_begin_1 +# define _obstack_memory_used rpl_obstack_memory_used +# define _obstack_allocated_p rpl_obstack_allocated_p +#endif + +/* The default name of the function for freeing a chunk is '_obstack_free', + but gnulib overrides this by defining '__obstack_free' above. */ +#ifndef __obstack_free # define __obstack_free _obstack_free #endif -- 2.49.0