34 lines
757 B
C++
34 lines
757 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 char* expression, const char* file, const int line);
|
|
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
#define SKULLC_ASSERT_DEBUG(e) (!(e) ? Utility::Assert::Detail::assertImpl(#e, __FILE__, __LINE__) : ((void) 0))
|
|
#else
|
|
#define SKULLC_ASSERT_DEBUG(e)
|
|
#endif
|
|
|
|
#define SKULLC_ASSERT_SAFE(e) (!(e) ? Utility::Assert::Detail::assertImpl(#e, __FILE__, __LINE__) : ((void) 0))
|
|
|
|
namespace Utility::Assert
|
|
{
|
|
|
|
using assert_cb = void (*)(const char* expression, const char* file, const int line);
|
|
|
|
void setHandler(assert_cb callback);
|
|
assert_cb getHandler();
|
|
|
|
}// namespace Utility::Assert
|
|
|
|
#endif// SKULLC_UTILITY_ASSERT_HPP_
|