Aether3D Game Engine
Macros.hpp
1 #ifndef MACROS_H
2 #define MACROS_H
3 
4 #if (defined( _MSC_VER ) && (_MSC_VER >= 1900)) || defined(__APPLE__) || defined(__GNUC__)
5 #define ALIGNAS( n ) alignas( n )
6 #else
7 #define ALIGNAS( n ) __declspec( align( n ) )
8 #endif
9 
10 // Prints TODO comments as compile warnings/links
11 #if _MSC_VER
12 #define Stringize( L ) #L
13 #define MakeString( M, L ) M(L)
14 #define $Line \
15 MakeString( Stringize, __LINE__ )
16 #define Todo \
17 __FILE__ "(" $Line "): TODO: "
18 // Usage: #pragma message(Todo "text")
19 #define A_TODO(msg) __pragma( message(Todo msg) )
20 #else
21 #define PRAGMA_MESSAGE(x) _Pragma(#x)
22 #define A_TODO(msg) PRAGMA_MESSAGE(message msg)
23 #endif
24 
25 #define AE3D_SAFE_RELEASE(x) if (x) { x->Release(); x = nullptr; }
26 #define AE3D_CHECK_D3D(x, msg) if (x != S_OK) { ae3d::System::Assert( false, msg ); }
27 
28 #endif