| |
| |
| |
|
|
| #ifndef INCLUDE_CPPGC_INTERNAL_LOGGING_H_ |
| #define INCLUDE_CPPGC_INTERNAL_LOGGING_H_ |
|
|
| #include "cppgc/source-location.h" |
| #include "v8config.h" |
|
|
| namespace cppgc { |
| namespace internal { |
|
|
| void V8_EXPORT DCheckImpl(const char*, |
| const SourceLocation& = SourceLocation::Current()); |
| [[noreturn]] void V8_EXPORT |
| FatalImpl(const char*, const SourceLocation& = SourceLocation::Current()); |
|
|
| |
| template <typename> |
| struct EatParams {}; |
|
|
| #if defined(DEBUG) |
| #define CPPGC_DCHECK_MSG(condition, message) \ |
| do { \ |
| if (V8_UNLIKELY(!(condition))) { \ |
| ::cppgc::internal::DCheckImpl(message); \ |
| } \ |
| } while (false) |
| #else |
| #define CPPGC_DCHECK_MSG(condition, message) \ |
| (static_cast<void>(::cppgc::internal::EatParams<decltype( \ |
| static_cast<void>(condition), message)>{})) |
| #endif |
|
|
| #define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition) |
|
|
| #define CPPGC_CHECK_MSG(condition, message) \ |
| do { \ |
| if (V8_UNLIKELY(!(condition))) { \ |
| ::cppgc::internal::FatalImpl(message); \ |
| } \ |
| } while (false) |
|
|
| #define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition) |
|
|
| } |
| } |
|
|
| #endif |
|
|