introduce option to time assert()s
. remove a few asserts in the kernel and 64bi library
that are not compatible with the timing code
. change the TIME_BLOCKS code a little to work in-kernel
This commit is contained in:
@@ -19,6 +19,12 @@
|
||||
#include <minix/ansi.h>
|
||||
#endif
|
||||
|
||||
#if TIME_ASSERTS
|
||||
#define _ASSERT_EVALUATE(st) do { TIME_BLOCK(st); } while(0)
|
||||
#else
|
||||
#define _ASSERT_EVALUATE(st) do { st } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
/* Debugging disabled -- do not evaluate assertions. */
|
||||
#define assert(expr) ((void) 0)
|
||||
@@ -29,10 +35,11 @@
|
||||
#define __xstr(x) __makestr(x)
|
||||
|
||||
_PROTOTYPE( void __bad_assertion, (const char *_mess) );
|
||||
#define assert(expr) ((expr)? (void)0 : \
|
||||
__bad_assertion("Assertion \"" #expr \
|
||||
"\" failed, file " __xstr(__FILE__) \
|
||||
", line " __xstr(__LINE__) "\n"))
|
||||
#define assert(expr) do { int _av; \
|
||||
_ASSERT_EVALUATE(_av = !!(expr);); \
|
||||
if(!_av) { \
|
||||
__bad_assertion("Assertion \"" #expr "\" failed, file " __xstr(__FILE__) ", line " __xstr(__LINE__) "\n"); \
|
||||
} } while(0)
|
||||
#else
|
||||
#define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__, __LINE__)))
|
||||
#endif /* _ANSI */
|
||||
|
||||
Reference in New Issue
Block a user