From 52130fa8a514635ccdd4dd4a081686dc6839e593 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 21 Nov 2021 12:30:35 +0100 Subject: [PATCH] Mark Exception::Throw as noreturn, fix windows build. --- src/Exception.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Exception.hpp b/src/Exception.hpp index 2368b25..3457e9a 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -61,6 +61,17 @@ namespace ArbUt { #endif { } + template + [[noreturn]] static void Throw(const std::string& expression, const std::source_location& location, + const Args... args) { + std::stringstream error; + error << "[" << file_name(location.file_name()) << ":" << location.line() << "] \""; + error << expression; + using List = int[]; + (void)List{0, ((void)(error << args), 0)...}; + error << "\""; + throw Exception(error.str()); + } /// @brief Returns the error message of the exception. [[nodiscard]] const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW final { @@ -117,17 +128,6 @@ namespace ArbUt { return ss.str(); } - template - static void Throw(const std::string& expression, const std::source_location& location, const Args... args) { - std::stringstream error; - error << "[" << file_name(location.file_name()) << ":" << location.line() << "] \""; - error << expression; - using List = int[]; - (void)List{0, ((void)(error << args), 0)...}; - error << "\""; - throw Exception(error.str()); - } - private: static void AppendNoSourceStack(std::stringstream& ss, const backward::ResolvedTrace& trace, bool include_addr) {