qse/ase/lib/utl/assert.c

33 lines
782 B
C
Raw Normal View History

2008-06-04 03:00:14 +00:00
/*
2008-06-10 00:57:20 +00:00
* $Id: assert.c 201 2008-06-09 06:57:20Z baconevi $
2008-06-04 03:00:14 +00:00
*/
2008-06-07 04:19:57 +00:00
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
2008-06-04 03:00:14 +00:00
#ifndef NDEBUG
2008-06-10 00:49:17 +00:00
#include <ase/utl/stdio.h>
2008-06-04 03:00:14 +00:00
#include <stdlib.h>
2008-06-10 00:49:17 +00:00
void ase_assert_failed (
2008-06-07 04:19:57 +00:00
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line)
2008-06-04 03:00:14 +00:00
{
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("=[ASSERTION FAILURE]============================================================"));
ase_fprintf (ASE_STDERR, ASE_T("FILE %s LINE %lu: %s\n"),
file, (unsigned long)line, expr);
if (desc != ASE_NULL)
2008-06-07 04:19:57 +00:00
{
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("DESCRIPTION: %s\n"),
2008-06-07 04:19:57 +00:00
file, (unsigned long)line, expr, desc);
}
2008-06-10 00:57:20 +00:00
ase_fprintf (ASE_STDERR, ASE_T("================================================================================"));
2008-06-07 04:19:57 +00:00
2008-06-04 03:00:14 +00:00
abort ();
}
#endif