34 lines
655 B
C++
34 lines
655 B
C++
//
|
|
// Created by erki on 29.06.22.
|
|
//
|
|
|
|
#ifndef SKULLC_UTILITY_ASSERT_HPP_
|
|
#define SKULLC_UTILITY_ASSERT_HPP_
|
|
|
|
namespace Utility::Assert::Detail
|
|
{
|
|
|
|
void assertImpl(const bool expr, const char* file, const int line);
|
|
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
# define SKULLC_ASSERT_DEBUG(e) Utility::Assert::Detail::assertImpl(e, __FILE__, __LINE__)
|
|
#else
|
|
# define SKULLC_ASSERT_DEBUG(e)
|
|
#endif
|
|
|
|
#define SKULLC_ASSERT_SAFE(e) Utility::Assert::Detail::assertImpl(e, __FILE__, __LINE__)
|
|
|
|
namespace Utility::Assert
|
|
{
|
|
|
|
using assert_cb = void (*)(const char* file, const int line);
|
|
|
|
void setHandler(assert_cb callback);
|
|
assert_cb getHandler();
|
|
|
|
}
|
|
|
|
#endif // SKULLC_UTILITY_ASSERT_HPP_
|