summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Wiktor Garbacz <wiktorg@google.com>2023-03-20 01:10:59 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-03-20 01:11:31 -0700
commitefeb95f4491740817a1c37345b66d26bce722ae4 (patch)
treef58f386534a1cc43f0534aa51c462127406d352d /absl/base
parent0697762c62cdb51ead8d9c2f0d299c5d4a4ff9db (diff)
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
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/internal/raw_logging.h10
1 files changed, 8 insertions, 2 deletions
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 {