MorphoGraphX  2.0-1-227
Assert.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef ASSERT_HPP
12 #define ASSERT_HPP
13 
22 #include <cassert>
23 
24 class QString;
25 
26 namespace mgx
27 {
28  void __assert_fail(const QString& assertion, const char* file, unsigned int line, const char* function);
29 
30  #ifdef NDEBUG
31  # define mgx_assert(expr) static_cast<void>(0)
32  # define mgx_assert_msg(expr, msg) static_cast<void>(0)
33  #else
34 
42  # define mgx_assert(expr) ((expr) ? static_cast<void>(0) : \
43  mgx::__assert_fail(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
44  # define mgx_assert_msg(expr, msg) ((expr) ? static_cast<void>(0) : \
45  mgx::__assert_fail(msg, __FILE__, __LINE__, __PRETTY_FUNCTION__))
46  #endif
47 }
48 
49 #endif
mgx::__assert_fail
void __assert_fail(const QString &assertion, const char *file, unsigned int line, const char *function)
mgx
Distributed matrix library.
Definition: Assert.hpp:26