diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-10 16:29:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-10 16:29:15 +0200 |
commit | d5a8c51d4010285be02f3252520300a737799872 (patch) | |
tree | 50c1ea90ce3d7a23c6c8400b4d982aa158485a5f /brep/diagnostics.cxx | |
parent | 2d89c9d6aa0f2fcdd6403c4973f7e7005a6796a0 (diff) |
Add diagnostics support
Diffstat (limited to 'brep/diagnostics.cxx')
-rw-r--r-- | brep/diagnostics.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/brep/diagnostics.cxx b/brep/diagnostics.cxx new file mode 100644 index 0000000..5ab34b6 --- /dev/null +++ b/brep/diagnostics.cxx @@ -0,0 +1,33 @@ +// file : brep/diagnostics.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include <brep/diagnostics> + +#include <cassert> +#include <exception> + +using namespace std; + +namespace build +{ + diag_record:: + ~diag_record () noexcept(false) + { + // Don't flush the record if this destructor was called as part of + // the stack unwinding. Right now this means we cannot use this + // mechanism in destructors, which is not a big deal, except for + // one place: exception_guard. So for now we are going to have + // this ugly special check which we will be able to get rid of + // once C++17 uncaught_exceptions() becomes available. + // + if (!data_.empty () && + (!std::uncaught_exception () /*|| exception_unwinding_dtor*/)) + { + data_.back ().msg = os_.str (); // Save last message. + + assert (epilogue_ != nullptr); + (*epilogue_) (move (data_)); // Can throw. + } + } +} |