[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Do not decorate symbols as dllexport on Cygwin
From: |
Bruno Haible |
Subject: |
Re: [PATCH] Do not decorate symbols as dllexport on Cygwin |
Date: |
Mon, 06 Feb 2023 18:37:04 +0100 |
Corinna Vinschen wrote:
> This patch will be in the next Cygwin release 3.4.6.
Thanks!
> I'm just a bit fuzzy what patches will be required for gnulib now...
With this patch, the setlocale_null lock should be gone in Cygwin >= 3.4.6.
I can't really test it, but I hope the patch is correct.
2023-02-06 Bruno Haible <bruno@clisp.org>
setlocale-null: Don't use a lock in Cygwin >= 3.4.6.
Road paved by Corinna Vinschen <vinschen@redhat.com>.
* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Assume that
setlocale (LC_ALL, NULL) is multithread-safe in Cygwin >= 3.4.6.
* lib/setlocale_null.c: Update comments.
* tests/test-setlocale_null-mt-all.c: Likewise.
diff --git a/lib/setlocale_null.c b/lib/setlocale_null.c
index 6ac563db14..89c8a06598 100644
--- a/lib/setlocale_null.c
+++ b/lib/setlocale_null.c
@@ -173,7 +173,7 @@ setlocale_null_unlocked (int category, char *buf, size_t
bufsize)
#endif
}
-#if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc,
macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin */
+#if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc,
macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */
/* Use a lock, so that no two threads can invoke setlocale_null_unlocked
at the same time. */
@@ -198,7 +198,7 @@ setlocale_null_with_lock (int category, char *buf, size_t
bufsize)
return ret;
}
-# elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX,
Haiku, Cygwin */
+# elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX,
Haiku, Cygwin < 3.4.6 */
extern
# if defined _WIN32 || defined __CYGWIN__
diff --git a/m4/setlocale_null.m4 b/m4/setlocale_null.m4
index dd6a5ef538..b41df499a8 100644
--- a/m4/setlocale_null.m4
+++ b/m4/setlocale_null.m4
@@ -1,4 +1,4 @@
-# setlocale_null.m4 serial 6
+# setlocale_null.m4 serial 7
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,
@@ -13,9 +13,23 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe],
[gl_cv_func_setlocale_null_all_mtsafe],
[case "$host_os" in
- # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku,
Cygwin.
- *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix*
| haiku* | cygwin*)
+ # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku.
+ *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix*
| haiku*)
gl_cv_func_setlocale_null_all_mtsafe=no ;;
+ # Guess no on Cygwin < 3.4.6.
+ cygwin*)
+ AC_EGREP_CPP([Lucky user],
+ [
+#if defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6)
+ Lucky user
+ #endif
+#endif
+ ],
+ [gl_cv_func_setlocale_null_all_mtsafe=yes],
+ [gl_cv_func_setlocale_null_all_mtsafe=no])
+ ;;
# Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows.
*-gnu* | gnu* | hpux* | irix* | solaris* | mingw*)
gl_cv_func_setlocale_null_all_mtsafe=yes ;;
diff --git a/tests/test-setlocale_null-mt-all.c
b/tests/test-setlocale_null-mt-all.c
index 6036c260cd..7480406639 100644
--- a/tests/test-setlocale_null-mt-all.c
+++ b/tests/test-setlocale_null-mt-all.c
@@ -166,7 +166,7 @@ Solaris 11.0 OK
Solaris 11.4 OK
Solaris OpenIndiana OK
Haiku crash < 1 sec
-Cygwin crash < 1 sec
+Cygwin < 3.4.6 crash < 1 sec
mingw OK
MSVC OK (assuming compiler option /MD !)
*/
- [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/05
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Bruno Haible, 2023/02/05
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Bruno Haible, 2023/02/05
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/05
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Bruno Haible, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin,
Bruno Haible <=
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Bruno Haible, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Reuben Thomas, 2023/02/06
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/07
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/07
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Reuben Thomas, 2023/02/10
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Bruno Haible, 2023/02/10
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Reuben Thomas, 2023/02/11
- Re: [PATCH] Do not decorate symbols as dllexport on Cygwin, Corinna Vinschen, 2023/02/11