about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--intl/tst-gettext.c36
-rw-r--r--locale/localeinfo.h10
-rw-r--r--posix/bug-regex5.c3
-rw-r--r--scripts/abilist.awk3
5 files changed, 57 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index fabe751674..9faa4cb93a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+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.
diff --git a/intl/tst-gettext.c b/intl/tst-gettext.c
index 55b8310dfa..8a768e03c5 100644
--- a/intl/tst-gettext.c
+++ b/intl/tst-gettext.c
@@ -24,6 +24,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <error.h>
+#include <errno.h>
 
 
 const struct
@@ -52,6 +54,15 @@ static int positive_dcgettext_test (const char *domain, int category);
 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[])
 {
@@ -76,8 +87,8 @@ 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.  */
@@ -108,7 +119,7 @@ main (int argc, char *argv[])
   /* 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.  */
@@ -138,11 +149,17 @@ main (int argc, char *argv[])
   /* 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.  */
@@ -191,8 +208,11 @@ main (int argc, char *argv[])
 
   /* 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");
@@ -219,7 +239,7 @@ main (int argc, char *argv[])
       result = 1;
     }
 
-  setlocale (LC_ALL, "C");
+  check_setlocale (LC_ALL, "C");
 
   return result;
 }
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 28256e9a2b..a9fa1f41f0 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -78,7 +78,11 @@ struct locale_data
   {
     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'.  */
 };
@@ -232,7 +236,7 @@ extern __thread struct locale_data *const *_nl_current_##category \
 
 /* 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) \
@@ -268,7 +272,7 @@ extern __thread struct locale_data *const *_nl_current_##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) \
diff --git a/posix/bug-regex5.c b/posix/bug-regex5.c
index 9d0eef1e2f..ee4d652157 100644
--- a/posix/bug-regex5.c
+++ b/posix/bug-regex5.c
@@ -21,7 +21,8 @@ main (void)
     }
   printf ("current locale : %s\n", ca);
 
-  nrules = (size_t) nl_langinfo (_NL_COLLATE_NRULES);
+  u.string = nl_langinfo (_NL_COLLATE_NRULES);
+  nrules = u.word;
   if (nrules == 0)
     {
       printf("No rule\n");
diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index 385e85da80..cd030e4c9d 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -25,6 +25,9 @@ $2 == "g" || $2 == "w" && NF == 7 {
   if (type == "D" && $4 == ".tbss") {
     print symbol, version, weak, "TLS", size | outpipe;
   }
+  else if (type == "D" && $4 == ".opd") {
+    print symbol, version, weak, "FDESC" | outpipe;
+  }
   else if (type == "DO" && $4 == "*ABS*") {
     print symbol, version, weak, "ABS" | outpipe;
   }