mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
add crash::doAssert() for debug purposes
This commit is contained in:
parent
35c0af0bf3
commit
5a4960b300
2 changed files with 16 additions and 0 deletions
|
@ -11,6 +11,16 @@
|
||||||
|
|
||||||
#include "CrashHelpers.h"
|
#include "CrashHelpers.h"
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// undefine NDEBUG so doAssert() works for all builds
|
||||||
|
#undef NDEBUG
|
||||||
|
#include <assert.h>
|
||||||
|
#define NDEBUG
|
||||||
|
#else
|
||||||
|
#include <assert.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace crash {
|
namespace crash {
|
||||||
|
|
||||||
class B;
|
class B;
|
||||||
|
@ -34,6 +44,11 @@ A::~A() {
|
||||||
_b->virtualFunction();
|
_b->virtualFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only use doAssert() for debug purposes
|
||||||
|
void doAssert(bool value) {
|
||||||
|
assert(value);
|
||||||
|
}
|
||||||
|
|
||||||
void pureVirtualCall() {
|
void pureVirtualCall() {
|
||||||
qCDebug(shared) << "About to make a pure virtual call";
|
qCDebug(shared) << "About to make a pure virtual call";
|
||||||
B b;
|
B b;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
namespace crash {
|
namespace crash {
|
||||||
|
|
||||||
|
void doAssert(bool value); // works for Release
|
||||||
void pureVirtualCall();
|
void pureVirtualCall();
|
||||||
void doubleFree();
|
void doubleFree();
|
||||||
void nullDeref();
|
void nullDeref();
|
||||||
|
|
Loading…
Reference in a new issue