2024-10-03 Paul Eggert <eggert@cs.ucla.edu>
+ mktime: prefer static_assert to verify
+ This should work better with glibc.
+ * lib/mktime.c: Do not include verify.h.
+ Use static_assert instead of verify.
+ * modules/mktime (Depends-on): Depend on assert-h, not verify.
+
mktime: refactor convert_time
This is to better merge with a future version of glibc.
This merges a glibc patch by Florian Weimer in:
#include <string.h>
#include <intprops.h>
-#include <verify.h>
#ifndef NEED_MKTIME_INTERNAL
# define NEED_MKTIME_INTERNAL 0
# else
typedef long long int long_int;
# endif
-verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60);
+static_assert (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60);
/* Shift A right by B bits portably, by dividing A by 2**B and
truncating towards minus infinity. B should be in the range 0 <= B
# define EPOCH_YEAR 1970
# define TM_YEAR_BASE 1900
-verify (TM_YEAR_BASE % 100 == 0);
+static_assert (TM_YEAR_BASE % 100 == 0);
/* Is YEAR + TM_YEAR_BASE a leap year? */
static bool
ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
int year0, int yday0, int hour0, int min0, int sec0)
{
- verify (-1 / 2 == 0);
+ static_assert (-1 / 2 == 0);
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid integer overflow here. */
time-h
c99
multiarch
+assert-h [test $REPLACE_MKTIME = 1]
intprops [test $REPLACE_MKTIME = 1]
libc-config [test $REPLACE_MKTIME = 1]
stdbool [test $REPLACE_MKTIME = 1]
stdckdint [test $REPLACE_MKTIME = 1]
time_r [test $REPLACE_MKTIME = 1]
-verify [test $REPLACE_MKTIME = 1]
configure.ac:
gl_FUNC_MKTIME