summaryrefslogtreecommitdiff
path: root/absl/log
diff options
context:
space:
mode:
authorGravatar Andy Getzendanner <durandal@google.com>2023-01-24 10:48:27 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-24 10:50:01 -0800
commit609770cefb495bd3913d3ba4fd215f8738533304 (patch)
tree04d98871bc85c45c6a6899a4612a941cda9c14bb /absl/log
parent20f44782bf1bb87069c43ff3f330e2dc4951a609 (diff)
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
Diffstat (limited to 'absl/log')
-rw-r--r--absl/log/internal/log_message.cc3
1 files changed, 2 insertions, 1 deletions
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;