File: assert.hh

package info (click to toggle)
bali-phy 3.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,608 kB
  • sloc: cpp: 67,094; xml: 4,074; perl: 3,715; haskell: 1,861; yacc: 1,067; python: 555; lex: 528; sh: 259; makefile: 20
file content (32 lines) | stat: -rw-r--r-- 957 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#define BOOST_ENABLE_ASSERT_HANDLER
#include <boost/assert.hpp>
#include "../myexception.H"
#ifdef assert
#undef assert
#endif
#ifdef assert_msg
#undef assert_msg
#endif
#ifdef NDEBUG
#define assert(expr)          (0?(void(expr)):(void(0)))
#define assert_msg(expr,message)  (0?(void(expr)):(void(0)))
#else
#define assert(expr)  BOOST_ASSERT(expr)
#define assert_msg(expr,message)  BOOST_ASSERT_MSG(expr,message)
#endif

#ifndef UTIL_ASSERT_H
#define UTIL_ASSERT_H
namespace boost
{
    inline void assertion_failed(char const * expr, char const * function, char const * file, long line)
    {
	throw myexception()<<"Assertion ("<<expr<<") failed in '"<<function<<"' at "<<file<<":"<<line;
    }

    inline void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line)
    {
	throw myexception()<<"Assertion ("<<expr<<") failed in '"<<function<<"' at "<<file<<":"<<line<<":\n   "<<msg;
    }
}
#endif