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