X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fmoof%2Fdebug.hh;h=a131ce950458ad2cc7d5f06fc41de5f729b6c889;hb=62f3ceaff75a6b08cb1aec9a465773bb81a2d79d;hp=161a8af8c68e7d31096ebbfa5be958364627c0a8;hpb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;p=chaz%2Fyoink diff --git a/src/moof/debug.hh b/src/moof/debug.hh index 161a8af..a131ce9 100644 --- a/src/moof/debug.hh +++ b/src/moof/debug.hh @@ -1,29 +1,31 @@ -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +/*] Copyright (c) 2009-2011, 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_ +#include + +#include + + /** * \file debug.hh * Debugging facilities. */ -#include // exit - -#include - +#define STRINGIZE(X) #X +#define QUOTE_MACRO(X) STRINGIZE(X) +#define FILELINE __FILE__":"QUOTE_MACRO(__LINE__) #undef ASSERT -#if NDEBUG +#ifdef NDEBUG #define ASSERT(X) #else /** @@ -31,9 +33,9 @@ * assertion is false. * \param X test to perform. */ -#define ASSERT(X) if (!(X)) moof::log_error \ - << "false assertion at " << __FILE__ << ":" << __LINE__ << ", " \ - << #X, exit(1) +#define ASSERT(X) \ + if (!(X)) moof::log_error \ + << "false assertion at " << FILELINE << ", " << #X, std::terminate() #endif