[kernel] Move kassert out of kutil
Continuing moving things out of kutil. The assert as implemented could only ever work in the kernel, so remaining kutil uses of kassert have been moved to including standard C assert instead. Along the way, kassert was broken out into panic::panic and kassert, and the panic.serial namespace was renamed panicking.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
CPP_CHECK_BEGIN
|
||||
|
||||
void _PDCLIB_assert( const char * const, const char * const, const char * const );
|
||||
void _PDCLIB_assert( const char * const, const char * const, const char * const, unsigned );
|
||||
|
||||
/* If NDEBUG is set, assert() is a null operation. */
|
||||
#undef assert
|
||||
@@ -19,11 +19,7 @@ void _PDCLIB_assert( const char * const, const char * const, const char * const
|
||||
#define assert( ignore ) ( (void) 0 )
|
||||
#else
|
||||
#define assert( expression ) ( ( expression ) ? (void) 0 \
|
||||
: _PDCLIB_assert( "Assertion failed: " #expression \
|
||||
", function ", __func__, \
|
||||
", file " __FILE__ \
|
||||
", line " _PDCLIB_symbol2string( __LINE__ ) \
|
||||
"." _PDCLIB_endl ) )
|
||||
: _PDCLIB_assert( #expression, __func__, __FILE__, __LINE__ ) )
|
||||
#endif
|
||||
|
||||
CPP_CHECK_END
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
#include "j6libc/aux.h"
|
||||
|
||||
void _PDCLIB_assert( const char * const message1, const char * const function, const char * const message2 )
|
||||
void _PDCLIB_assert( const char * const message, const char * const function, const char * const file, unsigned line )
|
||||
{
|
||||
fputs( message1, stderr );
|
||||
fputs( function, stderr );
|
||||
fputs( message2, stderr );
|
||||
fprintf( stderr, "Assertion failed: %s, function %s, file %s, line %d.%s",
|
||||
message, function, file, line, _PDCLIB_endl );
|
||||
abort();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user