In the spirit of the recent patches for bool and C23, here's a proposed pair of patches for C23's new keyword static_assert. This uses a similar approach, in that the existing assert-h module, which already provides an <assert.h> that supplies a static_assert macro, is modified to provide something like C23 static_assert even if you don't include <assert.h>. This patchset does differ from the bool patchset in that we can't assume the system <assert.h> supplies a static_assert macro since Gnulib doesn't assume C11.
I haven't installed these into Gnulib. Comments welcome. Paul Eggert (2): assert-h: static_assert is a keyword in C23 assert-h: prefer to ‘verify’ ChangeLog | 65 +++++++ doc/gnulib.texi | 27 ++- doc/posix-headers/assert.texi | 38 ++-- lib/alignalloc.c | 5 +- lib/argmatch.h | 4 +- lib/c32is-impl.h | 3 +- lib/c32snrtombs.c | 4 +- lib/c32srtombs.c | 4 +- lib/exclude.c | 9 +- lib/filevercmp.c | 3 +- lib/fma.c | 5 +- lib/i-ring.h | 3 +- lib/ino-map.c | 3 +- lib/localeinfo.c | 8 +- lib/malloca.c | 3 +- lib/mbrtoc32.c | 3 +- lib/mbrtowc.c | 3 +- lib/mbsinit.c | 3 +- lib/mbsnrtoc32s.c | 4 +- lib/mbsrtoc32s.c | 4 +- lib/nanosleep.c | 3 +- lib/parse-datetime.y | 9 +- lib/pipe2.c | 3 +- lib/rawmemchr.c | 3 +- lib/relocwrapper.c | 3 +- lib/sleep.c | 4 +- lib/stat-w32.c | 3 +- lib/stat.c | 1 - lib/strerror.c | 3 +- lib/strtoimax.c | 6 +- lib/utimecmp.c | 3 +- lib/vasnprintf.c | 11 +- m4/assert_h.m4 | 43 ++++- modules/alignalloc | 2 +- modules/alignof-tests | 3 +- modules/argmatch | 2 +- modules/assert-h | 2 +- modules/assert-h-tests | 3 + modules/c-vasnprintf | 2 +- modules/c32isalnum | 2 +- modules/c32isalpha | 2 +- modules/c32isblank | 2 +- modules/c32iscntrl | 2 +- modules/c32isdigit | 2 +- modules/c32isgraph | 2 +- modules/c32islower | 2 +- modules/c32isprint | 2 +- modules/c32ispunct | 2 +- modules/c32isspace | 2 +- modules/c32isupper | 2 +- modules/c32isxdigit | 2 +- modules/c32snrtombs | 2 +- modules/c32srtombs | 2 +- modules/exclude | 2 +- modules/filevercmp | 2 +- modules/fma | 2 +- modules/fmaf | 2 +- modules/fmal | 2 +- modules/fstat | 2 +- modules/i-ring | 2 +- modules/ino-map | 2 +- modules/intprops-tests | 2 +- modules/libgmp-tests | 2 +- modules/limits-h-tests | 2 +- modules/locale-tests | 2 +- modules/malloca | 2 +- modules/mbrtoc32 | 2 +- modules/mbrtowc | 2 +- modules/mbsinit | 2 +- modules/mbsnrtoc32s | 2 +- modules/mbsrtoc32s | 2 +- modules/nanosleep | 2 +- modules/parse-datetime | 2 +- modules/pipe2 | 2 +- modules/pthread-h-tests | 2 +- modules/rawmemchr | 2 +- modules/relocatable-prog-wrapper | 2 +- modules/round-tests | 2 +- modules/roundf-tests | 2 +- modules/sleep | 2 +- modules/stat | 2 +- modules/stdalign-tests | 2 +- modules/stdckdint-tests | 2 +- modules/stddef-tests | 2 +- modules/stdio-tests | 2 +- modules/stdlib-tests | 2 +- modules/strerror | 2 +- modules/string-tests | 2 +- modules/strtoimax | 2 +- modules/strtoumax | 2 +- modules/sys_stat-tests | 2 +- modules/time-tests | 2 +- modules/uchar-tests | 2 +- modules/unistd-tests | 2 +- modules/unistdio/u16-u16-vasnprintf | 2 +- modules/unistdio/u16-vasnprintf | 2 +- modules/unistdio/u32-u32-vasnprintf | 2 +- modules/unistdio/u32-vasnprintf | 2 +- modules/unistdio/u8-u8-vasnprintf | 2 +- modules/unistdio/u8-vasnprintf | 2 +- modules/unistdio/ulc-vasnprintf | 2 +- modules/utimecmp | 2 +- modules/vasnprintf | 2 +- modules/wchar-tests | 2 +- tests/test-alignof.c | 4 +- tests/test-assert.c | 71 +++++++ tests/test-intprops.c | 3 +- tests/test-libgmp.c | 4 +- tests/test-limits-h.c | 50 +++-- tests/test-locale.c | 4 +- tests/test-pthread.c | 2 - tests/test-round2.c | 4 +- tests/test-stdalign.c | 10 +- tests/test-stddef.c | 43 +++-- tests/test-stdio.c | 4 +- tests/test-stdlib.c | 4 +- tests/test-string.c | 4 +- tests/test-sys_stat.c | 276 ++++++++++++++-------------- tests/test-time.c | 6 +- tests/test-uchar.c | 12 +- tests/test-unistd.c | 4 +- tests/test-wchar.c | 4 +- 122 files changed, 540 insertions(+), 409 deletions(-) create mode 100644 tests/test-assert.c -- 2.37.2