bug-coreutils
[Top][All Lists]
Advanced

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

import some lib and m4 changes from gnulib


From: Paul Eggert
Subject: import some lib and m4 changes from gnulib
Date: Thu, 01 Dec 2005 16:44:59 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

I installed this into coreutils to keep things a bit more in sync:

2005-12-01  Paul Eggert  <address@hidden>

        Sync from gnulib.

        * lib/exclude.c: Include verify.h.
        (verify): Remove.  All callers changed to use verify.h's version.
        * lib/strtoimax.c: Likewise.
        * lib/utimecmp.c: Likewis.e

        * lib/obstack.c [defined _LIBC && defined USE_IN_LIBIO]: Don't
        include <wchar.h>; no longer needed.

2005-12-01  Jim Meyering  <address@hidden>

        Sync from gnulib.

        * lib/intprops.h (signed_type_or_expr__): Define.
        (INT_STRLEN_BOUND) [__GNUC__]: Use a slightly tighter bound
        for unsigned types.

2005-12-01  Jakub Jelinek  <address@hidden>
       and  Ulrich Drepper  <address@hidden>

        Import from libc via gnulib.
        * lib/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  <address@hidden>

        Import from libc via gnulib.  [BZ #1331]
        * lib/obstack.h [!__STDC__] (obstack_int_grow_fast): Fix misnamed
        macro argument.
        Reported by Matej Vela <address@hidden>.

2005-12-01  Bruno Haible  <address@hidden>

        Import from gnulib.
        * m4/mbchar.m4 (gl_MBCHAR): Check for wchar.h and wctype.h.
        Don't compile mbchar.c if they are not both present.
        * m4/mbiter.m4 (gl_MBITER): Likewise.
        * m4/strstr.m4 (gl_PREREQ_STRSTR): Use AC_REQUIRE.
        * m4/strcase.m4 (gl_PREREQ_STRCASECMP): Likewise.


Index: lib/exclude.c
===================================================================
RCS file: /fetish/cu/lib/exclude.c,v
retrieving revision 1.26
diff -p -u -r1.26 exclude.c
--- lib/exclude.c       22 Sep 2005 06:05:39 -0000      1.26
+++ lib/exclude.c       2 Dec 2005 00:34:13 -0000
@@ -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: lib/intprops.h
===================================================================
RCS file: /fetish/cu/lib/intprops.h,v
retrieving revision 1.5
diff -p -u -r1.5 intprops.h
--- lib/intprops.h      14 May 2005 07:58:06 -0000      1.5
+++ lib/intprops.h      2 Dec 2005 00:34:13 -0000
@@ -53,12 +53,25 @@
        ? (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: lib/obstack.c
===================================================================
RCS file: /fetish/cu/lib/obstack.c,v
retrieving revision 1.31
diff -p -u -r1.31 obstack.c
--- lib/obstack.c       14 May 2005 07:58:06 -0000      1.31
+++ lib/obstack.c       2 Dec 2005 00:34:14 -0000
@@ -51,10 +51,6 @@
 # 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: lib/obstack.h
===================================================================
RCS file: /fetish/cu/lib/obstack.h,v
retrieving revision 1.31
diff -p -u -r1.31 obstack.h
--- lib/obstack.h       14 May 2005 07:58:06 -0000      1.31
+++ lib/obstack.h       2 Dec 2005 00:34:14 -0000
@@ -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 address@hidden
+   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: lib/strtoimax.c
===================================================================
RCS file: /fetish/cu/lib/strtoimax.c,v
retrieving revision 1.13
diff -p -u -r1.13 strtoimax.c
--- lib/strtoimax.c     22 Sep 2005 06:05:39 -0000      1.13
+++ lib/strtoimax.c     2 Dec 2005 00:34:14 -0000
@@ -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: lib/utimecmp.c
===================================================================
RCS file: /fetish/cu/lib/utimecmp.c,v
retrieving revision 1.5
diff -p -u -r1.5 utimecmp.c
--- lib/utimecmp.c      22 Sep 2005 06:05:39 -0000      1.5
+++ lib/utimecmp.c      2 Dec 2005 00:34:14 -0000
@@ -39,11 +39,9 @@
 #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: m4/mbchar.m4
===================================================================
RCS file: /fetish/cu/m4/mbchar.m4,v
retrieving revision 1.2
diff -p -u -r1.2 mbchar.m4
--- m4/mbchar.m4        24 Sep 2005 23:13:19 -0000      1.2
+++ m4/mbchar.m4        2 Dec 2005 00:34:14 -0000
@@ -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: m4/mbiter.m4
===================================================================
RCS file: /fetish/cu/m4/mbiter.m4,v
retrieving revision 1.1
diff -p -u -r1.1 mbiter.m4
--- m4/mbiter.m4        22 Sep 2005 06:22:44 -0000      1.1
+++ m4/mbiter.m4        2 Dec 2005 00:34:14 -0000
@@ -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: m4/strcase.m4
===================================================================
RCS file: /fetish/cu/m4/strcase.m4,v
retrieving revision 1.3
diff -p -u -r1.3 strcase.m4
--- m4/strcase.m4       22 Sep 2005 06:44:26 -0000      1.3
+++ m4/strcase.m4       2 Dec 2005 00:34:14 -0000
@@ -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: m4/strstr.m4
===================================================================
RCS file: /fetish/cu/m4/strstr.m4,v
retrieving revision 1.4
diff -p -u -r1.4 strstr.m4
--- m4/strstr.m4        22 Sep 2005 06:44:26 -0000      1.4
+++ m4/strstr.m4        2 Dec 2005 00:34:14 -0000
@@ -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])
+  :
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]