]> Dogcows Code - chaz/yoink/blob - src/moof/debug.hh
baa0304ae535db72e3baf4ce6272614c4357e724
[chaz/yoink] / src / moof / debug.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _MOOF_DEBUG_HH_
11 #define _MOOF_DEBUG_HH_
12
13 /**
14 * \file debug.hh
15 * Debugging facilities.
16 */
17
18 #include <cstdlib> // exit
19
20 #include <stlplus/portability/debug.hpp>
21
22 #include <moof/log.hh>
23
24
25 #undef ASSERT
26 #ifdef NDEBUG
27 #define ASSERT(X)
28 #else
29 /**
30 * Macro which tests an assertion and issues a log_error() and exits if the
31 * assertion is false.
32 * \param X test to perform.
33 */
34 #define ASSERT(X) if (!(X)) moof::log_error \
35 << "false assertion at " << __FILE__ << ":" << __LINE__ << ", " \
36 << #X, exit(1)
37 #endif
38
39
40 #endif // _MOOF_DEBUG_HH_
41
This page took 0.029835 seconds and 3 git commands to generate.