X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fdebug.hh;fp=src%2Fmoof%2Fdebug.hh;h=161a8af8c68e7d31096ebbfa5be958364627c0a8;hp=0000000000000000000000000000000000000000;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hpb=85783316365181491a3e3c0c63659972477cebba diff --git a/src/moof/debug.hh b/src/moof/debug.hh new file mode 100644 index 0000000..161a8af --- /dev/null +++ b/src/moof/debug.hh @@ -0,0 +1,41 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_DEBUG_HH_ +#define _MOOF_DEBUG_HH_ + +/** + * \file debug.hh + * Debugging facilities. + */ + +#include // exit + +#include + + +#undef ASSERT +#if NDEBUG +#define ASSERT(X) +#else +/** + * Macro which tests an assertion and issues a log_error() and exits if the + * assertion is false. + * \param X test to perform. + */ +#define ASSERT(X) if (!(X)) moof::log_error \ + << "false assertion at " << __FILE__ << ":" << __LINE__ << ", " \ + << #X, exit(1) +#endif + + +#endif // _MOOF_DEBUG_HH_ +