skullc-peripherals/Utility/Inc/utility_assert.hpp
Erki c0a622c5e4
All checks were successful
continuous-integration/drone/push Build is passing
gitea/skullc-peripherals/pipeline/head This commit looks good
Utility: add mini-assert library
2022-06-29 01:00:45 +03:00

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_