Skip to content

Commit

Permalink
Stop using assertions as optimization hints
Browse files Browse the repository at this point in the history
Some code that shouldn't be generated in release builds was being
generated.  Maybe a different macro should be introduced instead.
  • Loading branch information
lpereira committed Apr 18, 2024
1 parent 6448577 commit 344c141
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/lib/missing/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@
# define static_assert(expr, msg)
#endif

/* Use assertions as optimization hints */
#ifndef NDEBUG
#undef assert
#ifdef __clang__
#define assert(expr) __builtin_assume(expr)
#else
#define assert(expr) \
do { \
if (!(expr)) \
__builtin_unreachable(); \
} while (0)
#endif
#endif

/* Macro to enable self-test on startup in debug builds.
* Details: https://tia.mat.br/posts/2023/12/11/self-test.html */
#if defined(NDEBUG)
Expand Down

0 comments on commit 344c141

Please sign in to comment.