+2024-12-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ stdlib: support including stdlib.h from config.h
+ Emacs <config.h> includes <stdlib.h> in some situations, causing
+ problems on macOS as described by Eli Zaretskii in:
+ https://lists.gnu.org/r/emacs-devel/2024-12/msg00923.html
+ Although this usage is not recommended, it is easier to support
+ it for POSIX-required headers, than to fix Emacs.
+ * doc/extern-inline.texi (extern inline): Document the Emacs problem.
+ * lib/endian.c, lib/math.c, lib/stdbit.c, lib/stdlib.c:
+ * lib/sys_socket.c, lib/unistd.c, lib/wctype-h.c:
+ Define #define _GL_..._INLINE to _GL_EXTERN_INLINE
+ before including <config.h>, not merely before including
+ the .h file that defines the inline function.
+
2024-12-24 Bruno Haible <bruno@clisp.org>
setlocale: Fix a buffer overflow check (mistake in yesterday's commit).
@example
/* aaa.c */
-#include <config.h>
#define AAA_INLINE _GL_EXTERN_INLINE
+#include <config.h>
#include <aaa.h>
@end example
platforms and will die out eventually.
In this coding idiom,
+the compilation unit should define @code{AAA_INLINE} before
+including the @file{aaa.h} header that conditionally defines it.
+In the unusual and not-recommended case where @file{config.h}
+itself includes @file{aaa.h}, the compilation unit should
+define @code{AAA_INLINE} before including @file{config.h},
+not merely before including @file{aaa.h}. Also,
you need one @code{AAA_INLINE}-like macro per compilation unit,
not one per header file.
In other words, if the header file @file{aaa.h} defines functions
/* Written by Collin Funk. */
+#define _GL_ENDIAN_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_ENDIAN_INLINE _GL_EXTERN_INLINE
#include <endian.h>
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#define _GL_MATH_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_MATH_INLINE _GL_EXTERN_INLINE
#include <math.h>
typedef int dummy;
/* Written by Paul Eggert. */
+#define _GL_STDBIT_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_STDBIT_INLINE _GL_EXTERN_INLINE
#include <stdbit.h>
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE
#include <stdlib.h>
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
#include <sys/socket.h>
typedef int dummy;
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
#include <unistd.h>
typedef int dummy;
/* Normally this would be wctype.c, but that name's already taken. */
+#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
#include <config.h>
-#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
#include <wctype.h>