~ubuntu-branches/ubuntu/oneiric/libclaw/oneiric

« back to all changes in this revision

Viewing changes to claw/assert.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge
  • Date: 2009-09-08 14:18:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090908141813-3gog70gacxiuzqru
Tags: 1.5.4-2
Pass -V option to dh_makeshlib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 */
44
44
/**
45
45
 * \fn CLAW_PRECOND( b )
46
 
 * \brief Stop the program if a precondition is not true.
 
46
 * \brief Abort the program if a precondition is not true.
47
47
 * \param b Condition to verify.
48
48
 */
49
49
/**
50
50
 * \fn CLAW_POSTCOND( b )
51
 
 * \brief Stop the program if a postcondition is not true.
 
51
 * \brief Abort the program if a postcondition is not true.
52
52
 * \param b Condition to verify.
53
53
 */
54
54
 
55
 
#ifdef _DEBUG
 
55
#ifndef NDEBUG
56
56
 
57
57
namespace claw
58
58
{
72
72
      {
73
73
        std::cerr << file << ":" << line << "\n\t"
74
74
                  << func << " : \n" << s << std::endl;
75
 
        exit( EXIT_FAILURE );
 
75
        abort();
76
76
      }
77
77
  } // claw::debug_assert()
78
78
 
83
83
  claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, (b), (s) )
84
84
 
85
85
/*---------------------------------------------------------------------------*/
 
86
#define CLAW_FAIL( s )                                                  \
 
87
  claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, false, (s) )
 
88
 
 
89
/*---------------------------------------------------------------------------*/
86
90
#define CLAW_PRECOND( b ) CLAW_ASSERT( b, "precondition failed : " #b )
87
91
 
88
92
/*---------------------------------------------------------------------------*/
89
93
#define CLAW_POSTCOND( b ) CLAW_ASSERT( b, "postcondition failed : " #b )
90
94
 
91
 
#else // !def _DEBUG
 
95
#else // def NDEBUG
92
96
 
93
97
#define CLAW_ASSERT( b, s )
 
98
#define CLAW_FAIL( s )
94
99
#define CLAW_PRECOND( b )
95
100
#define CLAW_POSTCOND( b )
96
101
 
97
 
#endif // _DEBUG
 
102
#endif // NDEBUG
98
103
 
99
104
#endif // __CLAW_ASSERT_HPP__