diff --git a/src/include/lean/lean.h b/src/include/lean/lean.h index 51e8984b8324..41e5b4c9ec8b 100644 --- a/src/include/lean/lean.h +++ b/src/include/lean/lean.h @@ -37,7 +37,13 @@ extern "C" { #if defined(__GNUC__) || defined(__clang__) #define LEAN_UNLIKELY(x) (__builtin_expect((x), 0)) #define LEAN_LIKELY(x) (__builtin_expect((x), 1)) + +// We have observed stack frame increases from forced inlining overflowing the stack in debug builds, +// let's leave the decision to the compiler in that case +#ifdef NDEBUG #define LEAN_ALWAYS_INLINE __attribute__((always_inline)) +#endif + #else #define LEAN_UNLIKELY(x) (x) #define LEAN_LIKELY(x) (x)