]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Import from gnulib.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 2 Dec 2005 00:42:52 +0000 (00:42 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 2 Dec 2005 00:42:52 +0000 (00:42 +0000)
12 files changed:
lib/ChangeLog
lib/exclude.c
lib/intprops.h
lib/obstack.c
lib/obstack.h
lib/strtoimax.c
lib/utimecmp.c
m4/ChangeLog
m4/mbchar.m4
m4/mbiter.m4
m4/strcase.m4
m4/strstr.m4

index 18e7622605168c47cb1f9227574e1ae31fc872c3..73b7e2acfda8e0a80f59341836980ed82bbf44e7 100644 (file)
@@ -1,3 +1,38 @@
+2005-12-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Sync from gnulib.
+
+       * exclude.c: Include verify.h.
+       (verify): Remove.  All callers changed to use verify.h's version.
+       * strtoimax.c: Likewise.
+       * utimecmp.c: Likewis.e
+
+       * obstack.c [defined _LIBC && defined USE_IN_LIBIO]: Don't
+       include <wchar.h>; no longer needed.
+
+2005-12-01  Jim Meyering  <jim@meyering.net>
+
+       Sync from gnulib.
+
+       * intprops.h (signed_type_or_expr__): Define.
+       (INT_STRLEN_BOUND) [__GNUC__]: Use a slightly tighter bound
+       for unsigned types.
+
+2005-12-01  Jakub Jelinek  <jakub@redhat.com>
+       and  Ulrich Drepper  <drepper@redhat.com>
+
+       Import from libc via gnulib.
+       * obstack.c (print_and_abort) [defined _LIBC]: Use __fxprintf
+       instead of inline stream orientation test and two separate
+       function calls.  Pay no attention to USE_IN_LIBIO.
+
+2005-12-01  Roland McGrath  <roland@redhat.com>
+
+       Import from libc via gnulib.  [BZ #1331]
+       * obstack.h [!__STDC__] (obstack_int_grow_fast): Fix misnamed
+       macro argument.
+       Reported by Matej Vela <vela@debian.org>.
+
 2005-11-30  Jim Meyering  <jim@meyering.net>
 
        * openat-priv.h: New file, defining macros used by mkdirat.c
index de1a5c3f3b6a04f629a1767263275be4b18a7688..6a0c14974dd425c96644e875d5a079066bce0275 100644 (file)
@@ -37,6 +37,7 @@
 #include "fnmatch.h"
 #include "strcase.h"
 #include "xalloc.h"
+#include "verify.h"
 
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
@@ -54,9 +55,6 @@ is_space (unsigned char c)
   return IN_CTYPE_DOMAIN (c) && isspace (c);
 }
 
-/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
-
 /* Non-GNU systems lack these options, so we don't need to check them.  */
 #ifndef FNM_CASEFOLD
 # define FNM_CASEFOLD 0
@@ -65,11 +63,10 @@ is_space (unsigned char c)
 # define FNM_LEADING_DIR 0
 #endif
 
-verify (EXCLUDE_macros_do_not_collide_with_FNM_macros,
-       (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
-         & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR
-            | FNM_CASEFOLD))
-        == 0));
+verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
+        & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR
+           | FNM_CASEFOLD))
+       == 0);
 
 /* An exclude pattern-options pair.  The options are fnmatch options
    ORed with EXCLUDE_* options.  */
index 65280b159f49a79785931cf97952c1cb2b171d93..34f971cbaad8c1a0504163d34cf766254dbf4002 100644 (file)
        ? (t) -1 \
        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
+/* Return zero if T can be determined to be an unsigned type.
+   Otherwise, return 1.
+   When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
+   tighter bound.  Otherwise, it overestimates the true bound by one byte
+   when applied to unsigned types of size 2, 4, 16, ... bytes.
+   The symbol signed_type_or_expr__ is private to this header file.  */
+#if __GNUC__ >= 2
+# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
+#else
+# define signed_type_or_expr__(t) 1
+#endif
+
 /* Bound on length of the string representing an integer type or expression T.
-   Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
+   Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
    add 1 for integer division truncation; add 1 more for a minus sign
    if needed.  */
 #define INT_STRLEN_BOUND(t) \
-  ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
+  ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
+   + signed_type_or_expr__ (t) + 1)
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
index f3ca2c2e06b0cf3c87f87e8b75c4956f081e4da9..6df0611d26f59e0799991fd7774ce2aa3c901c1c 100644 (file)
 # endif
 #endif
 
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
-
 #include <stddef.h>
 
 #ifndef ELIDE_CODE
@@ -433,12 +429,11 @@ print_and_abort (void)
      happen because the "memory exhausted" message appears in other places
      like this and the translation should be reused instead of creating
      a very similar string which requires a separate translation.  */
-# if defined _LIBC && defined USE_IN_LIBIO
-  if (_IO_fwide (stderr, 0) > 0)
-    __fwprintf (stderr, L"%s\n", _("memory exhausted"));
-  else
+# ifdef _LIBC
+  (void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
+# else
+  fprintf (stderr, "%s\n", _("memory exhausted"));
 # endif
-    fprintf (stderr, "%s\n", _("memory exhausted"));
   exit (obstack_exit_failure);
 }
 
index 940bc8051e41353a7c08961aabeea39013e1b464..95dd438ff7072b01a2cf5647f17a83b77a6d8fdd 100644 (file)
@@ -1,11 +1,7 @@
 /* obstack.h - object stack macros
-   Copyright (C) 1988-1994,1996-1999,2003,2004 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 /gd/gnu/lib.
-
-   NOTE: The canonical source of this file is maintained with the GNU C Library.
-   Bugs can be reported to bug-glibc@gnu.org.
+   Copyright (C) 1988-1994,1996-1999,2003,2004,2005
+       Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -464,7 +460,7 @@ __extension__                                                               \
   (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
 
 # define obstack_int_grow_fast(h,aint)                                 \
-  (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
+  (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
 
 # define obstack_blank(h,length)                                       \
 ( (h)->temp.tempint = (length),                                                \
index 43a690d24be1f8da514cbd31f1148bb57a6d347c..a15b84af3a7cf4ec0dd97f1c489aa85b94494a62 100644 (file)
@@ -32,8 +32,7 @@
 
 #include <stdlib.h>
 
-/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
+#include "verify.h"
 
 #ifdef UNSIGNED
 # ifndef HAVE_DECL_STRTOULL
@@ -68,15 +67,13 @@ INT
 strtoimax (char const *ptr, char **endptr, int base)
 {
 #if HAVE_LONG_LONG
-  verify (size_is_that_of_long_or_long_long,
-         (sizeof (INT) == sizeof (long int)
-          || sizeof (INT) == sizeof (long long int)));
+  verify (sizeof (INT) == sizeof (long int)
+         || sizeof (INT) == sizeof (long long int));
 
   if (sizeof (INT) != sizeof (long int))
     return strtoll (ptr, endptr, base);
 #else
-  verify (size_is_that_of_long,
-         sizeof (INT) == sizeof (long int));
+  verify (sizeof (INT) == sizeof (long int));
 #endif
 
   return strtol (ptr, endptr, base);
index 7308929f43ed70b3567fbbc297a59e1b194acb7f..9d07e9fd3ea3ad5f794ecb20b7025eda4c997b31 100644 (file)
 #include "stat-time.h"
 #include "timespec.h"
 #include "utimens.h"
+#include "verify.h"
 #include "xalloc.h"
 
-/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
-
 #ifndef MAX
 # define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
@@ -139,8 +137,8 @@ utimecmp (char const *dst_name,
 
      time_t might be unsigned.  */
 
-  verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
-  verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
+  verify (TYPE_IS_INTEGER (time_t));
+  verify (TYPE_TWOS_COMPLEMENT (int));
 
   /* Destination and source time stamps.  */
   time_t dst_s = dst_stat->st_mtime;
index 78cfe51285b3fe03bb84624cd458d436871ab833..fcc9f2af62bc97f71edb53652167c61c500a0936 100644 (file)
@@ -1,3 +1,18 @@
+2005-12-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * regex.m4 (gl_REGEX): Check whether off_t can be used in a switch
+       statement, to work around an HP-UX 10.20 compiler bug reported by
+       Peter O'Gorman.
+
+2005-12-01  Bruno Haible  <bruno@clisp.org>
+
+       Import from gnulib.
+       * mbchar.m4 (gl_MBCHAR): Check for wchar.h and wctype.h. Don't compile
+       mbchar.c if they are not both present.
+       * mbiter.m4 (gl_MBITER): Likewise.
+       * strstr.m4 (gl_PREREQ_STRSTR): Use AC_REQUIRE.
+       * strcase.m4 (gl_PREREQ_STRCASECMP): Likewise.
+
 2005-11-30  Jim Meyering  <jim@meyering.net>
 
        * openat.m4 (gl_FUNC_OPENAT): Require and compile mkdirat.c.
index 7657b6974011196bd2613409b69dae4b16c609bd..df351a6eb24ae2c53fb1d33dc8759188676c4bb6 100644 (file)
@@ -9,13 +9,12 @@ dnl From Bruno Haible.
 
 AC_DEFUN([gl_MBCHAR],
 [
-  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
-
-  case $ac_cv_header_wchar_h,$ac_cv_header_wctype_h in
-  yes,yes)
-    AC_LIBOBJ([mbchar]);;
-  esac
-
   AC_REQUIRE([AC_GNU_SOURCE])
-  :
+  dnl The following line is that so the user can test
+  dnl HAVE_WCHAR_H && HAVE_WCTYPE_H before #include "mbchar.h".
+  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+  dnl Compile mbchar.c only if HAVE_WCHAR_H && HAVE_WCTYPE_H.
+  if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then
+    AC_LIBOBJ([mbchar])
+  fi
 ])
index 3eb92bcca720b5444074fff2e852e6e0e05fed50..7d51af10dc5d830f7c5662d9c82763f624a90a4d 100644 (file)
@@ -1,4 +1,4 @@
-# mbiter.m4 serial 1
+# mbiter.m4 serial 2
 dnl Copyright (C) 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,5 +10,8 @@ dnl From Bruno Haible.
 AC_DEFUN([gl_MBITER],
 [
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  dnl The following line is that so the user can test HAVE_MBRTOWC before
+  dnl #include "mbiter.h" or "mbuiter.h".
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
   :
 ])
index 8a8ff3a451cf8afff9506be1d6691a90097e790e..6db401bb1b93d41f19b35f51ff4416ee8ec4dd97 100644 (file)
@@ -1,4 +1,4 @@
-# strcase.m4 serial 2
+# strcase.m4 serial 3
 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,8 @@ AC_DEFUN([gl_FUNC_STRNCASECMP],
 
 # Prerequisites of lib/strcasecmp.c.
 AC_DEFUN([gl_PREREQ_STRCASECMP], [
-  gl_FUNC_MBRTOWC
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  :
 ])
 
 # Prerequisites of lib/strncasecmp.c.
index aea809ebd15b1512e792daaf09d04cb2dc66cacb..a785d42866b1960b99e7d95bc7418d8719abb2e2 100644 (file)
@@ -1,4 +1,4 @@
-# strstr.m4 serial 4
+# strstr.m4 serial 5
 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,5 +14,6 @@ AC_DEFUN([gl_FUNC_STRSTR],
 
 # Prerequisites of lib/strstr.c.
 AC_DEFUN([gl_PREREQ_STRSTR], [
-  gl_FUNC_MBRTOWC
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  :
 ])