summaryrefslogtreecommitdiff
path: root/lib
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
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')
-rw-r--r--lib/alignalloc.c5
-rw-r--r--lib/argmatch.h4
-rw-r--r--lib/c32is-impl.h3
-rw-r--r--lib/c32snrtombs.c4
-rw-r--r--lib/c32srtombs.c4
-rw-r--r--lib/exclude.c9
-rw-r--r--lib/filevercmp.c3
-rw-r--r--lib/fma.c5
-rw-r--r--lib/i-ring.h3
-rw-r--r--lib/ino-map.c3
-rw-r--r--lib/localeinfo.c8
-rw-r--r--lib/malloca.c3
-rw-r--r--lib/mbrtoc32.c3
-rw-r--r--lib/mbrtowc.c3
-rw-r--r--lib/mbsinit.c3
-rw-r--r--lib/mbsnrtoc32s.c4
-rw-r--r--lib/mbsrtoc32s.c4
-rw-r--r--lib/nanosleep.c3
-rw-r--r--lib/parse-datetime.y9
-rw-r--r--lib/pipe2.c3
-rw-r--r--lib/rawmemchr.c3
-rw-r--r--lib/relocwrapper.c3
-rw-r--r--lib/sleep.c4
-rw-r--r--lib/stat-w32.c3
-rw-r--r--lib/stat.c1
-rw-r--r--lib/strerror.c3
-rw-r--r--lib/strtoimax.c6
-rw-r--r--lib/utimecmp.c3
-rw-r--r--lib/vasnprintf.c11
29 files changed, 44 insertions, 79 deletions
diff --git a/lib/alignalloc.c b/lib/alignalloc.c
index 1884394e3c..1be5d4d2ba 100644
--- a/lib/alignalloc.c
+++ b/lib/alignalloc.c
@@ -26,7 +26,6 @@
#include <stdalign.h>
#include <stdckdint.h>
#include <stdint.h>
-#include "verify.h"
#if !ALIGNALLOC_VIA_ALIGNED_ALLOC
# if HAVE_POSIX_MEMALIGN
@@ -37,7 +36,7 @@
sizeof (void *) is a power of two, which is true on all known platforms.
This check is here rather than in alignalloc.h to save the compiler
the trouble of checking it each time alignalloc.h is included. */
-verify (! (sizeof (void *) & (sizeof (void *) - 1)));
+static_assert (! (sizeof (void *) & (sizeof (void *) - 1)));
# else /* !HAVE_POSIX_MEMALIGN */
@@ -62,7 +61,7 @@ address_of_pointer_to_malloced (unsigned char *r)
for a 0 byte at R - 1. This approach assumes UCHAR_MAX is large
enough so that there is room for P; although true on all
plausible platforms, check the assumption to be safe. */
- verify (sizeof (void *) + alignof (void *) - 1 <= UCHAR_MAX);
+ static_assert (sizeof (void *) + alignof (void *) - 1 <= UCHAR_MAX);
return align_down (r - 1 - sizeof (void *), alignof (void *));
}
diff --git a/lib/argmatch.h b/lib/argmatch.h
index 846cff9066..db98187d7f 100644
--- a/lib/argmatch.h
+++ b/lib/argmatch.h
@@ -29,7 +29,6 @@
# include "gettext.h"
# include "quote.h"
-# include "verify.h"
# ifdef __cplusplus
extern "C" {
@@ -41,7 +40,8 @@ extern "C" {
(argument list ends with a NULL guard). */
# define ARGMATCH_VERIFY(Arglist, Vallist) \
- verify (ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
+ static_assert (ARRAY_CARDINALITY (Arglist) \
+ == ARRAY_CARDINALITY (Vallist) + 1)
/* Return the index of the element of ARGLIST (NULL terminated) that
matches with ARG. If VALLIST is not NULL, then use it to resolve
diff --git a/lib/c32is-impl.h b/lib/c32is-impl.h
index 6b910fafbf..ed3758c9e0 100644
--- a/lib/c32is-impl.h
+++ b/lib/c32is-impl.h
@@ -37,7 +37,6 @@
#endif
#include "unictype.h"
-#include "verify.h"
int
FUNC (wint_t wc)
@@ -96,7 +95,7 @@ FUNC (wint_t wc)
#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
/* char32_t and wchar_t are equivalent. */
- verify (sizeof (char32_t) == sizeof (wchar_t));
+ static_assert (sizeof (char32_t) == sizeof (wchar_t));
return WCHAR_FUNC (wc);
#endif
diff --git a/lib/c32snrtombs.c b/lib/c32snrtombs.c
index 6bbc65dad0..4b3b40a8f6 100644
--- a/lib/c32snrtombs.c
+++ b/lib/c32snrtombs.c
@@ -42,9 +42,7 @@ extern mbstate_t _gl_c32srtombs_state;
#else
/* char32_t and wchar_t are equivalent. */
-# include "verify.h"
-
-verify (sizeof (char32_t) == sizeof (wchar_t));
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
size_t
c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len,
diff --git a/lib/c32srtombs.c b/lib/c32srtombs.c
index d7480659a1..6f08deb234 100644
--- a/lib/c32srtombs.c
+++ b/lib/c32srtombs.c
@@ -42,9 +42,7 @@ extern mbstate_t _gl_c32srtombs_state;
#else
/* char32_t and wchar_t are equivalent. */
-# include "verify.h"
-
-verify (sizeof (char32_t) == sizeof (wchar_t));
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
size_t
c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
diff --git a/lib/exclude.c b/lib/exclude.c
index a39df312f2..4b96dbfc3f 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -37,7 +37,6 @@
#include "mbuiter.h"
#include "fnmatch.h"
#include "xalloc.h"
-#include "verify.h"
#include "filename.h"
#if GNULIB_EXCLUDE_SINGLE_THREAD
@@ -55,10 +54,10 @@
# define FNM_LEADING_DIR 0
#endif
-verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
- & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR
- | FNM_CASEFOLD | FNM_EXTMATCH))
- == 0);
+static_assert (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
+ & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR
+ | FNM_CASEFOLD | FNM_EXTMATCH))
+ == 0);
/* Exclusion patterns are grouped into a singly-linked list of
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index cb1b38d473..844505a6bf 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -23,7 +23,6 @@
#include <c-ctype.h>
#include <limits.h>
#include <idx.h>
-#include <verify.h>
/* Return the length of a prefix of S that corresponds to the suffix
defined by this extended regular expression in the C locale:
@@ -74,7 +73,7 @@ order (char const *s, idx_t pos, idx_t len)
return -2;
else
{
- verify (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2);
+ static_assert (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2);
return c + UCHAR_MAX + 1;
}
}
diff --git a/lib/fma.c b/lib/fma.c
index 25a41c485f..55f4fcdc98 100644
--- a/lib/fma.c
+++ b/lib/fma.c
@@ -32,7 +32,6 @@
#include "float+.h"
#include "integer_length.h"
-#include "verify.h"
#ifdef USE_LONG_DOUBLE
# define FUNC fmal
@@ -94,11 +93,11 @@
typedef unsigned int mp_limb_t;
#define GMP_LIMB_BITS 32
-verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
+static_assert (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
typedef unsigned long long mp_twolimb_t;
#define GMP_TWOLIMB_BITS 64
-verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
+static_assert (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
/* Number of limbs needed for a single DOUBLE. */
#define NLIMBS1 ((MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS)
diff --git a/lib/i-ring.h b/lib/i-ring.h
index ec27d5a3f4..d4efb9726d 100644
--- a/lib/i-ring.h
+++ b/lib/i-ring.h
@@ -14,10 +14,9 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-#include "verify.h"
enum { I_RING_SIZE = 4 };
-verify (1 <= I_RING_SIZE);
+static_assert (1 <= I_RING_SIZE);
/* When ir_empty is true, the ring is empty.
Otherwise, ir_data[B..F] are defined, where B..F is the contiguous
diff --git a/lib/ino-map.c b/lib/ino-map.c
index d9c56a0fa4..9a97391b8a 100644
--- a/lib/ino-map.c
+++ b/lib/ino-map.c
@@ -21,7 +21,6 @@
#include "ino-map.h"
#include "hash.h"
-#include "verify.h"
#include <limits.h>
#include <stdlib.h>
@@ -151,7 +150,7 @@ ino_map_insert (struct ino_map *im, ino_t ino)
overflow to zero, then it must equal INO_MAP_INSERT_FAILURE,
which is the value that should be returned in that case.
Verify that this works. */
- verify (INO_MAP_INSERT_FAILURE + 1 == 0);
+ static_assert (INO_MAP_INSERT_FAILURE + 1 == 0);
/* Prepare to allocate a new probe next time; this one is in use. */
im->probe = NULL;
diff --git a/lib/localeinfo.c b/lib/localeinfo.c
index 0e74f4220f..34c020cdc6 100644
--- a/lib/localeinfo.c
+++ b/lib/localeinfo.c
@@ -23,8 +23,6 @@
#include <localeinfo.h>
-#include <verify.h>
-
#include <limits.h>
#include <locale.h>
#include <stdlib.h>
@@ -32,7 +30,7 @@
#include <wctype.h>
/* The sbclen implementation relies on this. */
-verify (MB_LEN_MAX <= SCHAR_MAX);
+static_assert (MB_LEN_MAX <= SCHAR_MAX);
/* Return true if the locale uses UTF-8. */
@@ -123,8 +121,8 @@ static short const lonesome_lower[] =
/* Verify that the worst case fits. This is 1 for towupper, 1 for
towlower, and 1 for each entry in LONESOME_LOWER. */
-verify (1 + 1 + sizeof lonesome_lower / sizeof *lonesome_lower
- <= CASE_FOLDED_BUFSIZE);
+static_assert (1 + 1 + sizeof lonesome_lower / sizeof *lonesome_lower
+ <= CASE_FOLDED_BUFSIZE);
/* Find the characters equal to C after case-folding, other than C
itself, and store them into FOLDED. Return the number of characters
diff --git a/lib/malloca.c b/lib/malloca.c
index 183783a710..1e19978d90 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -24,7 +24,6 @@
#include <stdckdint.h>
#include "idx.h"
-#include "verify.h"
/* The speed critical point in this file is freea() applied to an alloca()
result: it must be fast, to match the speed of alloca(). The speed of
@@ -40,7 +39,7 @@
/* Type for holding very small pointer differences. */
typedef unsigned char small_t;
/* Verify that it is wide enough. */
-verify (2 * sa_alignment_max - 1 <= (small_t) -1);
+static_assert (2 * sa_alignment_max - 1 <= (small_t) -1);
void *
mmalloca (size_t n)
diff --git a/lib/mbrtoc32.c b/lib/mbrtoc32.c
index 6d09fe6db4..8f8095295d 100644
--- a/lib/mbrtoc32.c
+++ b/lib/mbrtoc32.c
@@ -52,11 +52,10 @@
# endif
-# include "verify.h"
# include "lc-charset-dispatch.h"
# include "mbtowc-lock.h"
-verify (sizeof (mbstate_t) >= 4);
+static_assert (sizeof (mbstate_t) >= 4);
static char internal_state[4];
size_t
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 4b164edd40..be6fdc6478 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -51,11 +51,10 @@
# endif
# include "attribute.h"
-# include "verify.h"
# include "lc-charset-dispatch.h"
# include "mbtowc-lock.h"
-verify (sizeof (mbstate_t) >= 4);
+static_assert (sizeof (mbstate_t) >= 4);
static char internal_state[4];
size_t
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index 9621defc73..2324f15680 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -20,7 +20,6 @@
/* Specification. */
#include <wchar.h>
-#include "verify.h"
#if GNULIB_defined_mbstate_t
@@ -39,7 +38,7 @@
- In wc -> mb direction, mbstate_t contains no information. In other
words, it is always in the initial state. */
-verify (sizeof (mbstate_t) >= 4);
+static_assert (sizeof (mbstate_t) >= 4);
int
mbsinit (const mbstate_t *ps)
diff --git a/lib/mbsnrtoc32s.c b/lib/mbsnrtoc32s.c
index 8d44d0e13f..391baee449 100644
--- a/lib/mbsnrtoc32s.c
+++ b/lib/mbsnrtoc32s.c
@@ -51,9 +51,7 @@ extern mbstate_t _gl_mbsrtoc32s_state;
#else
/* char32_t and wchar_t are equivalent. */
-# include "verify.h"
-
-verify (sizeof (char32_t) == sizeof (wchar_t));
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
size_t
mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len,
diff --git a/lib/mbsrtoc32s.c b/lib/mbsrtoc32s.c
index 6001b0bbf3..1cd0dd0ad1 100644
--- a/lib/mbsrtoc32s.c
+++ b/lib/mbsrtoc32s.c
@@ -43,9 +43,7 @@ extern mbstate_t _gl_mbsrtoc32s_state;
#else
/* char32_t and wchar_t are equivalent. */
-# include "verify.h"
-
-verify (sizeof (char32_t) == sizeof (wchar_t));
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
size_t
mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
diff --git a/lib/nanosleep.c b/lib/nanosleep.c
index 78e612d4b1..55d6fa650e 100644
--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -23,7 +23,6 @@
#include <time.h>
#include "intprops.h"
-#include "verify.h"
#include <stdio.h>
#include <sys/types.h>
@@ -58,7 +57,7 @@ nanosleep (const struct timespec *requested_delay,
{
/* Verify that time_t is large enough. */
- verify (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60);
+ static_assert (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60);
const time_t limit = 24 * 24 * 60 * 60;
time_t seconds = requested_delay->tv_sec;
struct timespec intermediate;
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));
diff --git a/lib/pipe2.c b/lib/pipe2.c
index 400aff001a..a3cbb7f261 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -23,7 +23,6 @@
#include <fcntl.h>
#include "binary-io.h"
-#include "verify.h"
#if GNULIB_defined_O_NONBLOCK
# include "nonblocking.h"
@@ -95,7 +94,7 @@ pipe2 (int fd[2], int flags)
}
# else
{
- verify (O_NONBLOCK == 0);
+ static_assert (O_NONBLOCK == 0);
}
# endif
diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
index ea68c1bfc6..c789599db8 100644
--- a/lib/rawmemchr.c
+++ b/lib/rawmemchr.c
@@ -26,7 +26,6 @@
# include <stdalign.h>
# include <stdint.h>
-# include "verify.h"
/* Find the first occurrence of C in S. */
void *
@@ -36,7 +35,7 @@ rawmemchr (const void *s, int c_in)
typedef uintptr_t longword;
/* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match.
This verifies that the type does not have padding bits. */
- verify (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword));
+ static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword));
const unsigned char *char_ptr;
unsigned char c = c_in;
diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c
index 3ec8b2888b..9ef115300a 100644
--- a/lib/relocwrapper.c
+++ b/lib/relocwrapper.c
@@ -81,7 +81,6 @@
#include "progname.h"
#include "relocatable.h"
#include "c-ctype.h"
-#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
#undef fprintf
@@ -142,7 +141,7 @@ add_dotbin (const char *filename)
/* List of directories that contain the libraries. */
static const char *libdirs[] = { LIBDIRS NULL };
/* Verify that at least one directory is given. */
-verify (sizeof (libdirs) / sizeof (libdirs[0]) > 1);
+static_assert (sizeof (libdirs) / sizeof (libdirs[0]) > 1);
/* Relocate the list of directories that contain the libraries. */
static void
diff --git a/lib/sleep.c b/lib/sleep.c
index 7a6fb152a7..80431c1081 100644
--- a/lib/sleep.c
+++ b/lib/sleep.c
@@ -22,8 +22,6 @@
#include <limits.h>
-#include "verify.h"
-
#if defined _WIN32 && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
@@ -56,7 +54,7 @@ unsigned int
rpl_sleep (unsigned int seconds)
{
/* This requires int larger than 16 bits. */
- verify (UINT_MAX / 24 / 24 / 60 / 60);
+ static_assert (UINT_MAX / 24 / 24 / 60 / 60);
const unsigned int limit = 24 * 24 * 60 * 60;
while (limit < seconds)
{
diff --git a/lib/stat-w32.c b/lib/stat-w32.c
index c1a2923977..e61b75c6e9 100644
--- a/lib/stat-w32.c
+++ b/lib/stat-w32.c
@@ -50,7 +50,6 @@
#include "stat-w32.h"
#include "pathmax.h"
-#include "verify.h"
/* Don't assume that UNICODE is not defined. */
#undef LoadLibrary
@@ -228,7 +227,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id)))
{
buf->st_dev = id.VolumeSerialNumber;
- verify (sizeof (ino_t) == sizeof (id.FileId));
+ static_assert (sizeof (ino_t) == sizeof (id.FileId));
memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t));
goto ino_done;
}
diff --git a/lib/stat.c b/lib/stat.c
index cdcc33165f..adb6123352 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -58,7 +58,6 @@ orig_stat (const char *filename, struct stat *buf)
#include <string.h>
#include "filename.h"
#include "malloca.h"
-#include "verify.h"
#ifdef WINDOWS_NATIVE
# define WIN32_LEAN_AND_MEAN
diff --git a/lib/strerror.c b/lib/strerror.c
index 67c5216e21..1019fe9eb6 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -27,7 +27,6 @@
#include "intprops.h"
#include "strerror-override.h"
-#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
#undef sprintf
@@ -55,7 +54,7 @@ strerror (int n)
if (!msg || !*msg)
{
static char const fmt[] = "Unknown error %d";
- verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
+ static_assert (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
sprintf (buf, fmt, n);
errno = EINVAL;
return buf;
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index cad12d0d9b..29d16d29ce 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -25,8 +25,6 @@
#include <stdlib.h>
-#include "verify.h"
-
#ifdef UNSIGNED
# ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run"
@@ -62,8 +60,8 @@ long long int strtoll (char const *, char **, int);
Int
Strtoimax (char const *ptr, char **endptr, int base)
{
- verify (sizeof (Int) == sizeof (Unsigned long int)
- || sizeof (Int) == sizeof (Unsigned long long int));
+ static_assert (sizeof (Int) == sizeof (Unsigned long int)
+ || sizeof (Int) == sizeof (Unsigned long long int));
if (sizeof (Int) != sizeof (Unsigned long int))
return Strtoll (ptr, endptr, base);
diff --git a/lib/utimecmp.c b/lib/utimecmp.c
index 7312ee0b88..ae7729d26b 100644
--- a/lib/utimecmp.c
+++ b/lib/utimecmp.c
@@ -33,7 +33,6 @@
#include "hash.h"
#include "intprops.h"
#include "stat-time.h"
-#include "verify.h"
#ifndef MAX
# define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -146,7 +145,7 @@ utimecmpat (int dfd, char const *dst_name,
time_t might be unsigned. */
- verify (TYPE_IS_INTEGER (time_t));
+ static_assert (TYPE_IS_INTEGER (time_t));
/* Destination and source timestamps. */
time_t dst_s = dst_stat->st_mtime;
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 285c674b9c..01d18bf598 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -101,7 +101,6 @@
#include "xsize.h"
#include "attribute.h"
-#include "verify.h"
#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
@@ -408,11 +407,11 @@ is_infinite_or_zerol (long double x)
typedef unsigned int mp_limb_t;
# define GMP_LIMB_BITS 32
-verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
+static_assert (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
typedef unsigned long long mp_twolimb_t;
# define GMP_TWOLIMB_BITS 64
-verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
+static_assert (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
/* Representation of a bignum >= 0. */
typedef struct
@@ -2628,7 +2627,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t characters;
# if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */
- verify (sizeof (TCHAR_T) == 1);
+ static_assert (sizeof (TCHAR_T) == 1);
TCHAR_T *tmpsrc;
DCHAR_T *tmpdst;
size_t tmpdst_len;
@@ -2894,7 +2893,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t characters;
# if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */
- verify (sizeof (TCHAR_T) == 1);
+ static_assert (sizeof (TCHAR_T) == 1);
TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
DCHAR_T *tmpdst;
size_t tmpdst_len;
@@ -5451,7 +5450,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
DCHAR_T *tmpdst;
size_t tmpdst_len;
/* This code assumes that TCHAR_T is 'char'. */
- verify (sizeof (TCHAR_T) == 1);
+ static_assert (sizeof (TCHAR_T) == 1);
# if USE_SNPRINTF
tmpsrc = (TCHAR_T *) (result + length);
# else