LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
lf_assert.cc
1
3#include "lf_assert.h"
4
5#include <boost/stacktrace.hpp>
6#include <iostream>
7
8namespace lf::base {
9
10// Output for assertions
11void AssertionFailed(const std::string& expr, const std::string& file,
12 long line, const std::string& msg) {
13 std::cerr << "***** Internal Program Error - assertion (" << expr
14 << ") failed:\n"
15 << file << '(' << line << "): " << msg << std::endl;
16 std::cerr << "Backtrace:\n" << boost::stacktrace::stacktrace() << '\n';
17 std::abort();
18}
19
20} // end namespace lf::base
21
22#ifdef LF_REDIRECT_ASSERTS
23namespace boost {
24// the following is needed to redirect BOOST_ASSERT(_MSG)/BOOST_VERIFY (_MSG)
25void assertion_failed_msg(char const* expr, char const* msg,
26 char const* /*function*/, char const* file,
27 long line) {
28 lf::base::AssertionFailed(expr, file, line, msg);
29}
30
31void assertion_failed(char const* expr, char const* /*function*/,
32 char const* file, long line) {
33 lf::base::AssertionFailed(expr, file, line, "");
34}
35} // namespace boost
36#endif
Contains basic functionality that is used by other parts of LehrFEM++.
Definition: base.h:15
void AssertionFailed(const std::string &expr, const std::string &file, long line, const std::string &msg)
Definition: lf_assert.cc:11