From 769ac7724489ce972b72ccf5d5a4cbc4d53b618d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Dec 2024 12:40:17 +0100 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ m4/btowc.m4 | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8595bb5ccc..e9735532e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-12-22 Bruno Haible + + 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 posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2. diff --git a/m4/btowc.m4 b/m4/btowc.m4 index 8bb55dc8f6..e485c88a3a 100644 --- a/m4/btowc.m4 +++ b/m4/btowc.m4 @@ -1,4 +1,4 @@ -# btowc.m4 serial 14 +# btowc.m4 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, @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WINT_T]) dnl Check whether is usable at all, first. Otherwise the test dnl program below may lead to an endless loop. See @@ -132,6 +133,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 ;; -- 2.39.5