about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog36
-rw-r--r--locale/Versions1
-rw-r--r--locale/broken_cur_max.c5
-rw-r--r--manual/time.texi45
-rw-r--r--math/Makefile2
-rw-r--r--stdlib/Makefile4
-rw-r--r--sysdeps/generic/mp_clz_tab.c37
-rw-r--r--sysdeps/hppa/mp_clz_tab.c1
-rw-r--r--sysdeps/i386/mp_clz_tab.c1
-rw-r--r--sysdeps/powerpc/mp_clz_tab.c1
-rw-r--r--time/strftime.c35
11 files changed, 121 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 6811be82c8..ca6b9c9878 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2002-03-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* locale/broken_cur_max.c (__ctype_get_mb_cur_max): Use nl_langinfo.
+	* locale/Versions (_nl_current_LC_COLLATE, _nl_current_LC_CTYPE):
+	Remove.
+
+2002-03-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/generic/mp_clz_tab.c: New file.
+	* sysdeps/i386/mp_clz_tab.c: New file.
+	* sysdeps/hppa/mp_clz_tab.c: New file.
+	* sysdeps/powerpc/mp_clz_tab.c: New file.
+	* stdlib/Makefile (aux): Revert last patch.
+	* math/Makefile (gmp-objs): Likewise.
+
+2002-03-13  Paul Eggert  <eggert@twinsun.com>
+
+	* time/strftime.c: Comment fixes for references to obsolescent
+	standards, In most cases the simplest fix is to remove the
+	confusing comments.  Cross-referencing all the standards properly
+	is a bit of a pain, and it should be enough to put that info in
+	the documentation as I did in my recent time.texi patch.
+
+2002-03-13  Paul Eggert  <eggert@twinsun.com>
+
+	* manual/time.texi (Formatting Calendar Time):
+	ISO C99 also specifies the E and O modifiers.
+	%P is a GNU extension, and is not in ISO C99.
+	Mention that %r is equivalent to %I:%M:%S %p in the POSIX locale.
+	%T is also in ISO C99.
+	The RFC 822 example is not valid in arbitrary locales.
+	Reword the POSIX.2 wording slightly, to make it a bit clearer
+	that POSIX.2 formats are also supported by later POSIX versions.
+	If a format was introduced in ISO C99 it is also required by
+	POSIX.1-2001.
+
 2002-03-13  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/gnu/errlist.awk: Define _sys_errlist_internal and
diff --git a/locale/Versions b/locale/Versions
index 6bce99f5c5..094a392fac 100644
--- a/locale/Versions
+++ b/locale/Versions
@@ -50,6 +50,5 @@ libc {
     # global variables
     __collate_element_hash; __collate_element_strings;
     __collate_symbol_classes; __collate_symbol_hash; __collate_symbol_strings;
-    _nl_current_LC_COLLATE; _nl_current_LC_CTYPE;
   }
 }
diff --git a/locale/broken_cur_max.c b/locale/broken_cur_max.c
index c997bec163..bfdec32f4f 100644
--- a/locale/broken_cur_max.c
+++ b/locale/broken_cur_max.c
@@ -44,7 +44,8 @@
 size_t
 __ctype_get_mb_cur_max (void)
 {
-  size_t correct_value = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX);
+  union locale_data_value u;
 
-  return ((size_t []) { 1, 1, 1, 2, 2, 3, 4 })[correct_value];
+  u.string = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
+  return ((size_t []) { 1, 1, 1, 2, 2, 3, 4 })[u.word];
 }
diff --git a/manual/time.texi b/manual/time.texi
index eb5a36183e..e16a7294a2 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -1143,7 +1143,8 @@ the result is written right adjusted and space padded to the given
 size.
 
 An optional modifier can follow the optional flag and width
-specification.  The modifiers, which are POSIX.2 extensions, are:
+specification.  The modifiers, which were first standardized by
+POSIX.2-1992 and by @w{ISO C99}, are:
 
 @table @code
 @item E
@@ -1185,7 +1186,7 @@ The preferred calendar time representation for the current locale.
 The century of the year.  This is equivalent to the greatest integer not
 greater than the year divided by 100.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %d
 The day of the month as a decimal number (range @code{01} through @code{31}).
@@ -1193,19 +1194,19 @@ The day of the month as a decimal number (range @code{01} through @code{31}).
 @item %D
 The date using the format @code{%m/%d/%y}.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %e
 The day of the month like with @code{%d}, but padded with blank (range
 @code{ 1} through @code{31}).
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %F
 The date using the format @code{%Y-%m-%d}.  This is the form specified
 in the @w{ISO 8601} standard and is the preferred form for all uses.
 
-This format is a @w{ISO C99} extension.
+This format was first standardized by @w{ISO C99} and by POSIX.1-2001.
 
 @item %g
 The year corresponding to the ISO week number, but without the century
@@ -1213,7 +1214,7 @@ The year corresponding to the ISO week number, but without the century
 as @code{%y}, except that if the ISO week number (see @code{%V}) belongs
 to the previous or next year, that year is used instead.
 
-This format was introduced in @w{ISO C99}.
+This format was first standardized by @w{ISO C99} and by POSIX.1-2001.
 
 @item %G
 The year corresponding to the ISO week number.  This has the same format
@@ -1221,14 +1222,14 @@ and value as @code{%Y}, except that if the ISO week number (see
 @code{%V}) belongs to the previous or next year, that year is used
 instead.
 
-This format was introduced in @w{ISO C99} but was previously available
-as a GNU extension.
+This format was first standardized by @w{ISO C99} and by POSIX.1-2001
+but was previously available as a GNU extension.
 
 @item %h
 The abbreviated month name according to the current locale.  The action
 is the same as for @code{%b}.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %H
 The hour as a decimal number, using a 24-hour clock (range @code{00} through
@@ -1262,7 +1263,7 @@ The minute as a decimal number (range @code{00} through @code{59}).
 @item %n
 A single @samp{\n} (newline) character.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %p
 Either @samp{AM} or @samp{PM}, according to the given time value; or the
@@ -1278,19 +1279,19 @@ Either @samp{am} or @samp{pm}, according to the given time value; or the
 corresponding strings for the current locale, printed in lowercase
 characters.  Noon is treated as @samp{pm} and midnight as @samp{am}.
 
-This format was introduced in @w{ISO C99} but was previously available
-as a GNU extension.
+This format is a GNU extension.
 
 @item %r
 The complete calendar time using the AM/PM format of the current locale.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
+In the POSIX locale, this format is equivalent to @code{%I:%M:%S %p}.
 
 @item %R
 The hour and minute in decimal numbers using the format @code{%H:%M}.
 
-This format was introduced in @w{ISO C99} but was previously available
-as a GNU extension.
+This format was first standardized by @w{ISO C99} and by POSIX.1-2001
+but was previously available as a GNU extension.
 
 @item %s
 The number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC.
@@ -1304,18 +1305,18 @@ The seconds as a decimal number (range @code{00} through @code{60}).
 @item %t
 A single @samp{\t} (tabulator) character.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %T
 The time of day using decimal numbers using the format @code{%H:%M:%S}.
 
-This format is a POSIX.2 extension.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %u
 The day of the week as a decimal number (range @code{1} through
 @code{7}), Monday being @code{1}.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %U
 The week number of the current year as a decimal number (range @code{00}
@@ -1334,7 +1335,7 @@ The week before week @code{01} of a year is the last week (@code{52} or
 @code{53}) of the previous year even if it contains days from the new
 year.
 
-This format is a POSIX.2 extension and also appears in @w{ISO C99}.
+This format was first standardized by POSIX.2-1992 and by @w{ISO C99}.
 
 @item %w
 The day of the week as a decimal number (range @code{0} through
@@ -1365,10 +1366,10 @@ before the year @code{1} are numbered @code{0}, @code{-1}, and so on.
 @code{-0600} or @code{+0100}), or nothing if no time zone is
 determinable.
 
-This format was introduced in @w{ISO C99} but was previously available
-as a GNU extension.
+This format was first standardized by @w{ISO C99} and by POSIX.1-2001
+but was previously available as a GNU extension.
 
-A full @w{RFC 822} timestamp is generated by the format
+In the POSIX locale, a full @w{RFC 822} timestamp is generated by the format
 @w{@samp{"%a, %d %b %Y %H:%M:%S %z"}} (or the equivalent
 @w{@samp{"%a, %d %b %Y %T %z"}}).
 
diff --git a/math/Makefile b/math/Makefile
index f7e88f6fe1..2887aed649 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -183,7 +183,7 @@ o = .os
 endif
 gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%$o,\
 		      add_n sub_n cmp addmul_1 mul_1 mul_n divmod_1 \
-		      lshift rshift udiv_qrnnd inlines)
+		      lshift rshift mp_clz_tab udiv_qrnnd inlines)
 $(objpfx)atest-exp: $(gmp-objs)
 $(objpfx)atest-sincos: $(gmp-objs)
 $(objpfx)atest-exp2: $(gmp-objs)
diff --git a/stdlib/Makefile b/stdlib/Makefile
index b92e0315b5..ab6c8bf6a2 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -70,9 +70,7 @@ mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
 routines := $(strip $(routines) $(mpn-routines))	\
 	    dbl2mpn ldbl2mpn				\
 	    mpn2flt mpn2dbl mpn2ldbl
-# mp_clz seems not to be used.  At least on x86.  If removing the file
-# does not cause problem clean this up and actually remove the file.
-aux := fpioconst# mp_clz_tab
+aux := fpioconst mp_clz_tab
 distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
 
 generated += isomac isomac.out
diff --git a/sysdeps/generic/mp_clz_tab.c b/sysdeps/generic/mp_clz_tab.c
new file mode 100644
index 0000000000..520ea31930
--- /dev/null
+++ b/sysdeps/generic/mp_clz_tab.c
@@ -0,0 +1,37 @@
+/* __clz_tab -- support for longlong.h
+   Copyright (C) 1991, 1993, 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in the GNU MP Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if 0
+#include "gmp.h"
+#include "gmp-impl.h"
+#endif
+
+const
+unsigned char __clz_tab[] =
+{
+  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+};
diff --git a/sysdeps/hppa/mp_clz_tab.c b/sysdeps/hppa/mp_clz_tab.c
new file mode 100644
index 0000000000..52d06383c1
--- /dev/null
+++ b/sysdeps/hppa/mp_clz_tab.c
@@ -0,0 +1 @@
+/* __clz_tab not needed on hppa.  */
diff --git a/sysdeps/i386/mp_clz_tab.c b/sysdeps/i386/mp_clz_tab.c
new file mode 100644
index 0000000000..860f98cc62
--- /dev/null
+++ b/sysdeps/i386/mp_clz_tab.c
@@ -0,0 +1 @@
+/* __clz_tab not needed on i386.  */
diff --git a/sysdeps/powerpc/mp_clz_tab.c b/sysdeps/powerpc/mp_clz_tab.c
new file mode 100644
index 0000000000..4b5f29bfe5
--- /dev/null
+++ b/sysdeps/powerpc/mp_clz_tab.c
@@ -0,0 +1 @@
+/* __clz_tab not needed on powerpc.  */
diff --git a/time/strftime.c b/time/strftime.c
index bcbe4a8a5b..bae952aadb 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -535,9 +535,8 @@ my_strftime (s, maxsize, format, tp ut_argument)
     }
   else
     {
-      /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
-	 time zone names contained in the external variable `tzname' shall
-	 be set as if the tzset() function had been called.  */
+      /* POSIX.1 requires that local time zone information is used as
+	 though strftime called tzset.  */
 # if HAVE_TZSET
       tzset ();
 # endif
@@ -756,7 +755,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 #endif
 
 	case L_('b'):
-	case L_('h'):		/* POSIX.2 extension.  */
+	case L_('h'):
 	  if (change_case)
 	    {
 	      to_uppcase = 1;
@@ -851,7 +850,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  break;
 #endif
 
-	case L_('C'):		/* POSIX.2 extension.  */
+	case L_('C'):
 	  if (modifier == L_('O'))
 	    goto bad_format;
 	  if (modifier == L_('E'))
@@ -898,7 +897,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  /* Fall through.  */
 # endif
 #endif
-	case L_('D'):		/* POSIX.2 extension.  */
+	case L_('D'):
 	  if (modifier != 0)
 	    goto bad_format;
 	  subfmt = L_("%m/%d/%y");
@@ -910,7 +909,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 
 	  DO_NUMBER (2, tp->tm_mday);
 
-	case L_('e'):		/* POSIX.2 extension.  */
+	case L_('e'):
 	  if (modifier == L_('E'))
 	    goto bad_format;
 
@@ -1042,7 +1041,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 
 	  DO_NUMBER (2, tp->tm_mon + 1);
 
-	case L_('n'):		/* POSIX.2 extension.  */
+	case L_('n'):
 	  add (1, *p = L_('\n'));
 	  break;
 
@@ -1066,11 +1065,11 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  goto underlying_strftime;
 #endif
 
-	case L_('R'):		/* ISO C99 extension.  */
+	case L_('R'):
 	  subfmt = L_("%H:%M");
 	  goto subformat;
 
-	case L_('r'):		/* POSIX.2 extension.  */
+	case L_('r'):
 #ifdef _NL_CURRENT
 	  if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
 						       NLW(T_FMT_AMPM)))
@@ -1141,15 +1140,15 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  /* Fall through.  */
 # endif
 #endif
-	case L_('T'):		/* POSIX.2 extension.  */
+	case L_('T'):
 	  subfmt = L_("%H:%M:%S");
 	  goto subformat;
 
-	case L_('t'):		/* POSIX.2 extension.  */
+	case L_('t'):
 	  add (1, *p = L_('\t'));
 	  break;
 
-	case L_('u'):		/* POSIX.2 extension.  */
+	case L_('u'):
 	  DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
 
 	case L_('U'):
@@ -1159,8 +1158,8 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
 
 	case L_('V'):
-	case L_('g'):		/* ISO C99 extension.  */
-	case L_('G'):		/* ISO C99 extension.  */
+	case L_('g'):
+	case L_('G'):
 	  if (modifier == L_('E'))
 	    goto bad_format;
 	  {
@@ -1268,7 +1267,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	    zone = tzname[tp->tm_isdst];
 #endif
 	  if (! zone)
-	    zone = "";		/* POSIX.2 requires the empty string here.  */
+	    zone = "";
 
 #ifdef COMPILE_WIDE
 	  {
@@ -1284,7 +1283,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
 #endif
 	  break;
 
-	case L_('z'):		/* ISO C99 extension.  */
+	case L_('z'):
 	  if (tp->tm_isdst < 0)
 	    break;