From f2effd8c67e486a94f76fbcdae22006b6dab3ed5 Mon Sep 17 00:00:00 2001 From: Yuriy Chernyshov Date: Fri, 16 Jul 2021 13:18:52 +0300 Subject: [PATCH 1/6] Fix some -Wunused-parameter warnings in cpp_helpers.h --- src/google/protobuf/compiler/cpp/cpp_helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 247c161ce5..8c07e47e8d 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -356,7 +356,7 @@ inline bool IsEagerlyVerifiedLazy(const FieldDescriptor* field, } inline bool IsFieldUsed(const FieldDescriptor* /* field */, - const Options& options) { + const Options& /* options */) { return true; } @@ -884,7 +884,7 @@ inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; } PROTOC_EXPORT std::string StripProto(const std::string& filename); -inline bool EnableMessageOwnedArena(const Descriptor* desc) { return false; } +inline bool EnableMessageOwnedArena(const Descriptor* /* desc */ ) { return false; } } // namespace cpp } // namespace compiler From c9baf39caaa3bcf0479cd04d62e1990401c44e34 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 20 Jul 2021 17:50:27 -0600 Subject: [PATCH 2/6] Add syntax highlighting for code blocks --- docs/field_presence.md | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/field_presence.md b/docs/field_presence.md index b208c95beb..7c0e7bf13b 100644 --- a/docs/field_presence.md +++ b/docs/field_presence.md @@ -66,7 +66,7 @@ Singular fields (of all types) track presence explicitly in the generated API. T Similar to singular fields, `oneof` fields explicitly track which one of the members, if any, contains a value. For example, consider this example `oneof`: -``` +```protobuf oneof foo { int32 a = 1; float b = 2; @@ -144,7 +144,7 @@ This change may or may not be safe, depending on the application's semantics. Fo Client A uses this definition of the message, which follows the _explicit presence_ serialization discipline for field `foo`: -``` +```protobuf syntax = "proto3"; message Msg { optional int32 foo = 1; @@ -153,7 +153,7 @@ message Msg { Client B uses a definition of the same message, except that it follows the _no presence_ discipline: -``` +```protobuf syntax = "proto3"; message Msg { int32 foo = 1; @@ -162,7 +162,7 @@ message Msg { Now, consider a scenario where client A observes `foo`'s presence as the clients repeatedly exchange the "same" message by deserializing and reserializing: -``` +```protobuf // Client A: Msg m_a; m_a.set_foo(1); // non-default value @@ -208,7 +208,7 @@ These are the general steps to use the experimental field tracking support for p This is an example of a proto3 message with fields which follow both _no presence_ and _explicit presence_ semantics: -``` +```protobuf syntax = "proto3"; package example; @@ -231,7 +231,7 @@ The generated code for proto3 fields with _explicit presence_ (the `optional` la This is the definition used in the "no presence" examples below: -``` +```protobuf syntax = "proto3"; package example; message Msg { @@ -241,7 +241,7 @@ message Msg { This is the definition used in the "explicit presence" examples below: -``` +```protobuf syntax = "proto3"; package example; message Msg { @@ -255,7 +255,7 @@ In the examples, a function `GetProto` constructs and returns a message of type No presence: -``` +```C++ Msg m = GetProto(); if (m.foo() != 0) { // "Clear" the field: @@ -268,7 +268,7 @@ if (m.foo() != 0) { Explicit presence: -``` +```C++ Msg m = GetProto(); if (m.has_foo()) { // Clear the field: @@ -283,7 +283,7 @@ if (m.has_foo()) { No presence: -``` +```C# var m = GetProto(); if (m.Foo != 0) { // "Clear" the field: @@ -296,7 +296,7 @@ if (m.Foo != 0) { Explicit presence: -``` +```C# var m = GetProto(); if (m.HasFoo) { // Clear the field: @@ -311,7 +311,7 @@ if (m.HasFoo) { No presence: -``` +```go m := GetProto() if m.Foo != 0 { // "Clear" the field: @@ -324,7 +324,7 @@ if m.Foo != 0 { Explicit presence: -``` +```go m := GetProto() if m.Foo != nil { // Clear the field: @@ -341,7 +341,7 @@ These examples use a `Builder` to demonstrate clearing. Simply checking presence No presence: -``` +```java Msg.Builder m = GetProto().toBuilder(); if (m.getFoo() != 0) { // "Clear" the field: @@ -354,7 +354,7 @@ if (m.getFoo() != 0) { Explicit presence: -``` +```java Msg.Builder m = GetProto().toBuilder(); if (m.hasFoo()) { // Clear the field: @@ -369,7 +369,7 @@ if (m.hasFoo()) { No presence: -``` +```python m = example.Msg() if m.foo != 0: // "Clear" the field: @@ -381,7 +381,7 @@ else: Explicit presence: -``` +```python m = example.Msg() if m.HasField('foo'): // Clear the field: @@ -395,7 +395,7 @@ else: No presence: -``` +```ruby m = Msg.new if m.foo != 0 // "Clear" the field: @@ -408,7 +408,7 @@ end Explicit presence: -``` +```ruby m = Msg.new if m.has_foo? // Clear the field: @@ -423,7 +423,7 @@ end No presence: -``` +```js var m = new Msg(); if (m.getFoo() != 0) { // "Clear" the field: @@ -436,7 +436,7 @@ if (m.getFoo() != 0) { Explicit presence: -``` +```js var m = new Msg(); if (m.hasFoo()) { // Clear the field: @@ -451,7 +451,7 @@ if (m.hasFoo()) { No presence: -``` +```Objective-C Msg *m = [[Msg alloc] init]; if (m.foo != 0) { // "Clear" the field: @@ -464,7 +464,7 @@ if (m.foo != 0) { Explicit presence: -``` +```Objective-C Msg *m = [[Msg alloc] init]; if (m.hasFoo()) { // Clear the field: From 6e0a456c7741818b3c1fffe52aa1c828ea4f5634 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 20 Jul 2021 17:58:29 -0600 Subject: [PATCH 3/6] Fix comment syntax for Ruby and Python --- docs/field_presence.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/field_presence.md b/docs/field_presence.md index 7c0e7bf13b..a82f93363e 100644 --- a/docs/field_presence.md +++ b/docs/field_presence.md @@ -372,10 +372,10 @@ No presence: ```python m = example.Msg() if m.foo != 0: - // "Clear" the field: + # "Clear" the field: m.foo = 0 else: - // Default value: field may not have been present. + # Default value: field may not have been present. m.foo = 1 ``` @@ -384,10 +384,10 @@ Explicit presence: ```python m = example.Msg() if m.HasField('foo'): - // Clear the field: + # Clear the field: m.ClearField('foo') else: - // Field is not present, so set it. + # Field is not present, so set it. m.foo = 1 ``` @@ -398,10 +398,10 @@ No presence: ```ruby m = Msg.new if m.foo != 0 - // "Clear" the field: + # "Clear" the field: m.foo = 0 else - // Default value: field may not have been present. + # Default value: field may not have been present. m.foo = 1 end ``` @@ -411,10 +411,10 @@ Explicit presence: ```ruby m = Msg.new if m.has_foo? - // Clear the field: + # Clear the field: m.clear_foo else - // Field is not present, so set it. + # Field is not present, so set it. m.foo = 1 end ``` From 18b1b21aba12bec96a59244a9b53b9f8bfd62a2a Mon Sep 17 00:00:00 2001 From: Andrew Parmet Date: Mon, 26 Jul 2021 14:11:02 -0400 Subject: [PATCH 4/6] update protokt options reference (#8834) --- docs/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index 61851f2b50..d78406a001 100644 --- a/docs/options.md +++ b/docs/options.md @@ -206,7 +206,7 @@ with info about your project (name and website) so we can add an entry for you. * Extensions: 1071 1. protokt - * Website: https://github.com/toasttab/protokt (Currently Private but will be open soon.) + * Website: https://github.com/open-toast/protokt * Extensions: 1072 1. Dart port of protocol buffers From 7326b571d27269afced05e8fe2fa604dcece6182 Mon Sep 17 00:00:00 2001 From: Yuriy Chernyshov Date: Fri, 30 Jul 2021 00:05:00 +0300 Subject: [PATCH 5/6] Fix undefined symbol error around SharedCtor() (#8827) * Fix undefined symbol error around SharedCtor() Apparently, #8532 was incorrect if applied to 3.17.x branch. 3.17.x changed code generation to mark `SharedCtor()` and `SharedDtor()` as inline in .pb.cc. It looks like we have a compile-time undefined behavior in C++ now. As cppreference.com [says](https://en.cppreference.com/w/cpp/language/inline): _The definition of an inline function <...> must be reachable in the translation unit where it is accessed (not necessarily before the point of access)._ As protobuf allows custom plugins to generate custom code, there is no limitation on where SharedCtor couble be possible referenced from. In our case we have SharedCtor invoked from corresponding `.pb.h` code, thus triggering: ``` ld: error: undefined symbol: package::Message::SharedCtor()` >>> referenced by file.pb.h:$$$$ ``` If this patch is not applicable, I can take a look into changing the code generation, but doing this will be harder then removing _inline_. * Regenerate checked-in generated .pb.cc files --- src/google/protobuf/any.pb.cc | 2 +- src/google/protobuf/any.pb.h | 4 +- src/google/protobuf/api.pb.cc | 6 +-- .../protobuf/compiler/cpp/cpp_message.cc | 2 +- src/google/protobuf/compiler/plugin.pb.cc | 8 +-- src/google/protobuf/descriptor.pb.cc | 54 +++++++++---------- src/google/protobuf/duration.pb.cc | 2 +- src/google/protobuf/empty.pb.cc | 2 +- src/google/protobuf/field_mask.pb.cc | 2 +- src/google/protobuf/source_context.pb.cc | 2 +- src/google/protobuf/struct.pb.cc | 6 +-- src/google/protobuf/timestamp.pb.cc | 2 +- src/google/protobuf/type.pb.cc | 10 ++-- src/google/protobuf/wrappers.pb.cc | 18 +++---- 14 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index c6dff7b1f3..e371a67350 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -123,7 +123,7 @@ Any::Any(const Any& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) } -inline void Any::SharedCtor() { +void Any::SharedCtor() { type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index b4ab93c1db..158da761ab 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -129,12 +129,12 @@ class PROTOBUF_EXPORT Any final : const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field); template ::value>::type> bool PackFrom(const T& message) { - return _any_metadata_.PackFrom(message); + return _any_metadata_.PackFrom(GetArena(), message); } template ::value>::type> bool PackFrom(const T& message, ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { - return _any_metadata_.PackFrom(message, type_url_prefix);} + return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);} template ::value>::type> bool UnpackTo(T* message) const { return _any_metadata_.UnpackTo(message); diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 310ea2b199..b2e14d1836 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -215,7 +215,7 @@ Api::Api(const Api& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) } -inline void Api::SharedCtor() { +void Api::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( @@ -625,7 +625,7 @@ Method::Method(const Method& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } -inline void Method::SharedCtor() { +void Method::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -1013,7 +1013,7 @@ Mixin::Mixin(const Mixin& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin) } -inline void Mixin::SharedCtor() { +void Mixin::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 79ed8aaa27..ff8b30834e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -2381,7 +2381,7 @@ std::pair MessageGenerator::GenerateOffsets( void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { Formatter format(printer, variables_); - format("inline void $classname$::SharedCtor() {\n"); + format("void $classname$::SharedCtor() {\n"); std::vector processed(optimized_order_.size(), false); GenerateConstructorBody(printer, processed, false); diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index fec62ed7ad..f66f854fe9 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -254,7 +254,7 @@ Version::Version(const Version& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) } -inline void Version::SharedCtor() { +void Version::SharedCtor() { suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&major_) - reinterpret_cast(this)), @@ -583,7 +583,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) } -inline void CodeGeneratorRequest::SharedCtor() { +void CodeGeneratorRequest::SharedCtor() { parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); compiler_version_ = nullptr; } @@ -939,7 +939,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) } -inline void CodeGeneratorResponse_File::SharedCtor() { +void CodeGeneratorResponse_File::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -1282,7 +1282,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) } -inline void CodeGeneratorResponse::SharedCtor() { +void CodeGeneratorResponse::SharedCtor() { error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); supported_features_ = uint64_t{0u}; } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 86df8966c5..2e91b7c1ab 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1255,7 +1255,7 @@ FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet) } -inline void FileDescriptorSet::SharedCtor() { +void FileDescriptorSet::SharedCtor() { } FileDescriptorSet::~FileDescriptorSet() { @@ -1510,7 +1510,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto) } -inline void FileDescriptorProto::SharedCtor() { +void FileDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -2129,7 +2129,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange) } -inline void DescriptorProto_ExtensionRange::SharedCtor() { +void DescriptorProto_ExtensionRange::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&options_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&end_) - @@ -2407,7 +2407,7 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange) } -inline void DescriptorProto_ReservedRange::SharedCtor() { +void DescriptorProto_ReservedRange::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&start_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&end_) - @@ -2680,7 +2680,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto) } -inline void DescriptorProto::SharedCtor() { +void DescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); options_ = nullptr; } @@ -3185,7 +3185,7 @@ ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions) } -inline void ExtensionRangeOptions::SharedCtor() { +void ExtensionRangeOptions::SharedCtor() { } ExtensionRangeOptions::~ExtensionRangeOptions() { @@ -3466,7 +3466,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto) } -inline void FieldDescriptorProto::SharedCtor() { +void FieldDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -4055,7 +4055,7 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto) } -inline void OneofDescriptorProto::SharedCtor() { +void OneofDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); options_ = nullptr; } @@ -4314,7 +4314,7 @@ EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(con // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -inline void EnumDescriptorProto_EnumReservedRange::SharedCtor() { +void EnumDescriptorProto_EnumReservedRange::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&start_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&end_) - @@ -4577,7 +4577,7 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto) } -inline void EnumDescriptorProto::SharedCtor() { +void EnumDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); options_ = nullptr; } @@ -4950,7 +4950,7 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto) } -inline void EnumValueDescriptorProto::SharedCtor() { +void EnumValueDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&options_) - reinterpret_cast(this)), @@ -5257,7 +5257,7 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto) } -inline void ServiceDescriptorProto::SharedCtor() { +void ServiceDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); options_ = nullptr; } @@ -5584,7 +5584,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto) } -inline void MethodDescriptorProto::SharedCtor() { +void MethodDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -6089,7 +6089,7 @@ FileOptions::FileOptions(const FileOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions) } -inline void FileOptions::SharedCtor() { +void FileOptions::SharedCtor() { java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -7006,7 +7006,7 @@ MessageOptions::MessageOptions(const MessageOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions) } -inline void MessageOptions::SharedCtor() { +void MessageOptions::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&message_set_wire_format_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&map_entry_) - @@ -7354,7 +7354,7 @@ FieldOptions::FieldOptions(const FieldOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } -inline void FieldOptions::SharedCtor() { +void FieldOptions::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&ctype_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&jstype_) - @@ -7738,7 +7738,7 @@ OneofOptions::OneofOptions(const OneofOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions) } -inline void OneofOptions::SharedCtor() { +void OneofOptions::SharedCtor() { } OneofOptions::~OneofOptions() { @@ -7961,7 +7961,7 @@ EnumOptions::EnumOptions(const EnumOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } -inline void EnumOptions::SharedCtor() { +void EnumOptions::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&allow_alias_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&deprecated_) - @@ -8248,7 +8248,7 @@ EnumValueOptions::EnumValueOptions(const EnumValueOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions) } -inline void EnumValueOptions::SharedCtor() { +void EnumValueOptions::SharedCtor() { deprecated_ = false; } @@ -8497,7 +8497,7 @@ ServiceOptions::ServiceOptions(const ServiceOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions) } -inline void ServiceOptions::SharedCtor() { +void ServiceOptions::SharedCtor() { deprecated_ = false; } @@ -8751,7 +8751,7 @@ MethodOptions::MethodOptions(const MethodOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions) } -inline void MethodOptions::SharedCtor() { +void MethodOptions::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&deprecated_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&idempotency_level_) - @@ -9054,7 +9054,7 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart) } -inline void UninterpretedOption_NamePart::SharedCtor() { +void UninterpretedOption_NamePart::SharedCtor() { name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); is_extension_ = false; } @@ -9347,7 +9347,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption) } -inline void UninterpretedOption::SharedCtor() { +void UninterpretedOption::SharedCtor() { identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -9776,7 +9776,7 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location) } -inline void SourceCodeInfo_Location::SharedCtor() { +void SourceCodeInfo_Location::SharedCtor() { leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } @@ -10143,7 +10143,7 @@ SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo) } -inline void SourceCodeInfo::SharedCtor() { +void SourceCodeInfo::SharedCtor() { } SourceCodeInfo::~SourceCodeInfo() { @@ -10352,7 +10352,7 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) } -inline void GeneratedCodeInfo_Annotation::SharedCtor() { +void GeneratedCodeInfo_Annotation::SharedCtor() { source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&begin_) - reinterpret_cast(this)), @@ -10666,7 +10666,7 @@ GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo) } -inline void GeneratedCodeInfo::SharedCtor() { +void GeneratedCodeInfo::SharedCtor() { } GeneratedCodeInfo::~GeneratedCodeInfo() { diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index 13fc338475..2f02356645 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -99,7 +99,7 @@ Duration::Duration(const Duration& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) } -inline void Duration::SharedCtor() { +void Duration::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&seconds_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&nanos_) - diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index c86ecc1b4e..96ee74a8e2 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -91,7 +91,7 @@ Empty::Empty(const Empty& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Empty) } -inline void Empty::SharedCtor() { +void Empty::SharedCtor() { } Empty::~Empty() { diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index a76cff2693..d073936d83 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -96,7 +96,7 @@ FieldMask::FieldMask(const FieldMask& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask) } -inline void FieldMask::SharedCtor() { +void FieldMask::SharedCtor() { } FieldMask::~FieldMask() { diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 3425dd48bd..1181ba87a5 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -99,7 +99,7 @@ SourceContext::SourceContext(const SourceContext& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext) } -inline void SourceContext::SharedCtor() { +void SourceContext::SharedCtor() { file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 61a93a617e..a561d2b48c 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -201,7 +201,7 @@ Struct::Struct(const Struct& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct) } -inline void Struct::SharedCtor() { +void Struct::SharedCtor() { } Struct::~Struct() { @@ -499,7 +499,7 @@ Value::Value(const Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Value) } -inline void Value::SharedCtor() { +void Value::SharedCtor() { clear_has_kind(); } @@ -866,7 +866,7 @@ ListValue::ListValue(const ListValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue) } -inline void ListValue::SharedCtor() { +void ListValue::SharedCtor() { } ListValue::~ListValue() { diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index f87380c292..c74a97372f 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -99,7 +99,7 @@ Timestamp::Timestamp(const Timestamp& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) } -inline void Timestamp::SharedCtor() { +void Timestamp::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&seconds_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&nanos_) - diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 06d8d7db48..1de2532e3b 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -380,7 +380,7 @@ Type::Type(const Type& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Type) } -inline void Type::SharedCtor() { +void Type::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&source_context_) - reinterpret_cast(this)), @@ -760,7 +760,7 @@ Field::Field(const Field& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) } -inline void Field::SharedCtor() { +void Field::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); @@ -1250,7 +1250,7 @@ Enum::Enum(const Enum& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Enum) } -inline void Enum::SharedCtor() { +void Enum::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&source_context_) - reinterpret_cast(this)), @@ -1578,7 +1578,7 @@ EnumValue::EnumValue(const EnumValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue) } -inline void EnumValue::SharedCtor() { +void EnumValue::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); number_ = 0; } @@ -1850,7 +1850,7 @@ Option::Option(const Option& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Option) } -inline void Option::SharedCtor() { +void Option::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); value_ = nullptr; } diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 998758121d..128ddfc409 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -261,7 +261,7 @@ DoubleValue::DoubleValue(const DoubleValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue) } -inline void DoubleValue::SharedCtor() { +void DoubleValue::SharedCtor() { value_ = 0; } @@ -444,7 +444,7 @@ FloatValue::FloatValue(const FloatValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue) } -inline void FloatValue::SharedCtor() { +void FloatValue::SharedCtor() { value_ = 0; } @@ -627,7 +627,7 @@ Int64Value::Int64Value(const Int64Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value) } -inline void Int64Value::SharedCtor() { +void Int64Value::SharedCtor() { value_ = int64_t{0}; } @@ -812,7 +812,7 @@ UInt64Value::UInt64Value(const UInt64Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value) } -inline void UInt64Value::SharedCtor() { +void UInt64Value::SharedCtor() { value_ = uint64_t{0u}; } @@ -997,7 +997,7 @@ Int32Value::Int32Value(const Int32Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value) } -inline void Int32Value::SharedCtor() { +void Int32Value::SharedCtor() { value_ = 0; } @@ -1182,7 +1182,7 @@ UInt32Value::UInt32Value(const UInt32Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value) } -inline void UInt32Value::SharedCtor() { +void UInt32Value::SharedCtor() { value_ = 0u; } @@ -1367,7 +1367,7 @@ BoolValue::BoolValue(const BoolValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue) } -inline void BoolValue::SharedCtor() { +void BoolValue::SharedCtor() { value_ = false; } @@ -1554,7 +1554,7 @@ StringValue::StringValue(const StringValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue) } -inline void StringValue::SharedCtor() { +void StringValue::SharedCtor() { value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } @@ -1754,7 +1754,7 @@ BytesValue::BytesValue(const BytesValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue) } -inline void BytesValue::SharedCtor() { +void BytesValue::SharedCtor() { value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } From 914c6fe101fdd0c709c294df1b1c77b9d5109dd4 Mon Sep 17 00:00:00 2001 From: xidang Date: Sat, 31 Jul 2021 00:04:40 +0800 Subject: [PATCH 6/6] Fix #8748 tests.exe link failure under mingw/mingw64 (#8751) --- src/google/protobuf/map_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc index 1414fc34f4..d8067f7fdf 100644 --- a/src/google/protobuf/map_test.cc +++ b/src/google/protobuf/map_test.cc @@ -30,7 +30,7 @@ // A hack to include windows.h first, which ensures the GetMessage macro can // be undefined when we include -#if defined(_WIN32) +#if defined(_MSC_VER) #define _WINSOCKAPI_ // to avoid re-definition in WinSock2.h #define NOMINMAX // to avoid defining min/max macros #include