diff options
author | John Hodge <tpg@mutabah.net> | 2016-07-10 15:31:29 +1000 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-07-10 15:31:29 +1000 |
commit | 154a9d48f58a8e3575dfa730aeabfc4d4e418ed2 (patch) | |
tree | 952f3e0e0ec579dd14ae47f4a241783d920d1494 /src | |
parent | 75e0b75cd4bebc08e1a0775a869ab255d26041ad (diff) | |
download | mrust-154a9d48f58a8e3575dfa730aeabfc4d4e418ed2.tar.gz |
Span - Add an assert macro
Diffstat (limited to 'src')
-rw-r--r-- | src/include/span.hpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/span.hpp b/src/include/span.hpp index 86d21514..881c34df 100644 --- a/src/include/span.hpp +++ b/src/include/span.hpp @@ -69,3 +69,4 @@ Spanned<T> make_spanned(Span sp, T val) { #define BUG(span, msg) do { ::Span(span).bug([&](::std::ostream& os) { os << msg; }); throw ::std::runtime_error("Bug fell through"); } while(0) #define TODO(span, msg) do { const char* __TODO_func = __func__; ::Span(span).bug([&](::std::ostream& os) { os << "TODO: " << __TODO_func << " - " << msg; }); throw ::std::runtime_error("Bug (todo) fell through"); } while(0) +#define ASSERT_BUG(span, cnd, msg) do { if( !(cnd) ) { ::Span(span).bug([&](::std::ostream& os) { os << "ASSERT FAIL: " #cnd << ": " << msg; }); throw ::std::runtime_error("Bug fell through"); } } while(0) |