Added support for completely disabling noexcept using MIJIN_TEST_NO_NOEXCEPT (for testing).
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include <cstdlib>
|
||||
#include <source_location>
|
||||
|
||||
#include "../internal/common.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "kernel32")
|
||||
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
|
||||
@@ -139,7 +141,7 @@ constexpr AssertionResult handleAssert(const char* /* condition */,
|
||||
#ifdef MIJIN_USE_CUSTOM_ERROR_HANDLER
|
||||
ErrorHandling handleError(const char* message, const std::source_location& location);
|
||||
#else
|
||||
inline ErrorHandling handleError(const char* message, const std::source_location& location) noexcept
|
||||
inline ErrorHandling handleError(const char* message, const std::source_location& location) MIJIN_NOEXCEPT
|
||||
{
|
||||
std::puts(message);
|
||||
std::printf("Function: %s\n", location.function_name());
|
||||
|
||||
@@ -75,7 +75,7 @@ thread_local backtrace_state* gBacktraceState = nullptr;
|
||||
// public functions
|
||||
//
|
||||
|
||||
Result<Stacktrace> captureStacktrace(unsigned skipFrames) noexcept
|
||||
Result<Stacktrace> captureStacktrace(unsigned skipFrames) MIJIN_NOEXCEPT
|
||||
{
|
||||
#if MIJIN_USE_LIBBACKTRACE
|
||||
BacktraceData btData;
|
||||
@@ -104,7 +104,7 @@ Result<Stacktrace> captureStacktrace(unsigned skipFrames) noexcept
|
||||
#endif // MIJIN_USE_LIBBACKTRACE
|
||||
}
|
||||
|
||||
const Optional<Stacktrace>& getExceptionStacktrace() noexcept
|
||||
const Optional<Stacktrace>& getExceptionStacktrace() MIJIN_NOEXCEPT
|
||||
{
|
||||
return gCurrentExceptionStackTrace;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# include <fmt/format.h>
|
||||
#endif
|
||||
#include "./symbol_info.hpp"
|
||||
#include "../internal/common.hpp"
|
||||
#include "../types/result.hpp"
|
||||
#include "../util/iterators.hpp"
|
||||
|
||||
@@ -45,20 +46,20 @@ public:
|
||||
Stacktrace() = default;
|
||||
Stacktrace(const Stacktrace&) = default;
|
||||
Stacktrace(Stacktrace&&) = default;
|
||||
explicit Stacktrace(std::vector<Stackframe> frames) noexcept : frames_(std::move(frames)) {}
|
||||
explicit Stacktrace(std::vector<Stackframe> frames) MIJIN_NOEXCEPT : frames_(std::move(frames)) {}
|
||||
|
||||
Stacktrace& operator=(const Stacktrace&) = default;
|
||||
Stacktrace& operator=(Stacktrace&&) = default;
|
||||
|
||||
[[nodiscard]] const std::vector<Stackframe>& getFrames() const noexcept { return frames_; }
|
||||
[[nodiscard]] const std::vector<Stackframe>& getFrames() const MIJIN_NOEXCEPT { return frames_; }
|
||||
};
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
[[nodiscard]] Result<Stacktrace> captureStacktrace(unsigned skipFrames = 0) noexcept;
|
||||
[[nodiscard]] const Optional<Stacktrace>& getExceptionStacktrace() noexcept;
|
||||
[[nodiscard]] Result<Stacktrace> captureStacktrace(unsigned skipFrames = 0) MIJIN_NOEXCEPT;
|
||||
[[nodiscard]] const Optional<Stacktrace>& getExceptionStacktrace() MIJIN_NOEXCEPT;
|
||||
|
||||
template<typename TStream>
|
||||
TStream& operator<<(TStream& stream, const Stackframe& stackframe)
|
||||
|
||||
Reference in New Issue
Block a user