+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
#include "fnmatch.h"
#include "strcase.h"
#include "xalloc.h"
+#include "verify.h"
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
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
# 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. */
? (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. */
# endif
#endif
-#if defined _LIBC && defined USE_IN_LIBIO
-# include <wchar.h>
-#endif
-
#include <stddef.h>
#ifndef ELIDE_CODE
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);
}
/* 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
(((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), \
#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
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);
#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
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;
+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.
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
])
-# 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,
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])
:
])
-# 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,
# Prerequisites of lib/strcasecmp.c.
AC_DEFUN([gl_PREREQ_STRCASECMP], [
- gl_FUNC_MBRTOWC
+ AC_REQUIRE([gl_FUNC_MBRTOWC])
+ :
])
# Prerequisites of lib/strncasecmp.c.
-# 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,
# Prerequisites of lib/strstr.c.
AC_DEFUN([gl_PREREQ_STRSTR], [
- gl_FUNC_MBRTOWC
+ AC_REQUIRE([gl_FUNC_MBRTOWC])
+ :
])