OpenVDB
13.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Assert.h
Go to the documentation of this file.
1
// Copyright Contributors to the OpenVDB Project
2
// SPDX-License-Identifier: Apache-2.0
3
///
4
/// @file Assert.h
5
6
#ifndef OPENVDB_UTIL_ASSERT_HAS_BEEN_INCLUDED
7
#define OPENVDB_UTIL_ASSERT_HAS_BEEN_INCLUDED
8
9
#include <
openvdb/Platform.h
>
10
#include <openvdb/version.h>
11
12
namespace
openvdb
{
13
OPENVDB_USE_VERSION_NAMESPACE
14
namespace
OPENVDB_VERSION_NAME
{
15
16
/// @brief Trigger a SIGABRT after printing a formatted assertion message.
17
/// Effectively performs the same functionality as cassert, but allows
18
/// VDB code to call this independently of the NDEBUG define.
19
/// @param assertion The variable or expression that triggered the assertion
20
/// as a string
21
/// @param file The name of the file the assertion occurred
22
/// @param line The line in the file the assertion occurred
23
/// @param function The name of the function the assertion occurred in
24
/// @param msg An optional descriptive message
25
[[noreturn]]
void
assertAbort
(
26
const
char
*assertion,
27
const
char
*file,
28
const
unsigned
line,
29
const
char
*function,
30
const
char
* msg =
nullptr
);
31
32
}
33
}
34
35
#ifdef OPENVDB_ENABLE_ASSERTS
36
#define OPENVDB_ASSERT(X) \
37
(OPENVDB_LIKELY(X) ? (void)0 : openvdb::assertAbort(#X, __FILE__, __LINE__, __PRETTY_FUNCTION__))
38
#define OPENVDB_ASSERT_MESSAGE(X, MSG) \
39
(OPENVDB_LIKELY(X) ? (void)0 : openvdb::assertAbort(#X, __FILE__, __LINE__, __PRETTY_FUNCTION__, MSG))
40
#else
41
#define OPENVDB_ASSERT(X) (void)0;
42
#define OPENVDB_ASSERT_MESSAGE(X, MSG) (void)0;
43
#endif
// OPENVDB_ENABLE_ASSERTS
44
45
#endif
// OPENVDB_UTIL_ASSERT_HAS_BEEN_INCLUDED
Platform.h
openvdb::v13_0::assertAbort
void assertAbort(const char *assertion, const char *file, const unsigned line, const char *function, const char *msg=nullptr)
Trigger a SIGABRT after printing a formatted assertion message. Effectively performs the same functio...
openvdb
Definition
Exceptions.h:13
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition
version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition
version.h.in:218
openvdb
util
Assert.h
Generated by
1.18.0