mktime: Avoid compilation error on Solaris 11.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Jan 2012 18:07:23 +0000 (19:07 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Jan 2012 18:09:28 +0000 (19:09 +0100)
* lib/mktime.c (WRAPV): Define to 0 on all non-glibc systems.

ChangeLog
lib/mktime.c

index 9ed54bb..d279751 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-01-08  Bruno Haible  <bruno@clisp.org>
 
+       mktime: Avoid compilation error on Solaris 11.
+       * lib/mktime.c (WRAPV): Define to 0 on all non-glibc systems.
+
+2012-01-08  Bruno Haible  <bruno@clisp.org>
+
        doc: Small fix.
        * doc/posix-headers/nl_types.texi: Correct platforms list.
 
index 17884cd..c644eb6 100644 (file)
 # include <config.h>
 #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,
    then it supports leap seconds; otherwise it probably doesn't.  */
 # 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 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
+   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]; }