Allow users to force eager parsing via CodedInputStream::ForceEagerParsing().
PiperOrigin-RevId: 579989063
diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc
index 79d7977..ef3a794 100644
--- a/src/google/protobuf/extension_set_heavy.cc
+++ b/src/google/protobuf/extension_set_heavy.cc
@@ -12,6 +12,8 @@
// Contains methods defined in extension_set.h which cannot be part of the
// lite library because they use descriptors or reflection.
+#include <cstddef>
+#include <cstdint>
#include <vector>
#include "absl/log/absl_check.h"
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index df926e7..cb96989 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -11,6 +11,7 @@
#include "google/protobuf/extension_set.h"
+#include <cstdint>
#include <string>
#include "google/protobuf/descriptor.pb.h"
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index ecb0f2e..97d62e4 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -91,6 +91,7 @@
#include <atomic>
#include <climits>
#include <cstddef>
+#include <cstdint>
#include <cstring>
#include <limits>
#include <string>
@@ -522,6 +523,9 @@
// See EnableAliasing().
bool aliasing_enabled_;
+ // If true, set eager parsing mode to override lazy fields.
+ bool force_eager_parsing_;
+
// Limits
Limit current_limit_; // if position = -1, no limit is applied
@@ -1553,6 +1557,7 @@
last_tag_(0),
legitimate_message_end_(false),
aliasing_enabled_(false),
+ force_eager_parsing_(false),
current_limit_(std::numeric_limits<int32_t>::max()),
buffer_size_after_limit_(0),
total_bytes_limit_(kDefaultTotalBytesLimit),
@@ -1573,6 +1578,7 @@
last_tag_(0),
legitimate_message_end_(false),
aliasing_enabled_(false),
+ force_eager_parsing_(false),
current_limit_(size),
buffer_size_after_limit_(0),
total_bytes_limit_(kDefaultTotalBytesLimit),
diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
index 36e8597..d6a473e 100644
--- a/src/google/protobuf/message_lite.cc
+++ b/src/google/protobuf/message_lite.cc
@@ -251,7 +251,7 @@
if (PROTOBUF_PREDICT_FALSE(!ptr)) return false;
ctx.BackUp(ptr);
if (!ctx.EndedAtEndOfStream()) {
- ABSL_DCHECK_NE(ctx.LastTag(), 1); // We can't end on a pushed limit.
+ ABSL_DCHECK_NE(ctx.LastTag(), 1u); // We can't end on a pushed limit.
if (ctx.IsExceedingLimit(ptr)) return false;
input->SetLastTag(ctx.LastTag());
} else {