diff options
author | rtk0c <[email protected]> | 2022-05-22 14:54:06 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-05-22 14:54:06 -0700 |
commit | 55c4420b69fa172ac7b6b3523597b9a46a5d1bcd (patch) | |
tree | 407fbd2fd7911b8bfa8567502d7493708036be2f /3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h | |
parent | 195e30b1e39fa4dc535172ba248f0c18733dcb3c (diff) |
Vendor SQLiteCpp completely for internal patching
Diffstat (limited to '3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h')
-rw-r--r-- | 3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h b/3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h new file mode 100644 index 0000000..b6d00be --- /dev/null +++ b/3rdparty/sqlitecpp/source/SQLiteCpp/Assertion.h @@ -0,0 +1,46 @@ +/** + * @file Assertion.h + * @ingroup SQLiteCpp + * @brief Definition of the SQLITECPP_ASSERT() macro. + * + * Copyright (c) 2012-2021 Sebastien Rombauts ([email protected]) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#pragma once + +#include <cassert> + + +/** + * SQLITECPP_ASSERT SQLITECPP_ASSERT() is used in destructors, where exceptions shall not be thrown + * + * Define SQLITECPP_ENABLE_ASSERT_HANDLER at the project level + * and define a SQLite::assertion_failed() assertion handler + * to tell SQLiteC++ to use it instead of assert() when an assertion fail. +*/ +#ifdef SQLITECPP_ENABLE_ASSERT_HANDLER + +// if an assert handler is provided by user code, use it instead of assert() +namespace SQLite +{ + // declaration of the assert handler to define in user code + void assertion_failed(const char* apFile, const long apLine, const char* apFunc, + const char* apExpr, const char* apMsg); + +#ifdef _MSC_VER + #define __func__ __FUNCTION__ +#endif +// call the assert handler provided by user code +#define SQLITECPP_ASSERT(expression, message) \ + if (!(expression)) SQLite::assertion_failed(__FILE__, __LINE__, __func__, #expression, message) +} // namespace SQLite + +#else + +// if no assert handler provided by user code, use standard assert() +// (note: in release mode assert() does nothing) +#define SQLITECPP_ASSERT(expression, message) assert(expression && message) + +#endif |