-/*] 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 <exception>
+
+#include <moof/log.hh>
+
+
/**
* \file debug.hh
* Debugging facilities.
*/
-#include <cstdlib> // exit
-
-#include <stlplus/portability/debug.hpp>
-
-#include <moof/log.hh>
-
+#define STRINGIZE(X) #X
+#define QUOTE_MACRO(X) STRINGIZE(X)
+#define FILELINE __FILE__":"QUOTE_MACRO(__LINE__)
#undef ASSERT
#ifdef NDEBUG
* 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