From: Bruno Haible Date: Fri, 15 Aug 2003 16:04:39 +0000 (+0000) Subject: Update from gnulib. X-Git-Tag: v0.13~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35b22ddfc9216095650caafba1415530c4357c9e;p=thirdparty%2Fgettext.git Update from gnulib. --- diff --git a/gettext-tools/lib/ChangeLog b/gettext-tools/lib/ChangeLog index 64157391e..e1119b869 100644 --- a/gettext-tools/lib/ChangeLog +++ b/gettext-tools/lib/ChangeLog @@ -1,3 +1,16 @@ +2003-08-11 Bruno Haible + + * stdbool_.h: Update from gnulib. + 2003-08-11 Bruno Haible + * 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 + * stdbool_.h (_Bool): Make it signed char, instead of + an enum type, so that it's guaranteed to promote to int. See: + + 2003-05-28 Paul Eggert * safe-read.c (CHAR_BIT): Don't define, since is guaranteed @@ -10,6 +23,13 @@ * copy-file.c: Include , for size_t. +2003-03-03 Paul Eggert + Bruno Haible + + * mbswidth.h: Include . 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 * c-ctype.h: Assume C_CTYPE_CONSECUTIVE_DIGITS. @@ -18,6 +38,15 @@ Optimize. Suggested by Paul Eggert. +2003-01-23 Bruno Haible + + * minmax.h: Add comments from Paul Eggert. + +2002-11-15 Bruno Haible + + * strcspn.c: Include . + * strpbrk.c: Minimize diffs to glibc. Include . + 2003-08-14 Bruno Haible * config.charset: Add support for Linux libc5. Based on data from diff --git a/gettext-tools/lib/mbswidth.h b/gettext-tools/lib/mbswidth.h index 40d4cba04..cd41c9f20 100644 --- a/gettext-tools/lib/mbswidth.h +++ b/gettext-tools/lib/mbswidth.h @@ -1,5 +1,5 @@ /* 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 @@ -17,6 +17,14 @@ #include +/* Avoid a clash of our mbswidth() with a function of the same name defined + in UnixWare 7.1.1 . We need this #include before the #define + below. */ +#if HAVE_WCHAR_H +# include +#endif + + /* Optional flags to influence mbswidth/mbsnwidth behavior. */ /* If this bit is set, return -1 upon finding an invalid or incomplete @@ -28,6 +36,7 @@ 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); diff --git a/gettext-tools/lib/minmax.h b/gettext-tools/lib/minmax.h index 376fc1348..6714cae18 100644 --- a/gettext-tools/lib/minmax.h +++ b/gettext-tools/lib/minmax.h @@ -18,10 +18,28 @@ #ifndef _MINMAX_H #define _MINMAX_H +/* Note: MIN, MAX are also defined in 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 file since otherwise we get redefinitions on some systems. */ #include +/* 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 diff --git a/gettext-tools/lib/stdbool_.h b/gettext-tools/lib/stdbool_.h index 69f6ef725..3dbb51b24 100644 --- a/gettext-tools/lib/stdbool_.h +++ b/gettext-tools/lib/stdbool_.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -20,6 +20,37 @@ /* ISO C 99 for platforms that lack it. */ +/* Usage suggestions: + + Programs that use should be aware of some limitations + and standards compliance issues. + + Standards compliance: + + - 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: + + - 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 already #defines false 0, true 1. We use the same @@ -29,10 +60,24 @@ # 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; diff --git a/gettext-tools/lib/stpcpy.c b/gettext-tools/lib/stpcpy.c index 83d82775e..a01636cd1 100644 --- a/gettext-tools/lib/stpcpy.c +++ b/gettext-tools/lib/stpcpy.c @@ -1,7 +1,8 @@ -/* 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 diff --git a/gettext-tools/lib/strcspn.c b/gettext-tools/lib/strcspn.c index 8ff1109db..2bbd90664 100644 --- a/gettext-tools/lib/strcspn.c +++ b/gettext-tools/lib/strcspn.c @@ -22,6 +22,8 @@ # include #endif +#include + #if defined _LIBC || HAVE_STRING_H # include #else diff --git a/gettext-tools/lib/strpbrk.c b/gettext-tools/lib/strpbrk.c index 1546233da..514b1e9a7 100644 --- a/gettext-tools/lib/strpbrk.c +++ b/gettext-tools/lib/strpbrk.c @@ -20,7 +20,9 @@ # include #endif -#if defined _LIBC || defined HAVE_CONFIG_H +#include + +#if defined _LIBC || HAVE_STRING_H # include #endif