From 609770cefb495bd3913d3ba4fd215f8738533304 Mon Sep 17 00:00:00 2001 From: Andy Getzendanner Date: Tue, 24 Jan 2023 10:48:27 -0800 Subject: Work around GCC -Wuninitialized when initializing a span from an uninitialized array in logging. It's uninitialized on purpose; we'll write into it through the span. PiperOrigin-RevId: 504318917 Change-Id: I79835f0190253b8b470b3ca404f3979715f2a718 --- absl/log/internal/log_message.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'absl/log') diff --git a/absl/log/internal/log_message.cc b/absl/log/internal/log_message.cc index a8080610..bdb10f2a 100644 --- a/absl/log/internal/log_message.cc +++ b/absl/log/internal/log_message.cc @@ -163,7 +163,8 @@ LogMessage::LogMessageData::LogMessageData(const char* file, int line, absl::Time timestamp) : extra_sinks_only(false), manipulated(nullptr), - encoded_remaining(encoded_buf) { + // This `absl::MakeSpan` silences spurious -Wuninitialized from GCC: + encoded_remaining(absl::MakeSpan(encoded_buf)) { // Legacy defaults for LOG's ostream: manipulated.setf(std::ios_base::showbase | std::ios_base::boolalpha); entry.full_filename_ = file; -- cgit v1.2.3