diff --git a/src/google/protobuf/any_test.cc b/src/google/protobuf/any_test.cc index c5fb2bcace..7561b02d93 100644 --- a/src/google/protobuf/any_test.cc +++ b/src/google/protobuf/any_test.cc @@ -45,9 +45,9 @@ TEST(AnyTest, TestPackAndUnpack) { } TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) { -#if defined(_MSC_VER) && defined(_M_IX86) - GTEST_SKIP() << "This toolchain can't allocate that much memory."; -#endif + if (std::string().max_size() < INT_MAX) { + GTEST_SKIP() << "This toolchain can't allocate that much memory."; + } protobuf_unittest::TestAny submessage; submessage.mutable_text()->resize(INT_MAX, 'a'); protobuf_unittest::TestAny message; diff --git a/src/google/protobuf/descriptor_database_unittest.cc b/src/google/protobuf/descriptor_database_unittest.cc index 7b24257244..1b8449a533 100644 --- a/src/google/protobuf/descriptor_database_unittest.cc +++ b/src/google/protobuf/descriptor_database_unittest.cc @@ -18,7 +18,6 @@ #include "google/protobuf/descriptor.pb.h" #include -#include "google/protobuf/testing/googletest.h" #include #include "google/protobuf/descriptor.h" #include "google/protobuf/test_textproto.h" diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index e062470f9e..3e125a1b62 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -16,7 +16,6 @@ #include #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/testing/googletest.h" #include #include "absl/base/casts.h" #include "absl/strings/cord.h" @@ -28,6 +27,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/message_lite.h" +#include "google/protobuf/port.h" #include "google/protobuf/test_util.h" #include "google/protobuf/test_util2.h" #include "google/protobuf/text_format.h" diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc index 8436903879..94d3841b86 100644 --- a/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/src/google/protobuf/generated_message_reflection_unittest.cc @@ -36,6 +36,7 @@ #include "google/protobuf/map_test_util.h" #include "google/protobuf/map_unittest.pb.h" #include "google/protobuf/message.h" +#include "google/protobuf/port.h" #include "google/protobuf/test_util.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_mset.pb.h" diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h index ed021cd3a7..9c4e9406fe 100644 --- a/src/google/protobuf/port.h +++ b/src/google/protobuf/port.h @@ -273,6 +273,11 @@ constexpr bool PerformDebugChecks() { // available. inline constexpr bool PtrIsAtLeast8BAligned() { return alignof(void*) >= 8; } +inline constexpr bool IsLazyParsingSupported() { + // We need 3 bits for pointer tagging in lazy parsing. + return PtrIsAtLeast8BAligned(); +} + // Prefetch 5 64-byte cache line starting from 7 cache-lines ahead. // Constants are somewhat arbitrary and pretty aggressive, but were // chosen to give a better benchmark results. E.g. this is ~20% diff --git a/src/google/protobuf/test_util2.h b/src/google/protobuf/test_util2.h index 88967c46c4..bc8d47a6b7 100644 --- a/src/google/protobuf/test_util2.h +++ b/src/google/protobuf/test_util2.h @@ -10,7 +10,7 @@ #include -#include "google/protobuf/testing/googletest.h" +#include #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/strings/strip.h" @@ -18,6 +18,8 @@ #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/util/message_differencer.h" +#include "google/protobuf/testing/googletest.h" + namespace google { namespace protobuf { namespace TestUtil { diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc index 27923675f1..95f2b8fd8d 100644 --- a/src/google/protobuf/unknown_field_set_unittest.cc +++ b/src/google/protobuf/unknown_field_set_unittest.cc @@ -20,7 +20,6 @@ #include "google/protobuf/stubs/callback.h" #include "google/protobuf/stubs/common.h" #include -#include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_set.h" #include "absl/functional/bind_front.h"