From bfe8d458485a452a56e819f9adc5f1499dc86d98 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 5 Apr 2023 14:41:51 +0200 Subject: uchar: Work around Haiku bug. * m4/uchar_h.m4 (gl_UCHAR_H, gl_TYPE_CHAR8_T, gl_TYPE_CHAR16_T, gl_TYPE_CHAR32_T): Before including , on Haiku, first include . * m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Likewise. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32, gl_CHECK_FUNC_MBRTOC32, gl_MBRTOC32_EMPTY_INPUT, gl_MBRTOC32_C_LOCALE, gl_MBRTOC32_SANITYCHECK): Likewise. * lib/uchar.in.h: On Haiku, include before the include_next. * doc/posix-headers/uchar.texi: Mention the Haiku bug. --- ChangeLog | 13 +++++++++++++ doc/posix-headers/uchar.texi | 4 ++++ lib/uchar.in.h | 4 ++++ m4/c32rtomb.m4 | 15 +++++++++++++-- m4/mbrtoc32.m4 | 21 +++++++++++++++++++-- m4/uchar_h.m4 | 17 +++++++++++++++-- 6 files changed, 68 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfb1b96eda..1d8429955c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2023-04-05 Bruno Haible + + uchar: Work around Haiku bug. + * m4/uchar_h.m4 (gl_UCHAR_H, gl_TYPE_CHAR8_T, gl_TYPE_CHAR16_T, + gl_TYPE_CHAR32_T): Before including , on Haiku, first include + . + * m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Likewise. + * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32, gl_CHECK_FUNC_MBRTOC32, + gl_MBRTOC32_EMPTY_INPUT, gl_MBRTOC32_C_LOCALE, gl_MBRTOC32_SANITYCHECK): + Likewise. + * lib/uchar.in.h: On Haiku, include before the include_next. + * doc/posix-headers/uchar.texi: Mention the Haiku bug. + 2023-04-05 Bruno Haible stdlib, btowc: Fix file lists. diff --git a/doc/posix-headers/uchar.texi b/doc/posix-headers/uchar.texi index 945ce665fd..64c8e3a8d7 100644 --- a/doc/posix-headers/uchar.texi +++ b/doc/posix-headers/uchar.texi @@ -13,6 +13,10 @@ Portability problems fixed by Gnulib: This header file is missing on many non-glibc platforms: glibc 2.15, macOS 11.1, FreeBSD 6.4, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, Cygwin, mingw, MSVC 9. @item +This file is not self-contained on some platforms: +@c https://dev.haiku-os.org/ticket/17040 +Haiku. +@item This file produces compilation errors in C++ mode on some platforms: AIX 7.2 with xlclang++. @end itemize diff --git a/lib/uchar.in.h b/lib/uchar.in.h index bd1c5441cc..7c20ddd878 100644 --- a/lib/uchar.in.h +++ b/lib/uchar.in.h @@ -28,6 +28,10 @@ @PRAGMA_COLUMNS@ #if @HAVE_UCHAR_H@ +# if defined __HAIKU__ +/* Work around . */ +# include +# endif /* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors because it contains typedef definitions of char16_t and char32_t, however char16_t and char32_t are keywords in this situation. To work around it, diff --git a/m4/c32rtomb.m4 b/m4/c32rtomb.m4 index 539e4f884c..5073865d48 100644 --- a/m4/c32rtomb.m4 +++ b/m4/c32rtomb.m4 @@ -1,4 +1,4 @@ -# c32rtomb.m4 serial 5 +# c32rtomb.m4 serial 6 dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,12 @@ AC_DEFUN([gl_FUNC_C32RTOMB], AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) dnl Cf. gl_CHECK_FUNCS_ANDROID - AC_CHECK_DECL([c32rtomb], , , [[#include ]]) + AC_CHECK_DECL([c32rtomb], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) if test $ac_cv_have_decl_c32rtomb = yes; then dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a dnl static inline function on Haiku 2020. @@ -19,6 +24,9 @@ AC_DEFUN([gl_FUNC_C32RTOMB], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include + #ifdef __HAIKU__ + #include + #endif #include ]], [[char buf[8]; @@ -54,6 +62,9 @@ changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include +#ifdef __HAIKU__ + #include +#endif #include int main () { diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4 index d6401fe2e4..acbd7f537c 100644 --- a/m4/mbrtoc32.m4 +++ b/m4/mbrtoc32.m4 @@ -1,4 +1,4 @@ -# mbrtoc32.m4 serial 11 +# mbrtoc32.m4 serial 12 dnl Copyright (C) 2014-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -47,7 +47,12 @@ AC_DEFUN([gl_FUNC_MBRTOC32], AC_DEFUN([gl_CHECK_FUNC_MBRTOC32], [ dnl Cf. gl_CHECK_FUNCS_ANDROID - AC_CHECK_DECL([mbrtoc32], , , [[#include ]]) + AC_CHECK_DECL([mbrtoc32], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) if test $ac_cv_have_decl_mbrtoc32 = yes; then dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a dnl static inline function on Haiku 2020. @@ -55,6 +60,9 @@ AC_DEFUN([gl_CHECK_FUNC_MBRTOC32], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include + #ifdef __HAIKU__ + #include + #endif #include ]], [[char32_t c; @@ -87,6 +95,9 @@ changequote(,)dnl changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ + #ifdef __HAIKU__ + #include + #endif #include static char32_t wc; static mbstate_t mbs; @@ -120,6 +131,9 @@ AC_DEFUN([gl_MBRTOC32_C_LOCALE], [AC_LANG_PROGRAM( [[#include #include + #ifdef __HAIKU__ + #include + #endif #include ]], [[ int i; @@ -185,6 +199,9 @@ changequote([,])dnl #include #include #include +#ifdef __HAIKU__ + #include +#endif #include int main () { diff --git a/m4/uchar_h.m4 b/m4/uchar_h.m4 index 6df3056b32..3af24cf3e4 100644 --- a/m4/uchar_h.m4 +++ b/m4/uchar_h.m4 @@ -1,4 +1,4 @@ -# uchar_h.m4 serial 21 +# uchar_h.m4 serial 22 dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -94,7 +94,11 @@ EOF dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C11. - gl_WARN_ON_USE_PREPARE([[#include + gl_WARN_ON_USE_PREPARE([[ + #ifdef __HAIKU__ + #include + #endif + #include ]], [c32rtomb mbrtoc32]) ]) @@ -105,6 +109,9 @@ AC_DEFUN_ONCE([gl_TYPE_CHAR8_T], [gl_cv_type_char8_t_works], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif #include int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1]; ]]) @@ -129,6 +136,9 @@ AC_DEFUN_ONCE([gl_TYPE_CHAR16_T], [gl_cv_type_char16_t_works], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif #include /* For simplicity, assume that uint16_least_t is equivalent to 'unsigned short'. */ @@ -152,6 +162,9 @@ AC_DEFUN_ONCE([gl_TYPE_CHAR32_T], [gl_cv_type_char32_t_works], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif #include /* For simplicity, assume that uint32_least_t is equivalent to 'unsigned int'. */ -- cgit v1.2.1