Skip to content
Snippets Groups Projects
Commit 028339e2 authored by Petr Rockai's avatar Petr Rockai
Browse files

libc: Improve presentation of assertion failures in counterexample traces.

parent 31462b9c
No related branches found
No related tags found
No related merge requests found
......@@ -13,17 +13,16 @@
#undef _assert
#ifdef NDEBUG
# define assert(e) ((void)0)
# define _assert(e) ((void)0)
# define assert(e) ((void)0)
# define _assert(e) ((void)0)
#else
# define _assert(e) assert(e)
# define assert(e) ((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __func__))
# define _assert(e) assert(e)
# define assert(e) ( (e) ? (void) 0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__) )
#endif
#ifndef _ASSERT_H_
#define _ASSERT_H_
__BEGIN_DECLS
void __assert_fail( const char *__assertion, const char *__file, unsigned int __line, const char *__function )
_PDCLIB_nothrow;
void __assert_fail( const char *, const char *, unsigned, const char * ) __nothrow;
__END_DECLS
#endif
......@@ -15,10 +15,11 @@
#include <_PDCLIB/cdefs.h>
void __assert_fail( const char *__assertion, const char *__file, unsigned int __line, const char *__function )
void __assert_fail( const char *stmt, const char *file, unsigned line, const char *fun )
{
__dios_trace_f( "Assertion failed: %s, file %s, line %u.", __assertion, __file, __line );
__dios_fault( _VM_F_Assert, NULL );
char buffer[ 200 ];
snprintf( buffer, 200, "%s:%u: %s: assertion '%s' failed", file, line, fun, stmt );
__dios_fault( _VM_F_Assert, buffer );
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment