File indexing completed on 2025-02-22 10:42:25
0001
0002
0003
0004
0005 #ifndef INCLUDE_CPPGC_INTERNAL_LOGGING_H_
0006 #define INCLUDE_CPPGC_INTERNAL_LOGGING_H_
0007
0008 #include "cppgc/source-location.h"
0009 #include "v8config.h" // NOLINT(build/include_directory)
0010
0011 namespace cppgc {
0012 namespace internal {
0013
0014 void V8_EXPORT DCheckImpl(const char*,
0015 const SourceLocation& = SourceLocation::Current());
0016 [[noreturn]] void V8_EXPORT
0017 FatalImpl(const char*, const SourceLocation& = SourceLocation::Current());
0018
0019
0020 template <typename>
0021 struct EatParams {};
0022
0023 #if defined(DEBUG)
0024 #define CPPGC_DCHECK_MSG(condition, message) \
0025 do { \
0026 if (V8_UNLIKELY(!(condition))) { \
0027 ::cppgc::internal::DCheckImpl(message); \
0028 } \
0029 } while (false)
0030 #else
0031 #define CPPGC_DCHECK_MSG(condition, message) \
0032 (static_cast<void>(::cppgc::internal::EatParams<decltype( \
0033 static_cast<void>(condition), message)>{}))
0034 #endif
0035
0036 #define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition)
0037
0038 #define CPPGC_CHECK_MSG(condition, message) \
0039 do { \
0040 if (V8_UNLIKELY(!(condition))) { \
0041 ::cppgc::internal::FatalImpl(message); \
0042 } \
0043 } while (false)
0044
0045 #define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition)
0046
0047 }
0048 }
0049
0050 #endif