forked from Project-OSRM/osrm-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassert.cpp
More file actions
29 lines (26 loc) · 912 Bytes
/
assert.cpp
File metadata and controls
29 lines (26 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "util/assert.hpp"
#include <sstream>
namespace
{
// We throw to guarantee for stack-unwinding and therefore our destructors being called.
void assertion_failed_msg_helper(
char const *expr, char const *msg, char const *function, char const *file, long line)
{
std::ostringstream fmt;
fmt << file << ":" << line << "\nin: " << function << ": " << expr << "\n" << msg;
throw osrm::util::assertionError{fmt.str().c_str()};
}
}
// Boost.Assert only declares the following two functions and let's us define them here.
namespace boost
{
void assertion_failed(char const *expr, char const *function, char const *file, long line)
{
::assertion_failed_msg_helper(expr, "", function, file, line);
}
void assertion_failed_msg(
char const *expr, char const *msg, char const *function, char const *file, long line)
{
::assertion_failed_msg_helper(expr, msg, function, file, line);
}
}