This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/9] mktime: merge wrapv change from gnulib
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 23 May 2012 11:10:40 -0700 (PDT)
- Subject: Re: [PATCH 1/9] mktime: merge wrapv change from gnulib
- References: <4FBD176B.4040704@cs.ucla.edu><4FBD17F6.5020900@cs.ucla.edu>
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -124,6 +124,13 @@
> mktime: merge time_r change from gnulib
> * time/mktime.c [!_LIBC]: Do not include "time_r.h".
>
> + mktime: merge wrapv change from gnulib
> + * time/mktime.c (WRAPV): New macro.
> + (time_t_avg, time_t_add_ok, time_t_int_add_ok): New static functions.
> + (guess_time_tm, __mktime_internal): Do not assume that signed
> + integer overflow wraps around; modern compilers generate code
> + where this assumption is no longer valid.
> +
> mktime: merge DEBUG change from gnulib
> * time/mktime.c (mktime) [DEBUG]: #undef before #define-ing, in
> case system <time.h> has a #define.
You probably know all this, but just in case. We don't usually include
ChangeLog bits in the diff. In the actual commit, the entry needs to go at
the top of ChangeLog with an appropriate header line, not in the middle
of an old entry.
> +#ifndef WRAPV
> +# if (((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) \
> + && defined __GLIBC__)
In libc code we have __GNUC_PREREQ for this.
But this is fine if you need it this way to match in gnulib.
For the rest of the code, I can't claim to meaningfully understand what it
is doing. But I don't see any style issues.
Thanks,
Roland