From: Paul Eggert Date: Mon, 5 May 2025 21:02:13 +0000 (-0700) Subject: obstack: define PTR_INT_TYPE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=622e9a8d17b13d26771f09236823f3fc5a557b02;p=thirdparty%2Fgnulib.git obstack: define PTR_INT_TYPE * lib/obstack.in.h (PTR_INT_TYPE): Define, for compatibility with glibc even though we don’t need the type for anything other than compatibility. Include stddef.h only if needed, like glibc obstack.h does. --- diff --git a/ChangeLog b/ChangeLog index 5c78f4dac4..7448c09ebc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-05-05 Paul Eggert + obstack: define PTR_INT_TYPE + * lib/obstack.in.h (PTR_INT_TYPE): Define, for compatibility + with glibc even though we don’t need the type for anything + other than compatibility. Include stddef.h only if needed, + like glibc obstack.h does. + obstack: merge better with glibc When compiled for glibc, keep the fake array content size at 4, for API compatibility with older glibc. diff --git a/lib/obstack.in.h b/lib/obstack.in.h index c82f6d4a6c..6b51ebde5d 100644 --- a/lib/obstack.in.h +++ b/lib/obstack.in.h @@ -113,9 +113,20 @@ # endif #endif -#include /* For size_t and ptrdiff_t. */ +/* For backward compatibility with older glibc, + define the otherwise-unused macro PTR_INT_TYPE. If __PTRDIFF_TYPE__ is + defined, as with GNU C, use that; that way we don't pollute the + namespace with 's symbols. Otherwise, include + and use ptrdiff_t. */ +#ifdef __PTRDIFF_TYPE__ +# define PTR_INT_TYPE __PTRDIFF_TYPE__ +#else +# include +# define PTR_INT_TYPE ptrdiff_t +#endif + #include /* For uintptr_t. */ -#include /* For memcpy. */ +#include /* For memcpy, size_t. */ /* These macros highlight the places where this implementation is different from the one in GNU libc. */