]> Savannah Git Hosting - gnulib.git/commitdiff
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 9ed54bb38f602e7d915047eb0c145db69f8f8f8a..d2797516648dc44519f4209cb3b7a0254f8b51bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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.
index 17884cde23d397cfb78a8767788f4cb75fa156d6..c644eb6a5ad2b381c34753e11974df844b8a2697 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]; }