diff options
| author | Coleman McFarland <43583445+dontlaugh@users.noreply.github.com> | 2025-02-02 20:32:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-02 20:32:07 -0500 |
| commit | f4439053787208bac2336ce999baa2afc7a0a2cb (patch) | |
| tree | 68bf680257ef33fbebe2b2a9f3216666abe678bb /src/assert.hh | |
| parent | d92496449d0c9655253ad16363685bb8446dc582 (diff) | |
Change kak_assert macro to silence a clang-tidy warning
When KAK_DEBUG is false (release mode), clang tidy emits a
warning when we pass a pointer to kak_assert. It's mad about
passing a pointer to `sizeof`.
We can avoid this warning by using `alignof(decltype(...))`. It
will still type-check the expression.
Diffstat (limited to 'src/assert.hh')
| -rw-r--r-- | src/assert.hh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/assert.hh b/src/assert.hh index ff642c9a..3bbb45d0 100644 --- a/src/assert.hh +++ b/src/assert.hh @@ -30,7 +30,7 @@ void on_assert_failed(const char* message); "\" at " __FILE__ ":" TOSTRING(__LINE__)); \ } catch (exception_type &err) {} #else - #define kak_assert(...) do { (void)sizeof(__VA_ARGS__); } while(false) + #define kak_assert(...) do { (void)alignof(decltype(__VA_ARGS__)); } while(false) #define kak_expect_throw(_, ...) do { (void)sizeof(__VA_ARGS__); } while(false) #endif |
