aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-11-27 19:15:53 +0000
committerWerner Koch <[email protected]>2019-11-27 19:21:47 +0000
commitf59455d054a79068ebf480cd28f02993c1facf3b (patch)
tree93f7e01273ccaf3c9fb984366e7647bc12f58b4f /dirmngr/dirmngr.c
parentgpg: Move a keydb function to another file. (diff)
downloadgnupg-f59455d054a79068ebf480cd28f02993c1facf3b.tar.gz
gnupg-f59455d054a79068ebf480cd28f02993c1facf3b.zip
dirmngr: Replace no-strict-overflow pragma by wrapv pragma.
* dirmngr/dirmngr.c (time_for_housekeeping_p): Build with --fwrapv. Replace protecting macro. -- I once replaced all JNLIB macros by GPGRT macros. However, I missed to get this right for the push pragma test and used GPGRT_GCC_HAVE_PUSH_PRAGMA instead of the correct GPGRT_HAVE_PRAGMA_GCC_PUSH Now after fixing this it turned out that no-strict-overflow is not anymore supported as oprimize pragma and thus I replaced that too according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58454 . Tested with 32 bit Windows but the real test will be in 2038. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'dirmngr/dirmngr.c')
-rw-r--r--dirmngr/dirmngr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 7948e3f24..8f28fa43d 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -1984,9 +1984,14 @@ housekeeping_thread (void *arg)
}
-#if GPGRT_GCC_HAVE_PUSH_PRAGMA
+/* We try to enable correct overflow handling for signed int (commonly
+ * used for time_t). With gcc 4.2 -fno-strict-overflow was introduced
+ * and used here as a pragma. Later gcc versions (gcc 6?) removed
+ * this as a pragma and -fwrapv was then suggested as a replacement
+ * for -fno-strict-overflow. */
+#if GPGRT_HAVE_PRAGMA_GCC_PUSH
# pragma GCC push_options
-# pragma GCC optimize ("no-strict-overflow")
+# pragma GCC optimize ("wrapv")
#endif
static int
time_for_housekeeping_p (time_t curtime)
@@ -2004,7 +2009,7 @@ time_for_housekeeping_p (time_t curtime)
}
return 0;
}
-#if GPGRT_GCC_HAVE_PUSH_PRAGMA
+#if GPGRT_HAVE_PRAGMA_GCC_PUSH
# pragma GCC pop_options
#endif