From 386fc8817e637fdd52c20e4ace6cc4ea1f1186ed Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 27 Aug 2024 15:59:57 -0400 Subject: diag: Get rid of bfs_static_assert() In most cases, it's not too annoying to specify a message. For tests/bit.c, we can manually polyfill the 1-argument version. --- src/diag.h | 10 ---------- src/ioq.c | 3 +-- src/trie.c | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/diag.h b/src/diag.h index d70bd43..a8e5a5c 100644 --- a/src/diag.h +++ b/src/diag.h @@ -12,16 +12,6 @@ #include "bfstd.h" #include -/** - * static_assert() with an optional second argument. - */ -#if __STDC_VERSION__ >= C23 -# 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 - /** * A source code location. */ diff --git a/src/ioq.c b/src/ioq.c index 50898c6..603163d 100644 --- a/src/ioq.c +++ b/src/ioq.c @@ -180,8 +180,7 @@ typedef atomic uintptr_t ioq_slot; /** Amount to add for an additional skip. */ #define IOQ_SKIP_ONE (~IOQ_BLOCKED) -// Need room for two flag bits -bfs_static_assert(alignof(struct ioq_ent) >= (1 << 2)); +static_assert(alignof(struct ioq_ent) >= (1 << 2), "struct ioq_ent is underaligned"); /** * An MPMC queue of I/O commands. diff --git a/src/trie.c b/src/trie.c index e1c9f26..1c4ac77 100644 --- a/src/trie.c +++ b/src/trie.c @@ -90,7 +90,7 @@ #include #include -bfs_static_assert(CHAR_WIDTH == 8); +static_assert(CHAR_WIDTH == 8, "This trie implementation assumes 8-bit bytes."); #if __i386__ || __x86_64__ # define _trie_clones _target_clones("popcnt", "default") -- cgit v1.2.3