2025-05-05 Paul Eggert <eggert@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
/* 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. */
_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)
({ 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
_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__ \
# 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 *)) \
((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)))