Skip to content

Commit

Permalink
Rework ivl_assert to be simpler and to use the correct incude file.
Browse files Browse the repository at this point in the history
  • Loading branch information
caryr authored and steveicarus committed Nov 2, 2010
1 parent a359cc3 commit 5dd67d8
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions ivl_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5dd67d8

Please sign in to comment.