Provide a way to selectively enable assertions in release mode
- Throwing an assertion exception for proper stack unwinding, making
sure destructors are called
- On in Debug mode, in Release, enable via:
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_ASSERTIONS=ON
Current problem that I'm seeing is that some code is not catching
exceptions or worse silently swallowing them. Would like to check the
whole pipeline before merging this in.
This commit is contained in:
committed by
Patrick Niklaus
parent
17f8e65808
commit
502aedb33e
@@ -0,0 +1,20 @@
|
||||
#ifndef OSRM_ASSERT_HPP
|
||||
#define OSRM_ASSERT_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
// Assertion type to be thrown for stack unwinding
|
||||
struct assertionError final : std::logic_error
|
||||
{
|
||||
assertionError(const char *msg) : std::logic_error{msg} {}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user