bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-localename mingw failure?


From: Bruno Haible
Subject: Re: test-localename mingw failure?
Date: Thu, 31 Dec 2009 02:28:37 +0100
User-agent: KMail/1.9.9

Hi Simon,

> i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I.  -I. -I. -I.. -I./.. -I../gllib 
> -I./../gllib   -g -O2 -MT test-localename.o -MD -MP -MF 
> .deps/test-localename.Tpo -c -o test-localename.o test-localename.c
> test-localename.c:31: error: ‘LC_CTYPE_MASK’ undeclared here (not in a 
> function)
> test-localename.c:32: error: ‘LC_NUMERIC_MASK’ undeclared here (not in a 
> function)
> test-localename.c:33: error: ‘LC_TIME_MASK’ undeclared here (not in a 
> function)
> test-localename.c:34: error: ‘LC_COLLATE_MASK’ undeclared here (not in a 
> function)
> test-localename.c:35: error: ‘LC_MONETARY_MASK’ undeclared here (not in a 
> function)
> test-localename.c:36: error: ‘LC_MESSAGES_MASK’ undeclared here (not in a 
> function)
> make[3]: *** [test-localename.o] Error 1

Ouch. Big mistake of mine :-( LC_CTYPE_MASK should not be used if
HAVE_NEWLOCALE is not defined.

> POSIX
> http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
> says:
> 
>   The <locale.h> header shall contain at least the following macros
>   representing bitmasks for use with the newlocale() function for each
>   supported locale category: LC_COLLATE_MASK LC_CTYPE_MASK
>   LC_MESSAGES_MASK LC_MONETARY_MASK LC_NUMERIC_MASK LC_TIME_MASK
> 
> I'm not sure how to parse this, are the macros optional if the locale
> categories aren't supported?
> 
> In any case, is this something gnulib's locale.h should fix?

It would be nice to be able to support uselocale and newlocale on all
platforms, but it is unrealistic: The support code would be huge, because it
would have to override every function that is locale dependent in some sense.

Therefore, on platforms where the system does not provide newlocale, we cannot
do it. It makes no sense to define LC_CTYPE_MASK in <locale.h> then, because
the only use of these macros is as argument to newlocale().

Bruno


2009-12-30  Bruno Haible  <address@hidden>

        Fix compilation error on most platforms.
        * tests/test-localename.c (categories): Define only if HAVE_NEWLOCALE.
        Reported by Simon Josefsson <address@hidden>
        and Nelson H. F. Beebe <address@hidden>.

*** tests/test-localename.c.orig        Thu Dec 31 02:21:27 2009
--- tests/test-localename.c     Thu Dec 31 02:17:33 2009
***************
*** 26,31 ****
--- 26,34 ----
  
  #include "macros.h"
  
+ 
+ #if HAVE_NEWLOCALE
+ 
  static struct { int cat; int mask; const char *string; } const categories[] =
    {
        { LC_CTYPE,          LC_CTYPE_MASK,          "LC_CTYPE" },
***************
*** 54,59 ****
--- 57,64 ----
  # endif
    };
  
+ #endif
+ 
  /* Test the gl_locale_name() function.  */
  static void
  test_locale_name (void)




reply via email to

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