Hello,
regarding this old patch:
On Mon, Mar 14, 2005 at 04:46:10PM -0800, Paul Eggert wrote:
> When I updated intprops.h I forgot to make similar modifications to
> mktime.c and strtol.c. I installed this patch to fix that.
>
> 2005-03-14 Paul Eggert <[EMAIL PROTECTED]>
>
> * mktime.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT,
> TYPE_SIGNED_MAGNITUDE, TYPE_MINIMUM, TYPE_MAXIMUM): Sync from
> intprops.h.
> * strtol.c: Likewise.
Why it is not possible to #include intprops.h?
What would be wrong with the following patch?
Stepan
2005-08-25 Stepan Kasal <[EMAIL PROTECTED]>
* modules/mktime, modules/strtol: Add lib/intprops.h.
* modules/xstrtol: Fix a typo in a comment.
2005-08-25 Stepan Kasal <[EMAIL PROTECTED]>
* mktime.c, strtol.c: Include intprops.h instead of defining the
same macros.
Index: lib/mktime.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/mktime.c,v
retrieving revision 1.52
diff -u -r1.52 mktime.c
--- lib/mktime.c23 Jun 2005 07:14:09 - 1.52
+++ lib/mktime.c25 Aug 2005 14:28:49 -
@@ -62,38 +62,7 @@
? (a) >> (b)\
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-/* The extra casts in the following macros work around compiler bugs,
- e.g., in Cray C 5.0.3.0. */
-
-/* True if the arithmetic type T is an integer type. bool counts as
- an integer. */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-
-/* True if negative values of the signed integer type T use two's
- complement, ones' complement, or signed magnitude representation,
- respectively. Much GNU code assumes two's complement, but some
- people like to be portable to all possible C hosts. */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the arithmetic type T is signed. */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* The maximum and minimum values for the integer type T. These
- macros have undefined behavior if T is signed and has padding bits.
- If this is a problem for you, please let us know how to fix it for
- your host. */
-#define TYPE_MINIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
- ? (t) 0 \
- : TYPE_SIGNED_MAGNITUDE (t) \
- ? ~ (t) 0 \
- : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
- ? (t) -1 \
- : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1
+#include "intprops.h"
#ifndef TIME_T_MIN
# define TIME_T_MIN TYPE_MINIMUM (time_t)
Index: lib/strtol.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/strtol.c,v
retrieving revision 1.23
diff -u -r1.23 strtol.c
--- lib/strtol.c14 May 2005 06:03:58 - 1.23
+++ lib/strtol.c25 Aug 2005 14:28:49 -
@@ -124,34 +124,7 @@
# define STRTOL_LONG_MAX LONG_LONG_MAX
# define STRTOL_ULONG_MAX ULONG_LONG_MAX
-/* The extra casts in the following macros work around compiler bugs,
- e.g., in Cray C 5.0.3.0. */
-
-/* True if negative values of the signed integer type T use two's
- complement, ones' complement, or signed magnitude representation,
- respectively. Much GNU code assumes two's complement, but some
- people like to be portable to all possible C hosts. */
-# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the arithmetic type T is signed. */
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* The maximum and minimum values for the integer type T. These
- macros have undefined behavior if T is signed and has padding bits.
- If this is a problem for you, please let us know how to fix it for
- your host. */
-# define TYPE_MINIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
-? (t) 0 \
-: TYPE_SIGNED_MAGNITUDE (t) \
-? ~ (t) 0 \
-: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-# define TYPE_MAXIMUM(t) \
- ((t) (! TYPE_SIGNED (t) \
-? (t) -1 \
-: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1
+# include "intprops.h"
# ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
Index: modules/mktime
===
RCS file: /cvsroot/gnulib/gnulib/modules/mktime,v
retrieving revision 1.5
diff -u -r1.5 mktime
--- modules/mktime 22 Sep 2004 15:11:04 - 1.5
+++ modules/mktime 25 Aug 2005 14:28:49 -
@@ -2,6 +2,7 @@
mktime() function: convert broken-down time to linear time.
Files:
+lib/intprops.h
lib/mktime.c
m4/mktime.m4
Index: modules/strtol
===
RCS file: /cvsroot/gnulib/gnulib/modules/strtol,v
retrieving revision 1.4
diff -u -r1.4 strtol
--- modul