Migrate some protobuf internal macros to Abseil public ones.

This reduces the size of port_def.inc, and reduces the total input to the preprocessor.

PiperOrigin-RevId: 574510248
pull/14459/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent dc67f8afc1
commit bac6e765af
  1. 4
      src/google/protobuf/arenastring.h
  2. 2
      src/google/protobuf/compiler/command_line_interface.cc
  3. 12
      src/google/protobuf/compiler/cpp/file.cc
  4. 2
      src/google/protobuf/compiler/cpp/message.cc
  5. 7
      src/google/protobuf/compiler/cpp/parse_function_generator.cc
  6. 34
      src/google/protobuf/compiler/java/java_features.pb.cc
  7. 2
      src/google/protobuf/compiler/java/java_features.pb.h
  8. 138
      src/google/protobuf/compiler/plugin.pb.cc
  9. 8
      src/google/protobuf/compiler/plugin.pb.h
  10. 30
      src/google/protobuf/cpp_features.pb.cc
  11. 2
      src/google/protobuf/cpp_features.pb.h
  12. 2
      src/google/protobuf/descriptor.cc
  13. 1172
      src/google/protobuf/descriptor.pb.cc
  14. 64
      src/google/protobuf/descriptor.pb.h
  15. 24
      src/google/protobuf/endian.h
  16. 2
      src/google/protobuf/generated_message_bases.h
  17. 2
      src/google/protobuf/generated_message_tctable_lite.cc
  18. 2
      src/google/protobuf/io/coded_stream.cc
  19. 18
      src/google/protobuf/io/coded_stream.h
  20. 2
      src/google/protobuf/io/zero_copy_stream_impl_lite.cc
  21. 35
      src/google/protobuf/message_lite.h
  22. 6
      src/google/protobuf/parse_context.h
  23. 106
      src/google/protobuf/port_def.inc
  24. 11
      src/google/protobuf/port_undef.inc
  25. 6
      src/google/protobuf/repeated_field.h
  26. 6
      src/google/protobuf/repeated_ptr_field.h
  27. 4
      src/google/protobuf/stubs/common.cc
  28. 38
      src/google/protobuf/stubs/port.h
  29. 2
      src/google/protobuf/wire_format.cc
  30. 6
      src/google/protobuf/wire_format_lite.cc
  31. 4
      src/google/protobuf/wire_format_lite.h

@ -337,7 +337,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr {
// Returns a pointer to the stored contents for this instance.
// This method is for internal debugging and tracking purposes only.
PROTOBUF_NDEBUG_INLINE const std::string* UnsafeGetPointer() const
PROTOBUF_RETURNS_NONNULL {
ABSL_ATTRIBUTE_RETURNS_NONNULL {
return tagged_ptr_.Get();
}
@ -383,7 +383,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr {
// Generated code only! An optimization, in certain cases the generated
// code is certain we can obtain a std::string with no default checks and
// tag tests.
std::string* UnsafeMutablePointer() PROTOBUF_RETURNS_NONNULL;
std::string* UnsafeMutablePointer() ABSL_ATTRIBUTE_RETURNS_NONNULL;
// Returns true if this instances holds an immutable default value.
inline bool IsDefault() const { return tagged_ptr_.IsDefault(); }

@ -1899,7 +1899,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
break; // only for --decode_raw
}
// --decode (not raw) is handled the same way as the rest of the modes.
PROTOBUF_FALLTHROUGH_INTENDED;
ABSL_FALLTHROUGH_INTENDED;
case MODE_ENCODE:
case MODE_PRINT:
missing_proto_definitions =

@ -1131,13 +1131,14 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) {
}},
},
R"cc(
const ::uint32_t $tablename$::offsets[] PROTOBUF_SECTION_VARIABLE(
protodesc_cold) = {
$offsets$,
const ::uint32_t
$tablename$::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
$offsets$,
};
static const ::_pbi::MigrationSchema
schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
$schemas$,
};
@ -1212,7 +1213,8 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) {
}
}}},
R"cc(
const char $desc_name$[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const char $desc_name$[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
$encoded_file_proto$,
};
)cc");

@ -1529,7 +1529,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
if (!HasSimpleBaseClass(descriptor_, options_)) {
format(
"PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;\n"
"ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;\n"
"bool IsInitialized() const final;\n"
"\n"
"::size_t ByteSizeLong() const final;\n");

@ -235,9 +235,12 @@ void ParseFunctionGenerator::GenerateDataDecls(io::Printer* p) {
// Since most (>80%) messages are never present, messages that are
// present are considered hot enough to be clustered together.
if (IsPresentMessage(descriptor_, options_)) {
p->Emit("PROTOBUF_SECTION_VARIABLE(proto_parse_table_hot)");
p->Emit(
"ABSL_ATTRIBUTE_SECTION_VARIABLE(proto_parse_table_hot)");
} else {
p->Emit("PROTOBUF_SECTION_VARIABLE(proto_parse_table_lukewarm)");
p->Emit(
"ABSL_ATTRIBUTE_SECTION_VARIABLE(proto_parse_table_"
"lukewarm)");
}
}},
{"table_size_log2", tc_table_info_->table_size_log2},

@ -46,31 +46,33 @@ static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fjava_2
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[1];
static constexpr const ::_pb::ServiceDescriptor**
file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto = nullptr;
const ::uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.legacy_closed_enum_),
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.utf8_validation_),
0,
1,
const ::uint32_t
TableStruct_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.legacy_closed_enum_),
PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.utf8_validation_),
0,
1,
};
static const ::_pbi::MigrationSchema
schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{0, 10, -1, sizeof(::pb::JavaFeatures)},
};
static const ::_pb::Message* const file_default_instances[] = {
&::pb::_JavaFeatures_default_instance_._instance,
};
const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
"\n1google/protobuf/compiler/java/java_fea"
"tures.proto\022\002pb\032 google/protobuf/descrip"
"tor.proto\"\352\001\n\014JavaFeatures\022>\n\022legacy_clo"

@ -201,7 +201,7 @@ class PROTOC_EXPORT JavaFeatures final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;

@ -130,76 +130,77 @@ static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1];
static constexpr const ::_pb::ServiceDescriptor**
file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr;
const ::uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.major_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.minor_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.patch_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.suffix_),
1,
2,
3,
0,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.file_to_generate_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.parameter_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.proto_file_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.source_file_descriptors_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.compiler_version_),
~0u,
0,
~0u,
~0u,
1,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.name_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.insertion_point_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.content_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.generated_code_info_),
0,
1,
2,
3,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.error_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.supported_features_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.file_),
0,
1,
~0u,
const ::uint32_t
TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.major_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.minor_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.patch_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::Version, _impl_.suffix_),
1,
2,
3,
0,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.file_to_generate_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.parameter_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.proto_file_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.source_file_descriptors_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorRequest, _impl_.compiler_version_),
~0u,
0,
~0u,
~0u,
1,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.name_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.insertion_point_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.content_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse_File, _impl_.generated_code_info_),
0,
1,
2,
3,
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.error_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.supported_features_),
PROTOBUF_FIELD_OFFSET(::google::protobuf::compiler::CodeGeneratorResponse, _impl_.file_),
0,
1,
~0u,
};
static const ::_pbi::MigrationSchema
schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{0, 12, -1, sizeof(::google::protobuf::compiler::Version)},
{16, 29, -1, sizeof(::google::protobuf::compiler::CodeGeneratorRequest)},
{34, 46, -1, sizeof(::google::protobuf::compiler::CodeGeneratorResponse_File)},
@ -212,7 +213,8 @@ static const ::_pb::Message* const file_default_instances[] = {
&::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_._instance,
&::google::protobuf::compiler::_CodeGeneratorResponse_default_instance_._instance,
};
const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
"\n%google/protobuf/compiler/plugin.proto\022"
"\030google.protobuf.compiler\032 google/protob"
"uf/descriptor.proto\"F\n\007Version\022\r\n\005major\030"

@ -218,7 +218,7 @@ class PROTOC_EXPORT Version final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -440,7 +440,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -678,7 +678,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -917,7 +917,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;

@ -46,29 +46,31 @@ static constexpr const ::_pb::EnumDescriptor**
file_level_enum_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto = nullptr;
static constexpr const ::_pb::ServiceDescriptor**
file_level_service_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto = nullptr;
const ::uint32_t TableStruct_google_2fprotobuf_2fcpp_5ffeatures_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _impl_.legacy_closed_enum_),
0,
const ::uint32_t
TableStruct_google_2fprotobuf_2fcpp_5ffeatures_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
~0u, // no _split_
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::pb::CppFeatures, _impl_.legacy_closed_enum_),
0,
};
static const ::_pbi::MigrationSchema
schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{0, 9, -1, sizeof(::pb::CppFeatures)},
};
static const ::_pb::Message* const file_default_instances[] = {
&::pb::_CppFeatures_default_instance_._instance,
};
const char descriptor_table_protodef_google_2fprotobuf_2fcpp_5ffeatures_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const char descriptor_table_protodef_google_2fprotobuf_2fcpp_5ffeatures_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
protodesc_cold) = {
"\n\"google/protobuf/cpp_features.proto\022\002pb"
"\032 google/protobuf/descriptor.proto\"M\n\013Cp"
"pFeatures\022>\n\022legacy_closed_enum\030\001 \001(\010B\"\210"

@ -170,7 +170,7 @@ class PROTOBUF_EXPORT CppFeatures final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;

@ -1266,7 +1266,7 @@ class FileDescriptorTables {
FieldsByNumberSet fields_by_number_; // Not including extensions.
EnumValuesByNumberSet enum_values_by_number_;
mutable EnumValuesByNumberSet unknown_enum_values_by_number_
PROTOBUF_GUARDED_BY(unknown_enum_values_mu_);
ABSL_GUARDED_BY(unknown_enum_values_mu_);
// Populated on first request to save space, hence constness games.
mutable absl::once_flag locations_by_path_once_;

File diff suppressed because it is too large Load Diff

@ -799,7 +799,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -995,7 +995,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -1269,7 +1269,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -1533,7 +1533,7 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -1729,7 +1729,7 @@ class PROTOBUF_EXPORT FeatureSet final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -2277,7 +2277,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -2518,7 +2518,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -2708,7 +2708,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -2898,7 +2898,7 @@ class PROTOBUF_EXPORT UninterpretedOption final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -3180,7 +3180,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -3365,7 +3365,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -3550,7 +3550,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -3744,7 +3744,7 @@ class PROTOBUF_EXPORT ServiceOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -4137,7 +4137,7 @@ class PROTOBUF_EXPORT OneofOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -4517,7 +4517,7 @@ class PROTOBUF_EXPORT MethodOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -4944,7 +4944,7 @@ class PROTOBUF_EXPORT MessageOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -5389,7 +5389,7 @@ class PROTOBUF_EXPORT FileOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -6110,7 +6110,7 @@ class PROTOBUF_EXPORT FieldOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -6741,7 +6741,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -6953,7 +6953,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -7388,7 +7388,7 @@ class PROTOBUF_EXPORT EnumValueOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -7794,7 +7794,7 @@ class PROTOBUF_EXPORT EnumOptions final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -8213,7 +8213,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -8413,7 +8413,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -8677,7 +8677,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -9075,7 +9075,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -9288,7 +9288,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -9495,7 +9495,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -9715,7 +9715,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -9987,7 +9987,7 @@ class PROTOBUF_EXPORT DescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -10360,7 +10360,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;
@ -10778,7 +10778,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final :
private:
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
::size_t ByteSizeLong() const final;

@ -65,7 +65,7 @@ inline uint16_t BSwap16(uint16_t host_int) {
namespace little_endian {
inline uint16_t FromHost(uint16_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap16(value);
#else
return value;
@ -73,7 +73,7 @@ inline uint16_t FromHost(uint16_t value) {
}
inline uint32_t FromHost(uint32_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap32(value);
#else
return value;
@ -81,7 +81,7 @@ inline uint32_t FromHost(uint32_t value) {
}
inline uint64_t FromHost(uint64_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap64(value);
#else
return value;
@ -89,7 +89,7 @@ inline uint64_t FromHost(uint64_t value) {
}
inline uint16_t ToHost(uint16_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap16(value);
#else
return value;
@ -97,7 +97,7 @@ inline uint16_t ToHost(uint16_t value) {
}
inline uint32_t ToHost(uint32_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap32(value);
#else
return value;
@ -105,7 +105,7 @@ inline uint32_t ToHost(uint32_t value) {
}
inline uint64_t ToHost(uint64_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return BSwap64(value);
#else
return value;
@ -117,7 +117,7 @@ inline uint64_t ToHost(uint64_t value) {
namespace big_endian {
inline uint16_t FromHost(uint16_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap16(value);
@ -125,7 +125,7 @@ inline uint16_t FromHost(uint16_t value) {
}
inline uint32_t FromHost(uint32_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap32(value);
@ -133,7 +133,7 @@ inline uint32_t FromHost(uint32_t value) {
}
inline uint64_t FromHost(uint64_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap64(value);
@ -141,7 +141,7 @@ inline uint64_t FromHost(uint64_t value) {
}
inline uint16_t ToHost(uint16_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap16(value);
@ -149,7 +149,7 @@ inline uint16_t ToHost(uint16_t value) {
}
inline uint32_t ToHost(uint32_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap32(value);
@ -157,7 +157,7 @@ inline uint32_t ToHost(uint32_t value) {
}
inline uint64_t ToHost(uint64_t value) {
#if defined(PROTOBUF_BIG_ENDIAN)
#if defined(ABSL_IS_BIG_ENDIAN)
return value;
#else
return BSwap64(value);

@ -29,7 +29,7 @@ namespace internal {
// rather than Message.
class PROTOBUF_EXPORT ZeroFieldsBase : public Message {
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final { return true; }
size_t ByteSizeLong() const final;
int GetCachedSize() const { return _cached_size_.Get(); }

@ -166,7 +166,7 @@ const TcParseTableBase::FieldEntry* TcParser::FindFieldEntry(
}
const uint16_t* lookup_table = table->field_lookup_begin();
for (;;) {
#ifdef PROTOBUF_LITTLE_ENDIAN
#ifdef ABSL_IS_LITTLE_ENDIAN
memcpy(&fstart, lookup_table, sizeof(fstart));
#else
fstart = lookup_table[0] | (lookup_table[1] << 16);

@ -893,7 +893,7 @@ uint8_t* EpsCopyOutputStream::WriteAliasedRaw(const void* data, int size,
}
}
#ifndef PROTOBUF_LITTLE_ENDIAN
#ifndef ABSL_IS_LITTLE_ENDIAN
uint8_t* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size,
uint8_t* ptr) {
auto p = static_cast<const uint8_t*>(data);

@ -912,7 +912,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream {
template <int S>
uint8_t* WriteRawLittleEndian(const void* data, int size, uint8_t* ptr);
#if !defined(PROTOBUF_LITTLE_ENDIAN) || \
#if !defined(ABSL_IS_LITTLE_ENDIAN) || \
defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
uint8_t* WriteRawLittleEndian32(const void* data, int size, uint8_t* ptr);
uint8_t* WriteRawLittleEndian64(const void* data, int size, uint8_t* ptr);
@ -960,7 +960,7 @@ template <>
inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data,
int size,
uint8_t* ptr) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
return WriteRaw(data, size, ptr);
#else
@ -971,7 +971,7 @@ template <>
inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data,
int size,
uint8_t* ptr) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
return WriteRaw(data, size, ptr);
#else
@ -1320,7 +1320,7 @@ inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) {
// static
inline const uint8_t* CodedInputStream::ReadLittleEndian32FromArray(
const uint8_t* buffer, uint32_t* value) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
memcpy(value, buffer, sizeof(*value));
return buffer + sizeof(*value);
@ -1335,7 +1335,7 @@ inline const uint8_t* CodedInputStream::ReadLittleEndian32FromArray(
// static
inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray(
const uint8_t* buffer, uint64_t* value) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
memcpy(value, buffer, sizeof(*value));
return buffer + sizeof(*value);
@ -1354,7 +1354,7 @@ inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray(
}
inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
buffer_ = ReadLittleEndian32FromArray(buffer_, value);
@ -1368,7 +1368,7 @@ inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) {
}
inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) {
buffer_ = ReadLittleEndian64FromArray(buffer_, value);
@ -1646,7 +1646,7 @@ inline uint8_t* CodedOutputStream::WriteVarint32SignExtendedToArray(
inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value,
uint8_t* target) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
memcpy(target, &value, sizeof(value));
#else
@ -1660,7 +1660,7 @@ inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value,
inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(uint64_t value,
uint8_t* target) {
#if defined(PROTOBUF_LITTLE_ENDIAN) && \
#if defined(ABSL_IS_LITTLE_ENDIAN) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
memcpy(target, &value, sizeof(value));
#else

@ -617,7 +617,7 @@ bool CordOutputStream::Next(void** data, int* size) {
case State::kFull:
assert(buffer_.length() > 0);
cord_.Append(std::move(buffer_));
PROTOBUF_FALLTHROUGH_INTENDED;
ABSL_FALLTHROUGH_INTENDED;
case State::kEmpty:
assert(buffer_.length() == 0);
buffer_ = absl::CordBuffer::CreateWithDefaultLimit(desired_size);

@ -273,34 +273,34 @@ class PROTOBUF_EXPORT MessageLite {
// format. A successful return does not indicate the entire input is
// consumed, ensure you call ConsumedEntireMessage() to check that if
// applicable.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromCodedStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromCodedStream(
io::CodedInputStream* input);
// Like ParseFromCodedStream(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCodedStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCodedStream(
io::CodedInputStream* input);
// Read a protocol buffer from the given zero-copy input stream. If
// successful, the entire input will be consumed.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromZeroCopyStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromZeroCopyStream(
io::ZeroCopyInputStream* input);
// Like ParseFromZeroCopyStream(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromZeroCopyStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromZeroCopyStream(
io::ZeroCopyInputStream* input);
// Parse a protocol buffer from a file descriptor. If successful, the entire
// input will be consumed.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromFileDescriptor(
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromFileDescriptor(
int file_descriptor);
// Like ParseFromFileDescriptor(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromFileDescriptor(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromFileDescriptor(
int file_descriptor);
// Parse a protocol buffer from a C++ istream. If successful, the entire
// input will be consumed.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromIstream(std::istream* input);
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromIstream(std::istream* input);
// Like ParseFromIstream(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromIstream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromIstream(
std::istream* input);
// Read a protocol buffer from the given zero-copy input stream, expecting
// the message to be exactly "size" bytes long. If successful, exactly
@ -310,29 +310,28 @@ class PROTOBUF_EXPORT MessageLite {
// Like ParseFromBoundedZeroCopyStream(), but accepts messages that are
// missing required fields.
bool MergeFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, int size);
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromBoundedZeroCopyStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromBoundedZeroCopyStream(
io::ZeroCopyInputStream* input, int size);
// Like ParseFromBoundedZeroCopyStream(), but accepts messages that are
// missing required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromBoundedZeroCopyStream(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromBoundedZeroCopyStream(
io::ZeroCopyInputStream* input, int size);
// Parses a protocol buffer contained in a string. Returns true on success.
// This function takes a string in the (non-human-readable) binary wire
// format, matching the encoding output by MessageLite::SerializeToString().
// If you'd like to convert a human-readable string into a protocol buffer
// object, see google::protobuf::TextFormat::ParseFromString().
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromString(absl::string_view data);
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromString(absl::string_view data);
// Like ParseFromString(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromString(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromString(
absl::string_view data);
// Parse a protocol buffer contained in an array of bytes.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromArray(const void* data,
int size);
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromArray(const void* data, int size);
// Like ParseFromArray(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromArray(const void* data,
int size);
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromArray(const void* data,
int size);
// Reads a protocol buffer from the stream and merges it into this
@ -418,10 +417,10 @@ class PROTOBUF_EXPORT MessageLite {
// required fields.
bool MergePartialFromCord(const absl::Cord& cord);
// Parse a protocol buffer contained in a Cord.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromCord(const absl::Cord& cord);
ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromCord(const absl::Cord& cord);
// Like ParseFromCord(), but accepts messages that are missing
// required fields.
PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCord(
ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCord(
const absl::Cord& cord);
// Serialize the message and store it in the given Cord. All required

@ -883,7 +883,7 @@ static const char* VarintParseSlowArm(const char* p, uint64_t* out,
template <typename T>
PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) {
#if defined(__aarch64__) && defined(PROTOBUF_LITTLE_ENDIAN)
#if defined(__aarch64__) && defined(ABSL_IS_LITTLE_ENDIAN)
// This optimization is not supported in big endian mode
uint64_t first8;
std::memcpy(&first8, p, sizeof(first8));
@ -1178,7 +1178,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
out->Reserve(old_entries + num);
int block_size = num * sizeof(T);
auto dst = out->AddNAlreadyReserved(num);
#ifdef PROTOBUF_LITTLE_ENDIAN
#ifdef ABSL_IS_LITTLE_ENDIAN
std::memcpy(dst, ptr, block_size);
#else
for (int i = 0; i < num; i++)
@ -1197,7 +1197,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
int old_entries = out->size();
out->Reserve(old_entries + num);
auto dst = out->AddNAlreadyReserved(num);
#ifdef PROTOBUF_LITTLE_ENDIAN
#ifdef ABSL_IS_LITTLE_ENDIAN
ABSL_CHECK(dst != nullptr) << out << "," << num;
std::memcpy(dst, ptr, block_size);
#else

@ -311,64 +311,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_TAILCALL false
#endif
#ifdef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED
#error PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(exclusive_locks_required)
#define PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED(...) \
__attribute__((exclusive_locks_required(__VA_ARGS__)))
#else
#define PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED(...)
#endif
#ifdef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
#error PROTOBUF_NO_THREAD_SAFETY_ANALYSIS was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(no_thread_safety_analysis)
#define PROTOBUF_NO_THREAD_SAFETY_ANALYSIS \
__attribute__((no_thread_safety_analysis))
#else
#define PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
#endif
#ifdef PROTOBUF_GUARDED_BY
#error PROTOBUF_GUARDED_BY was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(guarded_by)
#define PROTOBUF_GUARDED_BY(x) __attribute__((guarded_by(x)))
#else
#define PROTOBUF_GUARDED_BY(x)
#endif
#ifdef PROTOBUF_LOCKS_EXCLUDED
#error PROTOBUF_LOCKS_EXCLUDED was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(locks_excluded)
#define PROTOBUF_LOCKS_EXCLUDED(...) \
__attribute__((locks_excluded(__VA_ARGS__)))
#else
#define PROTOBUF_LOCKS_EXCLUDED(...)
#endif
#ifdef PROTOBUF_COLD
#error PROTOBUF_COLD was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(cold) || defined(__GNUC__)
# define PROTOBUF_COLD __attribute__((cold))
#else
# define PROTOBUF_COLD
#endif
#ifdef PROTOBUF_SECTION_VARIABLE
#error PROTOBUF_SECTION_VARIABLE was previously defined
#endif
#if (ABSL_HAVE_ATTRIBUTE(section) || defined(__GNUC__)) && defined(__ELF__)
// Place a variable in the given ELF section.
# define PROTOBUF_SECTION_VARIABLE(x) __attribute__((section(#x)))
#else
# define PROTOBUF_SECTION_VARIABLE(x)
#endif
#if defined(__clang__)
#define PROTOBUF_IGNORE_DEPRECATION_START \
_Pragma("clang diagnostic push") \
@ -386,24 +328,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_IGNORE_DEPRECATION_STOP
#endif
#ifdef PROTOBUF_RETURNS_NONNULL
#error PROTOBUF_RETURNS_NONNULL was previously defined
#endif
#if ABSL_HAVE_ATTRIBUTE(returns_nonnull) || defined(__GNUC__)
#define PROTOBUF_RETURNS_NONNULL __attribute__((returns_nonnull))
#else
#define PROTOBUF_RETURNS_NONNULL
#endif
#ifdef PROTOBUF_ATTRIBUTE_REINITIALIZES
#error PROTOBUF_ATTRIBUTE_REINITIALIZES was previously defined
#endif
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::reinitializes)
#define PROTOBUF_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]]
#else
#define PROTOBUF_ATTRIBUTE_REINITIALIZES
#endif
// The minimum library version which works with the current version of the
// headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 4024000
@ -576,20 +500,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#error PROTOBUF_FORCE_ALLOCATION_ON_CONSTRUCTION was previously defined
#endif
#ifdef PROTOBUF_FALLTHROUGH_INTENDED
#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
#endif
#if ABSL_HAVE_CPP_ATTRIBUTE(fallthrough)
#define PROTOBUF_FALLTHROUGH_INTENDED [[fallthrough]]
#elif ABSL_HAVE_FEATURE(cxx_attributes) && \
__has_warning("-Wimplicit-fallthrough")
#define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]]
#elif defined(__GNUC__)
#define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
#else
#define PROTOBUF_FALLTHROUGH_INTENDED
#endif
// Specify memory alignment for structs, classes, etc.
// Use like:
// class PROTOBUF_ALIGNAS(16) MyClass { ... }
@ -637,22 +547,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_THREAD_LOCAL __thread
#endif
// TODO: cleanup PROTOBUF_LITTLE_ENDIAN in various 3p forks.
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define PROTOBUF_LITTLE_ENDIAN 1
#ifdef PROTOBUF_BIG_ENDIAN
#error Conflicting PROTOBUF_BIG_ENDIAN was previously defined
#endif
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define PROTOBUF_BIG_ENDIAN 1
#elif defined(_WIN32) || defined(__x86_64__) || defined(__aarch64__)
#define PROTOBUF_LITTLE_ENDIAN 1
#else
#error "endian detection failed for current compiler"
#endif
#ifdef PROTOBUF_CONSTINIT
#error PROTOBUF_CONSTINIT was previously defined
#endif

@ -31,13 +31,9 @@
#undef PROTOBUF_NDEBUG_INLINE
#undef PROTOBUF_MUSTTAIL
#undef PROTOBUF_TAILCALL
#undef PROTOBUF_COLD
#undef PROTOBUF_NOINLINE
#undef PROTOBUF_SECTION_VARIABLE
#undef PROTOBUF_IGNORE_DEPRECATION_START
#undef PROTOBUF_IGNORE_DEPRECATION_STOP
#undef PROTOBUF_RETURNS_NONNULL
#undef PROTOBUF_ATTRIBUTE_REINITIALIZES
#undef PROTOBUF_RTTI
#undef PROTOBUF_VERSION
#undef PROTOBUF_VERSION_SUFFIX
@ -48,7 +44,6 @@
#undef PROTOBUF_MIN_PROTOC_VERSION
#undef PROTOBUF_PREDICT_TRUE
#undef PROTOBUF_PREDICT_FALSE
#undef PROTOBUF_FALLTHROUGH_INTENDED
#undef PROTOBUF_EXPORT
#undef PROTOC_EXPORT
#undef PROTOBUF_NODISCARD
@ -67,8 +62,6 @@
#undef PROTOBUF_ALIGNAS
#undef PROTOBUF_FINAL
#undef PROTOBUF_THREAD_LOCAL
#undef PROTOBUF_LITTLE_ENDIAN
#undef PROTOBUF_BIG_ENDIAN
#undef PROTOBUF_CONSTINIT
#undef PROTOBUF_CONSTEXPR
#undef PROTOBUF_CONSTINIT_DEFAULT_INSTANCES
@ -88,10 +81,6 @@
#undef PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION
#undef PROTOBUF_BUILTIN_CONSTANT_P
#undef PROTOBUF_TC_PARAM_DECL
#undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED
#undef PROTOBUF_LOCKS_EXCLUDED
#undef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
#undef PROTOBUF_GUARDED_BY
#undef PROTOBUF_DEBUG
#undef PROTO2_IS_OSS
#undef PROTOBUF_NO_THREADLOCAL

@ -204,13 +204,13 @@ class RepeatedField final
// Calling this routine inside a loop can cause quadratic behavior.
void ExtractSubrange(int start, int num, Element* elements);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
ABSL_ATTRIBUTE_REINITIALIZES void Clear();
void MergeFrom(const RepeatedField& other);
PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedField& other);
ABSL_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedField& other);
// Replaces the contents with RepeatedField(begin, end).
template <typename Iter>
PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
ABSL_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
// Reserves space to expand the field to at least the given size. If the
// array is grown, it will always be at least doubled in size.

@ -1097,13 +1097,13 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// Calling this routine inside a loop can cause quadratic behavior.
void DeleteSubrange(int start, int num);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
ABSL_ATTRIBUTE_REINITIALIZES void Clear();
void MergeFrom(const RepeatedPtrField& other);
PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);
ABSL_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);
// Replaces the contents with RepeatedPtrField(begin, end).
template <typename Iter>
PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
ABSL_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
// Reserves space to expand the field to at least the given size. This only
// resizes the pointer array; it doesn't allocate any objects. If the

@ -120,10 +120,6 @@ void DoNothing() {}
// ===================================================================
// emulates google3/util/endian/endian.h
//
// TODO: PROTOBUF_LITTLE_ENDIAN is unfortunately defined in
// google/protobuf/io/coded_stream.h and therefore can not be used here.
// Maybe move that macro definition here in the future.
uint32_t ghtonl(uint32_t x) {
union {
uint32_t result;

@ -21,42 +21,6 @@
// Must be last.
#include "google/protobuf/port_def.inc" // NOLINT
#undef PROTOBUF_LITTLE_ENDIAN
#ifdef _WIN32
// Assuming windows is always little-endian.
// TODO: The PROTOBUF_LITTLE_ENDIAN is not only used for
// optimization but also for correctness. We should define an
// different macro to test the big-endian code path in coded_stream.
#if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
#define PROTOBUF_LITTLE_ENDIAN 1
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
// If MSVC has "/RTCc" set, it will complain about truncating casts at
// runtime. This file contains some intentional truncating casts.
#pragma runtime_checks("c", off)
#endif
#else
#if (defined(__APPLE__) || defined(__NEWLIB__))
#include <machine/endian.h> // __BYTE_ORDER
#elif defined(__FreeBSD__)
#include <sys/endian.h> // __BYTE_ORDER
#elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
#include <sys/isa_defs.h> // __BYTE_ORDER
#elif defined(_AIX) || defined(__TOS_AIX__)
#include <sys/machine.h> // BYTE_ORDER
#elif defined(__QNX__)
#include <sys/param.h> // BYTE_ORDER
#else
#include <endian.h> // __BYTE_ORDER
#endif
#if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
(defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN)) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
#define PROTOBUF_LITTLE_ENDIAN 1
#endif
#endif
// These #includes are for the byte swap functions declared later on.
#ifdef _MSC_VER
#include <stdlib.h> // NOLINT(build/include)
@ -212,7 +176,7 @@ PROTOBUF_EXPORT uint32_t ghtonl(uint32_t x);
class BigEndian {
public:
#ifdef PROTOBUF_LITTLE_ENDIAN
#ifdef ABSL_IS_LITTLE_ENDIAN
static uint16_t FromHost16(uint16_t x) { return bswap_16(x); }
static uint16_t ToHost16(uint16_t x) { return bswap_16(x); }

@ -960,7 +960,7 @@ const char* WireFormat::_InternalParseAndMergeField(
case FieldDescriptor::TYPE_STRING:
utf8_check = true;
strict_utf8_check = field->requires_utf8_validation();
PROTOBUF_FALLTHROUGH_INTENDED;
ABSL_FALLTHROUGH_INTENDED;
case FieldDescriptor::TYPE_BYTES: {
int size = ReadSize(&ptr);
if (ptr == nullptr) return nullptr;

@ -303,7 +303,7 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns(
return true;
}
#if !defined(PROTOBUF_LITTLE_ENDIAN)
#if !defined(ABSL_IS_LITTLE_ENDIAN)
namespace {
void EncodeFixedSizeValue(float v, uint8_t* dest) {
@ -335,11 +335,11 @@ void EncodeFixedSizeValue(bool v, uint8_t* dest) {
}
} // anonymous namespace
#endif // !defined(PROTOBUF_LITTLE_ENDIAN)
#endif // !defined(ABSL_IS_LITTLE_ENDIAN)
template <typename CType>
static void WriteArray(const CType* a, int n, io::CodedOutputStream* output) {
#if defined(PROTOBUF_LITTLE_ENDIAN)
#if defined(ABSL_IS_LITTLE_ENDIAN)
output->WriteRaw(reinterpret_cast<const char*>(a), n * sizeof(a[0]));
#else
const int kAtATime = 128;

@ -1206,7 +1206,7 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
}
if (bytes_limit >= new_bytes) {
// Fast-path that pre-allocates *values to the final size.
#if defined(PROTOBUF_LITTLE_ENDIAN)
#if defined(ABSL_IS_LITTLE_ENDIAN)
values->Resize(old_entries + new_entries, 0);
// values->mutable_data() may change after Resize(), so do this after:
void* dest = reinterpret_cast<void*>(values->mutable_data() + old_entries);
@ -1476,7 +1476,7 @@ template <typename T>
inline uint8_t* WireFormatLite::WriteFixedNoTagToArray(
const RepeatedField<T>& value, uint8_t* (*Writer)(T, uint8_t*),
uint8_t* target) {
#if defined(PROTOBUF_LITTLE_ENDIAN)
#if defined(ABSL_IS_LITTLE_ENDIAN)
(void)Writer;
const int n = value.size();

Loading…
Cancel
Save