debug: add WARN_RETURN macro

This commit is contained in:
Danny Robson 2018-04-23 15:39:07 +10:00
parent f3f26fca64
commit 97f64490cf

View File

@ -78,6 +78,21 @@
} while (0) } while (0)
#define WARN_RETURN(CONDITION,VALUE) do { \
if (const auto& __warn_return = (CONDITION); !!__warn_return) { \
if constexpr (debug_enabled) { \
std::clog << __FILE__ << ':' \
<< __LINE__ << ':' \
<< __PRETTY_FUNCTION__ << "; " \
<< #CONDITION << '\n'; \
breakpoint (); \
} \
\
return (VALUE); \
} \
} while (0)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define _CHECK_PANIC(FMT,...) do { \ #define _CHECK_PANIC(FMT,...) do { \
panic ("%s:%s:%i:%s\n" FMT, \ panic ("%s:%s:%i:%s\n" FMT, \