Joedb
9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
error
assert.h
Go to the documentation of this file.
1
#ifndef JOEDB_DEBUG_ASSERT
2
3
#include "
joedb/error/Exception.h
"
4
5
#include <stdexcept>
6
7
#define JOEDB_ASSERT_STRINGIFY(x) #x
8
#define JOEDB_ASSERT_TO_STRING(x) JOEDB_ASSERT_STRINGIFY(x)
9
#define JOEDB_CHECK(x,e) do\
10
{\
11
if (!(x))\
12
throw e("!("#x ")\n File: " __FILE__ "\n Line: " JOEDB_ASSERT_TO_STRING(__LINE__));\
13
} while(0)
14
15
#if defined (NDEBUG) && !defined(JOEDB_FUZZING)
16
/// @ingroup error
17
#define JOEDB_DEBUG_ASSERT(x)
18
#else
19
/// @ingroup error
20
#define JOEDB_DEBUG_ASSERT(x) JOEDB_CHECK(x, joedb::Assertion_Failure)
21
#endif
22
23
/// @ingroup error
24
#define JOEDB_RELEASE_ASSERT(x) JOEDB_CHECK(x, joedb::Exception)
25
26
namespace
joedb
27
{
28
/// Indicates a bug in the code, thrown by @ref JOEDB_ASSERT when NDEBUG not defined
29
/// @ingroup error
30
class
Assertion_Failure
:
public
std::logic_error
31
{
32
public
:
33
explicit
Assertion_Failure
(
const
char
*what_arg):
34
std::logic_error(what_arg)
35
{
36
}
37
};
38
}
39
40
#endif
Exception.h
joedb::Assertion_Failure
Indicates a bug in the code, thrown by JOEDB_ASSERT when NDEBUG not defined.
Definition
assert.h:31
joedb::Assertion_Failure::Assertion_Failure
Assertion_Failure(const char *what_arg)
Definition
assert.h:33
joedb
Definition
Blob.h:7
Generated by
1.9.8