diff options
author | Andy Getzendanner <durandal@google.com> | 2023-01-24 10:48:27 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-01-24 10:50:01 -0800 |
commit | 609770cefb495bd3913d3ba4fd215f8738533304 (patch) | |
tree | 04d98871bc85c45c6a6899a4612a941cda9c14bb | |
parent | 20f44782bf1bb87069c43ff3f330e2dc4951a609 (diff) | |
download | abseil-609770cefb495bd3913d3ba4fd215f8738533304.tar.gz abseil-609770cefb495bd3913d3ba4fd215f8738533304.tar.bz2 abseil-609770cefb495bd3913d3ba4fd215f8738533304.zip |
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
-rw-r--r-- | absl/log/internal/log_message.cc | 3 |
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; |