* m4/call_once.m4 (gl_FUNC_CALL_ONCE): Require AC_CANONICAL_HOST.
On Cygwin, set REPLACE_CALL_ONCE to 1.
* lib/call_once.c (call_once): On Cygwin, use a cast, to avoid a
compiler warning.
* modules/call_once (Depends-on): Add pthread-once.
* doc/posix-functions/call_once.texi: Mention the Cygwin bug.
+2024-05-31 Bruno Haible <bruno@clisp.org>
+
+ call_once: Work around Cygwin 3.5.3 bug.
+ * m4/call_once.m4 (gl_FUNC_CALL_ONCE): Require AC_CANONICAL_HOST.
+ On Cygwin, set REPLACE_CALL_ONCE to 1.
+ * lib/call_once.c (call_once): On Cygwin, use a cast, to avoid a
+ compiler warning.
+ * modules/call_once (Depends-on): Add pthread-once.
+ * doc/posix-functions/call_once.texi: Mention the Cygwin bug.
+
2024-05-31 Bruno Haible <bruno@clisp.org>
lock: Work around Cygwin 3.5.3 bug.
Portability problems not fixed by Gnulib:
@itemize
@item
+This function makes applications hang forever on some platforms:
+Cygwin 3.5.3.
+@item
This function does not work on some platforms:
@c https://dev.haiku-os.org/ticket/18348
Haiku.
/* ISO C 11 once-only initialization.
- Copyright (C) 2005-2023 Free Software Foundation, Inc.
+ Copyright (C) 2005-2024 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
void
call_once (once_flag *flagp, void (*func) (void))
{
+# if defined __CYGWIN__
+ /* Verify that once_flag and pthread_once_t are of the same size. */
+ struct _ { int v [sizeof (once_flag) == sizeof (pthread_once_t) ? 1 : -1]; };
+ pthread_once ((pthread_once_t *) flagp, func);
+# else
pthread_once (flagp, func);
+# endif
}
#endif
-# call_once.m4 serial 1
+# call_once.m4 serial 2
dnl Copyright (C) 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,
AC_DEFUN([gl_FUNC_CALL_ONCE],
[
AC_REQUIRE([gl_THREADS_H])
+ AC_REQUIRE([AC_CANONICAL_HOST])
gl_CHECK_FUNCS_ANDROID([call_once], [[#include <threads.h>]])
case "$gl_cv_onwards_func_call_once" in
+ yes)
+ dnl Work around Cygwin 3.5.3 bug.
+ AC_CACHE_CHECK([whether call_once works],
+ [gl_cv_func_call_once_works],
+ [case "$host_os" in
+ cygwin*) gl_cv_func_call_once_works="guessing no" ;;
+ *) gl_cv_func_call_once_works="yes" ;;
+ esac
+ ])
+ case "$gl_cv_func_call_once_works" in
+ *yes) ;;
+ *) REPLACE_CALL_ONCE=1 ;;
+ esac
+ ;;
future*)
REPLACE_CALL_ONCE=1
;;
Depends-on:
threads-h
+pthread-once
windows-once
configure.ac: