Rework ivl_assert to be simpler and to use the correct incude file.

This commit is contained in:
Cary R 2010-11-01 14:39:34 -07:00 committed by Stephen Williams
parent a359cc301c
commit 5dd67d8571
1 changed files with 5 additions and 12 deletions

View File

@ -20,21 +20,14 @@
#ifndef __ivl_assert_h
#define __ivl_assert_h
# include <cassert>
# include <cstdlib>
#define ivl_assert(tok, expression) \
do { \
if (! (expression)) \
__ivl_assert(#expression, tok, __FILE__, __LINE__); \
} while(0)
#define __ivl_assert(expression, tok, file, line) \
do { \
if (! (expression)) { \
cerr << (tok).get_fileline() << ": assert: " \
<< file << ":" << line \
<< ": failed assertion " << (expression) << endl; \
<< __FILE__ << ":" << __LINE__ \
<< ": failed assertion " << #expression << endl; \
abort(); \
} while(0)
}
#endif