Initial
This commit is contained in:
parent
d4c558a59a
commit
db05d963be
74 changed files with 4473 additions and 3231 deletions
34
BaseModule/public/Assert.hpp
Normal file
34
BaseModule/public/Assert.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Environment.hpp"
|
||||
|
||||
namespace tp {
|
||||
void _assert_(const char* exp, const char* file, int line);
|
||||
void terminate(tp::alni code = 0);
|
||||
};
|
||||
|
||||
#define FAIL(exp) tp::_assert_(#exp, __FILE__, __LINE__);
|
||||
#define ASSERT(exp) if (!(exp)) { FAIL(exp) }
|
||||
|
||||
#undef assert
|
||||
#ifdef ENV_BUILD_DEBUG
|
||||
#define DEBUG_ASSERT(exp) ASSERT(exp)
|
||||
#else
|
||||
#define DEBUG_ASSERT(exp) {}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(ENV_OS_WINDOWS)
|
||||
#define DEBUG_BREAK(expr) if (expr) { __debugbreak(); }
|
||||
#elif defined(ENV_OS_ANDROID)
|
||||
#define DEBUG_BREAK(expr) if (expr) { __builtin_debugtrap(); }
|
||||
#elif defined(ENV_OS_LINUX)
|
||||
#define DEBUG_BREAK(expr) if (expr) { __builtin_trap(); }
|
||||
#else
|
||||
#define DEBUG_BREAK(expr) ()
|
||||
#endif
|
||||
|
||||
|
||||
#define SWITCH_NO_DEF default : { FAIL("No Default Case Possible"); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue