+2002-11-20 Roland McGrath <roland@redhat.com>
+
+ * scripts/abilist.awk: Grok function descriptor symbols.
+
+ * intl/tst-gettext.c (main): Check return values from setlocale.
+ Add necessary unsetenv's to make LANG=existing-locale check work.
+
+ * intl/tst-gettext.sh: Use mkdir -p. Copy test files unconditionally,
+ so aborted prior runs don't confuse things.
+
+ * locale/localeinfo.h (struct locale_data: union locale_data_value):
+ Use uintptr_t instead of unsigned int for `word' member.
+ (_NL_CURRENT_WORD): Cast to uint32_t.
+
+ * posix/bug-regex5.c (main): Use union to extract _NL_COLLATE_NRULES
+ value.
+
2002-11-20 Ulrich Drepper <drepper@redhat.com>
* elf/tls-macros.h: Add IA-64 definitions.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <error.h>
+#include <errno.h>
const struct
static int negative_dcgettext_test (const char *domain, int category);
+#define check_setlocale(cat, name) do { \
+ if (setlocale (cat, name) == NULL) \
+ { \
+ printf ("%s:%u: setlocale (%s, \"%s\"): %m\n", \
+ __FILE__, __LINE__, #cat, name); \
+ result = 1; \
+ } \
+ } while (0)
+
int
main (int argc, char *argv[])
{
setenv ("LC_MESSAGES", "non-existing-locale", 1);
setenv ("LC_CTYPE", "non-existing-locale", 1);
setenv ("LANG", "non-existing-locale", 1);
- setlocale (LC_CTYPE, "de_DE.ISO-8859-1");
- setlocale (LC_MESSAGES, "de_DE.ISO-8859-1");
+ check_setlocale (LC_CTYPE, "de_DE.ISO-8859-1");
+ check_setlocale (LC_MESSAGES, "de_DE.ISO-8859-1");
unsetenv ("OUTPUT_CHARSET");
/* This is the name of the existing domain with a catalog for the
LC_MESSAGES category. */
/* Now the same tests with LC_ALL deciding. */
unsetenv ("LANGUAGE");
setenv ("LC_ALL", "existing-locale", 1);
- setlocale (LC_ALL, "");
+ check_setlocale (LC_ALL, "");
puts ("test `gettext' with LC_ALL set");
/* This is the name of the existing domain with a catalog for the
LC_MESSAGES category. */
/* Now the same tests with LC_MESSAGES deciding. */
unsetenv ("LC_ALL");
setenv ("LC_MESSAGES", "existing-locale", 1);
- setlocale (LC_MESSAGES, "");
+ check_setlocale (LC_MESSAGES, "");
setenv ("LC_TIME", "existing-locale", 1);
- setlocale (LC_TIME, "");
+ check_setlocale (LC_TIME, "");
setenv ("LC_NUMERIC", "non-existing-locale", 1);
- setlocale (LC_NUMERIC, "");
+ char *what = setlocale (LC_NUMERIC, "");
+ if (what != NULL)
+ {
+ printf ("setlocale succeeded (%s), expected failure\n", what);
+ result = 1;
+ }
+
puts ("test `gettext' with LC_ALL set");
/* This is the name of the existing domain with a catalog for the
LC_MESSAGES category. */
/* Now the same tests with LANG deciding. */
unsetenv ("LC_MESSAGES");
+ unsetenv ("LC_CTYPE");
+ unsetenv ("LC_TIME");
+ unsetenv ("LC_NUMERIC");
setenv ("LANG", "existing-locale", 1);
- setlocale (LC_ALL, "");
+ check_setlocale (LC_ALL, "");
/* This is the name of the existing domain with a catalog for the
LC_MESSAGES category. */
textdomain ("existing-domain");
result = 1;
}
- setlocale (LC_ALL, "C");
+ check_setlocale (LC_ALL, "C");
return result;
}
{
const uint32_t *wstr;
const char *string;
- unsigned int word;
+ /* The values we store here are always uint32_t in fact. But it's
+ safer for the union to use a type that matches pointers so that
+ casting one of the pointer values to uint32_t produces the right
+ value for big-endian 64-bit platforms. */
+ uintptr_t word;
}
values __flexarr; /* Items, usually pointers into `filedata'. */
};
/* Extract the current CATEGORY locale's word for ITEM. */
#define _NL_CURRENT_WORD(category, item) \
- ((*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].word)
+ ((uint32_t) (*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].word)
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
#define _NL_CURRENT_DEFINE(category) \
/* Extract the current CATEGORY locale's word for ITEM. */
# define _NL_CURRENT_WORD(category, item) \
- (_NL_CURRENT_DATA (category)->values[_NL_ITEM_INDEX (item)].word)
+ ((uint32_t) _NL_CURRENT_DATA (category)->values[_NL_ITEM_INDEX (item)].word)
/* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY. */
# define _NL_CURRENT_DEFINE(category) \