On 07/21/2013 04:20 AM, Alois Treindl wrote:
But I wonder about the rationale behind the naming of this type: is it supposed to hold only 32-bit values?
The tz code assigns only 32-bit values to it, yes. The type might be wider than that, on machines where making it wider is faster. Formerly, the type 'long' was used for values of this form, but I thought it better to be more precise -- more for documentation than for efficiency. On 07/21/2013 07:25 AM, Christos Zoulas wrote:
The biggest problem with this change is that it is ABI changing in the following 3 functions:
Thanks for reporting that. The changes to offtime and timeoff weren't intended. I didn't notice that they were extern functions (we don't have .h files, or I might have; we rely on the system's). The function gtime is also affected. (offtime_r isn't part of the tz distribution.) I've pushed the patch proposed below to the experimental version on github.
And a cosmetic one, all the gcc attributes (not just some) should be __foo__ instead of foo, and the macros should be named consistenty.
There's no need to put underscores around 'const', as it's a keyword, and programs and standard headers are not allowed to #define keywords. The macro _Noreturn is named specially because it stands for a C11 keyword, something the other macros don't do. At some point someone (maybe Arthur? or maybe me) should look at the NetBSD enhancements. Thanks for reminding us.
From 5ea7a94f6a57161575cac3a9698265c684d19e6c Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Sun, 21 Jul 2013 08:24:45 -0700 Subject: [PATCH] Revert unintended change to ABI for extern functions.
* localtime.c (offtime, timeoff, gtime): Revert change to ABI, by going back to 'long' instead of 'int_fast32_t' for types accepted and returned by extern functions. Reported by Christos Zoulas in <http://mm.icann.org/pipermail/tz/2013-July/019488.html>. --- localtime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/localtime.c b/localtime.c index d83b8c1..23bc635 100644 --- a/localtime.c +++ b/localtime.c @@ -1426,7 +1426,7 @@ gmtime_r(const time_t *const timep, struct tm *tmp) #ifdef STD_INSPIRED struct tm * -offtime(const time_t *const timep, const int_fast32_t offset) +offtime(const time_t *const timep, const long offset) { return gmtsub(timep, offset, &tm); } @@ -1997,7 +1997,7 @@ timegm(struct tm *const tmp) } time_t -timeoff(struct tm *const tmp, const int_fast32_t offset) +timeoff(struct tm *const tmp, const long offset) { if (tmp != NULL) tmp->tm_isdst = 0; @@ -2013,7 +2013,7 @@ timeoff(struct tm *const tmp, const int_fast32_t offset) ** previous versions of the CMUCS runtime library. */ -int_fast32_t +long gtime(struct tm *const tmp) { const time_t t = mktime(tmp); -- 1.8.1.2