gencpp/base/dependencies/debug.cpp

49 lines
829 B
C++
Raw Normal View History

#ifdef GEN_INTELLISENSE_DIRECTIVES
# pragma once
# include "debug.hpp"
# include "basic_types.hpp"
# include "src_start.cpp"
#endif
#pragma region Debug
2024-12-07 14:17:02 -08:00
void assert_handler( char const* condition, char const* file, char const* function, s32 line, char const* msg, ... )
2023-07-24 15:35:16 -07:00
{
2024-12-07 14:17:02 -08:00
_printf_err( "%s - %s:(%d): Assert Failure: ", file, function, line );
2023-07-24 15:35:16 -07:00
if ( condition )
_printf_err( "`%s` \n", condition );
2023-07-24 15:35:16 -07:00
if ( msg )
{
va_list va;
va_start( va, msg );
_printf_err_va( msg, va );
va_end( va );
}
_printf_err( "%s", "\n" );
}
s32 assert_crash( char const* condition )
{
GEN_PANIC( condition );
return 0;
}
#if defined( GEN_SYSTEM_WINDOWS )
void process_exit( u32 code )
{
ExitProcess( code );
}
#else
# include <stdlib.h>
void process_exit( u32 code )
{
exit( code );
}
#endif
#pragma endregion Debug