2022-09-13 Paul Eggert <eggert@cs.ucla.edu>
+ 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.
+
assert-h: static_assert is a keyword in C23
* m4/assert_h.m4 (gl_ASSERT_H): Also test for static_assert
keyword a la C23, and define HAVE_C_STATIC_ASSERT if so.
#include <stdalign.h>
#include <stdckdint.h>
#include <stdint.h>
-#include "verify.h"
#if !ALIGNALLOC_VIA_ALIGNED_ALLOC
# if HAVE_POSIX_MEMALIGN
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 */
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 *));
}
# include "gettext.h"
# include "quote.h"
-# include "verify.h"
# ifdef __cplusplus
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
#endif
#include "unictype.h"
-#include "verify.h"
int
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
#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,
#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)
#include "mbuiter.h"
#include "fnmatch.h"
#include "xalloc.h"
-#include "verify.h"
#include "filename.h"
#if GNULIB_EXCLUDE_SINGLE_THREAD
# 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
#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:
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;
}
}
#include "float+.h"
#include "integer_length.h"
-#include "verify.h"
#ifdef USE_LONG_DOUBLE
# define FUNC fmal
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)
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
#include "ino-map.h"
#include "hash.h"
-#include "verify.h"
#include <limits.h>
#include <stdlib.h>
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;
#include <localeinfo.h>
-#include <verify.h>
-
#include <limits.h>
#include <locale.h>
#include <stdlib.h>
#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. */
/* 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
#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
/* 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)
# 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
# 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
/* Specification. */
#include <wchar.h>
-#include "verify.h"
#if GNULIB_defined_mbstate_t
- 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)
#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,
#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)
#include <time.h>
#include "intprops.h"
-#include "verify.h"
#include <stdio.h>
#include <sys/types.h>
{
/* 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;
#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
/* 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
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));
#include <fcntl.h>
#include "binary-io.h"
-#include "verify.h"
#if GNULIB_defined_O_NONBLOCK
# include "nonblocking.h"
}
# else
{
- verify (O_NONBLOCK == 0);
+ static_assert (O_NONBLOCK == 0);
}
# endif
# include <stdalign.h>
# include <stdint.h>
-# include "verify.h"
/* Find the first occurrence of C in S. */
void *
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;
#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
/* 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
#include <limits.h>
-#include "verify.h"
-
#if defined _WIN32 && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
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)
{
#include "stat-w32.h"
#include "pathmax.h"
-#include "verify.h"
/* Don't assume that UNICODE is not defined. */
#undef LoadLibrary
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;
}
#include <string.h>
#include "filename.h"
#include "malloca.h"
-#include "verify.h"
#ifdef WINDOWS_NATIVE
# define WIN32_LEAN_AND_MEAN
#include "intprops.h"
#include "strerror-override.h"
-#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
#undef sprintf
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;
#include <stdlib.h>
-#include "verify.h"
-
#ifdef UNSIGNED
# ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run"
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);
#include "hash.h"
#include "intprops.h"
#include "stat-time.h"
-#include "verify.h"
#ifndef MAX
# define MAX(a, b) ((a) > (b) ? (a) : (b))
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;
#include "xsize.h"
#include "attribute.h"
-#include "verify.h"
#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
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
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;
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;
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
m4/alignalloc.m4
Depends-on:
+assert-h
extensions
extern-inline
idx
stdalign
stdckdint
stdint
-verify
configure.ac:
gl_ALIGNALLOC
tests/test-alignof.c
Depends-on:
-verify
+assert-h
stdint
configure.ac:
Makefile.am:
TESTS += test-alignof
check_PROGRAMS += test-alignof
-
lib/argmatch.c
Depends-on:
+assert-h
c99
error
exitfail
quotearg
stdbool
stdlib
-verify
configure.ac:
m4/exponentd.m4
Depends-on:
+assert-h
attribute
stdio
isnand-nolibm
errno
memchr
multiarch
-verify
configure.ac:
AC_REQUIRE([AC_C_RESTRICT])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-alnum
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-alpha
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-blank
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-cntrl
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-digit
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-graph
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-lower
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-print
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-punct
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-space
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-upper
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
localcharset [test $REPLACE_MBSTATE_T = 1]
streq [test $REPLACE_MBSTATE_T = 1]
unictype/ctype-xdigit
-verify
+assert-h
configure.ac:
AC_REQUIRE([gl_UCHAR_H])
Depends-on:
uchar
wchar
-verify
+assert-h
c32rtomb
wcsnrtombs [test $SMALL_WCHAR_T = 0]
Depends-on:
uchar
wchar
-verify
+assert-h
c32rtomb
wcsrtombs [test $SMALL_WCHAR_T = 0]
lib/exclude.c
Depends-on:
+assert-h
filename
fnmatch
fopen-gnu
regex
stdbool
unlocked-io-internal
-verify
xalloc
configure.ac:
lib/filevercmp.c
Depends-on:
+assert-h
c-ctype
idx
stdbool
-verify
configure.ac:
math
float [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
stdbool [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
-verify [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
+assert-h [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
isfinite [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
integer_length [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
frexp [test $HAVE_FMA = 0 || test $REPLACE_FMA = 1]
extensions
float [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
stdbool [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
-verify [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
+assert-h [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
isfinite [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
integer_length [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
frexpf [test $HAVE_FMAF = 0 || test $REPLACE_FMAF = 1]
fma [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
float [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
stdbool [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
-verify [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+assert-h [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
isfinite [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
integer_length [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
frexpl [{ test $HAVE_FMAL = 0 || test $REPLACE_FMAL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
stat [test $REPLACE_FSTAT = 1]
stat-time [test $REPLACE_FSTAT = 1]
unistd [test $REPLACE_FSTAT = 1]
-verify [test $REPLACE_FSTAT = 1]
+assert-h [test $REPLACE_FSTAT = 1]
msvc-nothrow [test $REPLACE_FSTAT = 1]
configure.ac:
m4/i-ring.m4
Depends-on:
+assert-h
stdbool
-verify
configure.ac:
gl_I_RING
lib/ino-map.h
Depends-on:
+assert-h
hash
-verify
configure.ac:
tests/macros.h
Depends-on:
+assert-h
inttypes
stdbool
-verify
configure.ac:
tests/test-libgmp.c
Depends-on:
+assert-h
c99
-verify
configure.ac:
tests/test-limits-h.c
Depends-on:
+assert-h
extensions
-verify
limits-h-c++-tests
configure.ac:
tests/test-locale.c
Depends-on:
-verify
+assert-h
locale-c++-tests
configure.ac:
Depends-on:
alloca-opt
+assert-h
idx
stdckdint
stdint
-verify
xalloc-oversized
configure.ac:
c99 [{ test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1; } && test $REPLACE_MBSTATE_T = 0]
hard-locale [{ test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1; } && test $REPLACE_MBSTATE_T = 0]
mbrtowc [{ test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1; } && test $REPLACE_MBSTATE_T = 0]
+assert-h [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]
localcharset [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]
streq [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]
-verify [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]
configure.ac:
gl_FUNC_MBRTOC32
stdint [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
hard-locale [{ test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; } && test $REPLACE_MBSTATE_T = 0]
mbsinit [{ test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; } && test $REPLACE_MBSTATE_T = 0]
+assert-h [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
streq [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
-verify [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
configure.ac:
gl_FUNC_MBRTOWC
Depends-on:
wchar
extensions
+assert-h [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]
mbrtowc [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]
-verify [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]
configure.ac:
gl_FUNC_MBSINIT
Depends-on:
uchar
wchar
-verify
+assert-h
mbrtoc32
minmax
strnlen1
Depends-on:
uchar
wchar
-verify
+assert-h
mbrtoc32
strnlen1
mbsrtowcs [test $SMALL_WCHAR_T = 0]
time
extensions
multiarch
+assert-h [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
intprops [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
pselect [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
stdbool [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
sys_select [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
-verify [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
configure.ac:
gl_FUNC_NANOSLEEP
m4/parse-datetime.m4
Depends-on:
+assert-h
bison
c99
c-ctype
time_r
time_rz
timegm
-verify
configure.ac:
gl_PARSE_DATETIME
fcntl-h
binary-io
extensions
-verify
+assert-h
configure.ac:
gl_FUNC_PIPE2
tests/test-pthread.c
Depends-on:
-verify
+assert-h
pthread-h-c++-tests
configure.ac:
m4/rawmemchr.m4
Depends-on:
+assert-h
extensions
stdalign
stdint
string
-verify
configure.ac:
gl_FUNC_RAWMEMCHR
m4/setenv.m4
Depends-on:
+assert-h
c99
double-slash-root
eloop-threshold
string
sys_stat
unistd
-verify
xalloc-oversized
configure.ac-early:
tests/macros.h
Depends-on:
+assert-h
isnand-nolibm
stdbool
stdint
-verify
configure.ac:
tests/macros.h
Depends-on:
+assert-h
ceilf
floorf
isnanf-nolibm
stdbool
stdint
-verify
configure.ac:
Depends-on:
unistd
+assert-h [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
stdint [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
-verify [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
configure.ac:
gl_FUNC_SLEEP
Depends-on:
sys_stat
largefile
+assert-h [test $REPLACE_STAT = 1]
filename [test $REPLACE_STAT = 1]
malloca [test $REPLACE_STAT = 1]
pathmax [test $REPLACE_STAT = 1]
stat-time [test $REPLACE_STAT = 1]
stdbool [test $REPLACE_STAT = 1]
-verify [test $REPLACE_STAT = 1]
configure.ac:
gl_FUNC_STAT
tests/macros.h
Depends-on:
-verify
+assert-h
stdint
stdalign-c++-tests
tests/test-stdckdint.c
Depends-on:
+assert-h
inttypes
stdbool
-verify
stdckdint-c++-tests
configure.ac:
tests/test-stddef.c
Depends-on:
+assert-h
stdalign
-verify
stddef-c++-tests
configure.ac:
tests/test-stdio.c
Depends-on:
-verify
+assert-h
stdio-c++-tests
fgetc-tests
fputc-tests
tests/test-sys_wait.h
Depends-on:
-verify
+assert-h
stdlib-c++-tests
configure.ac:
Depends-on:
string
+assert-h [test $REPLACE_STRERROR = 1]
errno [test $REPLACE_STRERROR = 1]
intprops [test $REPLACE_STRERROR = 1]
strerror-override [test $REPLACE_STRERROR = 1]
-verify [test $REPLACE_STRERROR = 1]
configure.ac:
gl_FUNC_STRERROR
tests/test-string.c
Depends-on:
-verify
+assert-h
string-c++-tests
configure.ac:
Depends-on:
inttypes-incomplete
-verify [test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1]
+assert-h [test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1]
stdint [test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1]
strtoll [{ test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes]
Depends-on:
inttypes-incomplete
-verify [test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1]
+assert-h [test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1]
stdint [test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1]
strtoull [{ test $HAVE_DECL_STRTOUMAX = 0 || test $REPLACE_STRTOUMAX = 1; } && test $ac_cv_type_unsigned_long_long_int = yes]
tests/test-sys_stat.c
Depends-on:
-verify
+assert-h
sys_stat-c++-tests
configure.ac:
tests/test-time.c
Depends-on:
-verify
+assert-h
time-c++-tests
configure.ac:
tests/test-uchar.c
Depends-on:
-verify
+assert-h
uchar-c++-tests
configure.ac:
tests/test-unistd.c
Depends-on:
-verify
+assert-h
unistd-c++-tests
configure.ac:
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
free-posix
memchr
multiarch
-verify
+assert-h
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
intprops
stdbool
stdint
-verify
+assert-h
configure.ac:
gl_UTIMECMP
xsize
errno
memchr
-verify
+assert-h
wchar
configure.ac:
tests/test-wchar.c
Depends-on:
-verify
+assert-h
wchar-c++-tests
configure.ac:
#include <stddef.h>
#include <stdint.h>
-#include "verify.h"
-
typedef long double longdouble;
typedef struct { char a[1]; } struct1;
typedef struct { char a[2]; } struct2;
#define CHECK(type) \
typedef struct { char slot1; type slot2; } type##_helper; \
- verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \
+ static_assert (alignof_slot (type) == offsetof (type##_helper, slot2)); \
const int type##_slot_alignment = alignof_slot (type); \
const int type##_type_alignment = alignof_type (type);
#else
# include "intprops.h"
#endif
-#include "verify.h"
#include <inttypes.h>
#include <limits.h>
/* Compile-time verification of expression X.
In this file, we need it as a statement, rather than as a declaration. */
-#define verify_stmt(x) do { verify (x); } while (0)
+#define verify_stmt(x) do { static_assert (x); } while (0)
/* VERIFY (X) uses a static assertion for compilers that are known to work,
and falls back on a dynamic assertion for other compilers.
#include <limits.h>
#include <string.h>
-#include "verify.h"
-
#include "macros.h"
#ifndef MINI_GMP_LIMB_TYPE
/* Verify that the gmp.h header file was generated for the same
machine word size as we are using. */
-verify (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT);
+static_assert (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT);
#endif
int
#include <limits.h>
-#include "verify.h"
-
#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
# pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
#define verify_width(width, min, max) \
- verify ((max) >> ((width) - 1 - ((min) < 0)) == 1)
+ static_assert ((max) >> ((width) - 1 - ((min) < 0)) == 1)
/* Macros borrowed from intprops.h. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* Numerical limit macros. */
char limits1[] = { CHAR_MIN, CHAR_MAX };
-verify (TYPE_MINIMUM (char) == CHAR_MIN);
-verify (TYPE_MAXIMUM (char) == CHAR_MAX);
+static_assert (TYPE_MINIMUM (char) == CHAR_MIN);
+static_assert (TYPE_MAXIMUM (char) == CHAR_MAX);
signed char limits2[] = { SCHAR_MIN, SCHAR_MAX };
-verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
-verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
+static_assert (TYPE_MINIMUM (signed char) == SCHAR_MIN);
+static_assert (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
unsigned char limits3[] = { UCHAR_MAX };
-verify (TYPE_MINIMUM (unsigned char) == 0);
-verify (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
+static_assert (TYPE_MINIMUM (unsigned char) == 0);
+static_assert (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
short limits4[] = { SHRT_MIN, SHRT_MAX };
-verify (TYPE_MINIMUM (short int) == SHRT_MIN);
-verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
+static_assert (TYPE_MINIMUM (short int) == SHRT_MIN);
+static_assert (TYPE_MAXIMUM (short int) == SHRT_MAX);
unsigned short limits5[] = { USHRT_MAX };
-verify (TYPE_MINIMUM (unsigned short int) == 0);
-verify (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
+static_assert (TYPE_MINIMUM (unsigned short int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
int limits6[] = { INT_MIN, INT_MAX };
-verify (TYPE_MINIMUM (int) == INT_MIN);
-verify (TYPE_MAXIMUM (int) == INT_MAX);
+static_assert (TYPE_MINIMUM (int) == INT_MIN);
+static_assert (TYPE_MAXIMUM (int) == INT_MAX);
unsigned int limits7[] = { UINT_MAX };
-verify (TYPE_MINIMUM (unsigned int) == 0);
-verify (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
+static_assert (TYPE_MINIMUM (unsigned int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
long limits8[] = { LONG_MIN, LONG_MAX };
-verify (TYPE_MINIMUM (long int) == LONG_MIN);
-verify (TYPE_MAXIMUM (long int) == LONG_MAX);
+static_assert (TYPE_MINIMUM (long int) == LONG_MIN);
+static_assert (TYPE_MAXIMUM (long int) == LONG_MAX);
unsigned long limits9[] = { ULONG_MAX };
-verify (TYPE_MINIMUM (unsigned long int) == 0);
-verify (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
+static_assert (TYPE_MINIMUM (unsigned long int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
long long limits10[] = { LLONG_MIN, LLONG_MAX };
-verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
-verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
+static_assert (TYPE_MINIMUM (long long int) == LLONG_MIN);
+static_assert (TYPE_MAXIMUM (long long int) == LLONG_MAX);
unsigned long long limits11[] = { ULLONG_MAX };
-verify (TYPE_MINIMUM (unsigned long long int) == 0);
-verify (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
+static_assert (TYPE_MINIMUM (unsigned long long int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
/* Macros specified by ISO/IEC TS 18661-1:2014. */
/* Macros specified by C2x. */
int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
-verify (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1);
+static_assert (BOOL_MAX == (((1U << (BOOL_WIDTH - 1)) - 1) * 2) + 1);
int
main (void)
#include <locale.h>
-#include "verify.h"
-
int a[] =
{
LC_ALL,
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
int
main ()
#include <pthread.h>
-#include "verify.h"
-
/* Check that the types are all defined. */
pthread_t t1;
#include <stdio.h>
#include <stdlib.h>
-#include "verify.h"
-
#ifdef USE_LONG_DOUBLE
# error Long double not supported.
#elif ! defined USE_FLOAT
/* Combine highbits and lowbits into a floating-point number,
sign-extending the lowbits to DOUBLE_BITS-NUM_HIGHBITS bits. */
union { DOUBLE f; DOUBLE_UINT i; } janus;
- verify (sizeof janus.f == sizeof janus.i);
+ static_assert (sizeof janus.f == sizeof janus.i);
janus.i = lowbits | (highbits << (DOUBLE_BITS - NUM_HIGHBITS));
if (lowbits >> (NUM_LOWBITS - 1))
janus.i |= ((DOUBLE_UINT) -1
#include <stddef.h>
#include <stdint.h>
-#include "verify.h"
-
#include "macros.h"
typedef long double longdouble;
#define CHECK_STATIC(type) \
typedef struct { char slot1; type slot2; } type##_helper; \
- verify (alignof (type) == offsetof (type##_helper, slot2)); \
+ static_assert (alignof (type) == offsetof (type##_helper, slot2)); \
const int type##_alignment = alignof (type); \
type alignas (TEST_ALIGNMENT) static_##type##_alignas
#include <stddef.h>
#include <limits.h>
#include <stdalign.h>
-#include "verify.h"
/* Check that appropriate types are defined. */
wchar_t a = 'c';
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
/* Check that offsetof produces integer constants with correct type. */
struct d
/* Solaris 10 has a bug where offsetof is under-parenthesized, and
cannot be used as an arbitrary expression. However, since it is
unlikely to bite real code, we ignore that short-coming. */
-/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */
-verify (sizeof (offsetof (struct d, e)) == sizeof (size_t));
-verify (offsetof (struct d, f) == 1);
+/* static_assert (sizeof offsetof (struct d, e) == sizeof (size_t)); */
+static_assert (sizeof (offsetof (struct d, e)) == sizeof (size_t));
+static_assert (offsetof (struct d, f) == 1);
/* offsetof promotes to an unsigned integer if and only if sizes do
not fit in int. */
-verify ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
+static_assert ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
/* Check max_align_t's alignment. */
-verify (alignof (double) <= alignof (max_align_t));
-verify (alignof (int) <= alignof (max_align_t));
-verify (alignof (long double) <= alignof (max_align_t));
-verify (alignof (long int) <= alignof (max_align_t));
-verify (alignof (ptrdiff_t) <= alignof (max_align_t));
-verify (alignof (size_t) <= alignof (max_align_t));
-verify (alignof (wchar_t) <= alignof (max_align_t));
-verify (alignof (struct d) <= alignof (max_align_t));
+static_assert (alignof (double) <= alignof (max_align_t));
+static_assert (alignof (int) <= alignof (max_align_t));
+static_assert (alignof (long double) <= alignof (max_align_t));
+static_assert (alignof (long int) <= alignof (max_align_t));
+static_assert (alignof (ptrdiff_t) <= alignof (max_align_t));
+static_assert (alignof (size_t) <= alignof (max_align_t));
+static_assert (alignof (wchar_t) <= alignof (max_align_t));
+static_assert (alignof (struct d) <= alignof (max_align_t));
#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
-verify (__alignof__ (double) <= __alignof__ (max_align_t));
-verify (__alignof__ (int) <= __alignof__ (max_align_t));
-verify (__alignof__ (long double) <= __alignof__ (max_align_t));
-verify (__alignof__ (long int) <= __alignof__ (max_align_t));
-verify (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t));
-verify (__alignof__ (size_t) <= __alignof__ (max_align_t));
-verify (__alignof__ (wchar_t) <= __alignof__ (max_align_t));
-verify (__alignof__ (struct d) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (size_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (wchar_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (struct d) <= __alignof__ (max_align_t));
#endif
int
#include <stdio.h>
-#include "verify.h"
-
/* Check that the various SEEK_* macros are defined. */
int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
/* Check that the types are all defined. */
fpos_t t1;
#include <stdlib.h>
-#include "verify.h"
-
/* Check that EXIT_SUCCESS is 0, per POSIX. */
static int exitcode = EXIT_SUCCESS;
#if EXIT_SUCCESS
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
#if GNULIB_TEST_SYSTEM_POSIX
# include "test-sys_wait.h"
#include <string.h>
-#include "verify.h"
-
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
int
main (void)
#include <sys/stat.h>
-#include "verify.h"
-
/* Check the existence of some macros. */
int a[] =
{
/* Sanity checks. */
-verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR));
-verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP));
-verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH));
+static_assert (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR));
+static_assert (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP));
+static_assert (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH));
#ifdef S_IFBLK
-verify (S_ISBLK (S_IFBLK));
+static_assert (S_ISBLK (S_IFBLK));
#endif
-verify (!S_ISBLK (S_IFCHR));
-verify (!S_ISBLK (S_IFDIR));
-verify (!S_ISBLK (S_IFIFO));
-verify (!S_ISBLK (S_IFREG));
+static_assert (!S_ISBLK (S_IFCHR));
+static_assert (!S_ISBLK (S_IFDIR));
+static_assert (!S_ISBLK (S_IFIFO));
+static_assert (!S_ISBLK (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISBLK (S_IFLNK));
+static_assert (!S_ISBLK (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISBLK (S_IFSOCK));
+static_assert (!S_ISBLK (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISCHR (S_IFBLK));
+static_assert (!S_ISCHR (S_IFBLK));
#endif
-verify (S_ISCHR (S_IFCHR));
-verify (!S_ISCHR (S_IFDIR));
-verify (!S_ISCHR (S_IFIFO));
-verify (!S_ISCHR (S_IFREG));
+static_assert (S_ISCHR (S_IFCHR));
+static_assert (!S_ISCHR (S_IFDIR));
+static_assert (!S_ISCHR (S_IFIFO));
+static_assert (!S_ISCHR (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISCHR (S_IFLNK));
+static_assert (!S_ISCHR (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISCHR (S_IFSOCK));
+static_assert (!S_ISCHR (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISDIR (S_IFBLK));
+static_assert (!S_ISDIR (S_IFBLK));
#endif
-verify (!S_ISDIR (S_IFCHR));
-verify (S_ISDIR (S_IFDIR));
-verify (!S_ISDIR (S_IFIFO));
-verify (!S_ISDIR (S_IFREG));
+static_assert (!S_ISDIR (S_IFCHR));
+static_assert (S_ISDIR (S_IFDIR));
+static_assert (!S_ISDIR (S_IFIFO));
+static_assert (!S_ISDIR (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISDIR (S_IFLNK));
+static_assert (!S_ISDIR (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISDIR (S_IFSOCK));
+static_assert (!S_ISDIR (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISFIFO (S_IFBLK));
+static_assert (!S_ISFIFO (S_IFBLK));
#endif
-verify (!S_ISFIFO (S_IFCHR));
-verify (!S_ISFIFO (S_IFDIR));
-verify (S_ISFIFO (S_IFIFO));
-verify (!S_ISFIFO (S_IFREG));
+static_assert (!S_ISFIFO (S_IFCHR));
+static_assert (!S_ISFIFO (S_IFDIR));
+static_assert (S_ISFIFO (S_IFIFO));
+static_assert (!S_ISFIFO (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISFIFO (S_IFLNK));
+static_assert (!S_ISFIFO (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISFIFO (S_IFSOCK));
+static_assert (!S_ISFIFO (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISREG (S_IFBLK));
+static_assert (!S_ISREG (S_IFBLK));
#endif
-verify (!S_ISREG (S_IFCHR));
-verify (!S_ISREG (S_IFDIR));
-verify (!S_ISREG (S_IFIFO));
-verify (S_ISREG (S_IFREG));
+static_assert (!S_ISREG (S_IFCHR));
+static_assert (!S_ISREG (S_IFDIR));
+static_assert (!S_ISREG (S_IFIFO));
+static_assert (S_ISREG (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISREG (S_IFLNK));
+static_assert (!S_ISREG (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISREG (S_IFSOCK));
+static_assert (!S_ISREG (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISLNK (S_IFBLK));
+static_assert (!S_ISLNK (S_IFBLK));
#endif
-verify (!S_ISLNK (S_IFCHR));
-verify (!S_ISLNK (S_IFDIR));
-verify (!S_ISLNK (S_IFIFO));
-verify (!S_ISLNK (S_IFREG));
+static_assert (!S_ISLNK (S_IFCHR));
+static_assert (!S_ISLNK (S_IFDIR));
+static_assert (!S_ISLNK (S_IFIFO));
+static_assert (!S_ISLNK (S_IFREG));
#ifdef S_IFLNK
-verify (S_ISLNK (S_IFLNK));
+static_assert (S_ISLNK (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISLNK (S_IFSOCK));
+static_assert (!S_ISLNK (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISSOCK (S_IFBLK));
+static_assert (!S_ISSOCK (S_IFBLK));
#endif
-verify (!S_ISSOCK (S_IFCHR));
-verify (!S_ISSOCK (S_IFDIR));
-verify (!S_ISSOCK (S_IFIFO));
-verify (!S_ISSOCK (S_IFREG));
+static_assert (!S_ISSOCK (S_IFCHR));
+static_assert (!S_ISSOCK (S_IFDIR));
+static_assert (!S_ISSOCK (S_IFIFO));
+static_assert (!S_ISSOCK (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISSOCK (S_IFLNK));
+static_assert (!S_ISSOCK (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (S_ISSOCK (S_IFSOCK));
+static_assert (S_ISSOCK (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISDOOR (S_IFBLK));
+static_assert (!S_ISDOOR (S_IFBLK));
#endif
-verify (!S_ISDOOR (S_IFCHR));
-verify (!S_ISDOOR (S_IFDIR));
-verify (!S_ISDOOR (S_IFIFO));
-verify (!S_ISDOOR (S_IFREG));
+static_assert (!S_ISDOOR (S_IFCHR));
+static_assert (!S_ISDOOR (S_IFDIR));
+static_assert (!S_ISDOOR (S_IFIFO));
+static_assert (!S_ISDOOR (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISDOOR (S_IFLNK));
+static_assert (!S_ISDOOR (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISDOOR (S_IFSOCK));
+static_assert (!S_ISDOOR (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISMPB (S_IFBLK));
+static_assert (!S_ISMPB (S_IFBLK));
#endif
-verify (!S_ISMPB (S_IFCHR));
-verify (!S_ISMPB (S_IFDIR));
-verify (!S_ISMPB (S_IFIFO));
-verify (!S_ISMPB (S_IFREG));
+static_assert (!S_ISMPB (S_IFCHR));
+static_assert (!S_ISMPB (S_IFDIR));
+static_assert (!S_ISMPB (S_IFIFO));
+static_assert (!S_ISMPB (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISMPB (S_IFLNK));
+static_assert (!S_ISMPB (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISMPB (S_IFSOCK));
+static_assert (!S_ISMPB (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISMPX (S_IFBLK));
+static_assert (!S_ISMPX (S_IFBLK));
#endif
-verify (!S_ISMPX (S_IFCHR));
-verify (!S_ISMPX (S_IFDIR));
-verify (!S_ISMPX (S_IFIFO));
-verify (!S_ISMPX (S_IFREG));
+static_assert (!S_ISMPX (S_IFCHR));
+static_assert (!S_ISMPX (S_IFDIR));
+static_assert (!S_ISMPX (S_IFIFO));
+static_assert (!S_ISMPX (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISMPX (S_IFLNK));
+static_assert (!S_ISMPX (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISMPX (S_IFSOCK));
+static_assert (!S_ISMPX (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISNAM (S_IFBLK));
+static_assert (!S_ISNAM (S_IFBLK));
#endif
-verify (!S_ISNAM (S_IFCHR));
-verify (!S_ISNAM (S_IFDIR));
-verify (!S_ISNAM (S_IFIFO));
-verify (!S_ISNAM (S_IFREG));
+static_assert (!S_ISNAM (S_IFCHR));
+static_assert (!S_ISNAM (S_IFDIR));
+static_assert (!S_ISNAM (S_IFIFO));
+static_assert (!S_ISNAM (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISNAM (S_IFLNK));
+static_assert (!S_ISNAM (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISNAM (S_IFSOCK));
+static_assert (!S_ISNAM (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISNWK (S_IFBLK));
+static_assert (!S_ISNWK (S_IFBLK));
#endif
-verify (!S_ISNWK (S_IFCHR));
-verify (!S_ISNWK (S_IFDIR));
-verify (!S_ISNWK (S_IFIFO));
-verify (!S_ISNWK (S_IFREG));
+static_assert (!S_ISNWK (S_IFCHR));
+static_assert (!S_ISNWK (S_IFDIR));
+static_assert (!S_ISNWK (S_IFIFO));
+static_assert (!S_ISNWK (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISNWK (S_IFLNK));
+static_assert (!S_ISNWK (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISNWK (S_IFSOCK));
+static_assert (!S_ISNWK (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISPORT (S_IFBLK));
+static_assert (!S_ISPORT (S_IFBLK));
#endif
-verify (!S_ISPORT (S_IFCHR));
-verify (!S_ISPORT (S_IFDIR));
-verify (!S_ISPORT (S_IFIFO));
-verify (!S_ISPORT (S_IFREG));
+static_assert (!S_ISPORT (S_IFCHR));
+static_assert (!S_ISPORT (S_IFDIR));
+static_assert (!S_ISPORT (S_IFIFO));
+static_assert (!S_ISPORT (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISPORT (S_IFLNK));
+static_assert (!S_ISPORT (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISPORT (S_IFSOCK));
+static_assert (!S_ISPORT (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISCTG (S_IFBLK));
+static_assert (!S_ISCTG (S_IFBLK));
#endif
-verify (!S_ISCTG (S_IFCHR));
-verify (!S_ISCTG (S_IFDIR));
-verify (!S_ISCTG (S_IFIFO));
-verify (!S_ISCTG (S_IFREG));
+static_assert (!S_ISCTG (S_IFCHR));
+static_assert (!S_ISCTG (S_IFDIR));
+static_assert (!S_ISCTG (S_IFIFO));
+static_assert (!S_ISCTG (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISCTG (S_IFLNK));
+static_assert (!S_ISCTG (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISCTG (S_IFSOCK));
+static_assert (!S_ISCTG (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISOFD (S_IFBLK));
+static_assert (!S_ISOFD (S_IFBLK));
#endif
-verify (!S_ISOFD (S_IFCHR));
-verify (!S_ISOFD (S_IFDIR));
-verify (!S_ISOFD (S_IFIFO));
-verify (!S_ISOFD (S_IFREG));
+static_assert (!S_ISOFD (S_IFCHR));
+static_assert (!S_ISOFD (S_IFDIR));
+static_assert (!S_ISOFD (S_IFIFO));
+static_assert (!S_ISOFD (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISOFD (S_IFLNK));
+static_assert (!S_ISOFD (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISOFD (S_IFSOCK));
+static_assert (!S_ISOFD (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISOFL (S_IFBLK));
+static_assert (!S_ISOFL (S_IFBLK));
#endif
-verify (!S_ISOFL (S_IFCHR));
-verify (!S_ISOFL (S_IFDIR));
-verify (!S_ISOFL (S_IFIFO));
-verify (!S_ISOFL (S_IFREG));
+static_assert (!S_ISOFL (S_IFCHR));
+static_assert (!S_ISOFL (S_IFDIR));
+static_assert (!S_ISOFL (S_IFIFO));
+static_assert (!S_ISOFL (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISOFL (S_IFLNK));
+static_assert (!S_ISOFL (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISOFL (S_IFSOCK));
+static_assert (!S_ISOFL (S_IFSOCK));
#endif
#ifdef S_IFBLK
-verify (!S_ISWHT (S_IFBLK));
+static_assert (!S_ISWHT (S_IFBLK));
#endif
-verify (!S_ISWHT (S_IFCHR));
-verify (!S_ISWHT (S_IFDIR));
-verify (!S_ISWHT (S_IFIFO));
-verify (!S_ISWHT (S_IFREG));
+static_assert (!S_ISWHT (S_IFCHR));
+static_assert (!S_ISWHT (S_IFDIR));
+static_assert (!S_ISWHT (S_IFIFO));
+static_assert (!S_ISWHT (S_IFREG));
#ifdef S_IFLNK
-verify (!S_ISWHT (S_IFLNK));
+static_assert (!S_ISWHT (S_IFLNK));
#endif
#ifdef S_IFSOCK
-verify (!S_ISWHT (S_IFSOCK));
+static_assert (!S_ISWHT (S_IFSOCK));
#endif
/* POSIX 2008 requires traditional encoding of permission constants. */
-verify (S_IRWXU == 00700);
-verify (S_IRUSR == 00400);
-verify (S_IWUSR == 00200);
-verify (S_IXUSR == 00100);
-verify (S_IRWXG == 00070);
-verify (S_IRGRP == 00040);
-verify (S_IWGRP == 00020);
-verify (S_IXGRP == 00010);
-verify (S_IRWXO == 00007);
-verify (S_IROTH == 00004);
-verify (S_IWOTH == 00002);
-verify (S_IXOTH == 00001);
-verify (S_ISUID == 04000);
-verify (S_ISGID == 02000);
-verify (S_ISVTX == 01000);
+static_assert (S_IRWXU == 00700);
+static_assert (S_IRUSR == 00400);
+static_assert (S_IWUSR == 00200);
+static_assert (S_IXUSR == 00100);
+static_assert (S_IRWXG == 00070);
+static_assert (S_IRGRP == 00040);
+static_assert (S_IWGRP == 00020);
+static_assert (S_IXGRP == 00010);
+static_assert (S_IRWXO == 00007);
+static_assert (S_IROTH == 00004);
+static_assert (S_IWOTH == 00002);
+static_assert (S_IXOTH == 00001);
+static_assert (S_ISUID == 04000);
+static_assert (S_ISGID == 02000);
+static_assert (S_ISVTX == 01000);
#if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \
|| (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \
#include <time.h>
-#include "verify.h"
-
/* Check that the types are all defined. */
struct timespec t1;
#if 0
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
/* Check that TIME_UTC is defined and a positive integer. */
int t3 = TIME_UTC;
-verify (TIME_UTC > 0);
+static_assert (TIME_UTC > 0);
int
main (void)
#include <uchar.h>
-#include "verify.h"
-
/* Check that the types are defined. */
mbstate_t a = { 0 };
size_t b = 5;
char32_t d = 'y';
/* Check that char16_t and char32_t are unsigned types. */
-verify ((char16_t)(-1) >= 0);
+static_assert ((char16_t)(-1) >= 0);
#if !defined __HP_cc
-verify ((char32_t)(-1) >= 0);
+static_assert ((char32_t)(-1) >= 0);
#endif
/* Check that char32_t is at least 31 bits wide. */
-verify ((char32_t)0x7FFFFFFF != (char32_t)0x3FFFFFFF);
+static_assert ((char32_t)0x7FFFFFFF != (char32_t)0x3FFFFFFF);
/* Check that _GL_LARGE_CHAR32_T is correctly defined. */
#if _GL_LARGE_CHAR32_T
-verify (sizeof (char32_t) > sizeof (wchar_t));
+static_assert (sizeof (char32_t) > sizeof (wchar_t));
#else
-verify (sizeof (char32_t) == sizeof (wchar_t));
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
#endif
int
#include <unistd.h>
-#include "verify.h"
-
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
/* Check that the various SEEK_* macros are defined. */
int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
#include <wchar.h>
-#include "verify.h"
-
/* Check that the types wchar_t and wint_t are defined. */
wchar_t a = 'c';
wint_t b = 'x';
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
-verify (sizeof NULL == sizeof (void *));
+static_assert (sizeof NULL == sizeof (void *));
int
main (void)