summaryrefslogtreecommitdiff
path: root/include/tinyff/compat.h
diff options
context:
space:
mode:
authorWatson Wheeler <git@tazy.dev>2026-06-28 20:32:28 +1000
committerWatson Wheeler <git@tazy.dev>2026-07-02 19:39:07 +1000
commitecac8276be96da73512be6823e793b0952f29694 (patch)
tree04ffe0cf90950c81b3da89543806dcee9998b9be /include/tinyff/compat.h
parentc6f5ecdbbd82989f4641fe193e9d76de97446d03 (diff)
fix(compat): fix c99 static_assert LINE macro expansion
Added a wrapper (COMPAT_PASTE) to ensure LINE gets expanded properly Signed-off-by: Watson Wheeler <git@tazy.dev>
Diffstat (limited to 'include/tinyff/compat.h')
-rw-r--r--include/tinyff/compat.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/tinyff/compat.h b/include/tinyff/compat.h
index 0199513..1d64684 100644
--- a/include/tinyff/compat.h
+++ b/include/tinyff/compat.h
@@ -26,12 +26,12 @@
// Static assertion fallback for c99
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
- // static_assert already in version
# include <assert.h>
#else
- // c99 dummy
+# define COMPAT_PASTE_INNER(a, b) a ## b
+# define COMPAT_PASTE(a, b) COMPAT_PASTE_INNER(a, b)
# define COMPAT_STATIC_ASSERT(expr, msg) \
- typedef char compat_assertion_failed##__LINE__[(expr) ? 1 : -1]
+ typedef char COMPAT_PASTE(compat_assertion_failed_, __LINE__)[(expr) ? 1 : -1]
# undef static_assert
# define static_assert(expr, msg) COMPAT_STATIC_ASSERT(expr, msg)