Subject: bug#18051: trunk r117751: Improve robustness of new string-collation code.

From: Katsumi Yamaoka <[email-masked]>
Date: Thu, 28 Aug 2014 08:57:19 +0900

On Wed, 27 Aug 2014 18:56:52 +0000, Paul Eggert wrote:
> ------------------------------------------------------------
> revno: 117751
[...]
> message:
>   Improve robustness of new string-collation code.

>   * configure.ac (newlocale): Check for this, not for uselocale.
>   * src/sysdep.c (LC_COLLATE, LC_COLLATE_MASK, freelocale, locale_t)
>   (newlocale, wcscoll_l): Define substitutes for platforms that
>   lack them, so as to simplify the mainline code.
>   (str_collate): Simplify the code by assuming the above definitions.
>   Use wcscoll_l, not uselocale, as uselocale is too fragile.  For
>   example, the old version left the Emacs in the wrong locale if
>   wcscoll reported an error.  Use 'int', not ptrdiff_t, for the int
>   result.  Report an error if newlocale fails.

Emacs build gets stopped on Cygwin probably due to this change.

gcc [...options below...] sysdep.c
sysdep.c: In function 'str_collate':
sysdep.c:3706:33: error: 'LC_COLLATE_MASK' undeclared (first use in this function)
       locale_t loc = newlocale (LC_COLLATE_MASK, SSDATA (lc_collate), 0);
                                 ^
sysdep.c:3706:33: note: each undeclared identifier is reported only once for each function it appears in
Makefile:336: recipe for target 'sysdep.o' failed
make[1]: *** [sysdep.o] Error 1

Thanks.

gcc options:
-std=gnu99 -c -Demacs -I. -I. -I../lib -I../lib -D_REENTRANT
-I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ I/usr/include/cairo
--I/usr/include/pango-1.0 I/usr/include/harfbuzz -I/usr/include/pango-1.0
-I/usr/include/atk-1.0 -I/usr/include/cairo I/usr/include/pixman-1
--I/usr/include/freetype2 I/usr/include/libpng15 -I/usr/include/freetype2
-I/usr/include/libpng15 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/libpng15 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2
-I/usr/include/libpng15 -I/usr/include/freetype2 I/usr/include/libpng15
--D_REENTRANT -I/usr/include/librsvg-2.0 I/usr/include/gdk-pixbuf-2.0
--I/usr/include/libpng15 I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng15 I/usr/include/freetype2
--I/usr/include/libpng15 -fopenmp I/usr/include/ImageMagick
--I/usr/include/libpng15 I/usr/include/libxml2 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -D_REENTRANT I/usr/include/glib-2.0
--I/usr/lib/glib-2.0/include D_REENTRANT -I/usr/include/gconf/2
--I/usr/include/dbus-1.0 I/usr/lib/dbus-1.0/include
--I/usr/include/glib-2.0 I/usr/lib/glib-2.0/include
--I/usr/include/glib-2.0 I/usr/lib/glib-2.0/include
--I/usr/include/freetype2 I/usr/include/libpng15 -I/usr/include/freetype2
-I/usr/include/libpng15 -I/usr/include/freetype2 I/usr/include/libpng15
--MMD -MF deps/sysdep.d -MP I/usr/include/p11-kit-1 -D_REENTRANT
--I/usr/include/glib-2.0 I/usr/lib/glib-2.0/include -g3 -O2