World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
ErrorHandling.h
См. документацию.
1 #pragma once
2 
3 #include <cassert>
4 
5 #define Error(...) \
6  do { \
7  Error_impl_(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); \
8  assert(false); \
9  exit(0); \
10  } while (0)
11 
12 #ifdef _WINDOWS
13 #define Assert(condition, ...) \
14  Assert_impl_(__FILE__, __FUNCTION__, __LINE__, condition, #condition, __VA_ARGS__)
15 #else
16 #define Assert(condition, ...) \
17  Assert_impl_(__FILE__, __FUNCTION__, __LINE__, condition, #condition __VA_OPT__(,) __VA_ARGS__)
18 #endif
19 
20 void Error_impl_(const char *filename, const char *functionname,
21  int line, const char *format, ...);
22 
23 void Assert_impl_(const char *filename, const char *functionname,
24  int line, bool condition, const char *condition_string = nullptr,
25  const char *format = nullptr, ...);
26 
27 #ifndef _WINDOWS
28 #define __debugbreak(...) assert(false);
29 #endif
30 
condition
EGLenum condition
Definition: SDL_egl.h:1629
Error_impl_
void Error_impl_(const char *filename, const char *functionname, int line, const char *format,...)
Definition: ErrorHandling.cpp:9
format
SDL_AudioFormat format
Definition: SDL_audio.h:194
Assert_impl_
void Assert_impl_(const char *filename, const char *functionname, int line, bool condition, const char *condition_string=nullptr, const char *format=nullptr,...)
Definition: ErrorHandling.cpp:30