# HG changeset patch # User Paul Eggert # Date 1182208152 0 # Node ID 9d7e51011293e2727ba2f292d7e0c23b92bbb5c8 # Parent c931406ac6ef37e3871aeb6e0b385ee5f452adea Detect porting problems to FreeBSD/arm, which has time_t wider than long int. Original problem reported for GNU diff by Xin Li in . * modules/getdate (Depends-on): Add intprops, verify. * lib/getdate.y: Include intprops.h, verify.h. Verify that time_t is an integer type no wider than long int. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-06-18 Paul Eggert + + Detect porting problems to FreeBSD/arm, which has time_t wider than + long int. Original problem reported for GNU diff by Xin Li in + . + * modules/getdate (Depends-on): Add intprops, verify. + * lib/getdate.y: Include intprops.h, verify.h. Verify that time_t + is an integer type no wider than long int. + 2007-06-18 Jim Meyering New module: mreadlink-with-size. diff --git a/lib/getdate.y b/lib/getdate.y --- a/lib/getdate.y +++ b/lib/getdate.y @@ -35,7 +35,10 @@ #include #include "getdate.h" + +#include "intprops.h" #include "timespec.h" +#include "verify.h" /* There's no need to extend the stack, so there's no need to involve alloca. */ @@ -107,6 +110,13 @@ #define HOUR(x) ((x) * 60) +/* Lots of this code assumes time_t and time_t-like values fit into + long int. It also assumes that signed integer overflow silently + wraps around, but there's no portable way to check for that at + compile-time. */ +verify (TYPE_IS_INTEGER (time_t)); +verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= LONG_MAX); + /* An integer value, and the number of digits in its textual representation. */ typedef struct diff --git a/modules/getdate b/modules/getdate --- a/modules/getdate +++ b/modules/getdate @@ -12,9 +12,11 @@ Depends-on: stdbool gettime +intprops mktime setenv time +verify xalloc configure.ac: