aboutsummaryrefslogtreecommitdiff
path: root/mod/diagnostics.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/diagnostics.cxx')
-rw-r--r--mod/diagnostics.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/mod/diagnostics.cxx b/mod/diagnostics.cxx
index 07fd86c..601ecab 100644
--- a/mod/diagnostics.cxx
+++ b/mod/diagnostics.cxx
@@ -5,6 +5,7 @@
#include <mod/diagnostics.hxx>
using namespace std;
+using namespace butl;
namespace brep
{
@@ -12,14 +13,18 @@ namespace brep
~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.
+ // the stack unwinding.
+ //
+#ifdef __cpp_lib_uncaught_exceptions
+ if (!data_.empty () && uncaught_ == uncaught_exceptions ())
+#else
+ // Fallback implementation. Right now this means we cannot use this
+ // mechanism in destructors, which is not a big deal, except for one
+ // place: exception_guard. Thus the ugly special check.
//
if (!data_.empty () &&
- (!uncaught_exception () /*|| exception_unwinding_dtor*/))
+ (!uncaught_exception () || exception_unwinding_dtor ()))
+#endif
{
data_.back ().msg = os_.str (); // Save last message.