summaryrefslogtreecommitdiff
path: root/lib/parse-datetime.y
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-09-13 17:29:36 -0500
committerPaul Eggert <eggert@cs.ucla.edu>2022-09-13 17:52:21 -0500
commit28465e160f242e39e6008e6de674e7c2360cf7df (patch)
treeedbaa876d0bdb0a21e09413558e50ec9d5e03733 /lib/parse-datetime.y
parentc504bec035e90efceb212c538efc986ef3db7f7a (diff)
downloadgnulib-28465e160f242e39e6008e6de674e7c2360cf7df.tar.gz
assert-h: prefer to ‘verify’
Where it’s easy, prefer ‘static_assert’ to ‘verify’, as this simplifies the source by removing the need to include verify.h. Keep using ‘verify’ if verify.h is used for other reasons, or if code is shared with glibc. * lib/alignalloc.c, lib/argmatch.h, lib/c32is-impl.h: * lib/c32snrtombs.c, lib/c32srtombs.c, lib/exclude.c: * lib/filevercmp.c, lib/fma.c, lib/i-ring.h, lib/ino-map.c: * lib/localeinfo.c, lib/malloca.c, lib/mbrtoc32.c, lib/mbrtowc.c: * lib/mbsinit.c, lib/mbsnrtoc32s.c, lib/mbsrtoc32s.c: * lib/nanosleep.c, lib/parse-datetime.y, lib/pipe2.c: * lib/rawmemchr.c, lib/relocwrapper.c, lib/sleep.c: * lib/stat-w32.c, lib/strerror.c, lib/strtoimax.c: * lib/utimecmp.c, lib/vasnprintf.c, tests/test-alignof.c: * tests/test-intprops.c, tests/test-libgmp.c: * tests/test-limits-h.c, tests/test-locale.c: * tests/test-pthread.c, tests/test-round2.c: * tests/test-stdalign.c, tests/test-stddef.c, tests/test-stdio.c: * tests/test-stdlib.c, tests/test-string.c, tests/test-sys_stat.c: * tests/test-time.c, tests/test-uchar.c, tests/test-unistd.c: * tests/test-wchar.c: Prefer static_assert to verify, and stop including verify.h. * lib/stat.c: Don’t include verify.h (this include was unnecessary). * modules/alignalloc, modules/alignof-tests, modules/argmatch: * modules/c-vasnprintf, modules/c32isalnum, modules/c32isalpha: * modules/c32isblank, modules/c32iscntrl, modules/c32isdigit: * modules/c32isgraph, modules/c32islower, modules/c32isprint: * modules/c32ispunct, modules/c32isspace, modules/c32isupper: * modules/c32isxdigit, modules/c32snrtombs, modules/c32srtombs: * modules/exclude, modules/filevercmp, modules/fma, modules/fmaf: * modules/fmal, modules/fstat, modules/i-ring, modules/ino-map: * modules/intprops-tests, modules/libgmp-tests: * modules/limits-h-tests, modules/locale-tests, modules/malloca: * modules/mbrtoc32, modules/mbrtowc, modules/mbsinit: * modules/mbsnrtoc32s, modules/mbsrtoc32s, modules/nanosleep: * modules/parse-datetime, modules/pipe2, modules/pthread-h-tests: * modules/rawmemchr, modules/relocatable-prog-wrapper: * modules/round-tests, modules/roundf-tests, modules/sleep: * modules/stat, modules/stdalign-tests, modules/stdckdint-tests: * modules/stddef-tests, modules/stdio-tests, modules/stdlib-tests: * modules/strerror, modules/string-tests, modules/strtoimax: * modules/strtoumax, modules/sys_stat-tests, modules/time-tests: * modules/uchar-tests, modules/unistd-tests: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf, modules/unistdio/ulc-vasnprintf: * modules/utimecmp, modules/vasnprintf, modules/wchar-tests: Depend on assert-h, not verify.
Diffstat (limited to 'lib/parse-datetime.y')
-rw-r--r--lib/parse-datetime.y9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 0903c2003e..066d414c29 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -38,7 +38,6 @@
#include "idx.h"
#include "intprops.h"
#include "timespec.h"
-#include "verify.h"
#include "strftime.h"
/* There's no need to extend the stack, so there's no need to involve
@@ -94,9 +93,9 @@
/* Verify that time_t is an integer as POSIX requires, and that every
time_t value fits in intmax_t. Please file a bug report if these
assumptions are false on your platform. */
-verify (TYPE_IS_INTEGER (time_t));
-verify (!TYPE_SIGNED (time_t) || INTMAX_MIN <= TYPE_MINIMUM (time_t));
-verify (TYPE_MAXIMUM (time_t) <= INTMAX_MAX);
+static_assert (TYPE_IS_INTEGER (time_t));
+static_assert (!TYPE_SIGNED (time_t) || INTMAX_MIN <= TYPE_MINIMUM (time_t));
+static_assert (TYPE_MAXIMUM (time_t) <= INTMAX_MAX);
/* True if N is out of range for time_t. */
static bool
@@ -1253,7 +1252,7 @@ enum { TM_YEAR_BUFSIZE = INT_BUFSIZE_BOUND (int) + 1 };
static char const *
tm_year_str (int tm_year, char buf[TM_YEAR_BUFSIZE])
{
- verify (TM_YEAR_BASE % 100 == 0);
+ static_assert (TM_YEAR_BASE % 100 == 0);
sprintf (buf, &"-%02d%02d"[-TM_YEAR_BASE <= tm_year],
abs (tm_year / 100 + TM_YEAR_BASE / 100),
abs (tm_year % 100));