X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmktime.c;h=fc27adf18096c5aab22f8eb42bbe97e3083f8041;hb=0874a5828bbb4784e9c9d54243b3c978e8e54ece;hp=cba2b8b322e9e245c5c99a2e2352cd041f0cbb6d;hpb=3d3eb663070ec802a9fb13c8519db153e43241ec;p=gnulib.git diff --git a/lib/mktime.c b/lib/mktime.c index cba2b8b32..fc27adf18 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -1,5 +1,5 @@ -/* Convert a `struct tm' to a time_t value. - Copyright (C) 1993-1999, 2002-2007, 2009-2011 Free Software Foundation, Inc. +/* Convert a 'struct tm' to a time_t value. + Copyright (C) 1993-1999, 2002-2007, 2009-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert . @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* Define this to have a standalone program to test this implementation of mktime. */ @@ -25,26 +24,8 @@ # include #endif -/* Some of the code in this file assumes that signed integer overflow - silently wraps around. This assumption can't easily be programmed - around, nor can it be checked for portably at compile-time or - easily eliminated at run-time. - - Define WRAPV to 1 if the assumption is valid. Otherwise, define it - to 0; this forces the use of slower code that, while not guaranteed - by the C Standard, works on all production platforms that we know - about. */ -#ifndef WRAPV -# if (__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__ -# pragma GCC optimize ("wrapv") -# define WRAPV 1 -# else -# define WRAPV 0 -# endif -#endif - /* Assume that leap seconds are possible, unless told otherwise. - If the host has a `zic' command with a `-L leapsecondfilename' option, + If the host has a 'zic' command with a '-L leapsecondfilename' option, then it supports leap seconds; otherwise it probably doesn't. */ #ifndef LEAP_SECONDS_POSSIBLE # define LEAP_SECONDS_POSSIBLE 1 @@ -64,6 +45,26 @@ # define mktime my_mktime #endif /* DEBUG */ +/* Some of the code in this file assumes that signed integer overflow + silently wraps around. This assumption can't easily be programmed + around, nor can it be checked for portably at compile-time or + easily eliminated at run-time. + + Define WRAPV to 1 if the assumption is valid and if + #pragma GCC optimize ("wrapv") + does not trigger GCC bug . + Otherwise, define it to 0; this forces the use of slower code that, + while not guaranteed by the C Standard, works on all production + platforms that we know about. */ +#ifndef WRAPV +# if ((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) && defined __GLIBC__ +# pragma GCC optimize ("wrapv") +# define WRAPV 1 +# else +# define WRAPV 0 +# endif +#endif + /* Verify a requirement at compile-time (unlike assert, which is runtime). */ #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; } @@ -579,7 +580,7 @@ mktime (struct tm *tp) { #ifdef _LIBC /* POSIX.1 8.1.1 requires that whenever mktime() is called, the - time zone names contained in the external variable `tzname' shall + time zone names contained in the external variable 'tzname' shall be set as if the tzset() function had been called. */ __tzset (); #endif