diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-05-11 14:07:54 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-05-16 11:29:31 -0400 |
commit | 72cd1c2a584d89e76a5e9e7deaf07ddc4196d1aa (patch) | |
tree | 6cc8a291a2276d05790ba738637c65d5775f3620 | |
parent | a7932050f65844fb1f1145fee87c72aadaf4f995 (diff) | |
download | bfs-72cd1c2a584d89e76a5e9e7deaf07ddc4196d1aa.tar.xz |
diag: New bfs_static_assert() macro
-rw-r--r-- | src/diag.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -2,7 +2,7 @@ // SPDX-License-Identifier: 0BSD /** - * Formatters for diagnostic messages. + * Diagnostic messages. */ #ifndef BFS_DIAG_H @@ -12,6 +12,16 @@ #include "config.h" #include <stdarg.h> +/** + * static_assert() with an optional second argument. + */ +#if __STDC_VERSION__ >= 202311L +# define bfs_static_assert static_assert +#else +# define bfs_static_assert(...) BFS_STATIC_ASSERT(__VA_ARGS__, #__VA_ARGS__, ) +# define BFS_STATIC_ASSERT(expr, msg, ...) _Static_assert(expr, msg) +#endif + struct bfs_expr; /** |