diff options
author | John Hodge <tpg@mutabah.net> | 2018-05-26 13:23:10 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-05-26 13:23:10 +0800 |
commit | 8a08a06f31515ed26a1076ffe586de0289dca487 (patch) | |
tree | 1a392c6278c577a383d2c85cf901dd2ab66679b3 | |
parent | c87c4abc60f76d1304d46e9086a3467ae6f53bfe (diff) | |
download | mrust-8a08a06f31515ed26a1076ffe586de0289dca487.tar.gz |
Include - Add file/line to ASSERT_BUG
-rw-r--r-- | src/include/debug.hpp | 7 | ||||
-rw-r--r-- | src/include/span.hpp | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/include/debug.hpp b/src/include/debug.hpp index 2f593cfb..3f059301 100644 --- a/src/include/debug.hpp +++ b/src/include/debug.hpp @@ -1,4 +1,11 @@ /* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * include/debug.hpp + * - Common compiler debugging macros/helpers + * + * see also src/include/span.hpp */ #pragma once #include <sstream> diff --git a/src/include/span.hpp b/src/include/span.hpp index 59c960fc..68d6bfdf 100644 --- a/src/include/span.hpp +++ b/src/include/span.hpp @@ -74,4 +74,4 @@ Spanned<T> make_spanned(Span sp, T val) { #define BUG(span, msg) do { ::Span(span).bug([&](::std::ostream& os) { os << __FILE__ << ":" << __LINE__ << ": " << 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 << __FILE__ << ":" << __LINE__ << ": 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) +#define ASSERT_BUG(span, cnd, msg) do { if( !(cnd) ) { ::Span(span).bug([&](::std::ostream& os) { os << "ASSERT FAIL: " << __FILE__ << ":" << __LINE__ << ":" #cnd << ": " << msg; }); throw ::std::runtime_error("Bug fell through"); } } while(0) |