]> Savannah Git Hosting - gnulib.git/commitdiff
uchar: Work around Haiku bug.
authorBruno Haible <bruno@clisp.org>
Wed, 5 Apr 2023 12:41:51 +0000 (14:41 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 5 Apr 2023 12:41:51 +0000 (14:41 +0200)
* m4/uchar_h.m4 (gl_UCHAR_H, gl_TYPE_CHAR8_T, gl_TYPE_CHAR16_T,
gl_TYPE_CHAR32_T): Before including <uchar.h>, on Haiku, first include
<stdint.h>.
* 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 <stdint.h> before the include_next.
* doc/posix-headers/uchar.texi: Mention the Haiku bug.

ChangeLog
doc/posix-headers/uchar.texi
lib/uchar.in.h
m4/c32rtomb.m4
m4/mbrtoc32.m4
m4/uchar_h.m4

index cfb1b96edad164cfe65714bc25e072e4c5027a31..1d8429955cd10adc99260784c36234820903c883 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-04-05  Bruno Haible  <bruno@clisp.org>
+
+       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 <uchar.h>, on Haiku, first include
+       <stdint.h>.
+       * 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 <stdint.h> before the include_next.
+       * doc/posix-headers/uchar.texi: Mention the Haiku bug.
+
 2023-04-05  Bruno Haible  <bruno@clisp.org>
 
        stdlib, btowc: Fix file lists.
index 945ce665fd5920a1b79dc317b449361b6eb6dbe7..64c8e3a8d709944d6716cba79182fc33a74b6572 100644 (file)
@@ -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
index bd1c5441cc6542a3ef821679ab3c33b7b4532f7d..7c20ddd878b4fc8e11e0b122f32714260feb2efc 100644 (file)
 @PRAGMA_COLUMNS@
 
 #if @HAVE_UCHAR_H@
+# if defined __HAIKU__
+/* Work around <https://dev.haiku-os.org/ticket/17040>.  */
+#  include <stdint.h>
+# 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,
index 539e4f884c6a98912d58a7ccda1bce0d0ea87c76..5073865d4836cc3e3c94be0cd85028dc422f863b 100644 (file)
@@ -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 <uchar.h>]])
+  AC_CHECK_DECL([c32rtomb], , ,
+    [[#ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
+    ]])
   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 <stdlib.h>
+              #ifdef __HAIKU__
+               #include <stdint.h>
+              #endif
               #include <uchar.h>
             ]],
             [[char buf[8];
@@ -54,6 +62,9 @@ changequote([,])dnl
         AC_RUN_IFELSE(
           [AC_LANG_SOURCE([[
 #include <stddef.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
 #include <uchar.h>
 int main ()
 {
index d6401fe2e46bfb0152f323612a455a9c0442843b..acbd7f537cd8bf22e672874ab9f9a9c4e8b7cb95 100644 (file)
@@ -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 <uchar.h>]])
+  AC_CHECK_DECL([mbrtoc32], , ,
+    [[#ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
+    ]])
   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 <stdlib.h>
+              #ifdef __HAIKU__
+               #include <stdint.h>
+              #endif
               #include <uchar.h>
             ]],
             [[char32_t c;
@@ -87,6 +95,9 @@ changequote(,)dnl
 changequote([,])dnl
       AC_RUN_IFELSE(
         [AC_LANG_SOURCE([[
+           #ifdef __HAIKU__
+            #include <stdint.h>
+           #endif
            #include <uchar.h>
            static char32_t wc;
            static mbstate_t mbs;
@@ -120,6 +131,9 @@ AC_DEFUN([gl_MBRTOC32_C_LOCALE],
        [AC_LANG_PROGRAM(
           [[#include <limits.h>
             #include <locale.h>
+            #ifdef __HAIKU__
+             #include <stdint.h>
+            #endif
             #include <uchar.h>
           ]], [[
             int i;
@@ -185,6 +199,9 @@ changequote([,])dnl
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
 #include <uchar.h>
 int main ()
 {
index 6df3056b32780f7e8a5d032218cbe308afbe2857..3af24cf3e4725c442ecf72794b6ae4b28f395f08 100644 (file)
@@ -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 <uchar.h>
+  gl_WARN_ON_USE_PREPARE([[
+      #ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
     ]], [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 <stdint.h>
+          #endif
           #include <uchar.h>
           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 <stdint.h>
+          #endif
           #include <uchar.h>
           /* 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 <stdint.h>
+          #endif
           #include <uchar.h>
           /* For simplicity, assume that uint32_least_t is equivalent to
              'unsigned int'.  */