1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

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.
If not, arrange for config.h to #define static_assert
by including <assert.h>, and then do "#undef assert"
so that the assert macro still needs an explicit include.
This should be safe even on very old hosts, as assert.h
has been re-includable for decades.
* tests/tests-assert.c: New test.
* modules/assert-h-tests (Files, Makefile.am): Add it.
This commit is contained in:
Paul Eggert
2022-09-13 17:29:35 -05:00
parent c34d193387
commit c504bec035
7 changed files with 171 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
Description:
An <assert.h> that conforms to C11.
An <assert.h> and static_assert that are like C23.
Files:
lib/assert.in.h