Daniel Richard G. wrote: > I can now get past the library build, but then get errors compiling > test-duplocale.c and test-locale.c. The former fails at line 26: > > SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); > > The latter fails at line 49: > > locale_t b = LC_GLOBAL_LOCALE; > > These tests probably don't make sense without the locale_t type.
This should fix it. Thanks for the feedback. 2019-12-13 Bruno Haible <br...@clisp.org> locale, duplocale, localename: Fix errors if locale_t does not exist. Reported by Daniel Richard G. in <https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00078.html>. * lib/locale.in.h (HAVE_WORKING_NEWLOCALE, HAVE_WORKING_DUPLOCALE): New macros. * tests/test-locale.c: Test HAVE_WORKING_NEWLOCALE instead of HAVE_NEWLOCALE. * tests/test-localename.c: Likewise. * tests/test-duplocale.c: Test HAVE_WORKING_DUPLOCALE instead of HAVE_DUPLOCALE. * tests/test-locale-c++.cc: Likewise. diff --git a/lib/locale.in.h b/lib/locale.in.h index 77b8b3b..c0915a5 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.h @@ -227,6 +227,9 @@ _GL_CXXALIAS_SYS (newlocale, locale_t, # if @HAVE_NEWLOCALE@ _GL_CXXALIASWARN (newlocale); # endif +# ifndef HAVE_WORKING_NEWLOCALE +# define HAVE_WORKING_NEWLOCALE 1 +# endif #elif defined GNULIB_POSIXCHECK # undef newlocale # if HAVE_RAW_DECL_NEWLOCALE @@ -251,6 +254,9 @@ _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); # if @HAVE_DUPLOCALE@ _GL_CXXALIASWARN (duplocale); # endif +# ifndef HAVE_WORKING_DUPLOCALE +# define HAVE_WORKING_DUPLOCALE 1 +# endif #elif defined GNULIB_POSIXCHECK # undef duplocale # if HAVE_RAW_DECL_DUPLOCALE diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c index 3313c83..a0f699e 100644 --- a/tests/test-duplocale.c +++ b/tests/test-duplocale.c @@ -20,7 +20,7 @@ #include <locale.h> -#if HAVE_DUPLOCALE +#if HAVE_WORKING_DUPLOCALE #include "signature.h" SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); diff --git a/tests/test-locale-c++.cc b/tests/test-locale-c++.cc index ae24705..84abe9d 100644 --- a/tests/test-locale-c++.cc +++ b/tests/test-locale-c++.cc @@ -36,7 +36,7 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::setlocale, char *, (int, const char *)); SIGNATURE_CHECK (GNULIB_NAMESPACE::newlocale, locale_t, (int, const char *, locale_t)); #endif -#if GNULIB_TEST_DUPLOCALE && HAVE_DUPLOCALE +#if GNULIB_TEST_DUPLOCALE && HAVE_WORKING_DUPLOCALE SIGNATURE_CHECK (GNULIB_NAMESPACE::duplocale, locale_t, (locale_t)); #endif diff --git a/tests/test-locale.c b/tests/test-locale.c index 91deeed..80ca924 100644 --- a/tests/test-locale.c +++ b/tests/test-locale.c @@ -44,7 +44,7 @@ verify (sizeof NULL == sizeof (void *)); int main () { -#if HAVE_NEWLOCALE +#if HAVE_WORKING_NEWLOCALE /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */ locale_t b = LC_GLOBAL_LOCALE; (void) b; diff --git a/tests/test-localename.c b/tests/test-localename.c index 77699d9..5a52748 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -26,7 +26,7 @@ #include "macros.h" -#if HAVE_NEWLOCALE && HAVE_WORKING_USELOCALE && !HAVE_FAKE_LOCALES +#if HAVE_WORKING_NEWLOCALE && HAVE_WORKING_USELOCALE && !HAVE_FAKE_LOCALES # define HAVE_GOOD_USELOCALE 1 #endif