[PATCH] nl_langinfo: Add NL_LOCALE_NAME macro

Corinna Vinschen vinschen@redhat.com
Fri Jan 20 09:34:00 GMT 2017

Hi Eric,

On Jan 19 20:45, Eric Blake wrote:
> Provide an extension NL_LOCALE_NAME() macro, with semantics
> matching glibc, which can be used as:
>   nl_langinfo_l(NL_LOCALE_NAME(LC_MESSAGES), locale);
> to get back the locale string that locale was originally
> created with during newlocale(). This in turn allows a library
> (such as gettext) to determine what thread-local locale settings
> it has inherited from the main program without having to be told
> what parameters were passed to newlocale(), for less overall
> coupling between parts of the program.
> gnulib is set up to use the extension:
> https://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00129.html
> * libc/include/langinfo.h (NL_LOCALE_NAME): New macro
> * libc/locale/nl_langinfo.c (nl_langinfo_l): Expose locale names
> of a locale_t's category components.
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---

Thanks for this patch but...  did you actually try building with your
patch?  I'm getting undefined references to NL_LOCALE_NAME in

The reason is a missing #define _GNU_SOURCE.

I added this to your patch and pushed it.


Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170120/4a16124b/attachment.sig>

More information about the Newlib mailing list