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 <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-11-27 20:15:53 +01:00
parent 61f41cdce5
commit f59455d054
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 8 additions and 3 deletions

View File

@ -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