debug/assert: give WARN_RETURN a sane name

This commit is contained in:
Danny Robson 2019-07-19 16:33:37 +10:00
parent 07b1b04abc
commit 2d9a7109b1

View File

@ -75,6 +75,21 @@ constexpr bool debug_enabled = false;
} while (0) } while (0)
#define RETURN_FALSE_UNLESS(CONDITION) { \
if (const auto &__return_false_unless = (CONDITION); !__return_false_unless) { \
if constexpr (debug_enabled) { \
std::cerr << __FILE__ << ':' \
<< __LINE__ << ':' \
<< __PRETTY_FUNCTION__ << "; " \
<< #CONDITION << '\n'; \
breakpoint (); \
} \
\
return false; \
} \
} while (0)
#define WARN_RETURN(CONDITION,VALUE) do { \ #define WARN_RETURN(CONDITION,VALUE) do { \
if (const auto& __warn_return = (CONDITION); !!__warn_return) { \ if (const auto& __warn_return = (CONDITION); !!__warn_return) { \
if constexpr (debug_enabled) { \ if constexpr (debug_enabled) { \