bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building and testing Bison 3.0.2 with MinGW [3/5]


From: Akim Demaille
Subject: Re: Building and testing Bison 3.0.2 with MinGW [3/5]
Date: Fri, 16 Jan 2015 14:53:33 +0100

> Le 7 oct. 2014 à 20:14, Eli Zaretskii <address@hidden> a écrit :
> 
> A coupe of tests failed and revealed a problem with l10n: the Windows
> 'setlocale' doesn't cater to the LC_* environment variables, so
> isprint returns values that are not necessarily consistent with the
> locale that Bison is instructed to use (the test in question sets
> LC_ALL=C).  Here's a patch to fix that:

Hi Eli,

Shouldn't this be done by gettext?  Or maybe something
in gnulib?  Or maybe the tests should do something else
than LC_ALL=C to disable internationalization?

> --- src/main.c~0      2014-10-07 08:45:06 +0300
> +++ src/main.c        2014-10-07 09:53:07 +0300
> @@ -58,7 +58,32 @@ int
> main (int argc, char *argv[])
> {
>   set_program_name (argv[0]);
> +#ifdef __MINGW32__
> +  /* The Windows 'setlocale' doesn't look at the environment
> +     variables, so do it here by hand.  */
> +  {
> +    char const *cp = getenv ("LC_ALL");
> +
> +    if (!cp)
> +      cp = getenv ("LANG");
> +    if (cp)
> +      setlocale (LC_ALL, cp);
> +    else
> +      setlocale (LC_ALL, "");
> +    if ((cp = getenv ("LC_COLLATE")) != NULL)
> +      setlocale (LC_COLLATE, cp);
> +    if ((cp = getenv ("LC_CTYPE")) != NULL)
> +      setlocale (LC_CTYPE, cp);
> +    if ((cp = getenv ("LC_NUMERIC")) != NULL)
> +      setlocale (LC_NUMERIC, cp);
> +    if ((cp = getenv ("LC_MONETARY")) != NULL)
> +      setlocale (LC_MONETARY, cp);
> +    if ((cp = getenv ("LC_TIME")) != NULL)
> +      setlocale (LC_TIME, cp);
> +  }
> +#else  /* !__MINGW32__ */
>   setlocale (LC_ALL, "");
> +#endif
>   (void) bindtextdomain (PACKAGE, LOCALEDIR);
>   (void) bindtextdomain ("bison-runtime", LOCALEDIR);
>   (void) textdomain (PACKAGE);
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]