Minecraft Community Edition 0.1.0
Loading...
Searching...
No Matches
Assert.hpp
1#pragma once
2
3#include "IO/Logger.hpp"
4#include "Platform.hpp"
5
6#ifndef NDEBUG
7#ifdef MCE_PLATFORM_WINDOWS
8#define MCE_DEBUGBREAK() __debugbreak()
9#elif defined(MCE_PLATFORM_MACOS) || defined(MCE_PLATFORM_LINUX)
10#include <signal.h>
11#define MCE_DEBUGBREAK() raise(SIGTRAP)
12#endif
13
14#define MCE_ASSERT(check, ...) { if (!(check)) { MCE_ERROR(__VA_ARGS__); MCE_DEBUGBREAK(); } }
15#else
16#define MCE_DEBUGBREAK()
17#define MCE_ASSERT(...)
18#endif