mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 21:11:03 +03:00
[libc] Allow assertion failures to be counted
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -18,6 +18,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#define ASSERTING 1
|
||||
#endif
|
||||
|
||||
extern unsigned int assertion_failures;
|
||||
|
||||
/** printf() for assertions
|
||||
*
|
||||
* This function exists so that the assert() macro can expand to
|
||||
@@ -43,6 +45,7 @@ assert_printf ( const char *fmt, ... ) asm ( "printf" );
|
||||
#define assert( condition ) \
|
||||
do { \
|
||||
if ( ASSERTING && ! (condition) ) { \
|
||||
assertion_failures++; \
|
||||
assert_printf ( "assert(%s) failed at %s line %d\n", \
|
||||
#condition, __FILE__, __LINE__ ); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user