From 527c5ccb22ea244bae3bf6f9eabfd2d40f379364 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 24 Aug 2018 18:54:48 +0200 Subject: [PATCH] remove an unused class around exceptions --- include/xbt/exception.hpp | 40 +-------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/include/xbt/exception.hpp b/include/xbt/exception.hpp index 544f6ae247..edc0221d11 100644 --- a/include/xbt/exception.hpp +++ b/include/xbt/exception.hpp @@ -55,8 +55,7 @@ class ThrowPoint { /** A base class for exceptions with context * * This is a base class for exceptions which store additional contextual - * infomations about them: backtrace, throw point, simulated process name - * and PID, etc. + * information: backtrace, throw point, simulated process name, PID, etc. * * You are not expected to inherit from it. Instead of you use should * @ref XBT_THROW an exception which will throw a subclass of your original @@ -102,43 +101,6 @@ private: int pid_; /**< PID of the process who thrown this */ ThrowPoint throwpoint_; }; - -/** Internal class used to mixin an exception E with WithContextException */ -template -class WithContext : public E, public WithContextException -{ -public: - static_assert(not std::is_base_of::value, "Trying to appli WithContext twice"); - - explicit WithContext(E exception) : E(std::move(exception)) {} - WithContext(E exception, ThrowPoint throwpoint, Backtrace backtrace) : - E(std::move(exception)), - WithContextException(throwpoint, std::move(backtrace)) {} - WithContext(E exception, Backtrace backtrace) : - E(std::move(exception)), - WithContextException(std::move(backtrace)) {} - WithContext(E exception, WithContextException context) : - E(std::move(exception)), - WithContextException(std::move(context)) {} - ~WithContext() override = default; -}; - -/** Throw a C++ exception with some context - * - * @param e Exception to throw - * @ingroup XBT_ex - */ -#define XBT_THROW(e) \ - throw WithContext(std::move(exception), throwpoint, simgrid::xbt::backtrace()) - -/** Throw a C++ exception with a context and a nexted exception/cause - * - * @param e Exception to throw - * @ingroup XBT_ex - */ -#define XBT_THROW_NESTED(e) \ - std::throw_with_nested(WithContext(std::move(exception), throwpoint, simgrid::xbt::backtrace())) - } } -- 2.20.1