[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8864 - in /fsf/trunk/libc: ./ locale/ nptl/ nptl/sysdeps/unix/sysv/linux/bits/ nptl_db/ posix/ stdio-common/



Author: eglibc
Date: Mon Aug 24 00:04:08 2009
New Revision: 8864

Log:
Import glibc-mainline for 2009-08-24

Added:
    fsf/trunk/libc/posix/bug-regex29.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/locale/locale.h
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
    fsf/trunk/libc/nptl_db/ChangeLog
    fsf/trunk/libc/nptl_db/td_ta_map_lwp2thr.c
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/posix/regcomp.c
    fsf/trunk/libc/posix/unistd.h
    fsf/trunk/libc/stdio-common/printf_fp.c
    fsf/trunk/libc/stdio-common/printf_fphex.c
    fsf/trunk/libc/stdio-common/tstdiomisc.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Aug 24 00:04:08 2009
@@ -1,3 +1,21 @@
+2009-08-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* posix/regcomp.c (parse_dup_op): Verify the expression is correctly
+	terminated.
+	* posix/Makefile (tests): Add bug-regex29.
+	* posix/bug-regex29.c: New file.
+
+	* posix/unistd.h: Define _POSIX_VERSION and _POSIX2_* correctly if
+	older POSIX versions are selected.
+
+	* stdio-common/printf_fp.c: ISO C expects to print the sign of NaN
+	as well.
+	* stdio-common/printf_fphex.c: Likewise.
+	* stdio-common/tstdiomisc.c: Add more tests.
+
+	* locale/locale.h: Include xlocale.h and the thread-local locale
+	declarations for XPG7, not XPG6.
+
 2009-08-21  Andreas Schwab  <schwab@xxxxxxxxxx>
 
 	* sysdeps/powerpc/powerpc32/____longjmp_chk.S: Removed.

Modified: fsf/trunk/libc/locale/locale.h
==============================================================================
--- fsf/trunk/libc/locale/locale.h (original)
+++ fsf/trunk/libc/locale/locale.h Mon Aug 24 00:04:08 2009
@@ -130,7 +130,7 @@
 __END_NAMESPACE_STD
 
 
-#ifdef	__USE_XOPEN2K
+#ifdef	__USE_XOPEN2K8
 /* The concept of one static locale per category is not very well
    thought out.  Many applications will need to process its data using
    information from several different locales.  Another application is

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Mon Aug 24 00:04:08 2009
@@ -1,3 +1,7 @@
+2009-08-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/bits/posix_opt.h: Clean up namespace.
+
 2009-08-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S: Add CFI

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h Mon Aug 24 00:04:08 2009
@@ -85,15 +85,17 @@
 /* We support priority inheritence.  */
 #define _POSIX_THREAD_PRIO_INHERIT	200809L
 
-/* We support priority inheritence for robust mutexes.  */
-#define _POSIX_THREAD_ROBUST_PRIO_INHERIT	200809L
-
 /* We support priority protection, though only for non-robust
    mutexes.  */
 #define _POSIX_THREAD_PRIO_PROTECT	200809L
 
+#ifdef __USE_XOPEN2K8
+/* We support priority inheritence for robust mutexes.  */
+# define _POSIX_THREAD_ROBUST_PRIO_INHERIT	200809L
+
 /* We do not support priority protection for robust mutexes.  */
-#define _POSIX_THREAD_ROBUST_PRIO_PROTECT	-1
+# define _POSIX_THREAD_ROBUST_PRIO_PROTECT	-1
+#endif
 
 /* We support POSIX.1b semaphores.  */
 #define _POSIX_SEMAPHORES	200809L

Modified: fsf/trunk/libc/nptl_db/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl_db/ChangeLog (original)
+++ fsf/trunk/libc/nptl_db/ChangeLog Mon Aug 24 00:04:08 2009
@@ -1,3 +1,10 @@
+2009-08-23  Roland McGrath  <roland@xxxxxxxxxx>
+
+	* td_ta_map_lwp2thr.c (__td_ta_lookup_th_unique): Move ta_ok check
+	and LOG call back to ...
+	(td_ta_map_lwp2thr): ... here.
+	Reported by Maciej W. Rozycki <macro@xxxxxxxxxxxxxxxx>.
+
 2009-05-25  Aurelien Jarno  <aurelien@xxxxxxxxxxx>
 
 	[BZ #10200]

Modified: fsf/trunk/libc/nptl_db/td_ta_map_lwp2thr.c
==============================================================================
--- fsf/trunk/libc/nptl_db/td_ta_map_lwp2thr.c (original)
+++ fsf/trunk/libc/nptl_db/td_ta_map_lwp2thr.c Mon Aug 24 00:04:08 2009
@@ -1,5 +1,5 @@
 /* Which thread is running on an LWP?
-   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003,2004,2007,2009 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
@@ -32,12 +32,6 @@
   td_err_e terr;
   prgregset_t regs;
   psaddr_t addr;
-
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
 
   if (ta->ta_howto == ta_howto_unknown)
     {
@@ -181,6 +175,12 @@
 {
   td_thragent_t *const ta = (td_thragent_t *) ta_arg;
 
+  LOG ("td_ta_map_lwp2thr");
+
+  /* Test whether the TA parameter is ok.  */
+  if (! ta_ok (ta))
+    return TD_BADTA;
+
   /* We cannot rely on thread registers and such information at all
      before __pthread_initialize_minimal has gotten far enough.  They
      sometimes contain garbage that would confuse us, left by the kernel

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Mon Aug 24 00:04:08 2009
@@ -82,6 +82,7 @@
 		   bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
 		   bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
 		   bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
+		   bug-regex29 \
 		   tst-nice tst-nanosleep tst-regex2 \
 		   transbug tst-rxspencer tst-pcre tst-boost \
 		   bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \

Added: fsf/trunk/libc/posix/bug-regex29.c
==============================================================================
--- fsf/trunk/libc/posix/bug-regex29.c (added)
+++ fsf/trunk/libc/posix/bug-regex29.c Mon Aug 24 00:04:08 2009
@@ -1,0 +1,15 @@
+#include <regex.h>
+
+static int
+do_test (void)
+{
+  regex_t r;
+  int e = regcomp(&r, "xy\\{4,5,7\\}zabc", 0);
+  char buf[100];
+  regerror(e, &r, buf, sizeof (buf));
+  printf ("e = %d (%s)\n", e, buf);
+  return e != REG_BADBR;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/posix/regcomp.c
==============================================================================
--- fsf/trunk/libc/posix/regcomp.c (original)
+++ fsf/trunk/libc/posix/regcomp.c Mon Aug 24 00:04:08 2009
@@ -2481,7 +2481,7 @@
 	  return elem;
 	}
 
-      if (BE (end != -1 && start > end, 0))
+      if (BE ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM, 0))
 	{
 	  /* First number greater than second.  */
 	  *err = REG_BADBR;

Modified: fsf/trunk/libc/posix/unistd.h
==============================================================================
--- fsf/trunk/libc/posix/unistd.h (original)
+++ fsf/trunk/libc/posix/unistd.h Mon Aug 24 00:04:08 2009
@@ -30,30 +30,58 @@
 /* These may be used to determine what facilities are present at compile time.
    Their values can be obtained at run time from `sysconf'.  */
 
+#ifdef __USE_XOPEN2K8
 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008.  */
-#define	_POSIX_VERSION	200809L
+# define _POSIX_VERSION	200809L
+#elif defined __USE_XOPEN2K
+/* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001.  */
+# define _POSIX_VERSION	200112L
+#elif defined __USE_POSIX199506
+/* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995.  */
+# define _POSIX_VERSION	199506L
+#elif defined __USE_POSIX199309
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993.  */
+# define _POSIX_VERSION	199309L
+#else
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990.  */
+# define _POSIX_VERSION	199009L
+#endif
 
 /* These are not #ifdef __USE_POSIX2 because they are
    in the theoretically application-owned namespace.  */
 
+#ifdef __USE_XOPEN2K8
+# define __POSIX2_THIS_VERSION	200809L
 /* The utilities on GNU systems also correspond to this version.  */
-#define _POSIX2_VERSION	200809L
+#elif defined __USE_XOPEN2K
+/* The utilities on GNU systems also correspond to this version.  */
+# define __POSIX2_THIS_VERSION	200112L
+#elif defined __USE_POSIX199506
+/* The utilities on GNU systems also correspond to this version.  */
+# define __POSIX2_THIS_VERSION	199506L
+#else
+/* The utilities on GNU systems also correspond to this version.  */
+# define __POSIX2_THIS_VERSION	199209L
+#endif
+
+/* The utilities on GNU systems also correspond to this version.  */
+#define _POSIX2_VERSION	__POSIX2_THIS_VERSION
 
 /* If defined, the implementation supports the
    C Language Bindings Option.  */
-#define	_POSIX2_C_BIND	200809L
+#define	_POSIX2_C_BIND	__POSIX2_THIS_VERSION
 
 /* If defined, the implementation supports the
    C Language Development Utilities Option.  */
-#define	_POSIX2_C_DEV	200809L
+#define	_POSIX2_C_DEV	__POSIX2_THIS_VERSION
 
 /* If defined, the implementation supports the
    Software Development Utilities Option.  */
-#define	_POSIX2_SW_DEV	200809L
+#define	_POSIX2_SW_DEV	__POSIX2_THIS_VERSION
 
 /* If defined, the implementation supports the
    creation of locales with the localedef utility.  */
-#define _POSIX2_LOCALEDEF       200809L
+#define _POSIX2_LOCALEDEF       __POSIX2_THIS_VERSION
 
 /* X/Open version number to which the library conforms.  It is selectable.  */
 #ifdef __USE_XOPEN2K8

Modified: fsf/trunk/libc/stdio-common/printf_fp.c
==============================================================================
--- fsf/trunk/libc/stdio-common/printf_fp.c (original)
+++ fsf/trunk/libc/stdio-common/printf_fp.c Mon Aug 24 00:04:08 2009
@@ -28,6 +28,7 @@
 #include <float.h>
 #include <gmp-mparam.h>
 #include <gmp.h>
+#include <ieee754.h>
 #include <stdlib/gmp-impl.h>
 #include <stdlib/longlong.h>
 #include <stdlib/fpioconst.h>
@@ -335,6 +336,8 @@
       /* Check for special values: not a number or infinity.  */
       if (__isnanl (fpnum.ldbl))
 	{
+	  union ieee854_long_double u = { .d = fpnum.ldbl };
+	  is_neg = u.ieee.negative != 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";
@@ -345,10 +348,10 @@
 		special = "nan";
 		wspecial = L"nan";
 	      }
-	  is_neg = 0;
 	}
       else if (__isinfl (fpnum.ldbl))
 	{
+	  is_neg = fpnum.ldbl < 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "INF";
@@ -359,7 +362,6 @@
 	      special = "inf";
 	      wspecial = L"inf";
 	    }
-	  is_neg = fpnum.ldbl < 0;
 	}
       else
 	{
@@ -379,7 +381,8 @@
       /* Check for special values: not a number or infinity.  */
       if (__isnan (fpnum.dbl))
 	{
-	  is_neg = 0;
+	  union ieee754_double u = { .d = fpnum.dbl };
+	  is_neg = u.ieee.negative != 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";

Modified: fsf/trunk/libc/stdio-common/printf_fphex.c
==============================================================================
--- fsf/trunk/libc/stdio-common/printf_fphex.c (original)
+++ fsf/trunk/libc/stdio-common/printf_fphex.c Mon Aug 24 00:04:08 2009
@@ -172,6 +172,7 @@
       /* Check for special values: not a number or infinity.  */
       if (__isnanl (fpnum.ldbl.d))
 	{
+	  negative = fpnum.ldbl.ieee.negative != 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";
@@ -182,7 +183,6 @@
 	      special = "nan";
 	      wspecial = L"nan";
 	    }
-	  negative = 0;
 	}
       else
 	{
@@ -211,6 +211,7 @@
       /* Check for special values: not a number or infinity.  */
       if (__isnan (fpnum.dbl.d))
 	{
+	  negative = fpnum.dbl.ieee.negative != 0;
 	  if (isupper (info->spec))
 	    {
 	      special = "NAN";
@@ -221,7 +222,6 @@
 	      special = "nan";
 	      wspecial = L"nan";
 	    }
-	  negative = 0;
 	}
       else
 	{

Modified: fsf/trunk/libc/stdio-common/tstdiomisc.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tstdiomisc.c (original)
+++ fsf/trunk/libc/stdio-common/tstdiomisc.c Mon Aug 24 00:04:08 2009
@@ -47,33 +47,129 @@
 }
 
 volatile double nanval;
+volatile double infval;
+volatile long double lnanval;
+volatile long double linfval;
 
 
 static int
 F (void)
 {
-  char buf[20];
-  wchar_t wbuf[10];
+  char buf[80];
+  wchar_t wbuf[40];
   int result;
 
   nanval = NAN;
 
-  snprintf (buf, sizeof buf, "%f %F", nanval, nanval);
-  result = strcmp (buf, "nan NAN") != 0;
-  printf ("expected \"nan NAN\", got \"%s\"\n", buf);
+  snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+	    nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+  result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
+  printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
 
-  snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
-  result |= strcmp (buf, "inf INF") != 0;
-  printf ("expected \"inf INF\", got \"%s\"\n", buf);
+  snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+	    -nanval, -nanval, -nanval, -nanval,
+	    -nanval, -nanval, -nanval, -nanval);
+  result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+  printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
+	  buf);
 
-  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F", nanval, nanval);
-  result |= wcscmp (wbuf, L"nan NAN") != 0;
-  printf ("expected L\"nan NAN\", got L\"%S\"\n", wbuf);
+  infval = DBL_MAX * DBL_MAX;
 
-  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
-	    DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
-  result |= wcscmp (wbuf, L"inf INF") != 0;
-  printf ("expected L\"inf INF\", got L\"%S\"\n", wbuf);
+  snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+	    infval, infval, infval, infval, infval, infval, infval, infval);
+  result |= strcmp (buf, "inf INF inf INF inf INF inf INF") != 0;
+  printf ("expected \"inf INF inf INF inf INF inf INF\", got \"%s\"\n", buf);
+
+  snprintf (buf, sizeof buf, "%a %A %e %E %f %F %g %G",
+	    -infval, -infval, -infval, -infval,
+	    -infval, -infval, -infval, -infval);
+  result |= strcmp (buf, "-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+  printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+	  buf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+	    nanval, nanval, nanval, nanval, nanval, nanval, nanval, nanval);
+  result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
+  printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+	    -nanval, -nanval, -nanval, -nanval,
+	    -nanval, -nanval, -nanval, -nanval);
+  result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+  printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
+	  wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+	    infval, infval, infval, infval, infval, infval, infval, infval);
+  result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0;
+  printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
+	    -infval, -infval, -infval, -infval,
+	    -infval, -infval, -infval, -infval);
+  result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+  printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+	  wbuf);
+
+  lnanval = NAN;
+
+  snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    lnanval, lnanval, lnanval, lnanval,
+	    lnanval, lnanval, lnanval, lnanval);
+  result = strcmp (buf, "nan NAN nan NAN nan NAN nan NAN") != 0;
+  printf ("expected \"nan NAN nan NAN nan NAN nan NAN\", got \"%s\"\n", buf);
+
+  snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    -lnanval, -lnanval, -lnanval, -lnanval,
+	    -lnanval, -lnanval, -lnanval, -lnanval);
+  result = strcmp (buf, "-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+  printf ("expected \"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got \"%s\"\n",
+	  buf);
+
+  linfval = LDBL_MAX * LDBL_MAX;
+
+  snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    linfval, linfval, linfval, linfval,
+	    linfval, linfval, linfval, linfval);
+  result |= strcmp (buf, "inf INF inf INF inf INF inf INF") != 0;
+  printf ("expected \"inf INF inf INF inf INF inf INF\", got \"%s\"\n", buf);
+
+  snprintf (buf, sizeof buf, "%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    -linfval, -linfval, -linfval, -linfval,
+	    -linfval, -linfval, -linfval, -linfval);
+  result |= strcmp (buf, "-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+  printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
+	  buf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+	    L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    lnanval, lnanval, lnanval, lnanval,
+	    lnanval, lnanval, lnanval, lnanval);
+  result |= wcscmp (wbuf, L"nan NAN nan NAN nan NAN nan NAN") != 0;
+  printf ("expected L\"nan NAN nan NAN nan NAN nan NAN\", got L\"%S\"\n", wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+	    L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    -lnanval, -lnanval, -lnanval, -lnanval,
+	    -lnanval, -lnanval, -lnanval, -lnanval);
+  result |= wcscmp (wbuf, L"-nan -NAN -nan -NAN -nan -NAN -nan -NAN") != 0;
+  printf ("expected L\"-nan -NAN -nan -NAN -nan -NAN -nan -NAN\", got L\"%S\"\n",
+	  wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+	    L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    linfval, linfval, linfval, linfval,
+	    linfval, linfval, linfval, linfval);
+  result |= wcscmp (wbuf, L"inf INF inf INF inf INF inf INF") != 0;
+  printf ("expected L\"inf INF inf INF inf INF inf INF\", got L\"%S\"\n", wbuf);
+
+  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
+	    L"%La %LA %Le %LE %Lf %LF %Lg %LG",
+	    -linfval, -linfval, -linfval, -linfval,
+	    -linfval, -linfval, -linfval, -linfval);
+  result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
+  printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
+	  wbuf);
 
   return result;
 }