This partly reverts commit d15b2da0ac25e085ce30a9e2672624999ce910a6 dated 2014-11-03. It keeps the part of that commit that fixed the return type of non-gcc versions of obstack_make_room, obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow_fast, obstack_int_grow_fast, obstack_blank so that they agree with gcc versions. * lib/obstack.in.h (obstack_next_free, obstack_chunkfun) (obstack_freefun, obstack_1grow_fast, obstack_blank_fast): Go back to returning a value instead of void, to allay any glibc concerns about compatibility. (obstack_1grow, obstack_blank): Explicitly return void, since callees no longer do so. --- ChangeLog | 14 ++++++++++++++ lib/obstack.in.h | 23 +++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog index c73702402d..1e83db3d5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2025-05-05 Paul Eggert <egg...@cs.ucla.edu> + obstack: be more like glibc in return values + This partly reverts commit d15b2da0ac25e085ce30a9e2672624999ce910a6 + dated 2014-11-03. It keeps the part of that commit that fixed the + return type of non-gcc versions of obstack_make_room, + obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow_fast, + obstack_int_grow_fast, obstack_blank so that they agree with gcc + versions. + * lib/obstack.in.h (obstack_next_free, obstack_chunkfun) + (obstack_freefun, obstack_1grow_fast, obstack_blank_fast): + Go back to returning a value instead of void, + to allay any glibc concerns about compatibility. + (obstack_1grow, obstack_blank): Explicitly return void, + since callees no longer do so. + obstack: _obstack_free → __obstack_free * lib/obstack.in.h (__obstack_free): Rename back from _obstack_free. This is for compatibility with glibc, which in turn is for diff --git a/lib/obstack.in.h b/lib/obstack.in.h index 7d8a106448..00b4105927 100644 --- a/lib/obstack.in.h +++ b/lib/obstack.in.h @@ -278,7 +278,7 @@ extern int obstack_exit_failure; /* Pointer to next byte not yet allocated in current chunk. */ -#define obstack_next_free(h) ((void *) (h)->next_free) +#define obstack_next_free(h) ((h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ @@ -310,17 +310,16 @@ extern int obstack_exit_failure; _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) #define obstack_chunkfun(h, newchunkfun) \ - ((void) \ ((h)->chunkfun.extra = _OBSTACK_CAST (void *(*) (void *, \ _OBSTACK_CHUNK_SIZE_T), \ - newchunkfun))) + newchunkfun)) #define obstack_freefun(h, newfreefun) \ - ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) + ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun)) -#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) +#define obstack_1grow_fast(h, achar) (*((h)->next_free)++ = (achar)) -#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) +#define obstack_blank_fast(h, n) ((h)->next_free += (n)) #define obstack_memory_used(h) _obstack_memory_used (h) @@ -389,7 +388,8 @@ extern int obstack_exit_failure; ({ struct obstack *__o = (OBSTACK); \ if (obstack_room (__o) < 1) \ _obstack_newchunk (__o, 1); \ - obstack_1grow_fast (__o, datum); }) + obstack_1grow_fast (__o, datum); \ + (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object @@ -431,7 +431,8 @@ extern int obstack_exit_failure; _OBSTACK_INDEX_T __len = length; \ if (obstack_room (__o) < __len) \ _obstack_newchunk (__o, __len); \ - obstack_blank_fast (__o, __len); }) + obstack_blank_fast (__o, __len); \ + (void) 0; }) # define obstack_alloc(OBSTACK, length) \ __extension__ \ @@ -523,7 +524,8 @@ extern int obstack_exit_failure; # define obstack_1grow(h, datum) \ (((obstack_room (h) < 1) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ - obstack_1grow_fast (h, datum)) + obstack_1grow_fast (h, datum), \ + (void) 0) # define obstack_ptr_grow(h, datum) \ (((obstack_room (h) < sizeof (char *)) \ @@ -547,7 +549,8 @@ extern int obstack_exit_failure; ((h)->temp.tempint = (length), \ ((obstack_room (h) < (h)->temp.tempint) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ - obstack_blank_fast (h, (h)->temp.tempint)) + obstack_blank_fast (h, (h)->temp.tempint), \ + (void) 0) # define obstack_alloc(h, length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) -- 2.49.0