mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-23 00:04:45 -08:00
Ed_
5d7dfaf666
Isolating large macros to their own directory (components/temp). - Plan is to remove them soon with proper generation. Added additional component files, separating the old data_structures header for a set of ast headers. Header_end also had its inlines extracted out. Necessary to complete the macro isolation. ZPL parser dependencies were removed from the core library along with builder, its now generated in bootstrap as pare of making a gen_builder set of files. Singleheader will be changed in next few commits to reflect this as well (By making builder deps and components a conditional option). Tests are most likely all broken for now.
38 lines
1.5 KiB
C++
38 lines
1.5 KiB
C++
#pragma region Debug
|
|
|
|
#if defined( _MSC_VER )
|
|
# if _MSC_VER < 1300
|
|
# define GEN_DEBUG_TRAP() __asm int 3 /* Trap to debugger! */
|
|
# else
|
|
# define GEN_DEBUG_TRAP() __debugbreak()
|
|
# endif
|
|
#elif defined( GEN_COMPILER_TINYC )
|
|
# define GEN_DEBUG_TRAP() process_exit( 1 )
|
|
#else
|
|
# define GEN_DEBUG_TRAP() __builtin_trap()
|
|
#endif
|
|
|
|
#define GEN_ASSERT( cond ) GEN_ASSERT_MSG( cond, NULL )
|
|
|
|
#define GEN_ASSERT_MSG( cond, msg, ... ) \
|
|
do \
|
|
{ \
|
|
if ( ! ( cond ) ) \
|
|
{ \
|
|
assert_handler( #cond, __FILE__, zpl_cast( s64 ) __LINE__, msg, ##__VA_ARGS__ ); \
|
|
GEN_DEBUG_TRAP(); \
|
|
} \
|
|
} while ( 0 )
|
|
|
|
#define GEN_ASSERT_NOT_NULL( ptr ) GEN_ASSERT_MSG( ( ptr ) != NULL, #ptr " must not be NULL" )
|
|
|
|
// NOTE: Things that shouldn't happen with a message!
|
|
#define GEN_PANIC( msg, ... ) GEN_ASSERT_MSG( 0, msg, ##__VA_ARGS__ )
|
|
|
|
void assert_handler( char const* condition, char const* file, s32 line, char const* msg, ... );
|
|
s32 assert_crash( char const* condition );
|
|
void process_exit( u32 code );
|
|
|
|
#pragma endregion Debug
|
|
|