From 43c2a401091cf80a9a0a9a53a7bb8fc46b01012b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 14 Jul 2024 17:36:01 +0100 Subject: [PATCH] Test !FASTER_TIMEFNS with builtin resolutions * src/timefns.c (timespec_hz, trillion, ztrillion): If !FASTER_TIMEFNS, do not optimize the calculations of these variables. This gives better test coverage of the slow-path code, when compiling with -DFASTER_TIMEFNS=0. (NEED_ZTRILLION_INIT): Move up, to simplify #ifdefery. Now defined or not defined, instead of being 1 or not defined, since it is used only via #ifdef. (cherry picked from commit d10c1796c99637d847fa78e3fcb438d03774a00b) --- src/timefns.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/timefns.c b/src/timefns.c index 4ed5f50be96..333ff3730fd 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -73,20 +73,24 @@ enum { TM_YEAR_BASE = 1900 }; enum { CURRENT_TIME_LIST = true }; #endif -#if FIXNUM_OVERFLOW_P (1000000000) -static Lisp_Object timespec_hz; -#else +#if FASTER_TIMEFNS && !FIXNUM_OVERFLOW_P (1000000000) # define timespec_hz make_fixnum (TIMESPEC_HZ) +#else +static Lisp_Object timespec_hz; #endif #define TRILLION 1000000000000 -#if FIXNUM_OVERFLOW_P (TRILLION) -static Lisp_Object trillion; -# define ztrillion (*xbignum_val (trillion)) -#else +#if FASTER_TIMEFNS && !FIXNUM_OVERFLOW_P (TRILLION) # define trillion make_fixnum (TRILLION) -# if ULONG_MAX < TRILLION || !FASTER_TIMEFNS +#else +static Lisp_Object trillion; +#endif +#if ! (FASTER_TIMEFNS && TRILLION <= ULONG_MAX) +# if FIXNUM_OVERFLOW_P (TRILLION) +# define ztrillion (*xbignum_val (trillion)) +# else static mpz_t ztrillion; +# define NEED_ZTRILLION_INIT # endif #endif @@ -2137,10 +2141,6 @@ emacs_setenv_TZ (const char *tzstring) return 0; } -#if (ULONG_MAX < TRILLION || !FASTER_TIMEFNS) && !defined ztrillion -# define NEED_ZTRILLION_INIT 1 -#endif - #ifdef NEED_ZTRILLION_INIT static void syms_of_timefns_for_pdumper (void) -- 2.39.2