]> Dogcows Code - chaz/yoink/blobdiff - src/moof/debug.hh
testing new non-autotools build system
[chaz/yoink] / src / moof / debug.hh
diff --git a/src/moof/debug.hh b/src/moof/debug.hh
new file mode 100644 (file)
index 0000000..161a8af
--- /dev/null
@@ -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 <cstdlib>             // exit
+
+#include <moof/log.hh>
+
+
+#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_
+
This page took 0.016131 seconds and 4 git commands to generate.