xref: /TaskScheduler/Scheduler/Include/MTDebug.h (revision 58964d0b)
1 #pragma once
2 
3 #include <stdio.h>
4 
5 #if defined(_MSC_VER)
6 
7 inline void ThrowException()
8 {
9 	__debugbreak();
10 }
11 
12 #else
13 
14 #include<signal.h>
15 inline void ThrowException()
16 {
17 	raise(SIGTRAP);
18 }
19 
20 #endif
21 
22 
23 
24 
25 #define REPORT_ASSERT( condition, description, file, line ) printf("%s. %s, line %d\n", description, file, line);ThrowException();
26 
27 #define ASSERT( condition, description ) { if ( !(condition) ) { REPORT_ASSERT( #condition, description, __FILE__, __LINE__ ) } }
28 #define VERIFY( condition, description, operation ) { if ( !(condition) ) { { REPORT_ASSERT( #condition, description, __FILE__, __LINE__ ) }; operation; } }
29