@samp{verify (@var{V});} even when @var{V} is
nonzero.
-Although the standard @code{assert} macro is a runtime test, C2x
-specifies a builtin @code{_Static_assert (@var{V})},
-its @file{assert.h} header has a similar macro
-named @code{static_assert}, and C++17 has a similar
-@code{static_assert} builtin. These builtins and macros differ
-from @code{verify} in two major ways. First, they can also be used
+Although the standard @code{assert} macro is a runtime test, C23 and C++17
+specify a builtin @code{static_assert (@var{V})}, which differs
+from @code{verify} in two major ways. First, it can also be used
within a @code{struct} or @code{union} specifier, in place of an
-ordinary member declaration. Second, they allow the programmer to
+ordinary member declaration. Second, it allows the programmer to
specify, as an optional second argument, a compile-time diagnostic as
a string literal. If your program is not intended to be portable to
-compilers that lack C2x or C++17 @code{static_assert}, the only
+compilers that lack C23 or C++17 @code{static_assert}, the only
advantage of @code{verify} is that its name is a bit shorter.
The @file{verify.h} header defines one more macro, @code{assume
works as per C11. This is supported by GCC 4.6.0+ and by clang 4+.
Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
- per C2x. This is supported by GCC 9.1+.
+ per C23. This is supported by GCC 9.1+.
Support compilers claiming conformance to the relevant standard,
and also support GCC when not pedantic. If we were willing to slow
'configure' down we could also use it with other compilers, but
since this affects only the quality of diagnostics, why bother? */
#ifndef __cplusplus
-# if (201112L <= __STDC_VERSION__ \
+# if (201112 <= __STDC_VERSION__ \
|| (!defined __STRICT_ANSI__ \
&& (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
# define _GL_HAVE__STATIC_ASSERT 1
# endif
-# if (202000L <= __STDC_VERSION__ \
+# if (202000 <= __STDC_VERSION__ \
|| (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
# define _GL_HAVE__STATIC_ASSERT1 1
# endif
This macro requires three or more arguments but uses at most the first
two, so that the _Static_assert macro optionally defined below supports
- both the C11 two-argument syntax and the C2x one-argument syntax.
+ both the C11 two-argument syntax and the C23 one-argument syntax.
Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */
-#if 200410 <= __cpp_static_assert
+#if 202311 <= __STDC_VERSION__ || 200410 <= __cpp_static_assert
# define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC)
#elif defined _GL_HAVE__STATIC_ASSERT
# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
# define _Static_assert(...) \
_GL_VERIFY (__VA_ARGS__, "static assertion failed", -)
# endif
-# if __cpp_static_assert < 201411 && !defined static_assert
+# if (!defined static_assert \
+ && __STDC_VERSION__ < 202311 && __cpp_static_assert < 201411)
# define static_assert _Static_assert /* C11 requires this #define. */
# endif
#endif
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER
# define assume(R) __assume (R)
-#elif 202311L <= __STDC_VERSION__
+#elif 202311 <= __STDC_VERSION__
# include <stddef.h>
# define assume(R) ((R) ? (void) 0 : unreachable ())
#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP