summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-01-08 19:07:23 +0100
committerBruno Haible <bruno@clisp.org>2012-01-08 19:09:28 +0100
commite7b7d5dd1236fb4dc26c61f1d27bf2a9cc1c2060 (patch)
tree3a9a38597a6f7cdbfc300f7a2705c521e0052df1 /lib
parent9541fef5b442a986bae3db8af3355f25a29cce70 (diff)
downloadgnulib-e7b7d5dd1236fb4dc26c61f1d27bf2a9cc1c2060.tar.gz
mktime: Avoid compilation error on Solaris 11.
* lib/mktime.c (WRAPV): Define to 0 on all non-glibc systems.
Diffstat (limited to 'lib')
-rw-r--r--lib/mktime.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/mktime.c b/lib/mktime.c
index 17884cde23..c644eb6a5a 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -25,24 +25,6 @@
# 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. */
@@ -64,6 +46,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 <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]; }