From 03d8e5dcdec015e712bc3c1ef25be7517f5b4c78 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 6 May 2024 10:08:17 -0400 Subject: [PATCH 1/2] Update the proto files from upstream. Using upstream 51cba7ce170cf5ed88cc408ff7aa4b35aa0dd3b5. --- .../test_messages_edition2023.proto | 7 +++++++ .../test_messages_edition2023.proto | 7 +++++++ .../upstream/google/protobuf/unittest.proto | 1 + .../protobuf/unittest_custom_options.proto | 20 +++++++++++++++++++ .../google/protobuf/unittest_proto3.proto | 3 ++- .../protobuf/unittest_proto3_arena.proto | 1 + 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Protos/Conformance/conformance/test_protos/test_messages_edition2023.proto b/Protos/Conformance/conformance/test_protos/test_messages_edition2023.proto index 7688c4732..a6e2bcc86 100644 --- a/Protos/Conformance/conformance/test_protos/test_messages_edition2023.proto +++ b/Protos/Conformance/conformance/test_protos/test_messages_edition2023.proto @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + edition = "2023"; package protobuf_test_messages.editions; diff --git a/Protos/upstream/conformance/test_protos/test_messages_edition2023.proto b/Protos/upstream/conformance/test_protos/test_messages_edition2023.proto index 7688c4732..a6e2bcc86 100644 --- a/Protos/upstream/conformance/test_protos/test_messages_edition2023.proto +++ b/Protos/upstream/conformance/test_protos/test_messages_edition2023.proto @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + edition = "2023"; package protobuf_test_messages.editions; diff --git a/Protos/upstream/google/protobuf/unittest.proto b/Protos/upstream/google/protobuf/unittest.proto index 434325f4d..3d9dc3a77 100644 --- a/Protos/upstream/google/protobuf/unittest.proto +++ b/Protos/upstream/google/protobuf/unittest.proto @@ -198,6 +198,7 @@ enum ForeignEnum { FOREIGN_BAR = 5; FOREIGN_BAZ = 6; FOREIGN_BAX = 32; // (1 << 32) to generate a 64b bitmask would be incorrect. + FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. } message TestReservedFields { diff --git a/Protos/upstream/google/protobuf/unittest_custom_options.proto b/Protos/upstream/google/protobuf/unittest_custom_options.proto index ca6bec7a6..707501277 100644 --- a/Protos/upstream/google/protobuf/unittest_custom_options.proto +++ b/Protos/upstream/google/protobuf/unittest_custom_options.proto @@ -191,6 +191,26 @@ message SettingRealsFromNegativeInts { option (double_opt) = -154; } +message SettingRealsFromInf { + option (float_opt) = inf; + option (double_opt) = inf; +} + +message SettingRealsFromNegativeInf { + option (float_opt) = -inf; + option (double_opt) = -inf; +} + +message SettingRealsFromNan { + option (float_opt) = nan; + option (double_opt) = nan; +} + +message SettingRealsFromNegativeNan { + option (float_opt) = -nan; + option (double_opt) = -nan; +} + // Options of complex message types, themselves combined and extended in // various ways. diff --git a/Protos/upstream/google/protobuf/unittest_proto3.proto b/Protos/upstream/google/protobuf/unittest_proto3.proto index 1c0f65bc9..9067728ae 100644 --- a/Protos/upstream/google/protobuf/unittest_proto3.proto +++ b/Protos/upstream/google/protobuf/unittest_proto3.proto @@ -114,7 +114,7 @@ message TestAllTypes { repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; repeated string repeated_cord = 55 [ctype = CORD]; - repeated NestedMessage repeated_lazy_message = 57 ; + repeated NestedMessage repeated_lazy_message = 57; oneof oneof_field { uint32 oneof_uint32 = 111; @@ -178,6 +178,7 @@ enum ForeignEnum { FOREIGN_FOO = 4; FOREIGN_BAR = 5; FOREIGN_BAZ = 6; + FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. } // TestEmptyMessage is used to test behavior of unknown fields. diff --git a/Protos/upstream/google/protobuf/unittest_proto3_arena.proto b/Protos/upstream/google/protobuf/unittest_proto3_arena.proto index 032ce6ff6..96a9ea85e 100644 --- a/Protos/upstream/google/protobuf/unittest_proto3_arena.proto +++ b/Protos/upstream/google/protobuf/unittest_proto3_arena.proto @@ -197,6 +197,7 @@ enum ForeignEnum { FOREIGN_FOO = 4; FOREIGN_BAR = 5; FOREIGN_BAZ = 6; + FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. } // TestEmptyMessage is used to test behavior of unknown fields. From eba4849d08a197c67fc2dbc13eb12157dc783ee2 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 6 May 2024 10:10:03 -0400 Subject: [PATCH 2/2] Regenerate --- .../test_messages_edition2023.pb.swift | 7 ++ .../test_messages_edition2023.pb.swift | 7 ++ .../google/protobuf/unittest.pb.swift | 6 + .../protobuf/unittest_custom_options.pb.swift | 116 ++++++++++++++++++ .../google/protobuf/unittest_proto3.pb.swift | 7 ++ .../protobuf/unittest_proto3_arena.pb.swift | 7 ++ .../test_messages_edition2023.pb.swift | 7 ++ 7 files changed, 157 insertions(+) diff --git a/Reference/Conformance/conformance/test_protos/test_messages_edition2023.pb.swift b/Reference/Conformance/conformance/test_protos/test_messages_edition2023.pb.swift index 9bd6abe3c..926edacd2 100644 --- a/Reference/Conformance/conformance/test_protos/test_messages_edition2023.pb.swift +++ b/Reference/Conformance/conformance/test_protos/test_messages_edition2023.pb.swift @@ -7,6 +7,13 @@ // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + import Foundation import SwiftProtobuf diff --git a/Reference/upstream/conformance/test_protos/test_messages_edition2023.pb.swift b/Reference/upstream/conformance/test_protos/test_messages_edition2023.pb.swift index 9bd6abe3c..926edacd2 100644 --- a/Reference/upstream/conformance/test_protos/test_messages_edition2023.pb.swift +++ b/Reference/upstream/conformance/test_protos/test_messages_edition2023.pb.swift @@ -7,6 +7,13 @@ // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + import Foundation import SwiftProtobuf diff --git a/Reference/upstream/google/protobuf/unittest.pb.swift b/Reference/upstream/google/protobuf/unittest.pb.swift index abd61d93f..3f7c03c59 100644 --- a/Reference/upstream/google/protobuf/unittest.pb.swift +++ b/Reference/upstream/google/protobuf/unittest.pb.swift @@ -44,6 +44,9 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { /// (1 << 32) to generate a 64b bitmask would be incorrect. case foreignBax // = 32 + /// Large enough to escape the Boxed Integer cache. + case foreignLarge // = 123456 + init() { self = .foreignFoo } @@ -54,6 +57,7 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case 5: self = .foreignBar case 6: self = .foreignBaz case 32: self = .foreignBax + case 123456: self = .foreignLarge default: return nil } } @@ -64,6 +68,7 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case .foreignBar: return 5 case .foreignBaz: return 6 case .foreignBax: return 32 + case .foreignLarge: return 123456 } } @@ -10527,6 +10532,7 @@ extension ProtobufUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding { 5: .same(proto: "FOREIGN_BAR"), 6: .same(proto: "FOREIGN_BAZ"), 32: .same(proto: "FOREIGN_BAX"), + 123456: .same(proto: "FOREIGN_LARGE"), ] } diff --git a/Reference/upstream/google/protobuf/unittest_custom_options.pb.swift b/Reference/upstream/google/protobuf/unittest_custom_options.pb.swift index d887d3225..25ec2eb99 100644 --- a/Reference/upstream/google/protobuf/unittest_custom_options.pb.swift +++ b/Reference/upstream/google/protobuf/unittest_custom_options.pb.swift @@ -286,6 +286,46 @@ struct ProtobufUnittest_SettingRealsFromNegativeInts: Sendable { init() {} } +struct ProtobufUnittest_SettingRealsFromInf: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct ProtobufUnittest_SettingRealsFromNegativeInf: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct ProtobufUnittest_SettingRealsFromNan: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct ProtobufUnittest_SettingRealsFromNegativeNan: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + struct ProtobufUnittest_ComplexOptionType1: SwiftProtobuf.ExtensibleMessage, Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -2101,6 +2141,82 @@ extension ProtobufUnittest_SettingRealsFromNegativeInts: SwiftProtobuf.Message, } } +extension ProtobufUnittest_SettingRealsFromInf: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettingRealsFromInf" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ProtobufUnittest_SettingRealsFromInf, rhs: ProtobufUnittest_SettingRealsFromInf) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension ProtobufUnittest_SettingRealsFromNegativeInf: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNegativeInf" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ProtobufUnittest_SettingRealsFromNegativeInf, rhs: ProtobufUnittest_SettingRealsFromNegativeInf) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension ProtobufUnittest_SettingRealsFromNan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNan" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ProtobufUnittest_SettingRealsFromNan, rhs: ProtobufUnittest_SettingRealsFromNan) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension ProtobufUnittest_SettingRealsFromNegativeNan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNegativeNan" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ProtobufUnittest_SettingRealsFromNegativeNan, rhs: ProtobufUnittest_SettingRealsFromNegativeNan) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension ProtobufUnittest_ComplexOptionType1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ComplexOptionType1" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Reference/upstream/google/protobuf/unittest_proto3.pb.swift b/Reference/upstream/google/protobuf/unittest_proto3.pb.swift index f981b4013..92f0e7ee3 100644 --- a/Reference/upstream/google/protobuf/unittest_proto3.pb.swift +++ b/Reference/upstream/google/protobuf/unittest_proto3.pb.swift @@ -33,6 +33,9 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case foreignFoo // = 4 case foreignBar // = 5 case foreignBaz // = 6 + + /// Large enough to escape the Boxed Integer cache. + case foreignLarge // = 123456 case UNRECOGNIZED(Int) init() { @@ -45,6 +48,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case 4: self = .foreignFoo case 5: self = .foreignBar case 6: self = .foreignBaz + case 123456: self = .foreignLarge default: self = .UNRECOGNIZED(rawValue) } } @@ -55,6 +59,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case .foreignFoo: return 4 case .foreignBar: return 5 case .foreignBaz: return 6 + case .foreignLarge: return 123456 case .UNRECOGNIZED(let i): return i } } @@ -65,6 +70,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { .foreignFoo, .foreignBar, .foreignBaz, + .foreignLarge, ] } @@ -694,6 +700,7 @@ extension Proto3Unittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding { 4: .same(proto: "FOREIGN_FOO"), 5: .same(proto: "FOREIGN_BAR"), 6: .same(proto: "FOREIGN_BAZ"), + 123456: .same(proto: "FOREIGN_LARGE"), ] } diff --git a/Reference/upstream/google/protobuf/unittest_proto3_arena.pb.swift b/Reference/upstream/google/protobuf/unittest_proto3_arena.pb.swift index 395c26083..cb86e0c08 100644 --- a/Reference/upstream/google/protobuf/unittest_proto3_arena.pb.swift +++ b/Reference/upstream/google/protobuf/unittest_proto3_arena.pb.swift @@ -33,6 +33,9 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case foreignFoo // = 4 case foreignBar // = 5 case foreignBaz // = 6 + + /// Large enough to escape the Boxed Integer cache. + case foreignLarge // = 123456 case UNRECOGNIZED(Int) init() { @@ -45,6 +48,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case 4: self = .foreignFoo case 5: self = .foreignBar case 6: self = .foreignBaz + case 123456: self = .foreignLarge default: self = .UNRECOGNIZED(rawValue) } } @@ -55,6 +59,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { case .foreignFoo: return 4 case .foreignBar: return 5 case .foreignBaz: return 6 + case .foreignLarge: return 123456 case .UNRECOGNIZED(let i): return i } } @@ -65,6 +70,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable { .foreignFoo, .foreignBar, .foreignBaz, + .foreignLarge, ] } @@ -795,6 +801,7 @@ extension Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding { 4: .same(proto: "FOREIGN_FOO"), 5: .same(proto: "FOREIGN_BAR"), 6: .same(proto: "FOREIGN_BAZ"), + 123456: .same(proto: "FOREIGN_LARGE"), ] } diff --git a/Sources/Conformance/test_messages_edition2023.pb.swift b/Sources/Conformance/test_messages_edition2023.pb.swift index 9bd6abe3c..926edacd2 100644 --- a/Sources/Conformance/test_messages_edition2023.pb.swift +++ b/Sources/Conformance/test_messages_edition2023.pb.swift @@ -7,6 +7,13 @@ // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + import Foundation import SwiftProtobuf