+2003-08-11 Bruno Haible <bruno@clisp.org>
+
+ * stdbool_.h: Update from gnulib.
+ 2003-08-11 Bruno Haible <bruno@clisp.org>
+ * stdbool_.h (_Bool): Undo last change; instead use a negative
+ enum value to ensure that _Bool promotes to int. Use #define
+ for _Bool when using the Solaris C compiler. Adds comments
+ suggested by Paul Eggert.
+ 2003-08-03 Paul Eggert <eggert@twinsun.com>
+ * stdbool_.h (_Bool): Make it signed char, instead of
+ an enum type, so that it's guaranteed to promote to int. See:
+ <http://mail.gnu.org/archive/html/bug-gnulib/2003-07/msg00124.html>
+
2003-05-28 Paul Eggert <eggert@twinsun.com>
* safe-read.c (CHAR_BIT): Don't define, since <limits.h> is guaranteed
* copy-file.c: Include <stddef.h>, for size_t.
+2003-03-03 Paul Eggert <eggert@twinsun.com>
+ Bruno Haible <bruno@clisp.org>
+
+ * mbswidth.h: Include <wchar.h>. Needed for UnixWare 7.1.1.
+ Reported by John Hughes, see
+ http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html
+
2003-01-28 Bruno Haible <bruno@clisp.org>
* c-ctype.h: Assume C_CTYPE_CONSECUTIVE_DIGITS.
Optimize.
Suggested by Paul Eggert.
+2003-01-23 Bruno Haible <bruno@clisp.org>
+
+ * minmax.h: Add comments from Paul Eggert.
+
+2002-11-15 Bruno Haible <bruno@clisp.org>
+
+ * strcspn.c: Include <stddef.h>.
+ * strpbrk.c: Minimize diffs to glibc. Include <stddef.h>.
+
2003-08-14 Bruno Haible <bruno@clisp.org>
* config.charset: Add support for Linux libc5. Based on data from
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2002 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
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
#include <stddef.h>
+/* Avoid a clash of our mbswidth() with a function of the same name defined
+ in UnixWare 7.1.1 <wchar.h>. We need this #include before the #define
+ below. */
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+
/* Optional flags to influence mbswidth/mbsnwidth behavior. */
/* If this bit is set, return -1 upon finding an invalid or incomplete
control characters and 1 otherwise. */
#define MBSW_REJECT_UNPRINTABLE 2
+
/* Returns the number of screen columns needed for STRING. */
#define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */
extern int mbswidth (const char *string, int flags);
#ifndef _MINMAX_H
#define _MINMAX_H
+/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
+ (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about
+ MIN, MAX macro redefinitions on some systems; the workaround is to
+ #include this file as the last one among the #include list. */
+
/* Before we define the following symbols we get the <limits.h> file
since otherwise we get redefinitions on some systems. */
#include <limits.h>
+/* Note: MIN and MAX should preferrably be used with two arguments of the
+ same type. They might not return the minimum and maximum of their two
+ arguments, if the arguments have different types or have unusual
+ floating-point values. For example, on a typical host with 32-bit 'int',
+ 64-bit 'long long', and 64-bit IEEE 754 'double' types:
+
+ MAX (-1, 2147483648) returns 4294967295.
+ MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
+ MAX (NaN, 0.0) returns 0.0.
+ MAX (+0.0, -0.0) returns -0.0.
+
+ and in each case the answer is in some sense bogus. */
+
/* MAX(a,b) returns the maximum of A and B. */
#ifndef MAX
# if __STDC__ && defined __GNUC__ && __GNUC__ >= 2
-/* Copyright (C) 2001-2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
/* ISO C 99 <stdbool.h> for platforms that lack it. */
+/* Usage suggestions:
+
+ Programs that use <stdbool.h> should be aware of some limitations
+ and standards compliance issues.
+
+ Standards compliance:
+
+ - <stdbool.h> must be #included before 'bool', 'false', 'true'
+ can be used.
+
+ - You cannot assume that sizeof (bool) == 1.
+
+ - Programs should not undefine the macros bool, true, and false,
+ as C99 lists that as an "obsolescent feature".
+
+ Limitations of this substitute, when used in a C89 environment:
+
+ - <stdbool.h> must be #included before the '_Bool' type can be used.
+
+ - You cannot assume that _Bool is a typedef; it might be a macro.
+
+ - In C99, casts and automatic conversions to '_Bool' or 'bool' are
+ performed in such a way that every nonzero value gets converted
+ to 'true', and zero gets converted to 'false'. This doesn't work
+ with this substitute. With this substitute, only the values 0 and 1
+ give the expected result when converted to _Bool' or 'bool'.
+
+ Also, it is suggested that programs use 'bool' rather than '_Bool';
+ this isn't required, but 'bool' is more common. */
+
+
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
# undef true
#endif
-/* For the sake of symbolic names in gdb, define _Bool as an enum type. */
+/* For the sake of symbolic names in gdb, we define true and false as
+ enum constants, not only as macros.
+ It is tempting to write
+ typedef enum { false = 0, true = 1 } _Bool;
+ so that gdb prints values of type 'bool' symbolically. But if we do
+ this, values of type '_Bool' may promote to 'int' or 'unsigned int'
+ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
+ (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
+ enum; this ensures that '_Bool' promotes to 'int'. */
#ifndef __cplusplus
# if !@HAVE__BOOL@
-typedef enum { false = 0, true = 1 } _Bool;
+# if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
+ /* Avoid stupid "warning: _Bool is a keyword in ISO C99". */
+# define _Bool signed char
+enum { false = 0, true = 1 };
+# else
+typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
+# endif
# endif
#else
typedef bool _Bool;
-/* Copyright (C) 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
+/* stpcpy.c -- copy a string and return pointer to end of new string
+ Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@gnu.org.
+ Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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 the
# include <config.h>
#endif
+#include <stddef.h>
+
#if defined _LIBC || HAVE_STRING_H
# include <string.h>
#else
# include <config.h>
#endif
-#if defined _LIBC || defined HAVE_CONFIG_H
+#include <stddef.h>
+
+#if defined _LIBC || HAVE_STRING_H
# include <string.h>
#endif