From 2d9a7109b1ba37803f500eec8986bf8025047095 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 19 Jul 2019 16:33:37 +1000 Subject: [PATCH] debug/assert: give WARN_RETURN a sane name --- debug/assert.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debug/assert.hpp b/debug/assert.hpp index 7fa498be..2f12a41e 100644 --- a/debug/assert.hpp +++ b/debug/assert.hpp @@ -75,6 +75,21 @@ constexpr bool debug_enabled = false; } 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 { \ if (const auto& __warn_return = (CONDITION); !!__warn_return) { \ if constexpr (debug_enabled) { \