Simplify asserts
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Sonarqube (push) Skipped
This commit is contained in:
@@ -8,46 +8,13 @@
|
||||
#define BIGFOOT_ENGINE_ENGINEASSERTHANDLER_HPP
|
||||
#include <Engine/EngineLogger_generated.hpp>
|
||||
|
||||
#include <Utils/Assert.hpp>
|
||||
#include <Utils/Assert/AssertHandler.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <format>
|
||||
#include <source_location>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class EngineAssertHandler
|
||||
{
|
||||
public:
|
||||
EngineAssertHandler() = delete;
|
||||
|
||||
EngineAssertHandler(const EngineAssertHandler& p_handler) = delete;
|
||||
EngineAssertHandler(EngineAssertHandler&& p_handler) = delete;
|
||||
|
||||
~EngineAssertHandler() = delete;
|
||||
|
||||
/**
|
||||
* Handle an assertion.
|
||||
*
|
||||
* \param p_location Location of the assertion.
|
||||
* \param p_format Format string for the assertion message.
|
||||
* \param p_args Arguments for the format string.
|
||||
*/
|
||||
template<typename... ARGS>
|
||||
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(ENGINE_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name());
|
||||
}
|
||||
|
||||
EngineAssertHandler& operator=(const EngineAssertHandler& p_handler) = delete;
|
||||
EngineAssertHandler& operator=(EngineAssertHandler&& p_handler) = delete;
|
||||
};
|
||||
using EngineAssertHandler = AssertHandler<ENGINE_LOGGER>;
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -8,46 +8,13 @@
|
||||
#define BIGFOOT_SYSTEM_SYSTEMASSERTHANDLER_HPP
|
||||
#include <System/SystemLogger_generated.hpp>
|
||||
|
||||
#include <Utils/Assert.hpp>
|
||||
#include <Utils/Assert/AssertHandler.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <format>
|
||||
#include <source_location>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class SystemAssertHandler
|
||||
{
|
||||
public:
|
||||
SystemAssertHandler() = delete;
|
||||
|
||||
SystemAssertHandler(const SystemAssertHandler& p_handler) = delete;
|
||||
SystemAssertHandler(SystemAssertHandler&& p_handler) = delete;
|
||||
|
||||
~SystemAssertHandler() = delete;
|
||||
|
||||
/**
|
||||
* Handle an assertion.
|
||||
*
|
||||
* \param p_location Location of the assertion.
|
||||
* \param p_format Format string for the assertion message.
|
||||
* \param p_args Arguments for the format string.
|
||||
*/
|
||||
template<typename... ARGS>
|
||||
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(SYSTEM_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name());
|
||||
}
|
||||
|
||||
SystemAssertHandler& operator=(const SystemAssertHandler& p_handler) = delete;
|
||||
SystemAssertHandler& operator=(SystemAssertHandler&& p_handler) = delete;
|
||||
};
|
||||
using SystemAssertHandler = AssertHandler<SYSTEM_LOGGER>;
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*********************************************************************
|
||||
* \file AssertHandler.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date August 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_ASSERTHANDLER_HPP
|
||||
#define BIGFOOT_UTILS_ASSERTHANDLER_HPP
|
||||
#include <Utils/Assert/Assert.hpp>
|
||||
#include <Utils/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <format>
|
||||
#include <source_location>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
template<Log::LoggerInfo& LOGGER>
|
||||
class AssertHandler
|
||||
{
|
||||
public:
|
||||
AssertHandler() = delete;
|
||||
|
||||
AssertHandler(const AssertHandler& p_handler) = delete;
|
||||
AssertHandler(AssertHandler&& p_handler) = delete;
|
||||
|
||||
~AssertHandler() = delete;
|
||||
|
||||
/**
|
||||
* Handle an assertion.
|
||||
*
|
||||
* \param p_location Location of the assertion.
|
||||
* \param p_format Format string for the assertion message.
|
||||
* \param p_args Arguments for the format string.
|
||||
*/
|
||||
template<typename... ARGS>
|
||||
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name());
|
||||
}
|
||||
|
||||
AssertHandler& operator=(const AssertHandler& p_handler) = delete;
|
||||
AssertHandler& operator=(AssertHandler&& p_handler) = delete;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
@@ -6,47 +6,14 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP
|
||||
#define BIGFOOT_UTILS_UTILSASSERTHANDLER_HPP
|
||||
#include <Utils/Assert.hpp>
|
||||
#include <Utils/Assert/AssertHandler.hpp>
|
||||
#include <Utils/UtilsLogger_generated.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
#include <format>
|
||||
#include <source_location>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class UtilsAssertHandler
|
||||
{
|
||||
public:
|
||||
UtilsAssertHandler() = delete;
|
||||
|
||||
UtilsAssertHandler(const UtilsAssertHandler& p_handler) = delete;
|
||||
UtilsAssertHandler(UtilsAssertHandler&& p_handler) = delete;
|
||||
|
||||
~UtilsAssertHandler() = delete;
|
||||
|
||||
/**
|
||||
* Handle an assertion.
|
||||
*
|
||||
* \param p_location Location of the assertion.
|
||||
* \param p_format Format string for the assertion message.
|
||||
* \param p_args Arguments for the format string.
|
||||
*/
|
||||
template<typename... ARGS>
|
||||
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(UTILS_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name());
|
||||
}
|
||||
|
||||
UtilsAssertHandler& operator=(const UtilsAssertHandler& p_handler) = delete;
|
||||
UtilsAssertHandler& operator=(UtilsAssertHandler&& p_handler) = delete;
|
||||
};
|
||||
using UtilsAssertHandler = AssertHandler<UTILS_LOGGER>;
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user