[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:
Justin C. Miller
2022-01-02 01:38:04 -08:00
parent a6ec294f63
commit 5f88f5ed02
43 changed files with 148 additions and 117 deletions

View File

@@ -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

View File

@@ -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();
}