CHECK fixes.
GitOrigin-RevId: 7f82d11913592bb241ab69975278ee8be2ce9d23
This commit is contained in:
parent
61288bd8ab
commit
ffe53dcd12
@ -8,8 +8,6 @@
|
||||
|
||||
#include "td/utils/Slice-decl.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/MovableValue.h"
|
||||
#include "td/utils/Slice-decl.h"
|
||||
#include "td/utils/Slice.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
|
@ -6,7 +6,6 @@
|
||||
//
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/port/thread_local.h"
|
||||
#include "td/utils/Slice.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Slice-decl.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/StackAllocator.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -5,9 +5,12 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/utils/check.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
namespace td {
|
||||
namespace detail {
|
||||
|
||||
void process_check_error(const char *message, const char *file, int line) {
|
||||
::td::Logger(*log_interface, log_options, VERBOSITY_NAME(FATAL), Slice(file), line, Slice())
|
||||
<< "Check `" << message << "` failed";
|
||||
|
@ -5,22 +5,28 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
#define DUMMY_CHECK(condition) ((void)(condition))
|
||||
|
||||
#define TD_DUMMY_CHECK(condition) ((void)(condition))
|
||||
|
||||
#define CHECK(condition) \
|
||||
if (!(condition)) { \
|
||||
::td::detail::process_check_error(#condition, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#ifdef TD_DEBUG
|
||||
#define DCHECK CHECK
|
||||
// clang-format off
|
||||
#ifdef NDEBUG
|
||||
#define DCHECK CHECK
|
||||
#else
|
||||
#define DCHECK DUMMY_CHECK
|
||||
#define DCHECK TD_DUMMY_CHECK
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
#define UNREACHABLE(x) CHECK(false && "unreachable")
|
||||
#define UNREACHABLE() ::td::detail::process_check_error("Unreachable", __FILE__, __LINE__)
|
||||
|
||||
namespace td {
|
||||
namespace detail {
|
||||
|
||||
[[noreturn]] void process_check_error(const char *message, const char *file, int line);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace td
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/port/thread_local.h"
|
||||
#include "td/utils/Slice-decl.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/StackAllocator.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
@ -308,5 +308,3 @@ class TsLog : public LogInterface {
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
||||
#include "td/utils/Slice.h"
|
||||
|
Reference in New Issue
Block a user