From efeb95f4491740817a1c37345b66d26bce722ae4 Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Mon, 20 Mar 2023 01:10:59 -0700 Subject: Add `ABSL_UNREACHABLE()` to `ABSL_RAW_LOG` when severity is `FATAL` Also makes `ABSL_INTERNAL_LOG(LEVEL(x), "oops")` not call unreachable (even when x == kFatal) for consistency. PiperOrigin-RevId: 517894304 Change-Id: I798b1032d126330ace1e2b48edd8fc547a2ad2f8 --- absl/base/internal/raw_logging.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'absl/base') diff --git a/absl/base/internal/raw_logging.h b/absl/base/internal/raw_logging.h index c7b889cd..bdd536a1 100644 --- a/absl/base/internal/raw_logging.h +++ b/absl/base/internal/raw_logging.h @@ -48,6 +48,7 @@ ::absl::raw_log_internal::RawLog(ABSL_RAW_LOG_INTERNAL_##severity, \ absl_raw_log_internal_basename, __LINE__, \ __VA_ARGS__); \ + ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_##severity; \ } while (0) // Similar to CHECK(condition) << message, but for low-level modules: @@ -77,8 +78,7 @@ ::absl::raw_log_internal::internal_log_function( \ ABSL_RAW_LOG_INTERNAL_##severity, absl_raw_log_internal_filename, \ __LINE__, message); \ - if (ABSL_RAW_LOG_INTERNAL_##severity == ::absl::LogSeverity::kFatal) \ - ABSL_UNREACHABLE(); \ + ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_##severity; \ } while (0) #define ABSL_INTERNAL_CHECK(condition, message) \ @@ -97,6 +97,12 @@ #define ABSL_RAW_LOG_INTERNAL_LEVEL(severity) \ ::absl::NormalizeLogSeverity(severity) +#define ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_INFO +#define ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_WARNING +#define ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_ERROR +#define ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_FATAL ABSL_UNREACHABLE() +#define ABSL_RAW_LOG_INTERNAL_MAYBE_UNREACHABLE_LEVEL(severity) + namespace absl { ABSL_NAMESPACE_BEGIN namespace raw_log_internal { -- cgit v1.2.3