bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: [PATCH] Do not decorate symbols as dllexport on Cygwin
Date: Mon, 6 Feb 2023 21:04:24 +0100	[thread overview]
Message-ID: <Y+FdSEWvWz8VgYhv@calimero.vinschen.de> (raw)
In-Reply-To: <3384697.1Xququ8Bcc@nimes>

On Feb  6 18:37, Bruno Haible wrote:
> 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.

I just ran the setlocale_null-mt-* tests with gnulib from git master
under Cygwin with my newlib patch, and the tests succeeded.  I checked
that configure is doing the right thing and config.h contains the right
settings:

  $ ./configure
  [...]
  checking whether setlocale (LC_ALL, NULL) is multithread-safe... yes
  checking whether setlocale (category, NULL) is multithread-safe... yes
  [...]
  $ grep SETLOCALE_NULL config.h
  #define GNULIB_TEST_SETLOCALE_NULL 1
  #define SETLOCALE_NULL_ALL_MTSAFE 1
  #define SETLOCALE_NULL_ONE_MTSAFE 1
  $ grep SETLOCALE_NULL gltests/config.h
  #define GNULIB_TEST_SETLOCALE_NULL 1
  #define SETLOCALE_NULL_ALL_MTSAFE 1
  #define SETLOCALE_NULL_ONE_MTSAFE 1


Thanks a lot,
Corinna



> 
> 
> 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 !)
>  */
> 
> 



  reply	other threads:[~2023-02-06 20:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05 19:43 [PATCH] Do not decorate symbols as dllexport on Cygwin Corinna Vinschen
2023-02-05 20:41 ` Bruno Haible
2023-02-05 20:48   ` Bruno Haible
2023-02-05 21:22   ` Corinna Vinschen
2023-02-06 15:08     ` Corinna Vinschen
2023-02-06 16:36       ` Bruno Haible
2023-02-06 17:37       ` Bruno Haible
2023-02-06 20:04         ` Corinna Vinschen [this message]
2023-02-06 20:38           ` Bruno Haible
2023-02-06 20:43             ` Corinna Vinschen
2023-02-06 20:50             ` Reuben Thomas
2023-02-07 13:22               ` Corinna Vinschen
2023-02-07 15:22                 ` Corinna Vinschen
2023-02-10 14:11                   ` Reuben Thomas
2023-02-10 14:21                     ` Bruno Haible
2023-02-11 11:36                       ` Reuben Thomas
2023-02-11 12:06                         ` Corinna Vinschen
2023-02-11 12:29                           ` Reuben Thomas
2023-02-11 12:40                             ` Corinna Vinschen
2023-02-17  9:30                               ` Reuben Thomas
2023-02-17  9:58                                 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+FdSEWvWz8VgYhv@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).