]> Savannah Git Hosting - gnulib.git/commitdiff
btowc: Fix declaration on mingw/ucrt.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Dec 2024 11:40:17 +0000 (12:40 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Dec 2024 11:40:17 +0000 (12:40 +0100)
* m4/btowc.m4 (gl_FUNC_BTOWC): Require gt_TYPE_WINT_T. If gnulib
overrides wint_t, set REPLACE_BTOWC to 1.

ChangeLog
m4/btowc.m4

index 5a7c2d777fcbb3db986971002c0e1d3cc95cd1f7..ec6700e2c9b1e4950956442417a3fcca256e8d30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-12-22  Bruno Haible  <bruno@clisp.org>
+
+       btowc: Fix declaration on mingw/ucrt.
+       * m4/btowc.m4 (gl_FUNC_BTOWC): Require gt_TYPE_WINT_T. If gnulib
+       overrides wint_t, set REPLACE_BTOWC to 1.
+
 2024-12-22  Bruno Haible  <bruno@clisp.org>
 
        posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2.
index e5cab9662c65d651537fc267d7515ba675dea715..1aa12130e04e64c136413db8c79f2aee27e69b74 100644 (file)
@@ -1,5 +1,5 @@
 # btowc.m4
-# serial 14
+# serial 15
 dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@ dnl This file is offered as-is, without any warranty.
 AC_DEFUN([gl_FUNC_BTOWC],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gt_TYPE_WINT_T])
 
   dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
   dnl program below may lead to an endless loop. See
@@ -134,6 +135,13 @@ int main ()
           ])
       ])
 
+    if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
+      dnl On mingw/ucrt, we override the return type of btowc().
+      dnl While the original wint_t (= unsigned short) and the overridden wint_t
+      dnl (= unsigned int) are equivalent in function parameters, this is not
+      dnl the case for function return types.
+      REPLACE_BTOWC=1
+    fi
     case "$gl_cv_func_btowc_nul" in
       *yes) ;;
       *) REPLACE_BTOWC=1 ;;