Kùzu C++ API
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1#pragma once
2
3#include "internal.h"
4#include "string_format.h"
5
6namespace kuzu {
7namespace common {
8
9[[noreturn]] inline void kuAssertFailureInternal(const char* condition_name, const char* file,
10 int linenr) {
11 // LCOV_EXCL_START
12 throw InternalException(stringFormat("Assertion failed in file \"{}\" on line {}: {}", file,
13 linenr, condition_name));
14 // LCOV_EXCL_STOP
15}
16
17#if defined(KUZU_RUNTIME_CHECKS) || !defined(NDEBUG)
18#define RUNTIME_CHECK(code) code
19#define KU_ASSERT(condition) \
20 static_cast<bool>(condition) ? \
21 void(0) : \
22 kuzu::common::kuAssertFailureInternal(#condition, __FILE__, __LINE__)
23#else
24#define KU_ASSERT(condition) void(0)
25#define RUNTIME_CHECK(code) void(0)
26#endif
27
28#define KU_UNREACHABLE \
29 [[unlikely]] kuzu::common::kuAssertFailureInternal("KU_UNREACHABLE", __FILE__, __LINE__)
30#define KU_UNUSED(expr) (void)(expr)
31
32} // namespace common
33} // namespace kuzu
Definition internal.h:9
std::string stringFormat(std::string_view format, Args... args)
Definition string_format.h:99
void kuAssertFailureInternal(const char *condition_name, const char *file, int linenr)
Definition assert.h:9
Definition alter_type.h:5