From cd0efc0024482be745e1671461518bac07335ca1 Mon Sep 17 00:00:00 2001 From: "Mario J. Rugiero" Date: Fri, 5 May 2017 13:52:58 -0300 Subject: Workaround gcc < 4.5.0 bug See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=189 Signed-off-by: Mario J. Rugiero --- src/google/protobuf/metadata_lite.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/google') diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h index 840c02e8..64fde0c6 100644 --- a/src/google/protobuf/metadata_lite.h +++ b/src/google/protobuf/metadata_lite.h @@ -167,7 +167,8 @@ class InternalMetadataWithArenaLite InternalMetadataWithArenaLite() {} explicit InternalMetadataWithArenaLite(Arena* arena) - : InternalMetadataWithArenaBase(arena) {} + : InternalMetadataWithArenaBase(arena) {} void DoSwap(string* other) { mutable_unknown_fields()->swap(*other); -- cgit v1.2.3 From 3b227611d5c5b216fd323908b0c6c4af19777a52 Mon Sep 17 00:00:00 2001 From: Dennis Cappendijk Date: Mon, 22 May 2017 16:21:48 +0200 Subject: show help if protoc is called without any arguments, pre-empts -h and --help to show a useful message instead of just 'Missing input file.' --- src/google/protobuf/compiler/command_line_interface.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 7fcd0083..df03907d 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -1012,6 +1012,12 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { arguments.push_back(argv[i]); } + // if no arguments are given, show help + if(arguments.empty()) { + PrintHelpText(); + return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. + } + // Iterate through all arguments and parse them. for (int i = 0; i < arguments.size(); ++i) { string name, value; -- cgit v1.2.3 From 40da1ed572d60e9c7cc2fe1ca4175e30682f5a9d Mon Sep 17 00:00:00 2001 From: brian-peloton Date: Tue, 23 May 2017 16:22:57 -0700 Subject: Removing undefined behavior and compiler warnings (#1315) * Comment out unused arguments. These last few are all that's needed to compile with -Wunused-arguments. * Fix missing struct field initializer. With this fix, everything compiles with -Wmissing-field-initializers. * Add support for disabling unaligned memory accesses on x86 too. ubsan doesn't like these because they are technically undefined behavior, so -DGOOGLE_PROTOBUF_DONT_USE_UNALIGNED will disable them easily. * Avoid undefined integer overflow. ubsan catches all of these. --- src/google/protobuf/arena.h | 6 ++-- src/google/protobuf/compiler/parser.cc | 2 +- src/google/protobuf/io/tokenizer_unittest.cc | 2 +- src/google/protobuf/message.h | 6 ++-- src/google/protobuf/stubs/port.h | 10 ++++-- src/google/protobuf/util/message_differencer.h | 42 +++++++++++++------------- src/google/protobuf/wire_format_lite.h | 2 +- 7 files changed, 38 insertions(+), 32 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index b6a375ac..0ffc6004 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -829,13 +829,13 @@ class LIBPROTOBUF_EXPORT Arena { } template static void CreateInArenaStorageInternal( - T* ptr, Arena* arena, google::protobuf::internal::false_type) { + T* ptr, Arena* /* arena */, google::protobuf::internal::false_type) { new (ptr) T(); } template static void RegisterDestructorInternal( - T* ptr, Arena* arena, google::protobuf::internal::true_type) {} + T* /* ptr */, Arena* /* arena */, google::protobuf::internal::true_type) {} template static void RegisterDestructorInternal( T* ptr, Arena* arena, google::protobuf::internal::false_type) { @@ -870,7 +870,7 @@ class LIBPROTOBUF_EXPORT Arena { } template GOOGLE_ATTRIBUTE_ALWAYS_INLINE - static ::google::protobuf::Arena* GetArenaInternal(const T* value, ...) { + static ::google::protobuf::Arena* GetArenaInternal(const T* /* value */, ...) { return NULL; } diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 7a03d42b..1a409566 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -1373,7 +1373,7 @@ bool Parser::ParseOption(Message* options, value_location.AddPath( UninterpretedOption::kNegativeIntValueFieldNumber); uninterpreted_option->set_negative_int_value( - -static_cast(value)); + static_cast(-value)); } else { value_location.AddPath( UninterpretedOption::kPositiveIntValueFieldNumber); diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc index cadeb696..e55288e2 100644 --- a/src/google/protobuf/io/tokenizer_unittest.cc +++ b/src/google/protobuf/io/tokenizer_unittest.cc @@ -341,7 +341,7 @@ inline std::ostream& operator<<(std::ostream& out, MultiTokenCase kMultiTokenCases[] = { // Test empty input. { "", { - { Tokenizer::TYPE_END , "" , 0, 0 }, + { Tokenizer::TYPE_END , "" , 0, 0, 0 }, }}, // Test all token types at the same time. diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 68acb5b1..c155cbd6 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -753,7 +753,7 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(tmarek): Make virtual after all subclasses have been // updated. virtual void AddAllocatedMessage(Message* /* message */, - const FieldDescriptor* /*field */, + const FieldDescriptor* /* field */, Message* /* new_entry */) const {} @@ -961,7 +961,7 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(jieluo) - make the map APIs pure virtual after updating // all the subclasses. // Returns true if key is in map. Returns false if key is not in map field. - virtual bool ContainsMapKey(const Message& /* message*/, + virtual bool ContainsMapKey(const Message& /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; @@ -979,7 +979,7 @@ class LIBPROTOBUF_EXPORT Reflection { // Delete and returns true if key is in the map field. Returns false // otherwise. - virtual bool DeleteMapValue(Message* /* mesage */, + virtual bool DeleteMapValue(Message* /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 6ec5e001..0afd55d7 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -252,9 +252,15 @@ static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF); #define GOOGLE_GUARDED_BY(x) #define GOOGLE_ATTRIBUTE_COLD +#ifdef GOOGLE_PROTOBUF_DONT_USE_UNALIGNED +# define GOOGLE_PROTOBUF_USE_UNALIGNED 0 +#else // x86 and x86-64 can perform unaligned loads/stores directly. -#if defined(_M_X64) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(__i386__) +# define GOOGLE_PROTOBUF_USE_UNALIGNED defined(_M_X64) || \ + defined(__x86_64__) || defined(_M_IX86) || defined(__i386__) +#endif + +#if GOOGLE_PROTOBUF_USE_UNALIGNED #define GOOGLE_UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) #define GOOGLE_UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h index d99223cb..192266b6 100644 --- a/src/google/protobuf/util/message_differencer.h +++ b/src/google/protobuf/util/message_differencer.h @@ -241,18 +241,18 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // mutually exclusive. If a field has been both moved and modified, then // only ReportModified will be called. virtual void ReportMoved( - const Message& message1, - const Message& message2, - const std::vector& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector& /* field_path */) { } // Reports that two fields match. Useful for doing side-by-side diffs. // This function is mutually exclusive with ReportModified and ReportMoved. // Note that you must call set_report_matches(true) before calling Compare // to make use of this function. virtual void ReportMatched( - const Message& message1, - const Message& message2, - const std::vector& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector& /* field_path */) { } // Reports that two fields would have been compared, but the // comparison has been skipped because the field was marked as @@ -274,16 +274,16 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // the fields are equal or not (perhaps with a second call to // Compare()), if it cares. virtual void ReportIgnored( - const Message& message1, - const Message& message2, - const std::vector& field_path) { } + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector& /* field_path */) { } // Report that an unknown field is ignored. (see comment above). // Note this is a different function since the last SpecificField in field // path has a null field. This could break existing Reporter. virtual void ReportUnknownFieldIgnored( - const Message& message1, const Message& message2, - const std::vector& field_path) {} + const Message& /* message1 */, const Message& /* message2 */, + const std::vector& /* field_path */) {} private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Reporter); @@ -297,9 +297,9 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { virtual ~MapKeyComparator(); virtual bool IsMatch( - const Message& message1, - const Message& message2, - const std::vector& parent_fields) const { + const Message& /* message1 */, + const Message& /* message2 */, + const std::vector& /* parent_fields */) const { GOOGLE_CHECK(false) << "IsMatch() is not implemented."; return false; } @@ -321,18 +321,18 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { // Returns true if the field should be ignored. virtual bool IsIgnored( - const Message& message1, - const Message& message2, - const FieldDescriptor* field, - const std::vector& parent_fields) = 0; + const Message& /* message1 */, + const Message& /* message2 */, + const FieldDescriptor* /* field */, + const std::vector& /* parent_fields */) = 0; // Returns true if the unknown field should be ignored. // Note: This will be called for unknown fields as well in which case // field.field will be null. virtual bool IsUnknownFieldIgnored( - const Message& message1, const Message& message2, - const SpecificField& field, - const std::vector& parent_fields) { + const Message& /* message1 */, const Message& /* message2 */, + const SpecificField& /* field */, + const std::vector& /* parent_fields */) { return false; } }; diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 18b38eae..ce55f266 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -197,7 +197,7 @@ class LIBPROTOBUF_EXPORT WireFormatLite { // type-safe, though, so prefer it if possible. #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ static_cast( \ - ((FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ + (static_cast(FIELD_NUMBER) << ::google::protobuf::internal::WireFormatLite::kTagTypeBits) \ | (TYPE)) // These are the tags for the old MessageSet format, which was defined as: -- cgit v1.2.3 From aea4374393e34da4147965323319468a47c7f4a8 Mon Sep 17 00:00:00 2001 From: lundefugl Date: Wed, 24 May 2017 12:54:23 +0200 Subject: Issue 3112: Object class with fully qualified name --- src/google/protobuf/compiler/java/java_message_builder.cc | 6 +++--- src/google/protobuf/compiler/java/java_message_lite.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/java/java_message_builder.cc b/src/google/protobuf/compiler/java/java_message_builder.cc index f5643abc..56017171 100644 --- a/src/google/protobuf/compiler/java/java_message_builder.cc +++ b/src/google/protobuf/compiler/java/java_message_builder.cc @@ -472,7 +472,7 @@ GenerateCommonBuilderMethods(io::Printer* printer) { "}\n" "public Builder setField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " Object value) {\n" + " java.lang.Object value) {\n" " return (Builder) super.setField(field, value);\n" "}\n" "public Builder clearField(\n" @@ -485,12 +485,12 @@ GenerateCommonBuilderMethods(io::Printer* printer) { "}\n" "public Builder setRepeatedField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " int index, Object value) {\n" + " int index, java.lang.Object value) {\n" " return (Builder) super.setRepeatedField(field, index, value);\n" "}\n" "public Builder addRepeatedField(\n" " com.google.protobuf.Descriptors.FieldDescriptor field,\n" - " Object value) {\n" + " java.lang.Object value) {\n" " return (Builder) super.addRepeatedField(field, value);\n" "}\n"); diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc index 5007ecee..aad10bb1 100644 --- a/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/src/google/protobuf/compiler/java/java_message_lite.cc @@ -346,9 +346,9 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Print( "@java.lang.SuppressWarnings({\"unchecked\", \"fallthrough\"})\n" - "protected final Object dynamicMethod(\n" + "protected final java.lang.Object dynamicMethod(\n" " com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,\n" - " Object arg0, Object arg1) {\n" + " java.lang.Object arg0, java.lang.Object arg1) {\n" " switch (method) {\n" " case NEW_MUTABLE_INSTANCE: {\n" " return new $classname$();\n" -- cgit v1.2.3 From 4d5daf4ef97918176b892dbedce17b1d854ffe8e Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 29 May 2017 10:39:14 -0700 Subject: Adds fluent setters for PHP (#3130) --- php/tests/generated_class_test.php | 13 +++++++++++++ src/google/protobuf/compiler/php/php_generator.cc | 2 ++ 2 files changed, 15 insertions(+) (limited to 'src/google') diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index 21ee8490..b42397bb 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -877,4 +877,17 @@ class GeneratedClassTest extends TestBase $m = new \Foo\PBEmpty(); $m = new \PrefixEmpty(); } + + ######################################################### + # Test fluent setters. + ######################################################### + + public function testFluentSetters() + { + $m = (new TestMessage()) + ->setOptionalInt32(1) + ->setOptionalInt64(2); + $this->assertSame(1, $m->getOptionalInt32()); + $this->assertSame(2, $m->getOptionalInt64()); + } } diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index ea850c0f..54fafc40 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -530,6 +530,8 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "field_name", field->name()); } + printer->Print("\nreturn $this;\n"); + Outdent(printer); printer->Print( -- cgit v1.2.3 From 282fb9e68ec101b7b7616a45279427944afc3e6b Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 29 May 2017 15:30:47 -0700 Subject: Add ARRAY for reserved name (#3150) --- php/ext/google/protobuf/def.c | 4 ++-- php/src/Google/Protobuf/descriptor.php | 2 +- php/tests/generated_class_test.php | 5 +++-- php/tests/memory_leak_test.php | 1 + php/tests/proto/test.proto | 4 ++++ src/google/protobuf/compiler/php/php_generator.cc | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/google') diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 8e563a61..099ebd05 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -30,8 +30,8 @@ #include "protobuf.h" -const char* const kReservedNames[] = {"Empty"}; -const int kReservedNamesSize = 1; +const char* const kReservedNames[] = {"Empty", "ECHO", "ARRAY"}; +const int kReservedNamesSize = 3; // Forward declare. static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC); diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php index fb69eda0..35e4929b 100644 --- a/php/src/Google/Protobuf/descriptor.php +++ b/php/src/Google/Protobuf/descriptor.php @@ -236,7 +236,7 @@ function getClassNamePrefix( return $prefix; } - $reserved_words = array("Empty"); + $reserved_words = array("Empty", "ECHO", "ARRAY"); foreach ($reserved_words as $reserved_word) { if ($classname === $reserved_word) { if ($file_proto->getPackage() === "google.protobuf") { diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index b42397bb..be641b6e 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -876,6 +876,7 @@ class GeneratedClassTest extends TestBase $m = new \Foo\TestMessage_Empty(); $m = new \Foo\PBEmpty(); $m = new \PrefixEmpty(); + $m = new \Foo\PBARRAY(); } ######################################################### @@ -886,8 +887,8 @@ class GeneratedClassTest extends TestBase { $m = (new TestMessage()) ->setOptionalInt32(1) - ->setOptionalInt64(2); + ->setOptionalUInt32(2); $this->assertSame(1, $m->getOptionalInt32()); - $this->assertSame(2, $m->getOptionalInt64()); + $this->assertSame(2, $m->getOptionalUInt32()); } } diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 361982b5..5eac56f0 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -8,6 +8,7 @@ require_once('generated/NoNamespaceMessage_NestedEnum.php'); require_once('generated/PrefixEmpty.php'); require_once('generated/PrefixTestPrefix.php'); require_once('generated/Bar/TestInclude.php'); +require_once('generated/Foo/PBARRAY.php'); require_once('generated/Foo/PBEmpty.php'); require_once('generated/Foo/TestEnum.php'); require_once('generated/Foo/TestIncludePrefixMessage.php'); diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto index 39229254..583bf8e1 100644 --- a/php/tests/proto/test.proto +++ b/php/tests/proto/test.proto @@ -127,6 +127,10 @@ message Empty { int32 a = 1; } +message ARRAY { + int32 a = 1; +} + message TestPackedMessage { repeated int32 repeated_int32 = 90 [packed = true]; repeated int64 repeated_int64 = 91 [packed = true]; diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 54fafc40..cbddee9e 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -49,8 +49,8 @@ const std::string kDescriptorMetadataFile = "GPBMetadata/Google/Protobuf/Internal/Descriptor.php"; const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; -const char* const kReservedNames[] = {"Empty", "ECHO"}; -const int kReservedNamesSize = 2; +const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"}; +const int kReservedNamesSize = 3; namespace google { namespace protobuf { -- cgit v1.2.3 From d6470abef1ca76c40e6da3b4445b7c32f1d0e2e3 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Tue, 30 May 2017 11:18:23 -0700 Subject: not to use std::random_device for map.Seed(). (#3133) * not to use std::random_device for map.Seed(). * remove include random --- src/google/protobuf/map.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 18ee3652..e5a32c5c 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -47,9 +47,6 @@ #include #include #include -#if __cpp_exceptions && LANG_CXX11 -#include -#endif namespace google { namespace protobuf { @@ -922,16 +919,6 @@ class Map { // Return a randomish value. size_type Seed() const { - // random_device can throw, so avoid it unless we are compiling with - // exceptions enabled. -#if __cpp_exceptions && LANG_CXX11 - try { - std::random_device rd; - std::knuth_b knuth(rd()); - std::uniform_int_distribution u; - return u(knuth); - } catch (...) { } -#endif size_type s = static_cast(reinterpret_cast(this)); #if defined(__x86_64__) && defined(__GNUC__) uint32 hi, lo; -- cgit v1.2.3 From e9c15d601e1f424d4e2c2b004b00cd6efd394d3e Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Fri, 2 Jun 2017 13:45:57 -0700 Subject: Ensure that for Java, imports of .proto files with empty packages works This fixes a compiler bug that caused a Java syntax error when one .proto file would import another one with an empty package and java_package. This fixes issue #3114. --- .../protobuf/compiler/java/java_shared_code_generator.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/java/java_shared_code_generator.cc b/src/google/protobuf/compiler/java/java_shared_code_generator.cc index 7bd5ad7a..f73bfb04 100644 --- a/src/google/protobuf/compiler/java/java_shared_code_generator.cc +++ b/src/google/protobuf/compiler/java/java_shared_code_generator.cc @@ -182,10 +182,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) { std::vector > dependencies; for (int i = 0; i < file_->dependency_count(); i++) { string filename = file_->dependency(i)->name(); - string classname = FileJavaPackage(file_->dependency(i)) + "." + - name_resolver_->GetDescriptorClassName( - file_->dependency(i)); - dependencies.push_back(std::make_pair(filename, classname)); + string package = FileJavaPackage(file_->dependency(i)); + string classname = name_resolver_->GetDescriptorClassName( + file_->dependency(i)); + string full_name; + if (package.empty()) { + full_name = classname; + } else { + full_name = package + "." + classname; + } + dependencies.push_back(std::make_pair(filename, full_name)); } // ----------------------------------------------------------------- -- cgit v1.2.3 From 6f325805c0bc956f927b0e2dbfb4dd8133b4ed69 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 5 Jun 2017 00:10:18 -0700 Subject: Add new file option php_namespace. (#3162) * Add new file option php_namespace. Use this option to change the namespace of php generated classes. Default is empty. When this option is empty, the package name will be used for determining the namespace. * Uncomment commented tests * Revert gdb test change * Update csharp descriptor. * Add test for empty php_namespace. --- Makefile.am | 4 +- .../src/Google.Protobuf/Reflection/Descriptor.cs | 143 ++++--- php/ext/google/protobuf/def.c | 27 +- php/ext/google/protobuf/upb.c | 377 +++++++++--------- php/ext/google/protobuf/upb.h | 33 +- .../Google/Protobuf/Internal/Descriptor.php | 1 + .../Google/Protobuf/Internal/DescriptorProto.php | 20 + .../Internal/DescriptorProto_ExtensionRange.php | 4 + .../Internal/DescriptorProto_ReservedRange.php | 4 + .../Protobuf/Internal/EnumDescriptorProto.php | 6 + php/src/Google/Protobuf/Internal/EnumOptions.php | 6 + .../Protobuf/Internal/EnumValueDescriptorProto.php | 6 + .../Google/Protobuf/Internal/EnumValueOptions.php | 4 + .../Protobuf/Internal/FieldDescriptorProto.php | 20 + php/src/Google/Protobuf/Internal/FieldOptions.php | 14 + .../Protobuf/Internal/FileDescriptorProto.php | 24 ++ .../Google/Protobuf/Internal/FileDescriptorSet.php | 2 + php/src/Google/Protobuf/Internal/FileOptions.php | 82 ++++ .../Google/Protobuf/Internal/GeneratedCodeInfo.php | 2 + .../Internal/GeneratedCodeInfo_Annotation.php | 8 + .../Google/Protobuf/Internal/MessageOptions.php | 10 + .../Protobuf/Internal/MethodDescriptorProto.php | 12 + php/src/Google/Protobuf/Internal/MethodOptions.php | 6 + .../Protobuf/Internal/OneofDescriptorProto.php | 4 + php/src/Google/Protobuf/Internal/OneofOptions.php | 2 + .../Protobuf/Internal/ServiceDescriptorProto.php | 6 + .../Google/Protobuf/Internal/ServiceOptions.php | 4 + .../Google/Protobuf/Internal/SourceCodeInfo.php | 2 + .../Protobuf/Internal/SourceCodeInfo_Location.php | 10 + .../Protobuf/Internal/UninterpretedOption.php | 14 + .../Internal/UninterpretedOption_NamePart.php | 4 + php/src/Google/Protobuf/descriptor.php | 13 + php/tests/generated_class_test.php | 21 ++ php/tests/memory_leak_test.php | 5 + php/tests/proto/test.proto | 7 + php/tests/proto/test_empty_php_namespace.proto | 8 + php/tests/proto/test_php_namespace.proto | 8 + src/google/protobuf/compiler/php/php_generator.cc | 27 +- src/google/protobuf/descriptor.pb.cc | 420 +++++++++++++-------- src/google/protobuf/descriptor.pb.h | 135 +++++-- src/google/protobuf/descriptor.proto | 5 + tests.sh | 2 +- 42 files changed, 1070 insertions(+), 442 deletions(-) create mode 100644 php/tests/proto/test_empty_php_namespace.proto create mode 100644 php/tests/proto/test_php_namespace.proto (limited to 'src/google') diff --git a/Makefile.am b/Makefile.am index 3c3ca13d..385531ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -654,11 +654,13 @@ php_EXTRA_DIST= \ php/tests/map_field_test.php \ php/tests/memory_leak_test.php \ php/tests/php_implementation_test.php \ + php/tests/proto/test_empty_php_namespace.proto \ php/tests/proto/test_import_descriptor_proto.proto \ php/tests/proto/test_include.proto \ php/tests/proto/test.proto \ - php/tests/proto/test_prefix.proto \ php/tests/proto/test_no_namespace.proto \ + php/tests/proto/test_php_namespace.proto \ + php/tests/proto/test_prefix.proto \ php/tests/test.sh \ php/tests/test_base.php \ php/tests/test_util.php \ diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 2960d1cd..c3517802 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -80,7 +80,7 @@ namespace Google.Protobuf.Reflection { "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n", "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt", "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm", - "YWxzZSK0BQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", + "YWxzZSLLBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf", "ZmlsZXMYCiABKAg6BWZhbHNlEikKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu", "ZF9oYXNoGBQgASgIQgIYARIlChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsg", @@ -92,61 +92,61 @@ namespace Google.Protobuf.Reflection { "ZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFs", "c2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVz", "cGFjZRglIAEoCRIUCgxzd2lmdF9wcmVmaXgYJyABKAkSGAoQcGhwX2NsYXNz", - "X3ByZWZpeBgoIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsy", - "JC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRp", - "bWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JV", - "TlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIvIBCg5NZXNzYWdlT3B0aW9ucxIm", - "ChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9f", - "c3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoK", - "ZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMK", - "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1", - "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgIEAlKBAgJEAoi", - "ngMKDEZpZWxkT3B0aW9ucxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90", - "b2J1Zi5GaWVsZE9wdGlvbnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiAB", - "KAgSPwoGanN0eXBlGAYgASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0", - "aW9ucy5KU1R5cGU6CUpTX05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZ", - "CgpkZXByZWNhdGVkGAMgASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxz", - "ZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJv", - "dG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQ", - "ABIICgRDT1JEEAESEAoMU1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpT", - "X05PUk1BTBAAEg0KCUpTX1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQ", - "gICAgAJKBAgEEAUiXgoMT25lb2ZPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRf", - "b3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVk", - "T3B0aW9uKgkI6AcQgICAgAIikwEKC0VudW1PcHRpb25zEhMKC2FsbG93X2Fs", - "aWFzGAIgASgIEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZhbHNlEkMKFHVuaW50", + "X3ByZWZpeBgoIAEoCRIVCg1waHBfbmFtZXNwYWNlGCkgASgJEkMKFHVuaW50", "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", - "dGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgFEAYifQoQRW51bVZhbHVl", - "T3B0aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVmYWxzZRJDChR1bmludGVy", - "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl", - "cnByZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNlcnZpY2VPcHRpb25zEhkK", - "CmRlcHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0", + "dGVycHJldGVkT3B0aW9uIjoKDE9wdGltaXplTW9kZRIJCgVTUEVFRBABEg0K", + "CUNPREVfU0laRRACEhAKDExJVEVfUlVOVElNRRADKgkI6AcQgICAgAJKBAgm", + "ECci8gEKDk1lc3NhZ2VPcHRpb25zEiYKF21lc3NhZ2Vfc2V0X3dpcmVfZm9y", + "bWF0GAEgASgIOgVmYWxzZRIuCh9ub19zdGFuZGFyZF9kZXNjcmlwdG9yX2Fj", + "Y2Vzc29yGAIgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxz", + "ZRIRCgltYXBfZW50cnkYByABKAgSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y", + "5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24q", + "CQjoBxCAgICAAkoECAgQCUoECAkQCiKeAwoMRmllbGRPcHRpb25zEjoKBWN0", + "eXBlGAEgASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlw", + "ZToGU1RSSU5HEg4KBnBhY2tlZBgCIAEoCBI/CgZqc3R5cGUYBiABKA4yJC5n", + "b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zLkpTVHlwZToJSlNfTk9STUFM", + "EhMKBGxhenkYBSABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZh", + "bHNlEhMKBHdlYWsYCiABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0", "aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0", - "aW9uKgkI6AcQgICAgAIirQIKDU1ldGhvZE9wdGlvbnMSGQoKZGVwcmVjYXRl", - "ZBghIAEoCDoFZmFsc2USXwoRaWRlbXBvdGVuY3lfbGV2ZWwYIiABKA4yLy5n", - "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucy5JZGVtcG90ZW5jeUxldmVs", - "OhNJREVNUE9URU5DWV9VTktOT1dOEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9u", - "GOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9u", - "IlAKEElkZW1wb3RlbmN5TGV2ZWwSFwoTSURFTVBPVEVOQ1lfVU5LTk9XThAA", - "EhMKD05PX1NJREVfRUZGRUNUUxABEg4KCklERU1QT1RFTlQQAioJCOgHEICA", - "gIACIp4CChNVbmludGVycHJldGVkT3B0aW9uEjsKBG5hbWUYAiADKAsyLS5n", - "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbi5OYW1lUGFydBIY", - "ChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBvc2l0aXZlX2ludF92YWx1", - "ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUYBSABKAMSFAoMZG91Ymxl", - "X3ZhbHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgHIAEoDBIXCg9hZ2dyZWdh", - "dGVfdmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJbmFtZV9wYXJ0GAEgAigJ", - "EhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291cmNlQ29kZUluZm8SOgoI", - "bG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYuU291cmNlQ29kZUlu", - "Zm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBhdGgYASADKAVCAhABEhAK", - "BHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29tbWVudHMYAyABKAkSGQoR", - "dHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVhZGluZ19kZXRhY2hlZF9j", - "b21tZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29kZUluZm8SQQoKYW5ub3Rh", - "dGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5m", - "by5Bbm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoEcGF0aBgBIAMoBUICEAES", - "EwoLc291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4YAyABKAUSCwoDZW5kGAQg", - "ASgFQowBChNjb20uZ29vZ2xlLnByb3RvYnVmQhBEZXNjcmlwdG9yUHJvdG9z", - "SAFaPmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3Byb3RvYy1nZW4tZ28v", - "ZGVzY3JpcHRvcjtkZXNjcmlwdG9yogIDR1BCqgIaR29vZ2xlLlByb3RvYnVm", - "LlJlZmxlY3Rpb24=")); + "aW9uIi8KBUNUeXBlEgoKBlNUUklORxAAEggKBENPUkQQARIQCgxTVFJJTkdf", + "UElFQ0UQAiI1CgZKU1R5cGUSDQoJSlNfTk9STUFMEAASDQoJSlNfU1RSSU5H", + "EAESDQoJSlNfTlVNQkVSEAIqCQjoBxCAgICAAkoECAQQBSJeCgxPbmVvZk9w", + "dGlvbnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xl", + "LnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKTAQoL", + "RW51bU9wdGlvbnMSEwoLYWxsb3dfYWxpYXMYAiABKAgSGQoKZGVwcmVjYXRl", + "ZBgDIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygL", + "MiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCA", + "gICAAkoECAUQBiJ9ChBFbnVtVmFsdWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQY", + "ASABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", + "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA", + "gAIiewoOU2VydmljZU9wdGlvbnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFs", + "c2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy", + "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKtAgoNTWV0", + "aG9kT3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJfChFpZGVt", + "cG90ZW5jeV9sZXZlbBgiIAEoDjIvLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RP", + "cHRpb25zLklkZW1wb3RlbmN5TGV2ZWw6E0lERU1QT1RFTkNZX1VOS05PV04S", + "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv", + "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iUAoQSWRlbXBvdGVuY3lMZXZlbBIX", + "ChNJREVNUE9URU5DWV9VTktOT1dOEAASEwoPTk9fU0lERV9FRkZFQ1RTEAES", + "DgoKSURFTVBPVEVOVBACKgkI6AcQgICAgAIingIKE1VuaW50ZXJwcmV0ZWRP", + "cHRpb24SOwoEbmFtZRgCIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy", + "cHJldGVkT3B0aW9uLk5hbWVQYXJ0EhgKEGlkZW50aWZpZXJfdmFsdWUYAyAB", + "KAkSGgoScG9zaXRpdmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2lu", + "dF92YWx1ZRgFIAEoAxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5n", + "X3ZhbHVlGAcgASgMEhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1l", + "UGFydBIRCgluYW1lX3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigI", + "ItUBCg5Tb3VyY2VDb2RlSW5mbxI6Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2ds", + "ZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5mby5Mb2NhdGlvbhqGAQoITG9jYXRp", + "b24SEAoEcGF0aBgBIAMoBUICEAESEAoEc3BhbhgCIAMoBUICEAESGAoQbGVh", + "ZGluZ19jb21tZW50cxgDIAEoCRIZChF0cmFpbGluZ19jb21tZW50cxgEIAEo", + "CRIhChlsZWFkaW5nX2RldGFjaGVkX2NvbW1lbnRzGAYgAygJIqcBChFHZW5l", + "cmF0ZWRDb2RlSW5mbxJBCgphbm5vdGF0aW9uGAEgAygLMi0uZ29vZ2xlLnBy", + "b3RvYnVmLkdlbmVyYXRlZENvZGVJbmZvLkFubm90YXRpb24aTwoKQW5ub3Rh", + "dGlvbhIQCgRwYXRoGAEgAygFQgIQARITCgtzb3VyY2VfZmlsZRgCIAEoCRIN", + "CgViZWdpbhgDIAEoBRILCgNlbmQYBCABKAVCjAEKE2NvbS5nb29nbGUucHJv", + "dG9idWZCEERlc2NyaXB0b3JQcm90b3NIAVo+Z2l0aHViLmNvbS9nb2xhbmcv", + "cHJvdG9idWYvcHJvdG9jLWdlbi1nby9kZXNjcmlwdG9yO2Rlc2NyaXB0b3Ki", + "AgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -160,7 +160,7 @@ namespace Google.Protobuf.Reflection { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), @@ -2810,6 +2810,7 @@ namespace Google.Protobuf.Reflection { csharpNamespace_ = other.csharpNamespace_; swiftPrefix_ = other.swiftPrefix_; phpClassPrefix_ = other.phpClassPrefix_; + phpNamespace_ = other.phpNamespace_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } @@ -3073,6 +3074,22 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "php_namespace" field. + public const int PhpNamespaceFieldNumber = 41; + private string phpNamespace_ = ""; + /// + /// Use this option to change the namespace of php generated classes. Default + /// is empty. When this option is empty, the package name will be used for + /// determining the namespace. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpNamespace { + get { return phpNamespace_; } + set { + phpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Field number for the "uninterpreted_option" field. public const int UninterpretedOptionFieldNumber = 999; private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec @@ -3115,6 +3132,7 @@ namespace Google.Protobuf.Reflection { if (CsharpNamespace != other.CsharpNamespace) return false; if (SwiftPrefix != other.SwiftPrefix) return false; if (PhpClassPrefix != other.PhpClassPrefix) return false; + if (PhpNamespace != other.PhpNamespace) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; return true; } @@ -3138,6 +3156,7 @@ namespace Google.Protobuf.Reflection { if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode(); if (SwiftPrefix.Length != 0) hash ^= SwiftPrefix.GetHashCode(); if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode(); + if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); return hash; } @@ -3213,6 +3232,10 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(194, 2); output.WriteString(PhpClassPrefix); } + if (PhpNamespace.Length != 0) { + output.WriteRawTag(202, 2); + output.WriteString(PhpNamespace); + } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } @@ -3267,6 +3290,9 @@ namespace Google.Protobuf.Reflection { if (PhpClassPrefix.Length != 0) { size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpClassPrefix); } + if (PhpNamespace.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); + } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); return size; } @@ -3324,6 +3350,9 @@ namespace Google.Protobuf.Reflection { if (other.PhpClassPrefix.Length != 0) { PhpClassPrefix = other.PhpClassPrefix; } + if (other.PhpNamespace.Length != 0) { + PhpNamespace = other.PhpNamespace; + } uninterpretedOption_.Add(other.uninterpretedOption_); } @@ -3399,6 +3428,10 @@ namespace Google.Protobuf.Reflection { PhpClassPrefix = input.ReadString(); break; } + case 330: { + PhpNamespace = input.ReadString(); + break; + } case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); break; diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 099ebd05..332616b2 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -405,23 +405,34 @@ static const char *classname_prefix(const char *classname, } static void convert_to_class_name_inplace(const char *package, + const char *namespace_given, const char *prefix, char *classname) { - size_t package_len = package == NULL ? 0 : strlen(package); size_t prefix_len = prefix == NULL ? 0 : strlen(prefix); size_t classname_len = strlen(classname); int i = 0, j; bool first_char = true; - int offset = package_len != 0 ? 2 : 0; + size_t package_len = package == NULL ? 0 : strlen(package); + size_t namespace_given_len = + namespace_given == NULL ? 0 : strlen(namespace_given); + bool use_namespace_given = namespace_given != NULL; + size_t namespace_len = + use_namespace_given ? namespace_given_len : package_len; + + int offset = namespace_len != 0 ? 2 : 0; for (j = 0; j < classname_len; j++) { - classname[package_len + prefix_len + classname_len + offset - 1 - j] = + classname[namespace_len + prefix_len + classname_len + offset - 1 - j] = classname[classname_len - j - 1]; } - if (package_len != 0) { + if (namespace_len != 0) { classname[i++] = '\\'; - for (j = 0; j < package_len; j++) { + for (j = 0; j < namespace_len; j++) { + if (use_namespace_given) { + classname[i++] = namespace_given[j]; + continue; + } // php packages are divided by '\'. if (package[j] == '.') { classname[i++] = '\\'; @@ -490,16 +501,20 @@ PHP_METHOD(DescriptorPool, internalAddGeneratedFile) { * bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if \ * given message is google.protobuf.Empty.*/ \ const char *fullname = upb_##def_type_lower##_fullname(def_type_lower); \ + const char *php_namespace = upb_filedef_phpnamespace(files[0]); \ const char *prefix_given = upb_filedef_phpprefix(files[0]); \ size_t classname_len = strlen(fullname) + 5; \ if (prefix_given != NULL) { \ classname_len += strlen(prefix_given); \ } \ + if (php_namespace != NULL) { \ + classname_len += strlen(php_namespace); \ + } \ char *classname = ecalloc(sizeof(char), classname_len); \ const char *package = upb_filedef_package(files[0]); \ classname_no_prefix(fullname, package, classname); \ const char *prefix = classname_prefix(classname, prefix_given, package); \ - convert_to_class_name_inplace(package, prefix, classname); \ + convert_to_class_name_inplace(package, php_namespace, prefix, classname); \ PHP_PROTO_CE_DECLARE pce; \ if (php_proto_zend_lookup_class(classname, strlen(classname), &pce) == \ FAILURE) { \ diff --git a/php/ext/google/protobuf/upb.c b/php/ext/google/protobuf/upb.c index 70983016..cac2b401 100644 --- a/php/ext/google/protobuf/upb.c +++ b/php/ext/google/protobuf/upb.c @@ -1859,6 +1859,7 @@ static void freefiledef(upb_refcounted *r) { upb_gfree((void*)f->name); upb_gfree((void*)f->package); upb_gfree((void*)f->phpprefix); + upb_gfree((void*)f->phpnamespace); upb_gfree(f); } @@ -1874,6 +1875,7 @@ upb_filedef *upb_filedef_new(const void *owner) { f->package = NULL; f->name = NULL; f->phpprefix = NULL; + f->phpnamespace = NULL; f->syntax = UPB_SYNTAX_PROTO2; if (!upb_refcounted_init(upb_filedef_upcast_mutable(f), &upb_filedef_vtbl, @@ -1912,6 +1914,10 @@ const char *upb_filedef_phpprefix(const upb_filedef *f) { return f->phpprefix; } +const char *upb_filedef_phpnamespace(const upb_filedef *f) { + return f->phpnamespace; +} + upb_syntax_t upb_filedef_syntax(const upb_filedef *f) { return f->syntax; } @@ -1980,6 +1986,18 @@ bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix, return true; } +bool upb_filedef_setphpnamespace(upb_filedef *f, const char *phpnamespace, + upb_status *s) { + phpnamespace = upb_gstrdup(phpnamespace); + if (!phpnamespace) { + upb_upberr_setoom(s); + return false; + } + upb_gfree((void*)f->phpnamespace); + f->phpnamespace = phpnamespace; + return true; +} + bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s) { UPB_UNUSED(s); @@ -6419,14 +6437,14 @@ size_t upb_env_bytesallocated(const upb_env *e) { static const upb_msgdef msgs[22]; -static const upb_fielddef fields[106]; +static const upb_fielddef fields[107]; static const upb_enumdef enums[5]; static const upb_tabent strentries[236]; static const upb_tabent intentries[18]; -static const upb_tabval arrays[186]; +static const upb_tabval arrays[187]; #ifdef UPB_DEBUG_REFS -static upb_inttable reftables[266]; +static upb_inttable reftables[268]; #endif static const upb_msgdef msgs[22] = { @@ -6441,20 +6459,20 @@ static const upb_msgdef msgs[22] = { UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]), UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 42, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]), UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]), - UPB_MSGDEF_INIT("google.protobuf.FileOptions", 34, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 41, 16), UPB_STRTABLE_INIT(17, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]), - UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[109], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]), - UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[117], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]), - UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[124], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]), - UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[125], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]), - UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[127], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]), - UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[131], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]), - UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[132], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]), - UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[134], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]), - UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[141], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]), - UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[150], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]), + UPB_MSGDEF_INIT("google.protobuf.FileOptions", 37, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 42, 17), UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]), + UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[110], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]), + UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[118], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]), + UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[125], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]), + UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[126], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]), + UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[128], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]), + UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[132], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]), + UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[133], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]), + UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[135], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]), + UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[142], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]), + UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[151], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]), }; -static const upb_fielddef fields[106] = { +static const upb_fielddef fields[107] = { UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 15, 6, {0},&reftables[44], &reftables[45]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 6, 1, {0},&reftables[46], &reftables[47]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 23, 12, {0},&reftables[48], &reftables[49]), @@ -6505,77 +6523,78 @@ static const upb_fielddef fields[106] = { UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 10, 0, {0},&reftables[138], &reftables[139]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 6, 0, {0},&reftables[140], &reftables[141]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[142], &reftables[143]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[144], &reftables[145]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[146], &reftables[147]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[148], &reftables[149]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[144], &reftables[145]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[146], &reftables[147]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[148], &reftables[149]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[150], &reftables[151]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[152], &reftables[153]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[154], &reftables[155]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[152], &reftables[153]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[154], &reftables[155]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[156], &reftables[157]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[158], &reftables[159]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[158], &reftables[159]), UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 2, 0, {0},&reftables[160], &reftables[161]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 10, 3, {0},&reftables[162], &reftables[163]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 15, 1, {0},&reftables[164], &reftables[165]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "no_standard_descriptor_accessor", 2, &msgs[12], NULL, 7, 2, {0},&reftables[166], &reftables[167]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[168], &reftables[169]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[170], &reftables[171]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 3, &msgs[7], NULL, 10, 3, {0},&reftables[168], &reftables[169]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "number", 2, &msgs[5], NULL, 7, 2, {0},&reftables[170], &reftables[171]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "objc_class_prefix", 36, &msgs[11], NULL, 24, 13, {0},&reftables[172], &reftables[173]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 28, 6, {0},&reftables[174], &reftables[175]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 19, 8, {0},&reftables[176], &reftables[177]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 12, 3, {0},&reftables[178], &reftables[179]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[180], &reftables[181]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[182], &reftables[183]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[184], &reftables[185]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[186], &reftables[187]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[188], &reftables[189]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[190], &reftables[191]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[192], &reftables[193]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[180], &reftables[181]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[182], &reftables[183]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[184], &reftables[185]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[186], &reftables[187]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[188], &reftables[189]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[190], &reftables[191]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[192], &reftables[193]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 10, 3, {0},&reftables[194], &reftables[195]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 25, 7, {0},&reftables[196], &reftables[197]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 7, 2, {0},&reftables[198], &reftables[199]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 4, 0, {0},&reftables[200], &reftables[201]), UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 31, 16, {0},&reftables[202], &reftables[203]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[204], &reftables[205]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[206], &reftables[207]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[208], &reftables[209]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[210], &reftables[211]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[212], &reftables[213]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[214], &reftables[215]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[216], &reftables[217]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[218], &reftables[219]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[220], &reftables[221]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[222], &reftables[223]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[224], &reftables[225]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[226], &reftables[227]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[228], &reftables[229]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[230], &reftables[231]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[232], &reftables[233]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[234], &reftables[235]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[236], &reftables[237]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_namespace", 41, &msgs[11], NULL, 34, 17, {0},&reftables[204], &reftables[205]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[206], &reftables[207]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[208], &reftables[209]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[210], &reftables[211]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[212], &reftables[213]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[214], &reftables[215]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[216], &reftables[217]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[218], &reftables[219]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[220], &reftables[221]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[222], &reftables[223]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[224], &reftables[225]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[226], &reftables[227]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[228], &reftables[229]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[230], &reftables[231]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[232], &reftables[233]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[234], &reftables[235]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[236], &reftables[237]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]), UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[248], &reftables[249]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[250], &reftables[251]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[252], &reftables[253]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[254], &reftables[255]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[248], &reftables[249]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[250], &reftables[251]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[252], &reftables[253]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[254], &reftables[255]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[256], &reftables[257]), }; static const upb_enumdef enums[5] = { - UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[153], 4, 3), 0, &reftables[256], &reftables[257]), - UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &strentries[192]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[157], 19, 18), 0, &reftables[258], &reftables[259]), - UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[224]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[176], 3, 3), 0, &reftables[260], &reftables[261]), - UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.JSType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[228]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[179], 3, 3), 0, &reftables[262], &reftables[263]), - UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[182], 4, 3), 0, &reftables[264], &reftables[265]), + UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[154], 4, 3), 0, &reftables[258], &reftables[259]), + UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &strentries[192]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[158], 19, 18), 0, &reftables[260], &reftables[261]), + UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[224]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[177], 3, 3), 0, &reftables[262], &reftables[263]), + UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.JSType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[228]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[180], 3, 3), 0, &reftables[264], &reftables[265]), + UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[183], 4, 3), 0, &reftables[266], &reftables[267]), }; static const upb_tabent strentries[236] = { {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[22]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), NULL}, + {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, @@ -6584,31 +6603,31 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\013", "\000", "\000", "\000", "nested_type"), UPB_TABVALUE_PTR_INIT(&fields[60]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), NULL}, + {UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "oneof_decl"), UPB_TABVALUE_PTR_INIT(&fields[65]), NULL}, {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), &strentries[13]}, - {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[90]), NULL}, + {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[91]), NULL}, {UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[18]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[89]), NULL}, + {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[90]), NULL}, {UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[17]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), &strentries[26]}, - {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL}, + {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[52]), &strentries[26]}, + {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL}, {UPB_TABKEY_STR("\013", "\000", "\000", "\000", "allow_alias"), UPB_TABVALUE_PTR_INIT(&fields[1]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), NULL}, + {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), &strentries[34]}, - {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), &strentries[34]}, + {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, @@ -6620,17 +6639,17 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), &strentries[53]}, + {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), &strentries[53]}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\010", "\000", "\000", "\000", "extendee"), UPB_TABVALUE_PTR_INIT(&fields[21]), NULL}, - {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL}, + {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL}, {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "json_name"), UPB_TABVALUE_PTR_INIT(&fields[38]), NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[94]), &strentries[50]}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[95]), &strentries[50]}, {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "default_value"), UPB_TABVALUE_PTR_INIT(&fields[7]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL}, - {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL}, + {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[105]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, @@ -6645,21 +6664,21 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[23]), NULL}, - {UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[105]), NULL}, + {UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[106]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[87]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[87]), NULL}, + {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[88]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "syntax"), UPB_TABVALUE_PTR_INIT(&fields[92]), NULL}, + {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "syntax"), UPB_TABVALUE_PTR_INIT(&fields[93]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "dependency"), UPB_TABVALUE_PTR_INIT(&fields[8]), NULL}, {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "message_type"), UPB_TABVALUE_PTR_INIT(&fields[47]), NULL}, {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "package"), UPB_TABVALUE_PTR_INIT(&fields[76]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), &strentries[86]}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), &strentries[86]}, {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), NULL}, - {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[81]), &strentries[85]}, + {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[82]), &strentries[85]}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "file"), UPB_TABVALUE_PTR_INIT(&fields[26]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, @@ -6680,17 +6699,17 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "java_outer_classname"), UPB_TABVALUE_PTR_INIT(&fields[34]), NULL}, - {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, + {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "php_namespace"), UPB_TABVALUE_PTR_INIT(&fields[80]), &strentries[113]}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\023", "\000", "\000", "\000", "java_multiple_files"), UPB_TABVALUE_PTR_INIT(&fields[33]), &strentries[117]}, - {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, + {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL}, {UPB_TABKEY_STR("\025", "\000", "\000", "\000", "java_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[32]), &strentries[118]}, {UPB_TABKEY_STR("\035", "\000", "\000", "\000", "java_generate_equals_and_hash"), UPB_TABVALUE_PTR_INIT(&fields[31]), NULL}, {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "php_class_prefix"), UPB_TABVALUE_PTR_INIT(&fields[79]), NULL}, {UPB_TABKEY_STR("\037", "\000", "\000", "\000", "javanano_use_deprecated_package"), UPB_TABVALUE_PTR_INIT(&fields[37]), &strentries[123]}, - {UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[82]), NULL}, + {UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL}, {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "optimize_for"), UPB_TABVALUE_PTR_INIT(&fields[67]), NULL}, {UPB_TABKEY_STR("\026", "\000", "\000", "\000", "java_string_check_utf8"), UPB_TABVALUE_PTR_INIT(&fields[36]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[12]), &strentries[119]}, @@ -6706,22 +6725,22 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_STR("\037", "\000", "\000", "\000", "no_standard_descriptor_accessor"), UPB_TABVALUE_PTR_INIT(&fields[61]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "client_streaming"), UPB_TABVALUE_PTR_INIT(&fields[4]), NULL}, - {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[52]), NULL}, + {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "input_type"), UPB_TABVALUE_PTR_INIT(&fields[29]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\013", "\000", "\000", "\000", "output_type"), UPB_TABVALUE_PTR_INIT(&fields[75]), NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL}, - {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL}, + {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), &strentries[150]}, + {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), &strentries[150]}, {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "method"), UPB_TABVALUE_PTR_INIT(&fields[48]), NULL}, {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[149]}, {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL}, @@ -6735,9 +6754,9 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "span"), UPB_TABVALUE_PTR_INIT(&fields[88]), &strentries[167]}, + {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "span"), UPB_TABVALUE_PTR_INIT(&fields[89]), &strentries[167]}, {UPB_TABKEY_STR("\031", "\000", "\000", "\000", "leading_detached_comments"), UPB_TABVALUE_PTR_INIT(&fields[43]), &strentries[165]}, - {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "trailing_comments"), UPB_TABVALUE_PTR_INIT(&fields[93]), NULL}, + {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "trailing_comments"), UPB_TABVALUE_PTR_INIT(&fields[94]), NULL}, {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "leading_comments"), UPB_TABVALUE_PTR_INIT(&fields[42]), &strentries[164]}, {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "path"), UPB_TABVALUE_PTR_INIT(&fields[78]), NULL}, {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "double_value"), UPB_TABVALUE_PTR_INIT(&fields[16]), NULL}, @@ -6753,9 +6772,9 @@ static const upb_tabent strentries[236] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_STR("\022", "\000", "\000", "\000", "positive_int_value"), UPB_TABVALUE_PTR_INIT(&fields[80]), NULL}, + {UPB_TABKEY_STR("\022", "\000", "\000", "\000", "positive_int_value"), UPB_TABVALUE_PTR_INIT(&fields[81]), NULL}, {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "identifier_value"), UPB_TABVALUE_PTR_INIT(&fields[28]), NULL}, - {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "string_value"), UPB_TABVALUE_PTR_INIT(&fields[91]), &strentries[182]}, + {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "string_value"), UPB_TABVALUE_PTR_INIT(&fields[92]), &strentries[182]}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "is_extension"), UPB_TABVALUE_PTR_INIT(&fields[30]), NULL}, @@ -6811,6 +6830,8 @@ static const upb_tabent strentries[236] = { }; static const upb_tabent intentries[18] = { + {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, + {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, @@ -6818,60 +6839,58 @@ static const upb_tabent intentries[18] = { {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, - {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, - {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL}, + {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL}, {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL}, {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL}, }; -static const upb_tabval arrays[186] = { +static const upb_tabval arrays[187] = { UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[50]), + UPB_TABVALUE_PTR_INIT(&fields[57]), UPB_TABVALUE_PTR_INIT(&fields[25]), UPB_TABVALUE_PTR_INIT(&fields[60]), UPB_TABVALUE_PTR_INIT(&fields[20]), UPB_TABVALUE_PTR_INIT(&fields[24]), UPB_TABVALUE_PTR_INIT(&fields[22]), - UPB_TABVALUE_PTR_INIT(&fields[69]), + UPB_TABVALUE_PTR_INIT(&fields[68]), UPB_TABVALUE_PTR_INIT(&fields[65]), + UPB_TABVALUE_PTR_INIT(&fields[85]), UPB_TABVALUE_PTR_INIT(&fields[84]), - UPB_TABVALUE_PTR_INIT(&fields[83]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[90]), + UPB_TABVALUE_PTR_INIT(&fields[91]), UPB_TABVALUE_PTR_INIT(&fields[18]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[89]), + UPB_TABVALUE_PTR_INIT(&fields[90]), UPB_TABVALUE_PTR_INIT(&fields[17]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[54]), - UPB_TABVALUE_PTR_INIT(&fields[103]), - UPB_TABVALUE_PTR_INIT(&fields[74]), + UPB_TABVALUE_PTR_INIT(&fields[52]), + UPB_TABVALUE_PTR_INIT(&fields[104]), + UPB_TABVALUE_PTR_INIT(&fields[73]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[1]), UPB_TABVALUE_PTR_INIT(&fields[14]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[51]), - UPB_TABVALUE_PTR_INIT(&fields[62]), - UPB_TABVALUE_PTR_INIT(&fields[72]), + UPB_TABVALUE_PTR_INIT(&fields[50]), + UPB_TABVALUE_PTR_INIT(&fields[63]), + UPB_TABVALUE_PTR_INIT(&fields[74]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[13]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[56]), UPB_TABVALUE_PTR_INIT(&fields[21]), - UPB_TABVALUE_PTR_INIT(&fields[63]), + UPB_TABVALUE_PTR_INIT(&fields[62]), UPB_TABVALUE_PTR_INIT(&fields[40]), - UPB_TABVALUE_PTR_INIT(&fields[94]), UPB_TABVALUE_PTR_INIT(&fields[95]), + UPB_TABVALUE_PTR_INIT(&fields[96]), UPB_TABVALUE_PTR_INIT(&fields[7]), - UPB_TABVALUE_PTR_INIT(&fields[71]), + UPB_TABVALUE_PTR_INIT(&fields[70]), UPB_TABVALUE_PTR_INIT(&fields[66]), UPB_TABVALUE_PTR_INIT(&fields[38]), UPB_TABVALUE_EMPTY_INIT, @@ -6884,20 +6903,20 @@ static const upb_tabval arrays[186] = { UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[104]), + UPB_TABVALUE_PTR_INIT(&fields[105]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[57]), + UPB_TABVALUE_PTR_INIT(&fields[51]), UPB_TABVALUE_PTR_INIT(&fields[76]), UPB_TABVALUE_PTR_INIT(&fields[8]), UPB_TABVALUE_PTR_INIT(&fields[47]), UPB_TABVALUE_PTR_INIT(&fields[19]), - UPB_TABVALUE_PTR_INIT(&fields[86]), - UPB_TABVALUE_PTR_INIT(&fields[23]), - UPB_TABVALUE_PTR_INIT(&fields[68]), UPB_TABVALUE_PTR_INIT(&fields[87]), - UPB_TABVALUE_PTR_INIT(&fields[81]), - UPB_TABVALUE_PTR_INIT(&fields[105]), - UPB_TABVALUE_PTR_INIT(&fields[92]), + UPB_TABVALUE_PTR_INIT(&fields[23]), + UPB_TABVALUE_PTR_INIT(&fields[69]), + UPB_TABVALUE_PTR_INIT(&fields[88]), + UPB_TABVALUE_PTR_INIT(&fields[82]), + UPB_TABVALUE_PTR_INIT(&fields[106]), + UPB_TABVALUE_PTR_INIT(&fields[93]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[26]), UPB_TABVALUE_EMPTY_INIT, @@ -6918,7 +6937,7 @@ static const upb_tabval arrays[186] = { UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[3]), UPB_TABVALUE_PTR_INIT(&fields[32]), - UPB_TABVALUE_PTR_INIT(&fields[82]), + UPB_TABVALUE_PTR_INIT(&fields[83]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[31]), UPB_TABVALUE_EMPTY_INIT, @@ -6941,6 +6960,7 @@ static const upb_tabval arrays[186] = { UPB_TABVALUE_PTR_INIT(&fields[37]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[79]), + UPB_TABVALUE_PTR_INIT(&fields[80]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[46]), UPB_TABVALUE_PTR_INIT(&fields[61]), @@ -6950,37 +6970,37 @@ static const upb_tabval arrays[186] = { UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[45]), UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[52]), + UPB_TABVALUE_PTR_INIT(&fields[55]), UPB_TABVALUE_PTR_INIT(&fields[29]), UPB_TABVALUE_PTR_INIT(&fields[75]), - UPB_TABVALUE_PTR_INIT(&fields[70]), + UPB_TABVALUE_PTR_INIT(&fields[71]), UPB_TABVALUE_PTR_INIT(&fields[4]), - UPB_TABVALUE_PTR_INIT(&fields[85]), + UPB_TABVALUE_PTR_INIT(&fields[86]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, - UPB_TABVALUE_PTR_INIT(&fields[55]), + UPB_TABVALUE_PTR_INIT(&fields[54]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[53]), UPB_TABVALUE_PTR_INIT(&fields[48]), - UPB_TABVALUE_PTR_INIT(&fields[73]), + UPB_TABVALUE_PTR_INIT(&fields[72]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[44]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[78]), - UPB_TABVALUE_PTR_INIT(&fields[88]), + UPB_TABVALUE_PTR_INIT(&fields[89]), UPB_TABVALUE_PTR_INIT(&fields[42]), - UPB_TABVALUE_PTR_INIT(&fields[93]), + UPB_TABVALUE_PTR_INIT(&fields[94]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[43]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[49]), UPB_TABVALUE_PTR_INIT(&fields[28]), - UPB_TABVALUE_PTR_INIT(&fields[80]), + UPB_TABVALUE_PTR_INIT(&fields[81]), UPB_TABVALUE_PTR_INIT(&fields[59]), UPB_TABVALUE_PTR_INIT(&fields[16]), - UPB_TABVALUE_PTR_INIT(&fields[91]), + UPB_TABVALUE_PTR_INIT(&fields[92]), UPB_TABVALUE_PTR_INIT(&fields[0]), UPB_TABVALUE_EMPTY_INIT, UPB_TABVALUE_PTR_INIT(&fields[58]), @@ -7021,7 +7041,9 @@ static const upb_tabval arrays[186] = { }; #ifdef UPB_DEBUG_REFS -static upb_inttable reftables[266] = { +static upb_inttable reftables[268] = { + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), @@ -7565,6 +7587,34 @@ static size_t file_onpackage(void *closure, const void *hd, const char *buf, return n; } +static void *file_startphpnamespace(void *closure, const void *hd, + size_t size_hint) { + upb_descreader *r = closure; + bool ok; + UPB_UNUSED(hd); + UPB_UNUSED(size_hint); + + ok = upb_filedef_setphpnamespace(r->file, "", NULL); + UPB_ASSERT(ok); + return closure; +} + +static size_t file_onphpnamespace(void *closure, const void *hd, + const char *buf, size_t n, + const upb_bufhandle *handle) { + upb_descreader *r = closure; + char *php_namespace; + bool ok; + UPB_UNUSED(hd); + UPB_UNUSED(handle); + + php_namespace = upb_gstrndup(buf, n); + ok = upb_filedef_setphpnamespace(r->file, php_namespace, NULL); + upb_gfree(php_namespace); + UPB_ASSERT(ok); + return n; +} + static size_t file_onphpprefix(void *closure, const void *hd, const char *buf, size_t n, const upb_bufhandle *handle) { upb_descreader *r = closure; @@ -8109,6 +8159,10 @@ static void reghandlers(const void *closure, upb_handlers *h) { } else if (upbdefs_google_protobuf_FileOptions_is(m)) { upb_handlers_setstring(h, F(FileOptions, php_class_prefix), &file_onphpprefix, NULL); + upb_handlers_setstartstr(h, F(FileOptions, php_namespace), + &file_startphpnamespace, NULL); + upb_handlers_setstring(h, F(FileOptions, php_namespace), + &file_onphpnamespace, NULL); } UPB_ASSERT(upb_ok(upb_handlers_status(h))); @@ -11271,57 +11325,6 @@ done: return r; } -/* Given an encoded varint v, returns an integer with a single bit set that - * indicates the end of the varint. Subtracting one from this value will - * yield a mask that leaves only bits that are part of the varint. Returns - * 0 if the varint is unterminated. */ -static uint64_t upb_get_vstopbit(uint64_t v) { - uint64_t cbits = v | 0x7f7f7f7f7f7f7f7fULL; - return ~cbits & (cbits+1); -} - -/* A branchless decoder. Credit to Pascal Massimino for the bit-twiddling. */ -upb_decoderet upb_vdecode_max8_massimino(upb_decoderet r) { - uint64_t b; - uint64_t stop_bit; - upb_decoderet my_r; - memcpy(&b, r.p, sizeof(b)); - stop_bit = upb_get_vstopbit(b); - b = (b & 0x7f7f7f7f7f7f7f7fULL) & (stop_bit - 1); - b += b & 0x007f007f007f007fULL; - b += 3 * (b & 0x0000ffff0000ffffULL); - b += 15 * (b & 0x00000000ffffffffULL); - if (stop_bit == 0) { - /* Error: unterminated varint. */ - upb_decoderet err_r = {(void*)0, 0}; - return err_r; - } - my_r = upb_decoderet_make(r.p + ((__builtin_ctzll(stop_bit) + 1) / 8), - r.val | (b << 7)); - return my_r; -} - -/* A branchless decoder. Credit to Daniel Wright for the bit-twiddling. */ -upb_decoderet upb_vdecode_max8_wright(upb_decoderet r) { - uint64_t b; - uint64_t stop_bit; - upb_decoderet my_r; - memcpy(&b, r.p, sizeof(b)); - stop_bit = upb_get_vstopbit(b); - b &= (stop_bit - 1); - b = ((b & 0x7f007f007f007f00ULL) >> 1) | (b & 0x007f007f007f007fULL); - b = ((b & 0xffff0000ffff0000ULL) >> 2) | (b & 0x0000ffff0000ffffULL); - b = ((b & 0xffffffff00000000ULL) >> 4) | (b & 0x00000000ffffffffULL); - if (stop_bit == 0) { - /* Error: unterminated varint. */ - upb_decoderet err_r = {(void*)0, 0}; - return err_r; - } - my_r = upb_decoderet_make(r.p + ((__builtin_ctzll(stop_bit) + 1) / 8), - r.val | (b << 14)); - return my_r; -} - #line 1 "upb/json/parser.rl" /* ** upb::json::Parser (upb_json_parser) diff --git a/php/ext/google/protobuf/upb.h b/php/ext/google/protobuf/upb.h index 78f255f9..4b51275d 100644 --- a/php/ext/google/protobuf/upb.h +++ b/php/ext/google/protobuf/upb.h @@ -2973,10 +2973,16 @@ class upb::FileDef { bool set_package(const char* package, Status* s); /* Sets the php class prefix which is prepended to all php generated classes - / from this .proto. Default is empty. */ + * from this .proto. Default is empty. */ const char* phpprefix() const; bool set_phpprefix(const char* phpprefix, Status* s); + /* Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. */ + const char* phpnamespace() const; + bool set_phpnamespace(const char* phpnamespace, Status* s); + /* Syntax for the file. Defaults to proto2. */ upb_syntax_t syntax() const; void set_syntax(upb_syntax_t syntax); @@ -3031,6 +3037,7 @@ UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast) const char *upb_filedef_name(const upb_filedef *f); const char *upb_filedef_package(const upb_filedef *f); const char *upb_filedef_phpprefix(const upb_filedef *f); +const char *upb_filedef_phpnamespace(const upb_filedef *f); upb_syntax_t upb_filedef_syntax(const upb_filedef *f); size_t upb_filedef_defcount(const upb_filedef *f); size_t upb_filedef_depcount(const upb_filedef *f); @@ -3042,6 +3049,8 @@ bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s); bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s); bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix, upb_status *s); +bool upb_filedef_setphpnamespace(upb_filedef *f, const char *phpnamespace, + upb_status *s); bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s); bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor, @@ -3806,6 +3815,12 @@ inline const char* FileDef::phpprefix() const { inline bool FileDef::set_phpprefix(const char* phpprefix, Status* s) { return upb_filedef_setphpprefix(this, phpprefix, s); } +inline const char* FileDef::phpnamespace() const { + return upb_filedef_phpnamespace(this); +} +inline bool FileDef::set_phpnamespace(const char* phpnamespace, Status* s) { + return upb_filedef_setphpnamespace(this, phpnamespace, s); +} inline int FileDef::def_count() const { return upb_filedef_defcount(this); } @@ -4021,6 +4036,7 @@ struct upb_filedef { const char *name; const char *package; const char *phpprefix; + const char *phpnamespace; upb_syntax_t syntax; upb_inttable defs; @@ -7228,6 +7244,7 @@ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_us UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); } UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); } UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 40); } +UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_namespace(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 41); } UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); } UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); } UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); } @@ -8326,16 +8343,8 @@ UPB_INLINE upb_decoderet upb_decoderet_make(const char *p, uint64_t val) { return ret; } -/* Four functions for decoding a varint of at most eight bytes. They are all - * functionally identical, but are implemented in different ways and likely have - * different performance profiles. We keep them around for performance testing. - * - * Note that these functions may not read byte-by-byte, so they must not be used - * unless there are at least eight bytes left in the buffer! */ upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r); upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r); -upb_decoderet upb_vdecode_max8_wright(upb_decoderet r); -upb_decoderet upb_vdecode_max8_massimino(upb_decoderet r); /* Template for a function that checks the first two bytes with branching * and dispatches 2-10 bytes with a separate function. Note that this may read @@ -8360,8 +8369,6 @@ UPB_INLINE upb_decoderet upb_vdecode_check2_ ## name(const char *_p) { \ UPB_VARINT_DECODER_CHECK2(branch32, upb_vdecode_max8_branch32) UPB_VARINT_DECODER_CHECK2(branch64, upb_vdecode_max8_branch64) -UPB_VARINT_DECODER_CHECK2(wright, upb_vdecode_max8_wright) -UPB_VARINT_DECODER_CHECK2(massimino, upb_vdecode_max8_massimino) #undef UPB_VARINT_DECODER_CHECK2 /* Our canonical functions for decoding varints, based on the currently @@ -8373,10 +8380,6 @@ UPB_INLINE upb_decoderet upb_vdecode_fast(const char *p) { return upb_vdecode_check2_branch32(p); } -UPB_INLINE upb_decoderet upb_vdecode_max8_fast(upb_decoderet r) { - return upb_vdecode_max8_massimino(r); -} - /* Encoding *******************************************************************/ diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php index 1b6b3d60..636a0ad4 100644 --- a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php +++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -145,6 +145,7 @@ class Descriptor ->optional('csharp_namespace', \Google\Protobuf\Internal\GPBType::STRING, 37) ->optional('swift_prefix', \Google\Protobuf\Internal\GPBType::STRING, 39) ->optional('php_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 40) + ->optional('php_namespace', \Google\Protobuf\Internal\GPBType::STRING, 41) ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index 948c5876..c72c0962 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -97,6 +97,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->name = $var; $this->has_name = true; + + return $this; } public function hasName() @@ -120,6 +122,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->field = $arr; $this->has_field = true; + + return $this; } public function hasField() @@ -143,6 +147,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->extension = $arr; $this->has_extension = true; + + return $this; } public function hasExtension() @@ -166,6 +172,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); $this->nested_type = $arr; $this->has_nested_type = true; + + return $this; } public function hasNestedType() @@ -189,6 +197,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); $this->enum_type = $arr; $this->has_enum_type = true; + + return $this; } public function hasEnumType() @@ -212,6 +222,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); $this->extension_range = $arr; $this->has_extension_range = true; + + return $this; } public function hasExtensionRange() @@ -235,6 +247,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); $this->oneof_decl = $arr; $this->has_oneof_decl = true; + + return $this; } public function hasOneofDecl() @@ -258,6 +272,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); $this->options = $var; $this->has_options = true; + + return $this; } public function hasOptions() @@ -281,6 +297,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); $this->reserved_range = $arr; $this->has_reserved_range = true; + + return $this; } public function hasReservedRange() @@ -314,6 +332,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->reserved_name = $arr; $this->has_reserved_name = true; + + return $this; } public function hasReservedName() diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php index 738a1738..b5e5453e 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php @@ -48,6 +48,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->start = $var; $this->has_start = true; + + return $this; } public function hasStart() @@ -71,6 +73,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->end = $var; $this->has_end = true; + + return $this; } public function hasEnd() diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php index be36b8aa..e5b7b05a 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php @@ -70,6 +70,8 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->start = $var; $this->has_start = true; + + return $this; } public function hasStart() @@ -101,6 +103,8 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->end = $var; $this->has_end = true; + + return $this; } public function hasEnd() diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index 73f6edbd..bf597436 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -57,6 +57,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->name = $var; $this->has_name = true; + + return $this; } public function hasName() @@ -80,6 +82,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); $this->value = $arr; $this->has_value = true; + + return $this; } public function hasValue() @@ -103,6 +107,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); $this->options = $var; $this->has_options = true; + + return $this; } public function hasOptions() diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php index 4fa0bce7..cfa0cb3e 100644 --- a/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -79,6 +79,8 @@ class EnumOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->allow_alias = $var; $this->has_allow_alias = true; + + return $this; } public function hasAllowAlias() @@ -116,6 +118,8 @@ class EnumOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->deprecated = $var; $this->has_deprecated = true; + + return $this; } public function hasDeprecated() @@ -147,6 +151,8 @@ class EnumOptions extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; + + return $this; } public function hasUninterpretedOption() diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php index 94dc36ec..43eee73f 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -57,6 +57,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->name = $var; $this->has_name = true; + + return $this; } public function hasName() @@ -80,6 +82,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->number = $var; $this->has_number = true; + + return $this; } public function hasNumber() @@ -103,6 +107,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); $this->options = $var; $this->has_options = true; + + return $this; } public function hasOptions() diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php index 232a6738..d66c7684 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -73,6 +73,8 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->deprecated = $var; $this->has_deprecated = true; + + return $this; } public function hasDeprecated() @@ -104,6 +106,8 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; + + return $this; } public function hasUninterpretedOption() diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php index 6ae2cd41..2af9c0a0 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -130,6 +130,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->name = $var; $this->has_name = true; + + return $this; } public function hasName() @@ -153,6 +155,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->number = $var; $this->has_number = true; + + return $this; } public function hasNumber() @@ -176,6 +180,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); $this->label = $var; $this->has_label = true; + + return $this; } public function hasLabel() @@ -209,6 +215,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); $this->type = $var; $this->has_type = true; + + return $this; } public function hasType() @@ -248,6 +256,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->type_name = $var; $this->has_type_name = true; + + return $this; } public function hasTypeName() @@ -281,6 +291,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->extendee = $var; $this->has_extendee = true; + + return $this; } public function hasExtendee() @@ -320,6 +332,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->default_value = $var; $this->has_default_value = true; + + return $this; } public function hasDefaultValue() @@ -353,6 +367,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkInt32($var); $this->oneof_index = $var; $this->has_oneof_index = true; + + return $this; } public function hasOneofIndex() @@ -390,6 +406,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->json_name = $var; $this->has_json_name = true; + + return $this; } public function hasJsonName() @@ -413,6 +431,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); $this->options = $var; $this->has_options = true; + + return $this; } public function hasOptions() diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index 8db7ed67..b30caa75 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -156,6 +156,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_CType::class); $this->ctype = $var; $this->has_ctype = true; + + return $this; } public function hasCtype() @@ -195,6 +197,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->packed = $var; $this->has_packed = true; + + return $this; } public function hasPacked() @@ -242,6 +246,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_JSType::class); $this->jstype = $var; $this->has_jstype = true; + + return $this; } public function hasJstype() @@ -319,6 +325,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->lazy = $var; $this->has_lazy = true; + + return $this; } public function hasLazy() @@ -356,6 +364,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->deprecated = $var; $this->has_deprecated = true; + + return $this; } public function hasDeprecated() @@ -387,6 +397,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->weak = $var; $this->has_weak = true; + + return $this; } public function hasWeak() @@ -418,6 +430,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; + + return $this; } public function hasUninterpretedOption() diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index 0363d9e9..b229522a 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -147,6 +147,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->name = $var; $this->has_name = true; + + return $this; } public function hasName() @@ -178,6 +180,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->package = $var; $this->has_package = true; + + return $this; } public function hasPackage() @@ -209,6 +213,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->dependency = $arr; $this->has_dependency = true; + + return $this; } public function hasDependency() @@ -240,6 +246,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->public_dependency = $arr; $this->has_public_dependency = true; + + return $this; } public function hasPublicDependency() @@ -273,6 +281,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->weak_dependency = $arr; $this->has_weak_dependency = true; + + return $this; } public function hasWeakDependency() @@ -304,6 +314,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); $this->message_type = $arr; $this->has_message_type = true; + + return $this; } public function hasMessageType() @@ -327,6 +339,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); $this->enum_type = $arr; $this->has_enum_type = true; + + return $this; } public function hasEnumType() @@ -350,6 +364,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); $this->service = $arr; $this->has_service = true; + + return $this; } public function hasService() @@ -373,6 +389,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->extension = $arr; $this->has_extension = true; + + return $this; } public function hasExtension() @@ -396,6 +414,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); $this->options = $var; $this->has_options = true; + + return $this; } public function hasOptions() @@ -433,6 +453,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); $this->source_code_info = $var; $this->has_source_code_info = true; + + return $this; } public function hasSourceCodeInfo() @@ -466,6 +488,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->syntax = $var; $this->has_syntax = true; + + return $this; } public function hasSyntax() diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 0bcc8051..8271ee66 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -48,6 +48,8 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); $this->file = $arr; $this->has_file = true; + + return $this; } public function hasFile() diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 22653a4f..332da3dc 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -186,6 +186,17 @@ class FileOptions extends \Google\Protobuf\Internal\Message */ private $php_class_prefix = ''; private $has_php_class_prefix = false; + /** + *
+     * Use this option to change the namespace of php generated classes. Default
+     * is empty. When this option is empty, the package name will be used for
+     * determining the namespace.
+     * 
+ * + * optional string php_namespace = 41; + */ + private $php_namespace = ''; + private $has_php_namespace = false; /** *
      * The parser stores options it doesn't recognize here. See above.
@@ -231,6 +242,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->java_package = $var;
         $this->has_java_package = true;
+
+        return $this;
     }
 
     public function hasJavaPackage()
@@ -270,6 +283,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->java_outer_classname = $var;
         $this->has_java_outer_classname = true;
+
+        return $this;
     }
 
     public function hasJavaOuterClassname()
@@ -311,6 +326,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->java_multiple_files = $var;
         $this->has_java_multiple_files = true;
+
+        return $this;
     }
 
     public function hasJavaMultipleFiles()
@@ -342,6 +359,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->java_generate_equals_and_hash = $var;
         $this->has_java_generate_equals_and_hash = true;
+
+        return $this;
     }
 
     public function hasJavaGenerateEqualsAndHash()
@@ -383,6 +402,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->java_string_check_utf8 = $var;
         $this->has_java_string_check_utf8 = true;
+
+        return $this;
     }
 
     public function hasJavaStringCheckUtf8()
@@ -406,6 +427,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class);
         $this->optimize_for = $var;
         $this->has_optimize_for = true;
+
+        return $this;
     }
 
     public function hasOptimizeFor()
@@ -445,6 +468,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->go_package = $var;
         $this->has_go_package = true;
+
+        return $this;
     }
 
     public function hasGoPackage()
@@ -492,6 +517,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->cc_generic_services = $var;
         $this->has_cc_generic_services = true;
+
+        return $this;
     }
 
     public function hasCcGenericServices()
@@ -515,6 +542,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->java_generic_services = $var;
         $this->has_java_generic_services = true;
+
+        return $this;
     }
 
     public function hasJavaGenericServices()
@@ -538,6 +567,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->py_generic_services = $var;
         $this->has_py_generic_services = true;
+
+        return $this;
     }
 
     public function hasPyGenericServices()
@@ -575,6 +606,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->deprecated = $var;
         $this->has_deprecated = true;
+
+        return $this;
     }
 
     public function hasDeprecated()
@@ -608,6 +641,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->cc_enable_arenas = $var;
         $this->has_cc_enable_arenas = true;
+
+        return $this;
     }
 
     public function hasCcEnableArenas()
@@ -641,6 +676,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->objc_class_prefix = $var;
         $this->has_objc_class_prefix = true;
+
+        return $this;
     }
 
     public function hasObjcClassPrefix()
@@ -672,6 +709,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->csharp_namespace = $var;
         $this->has_csharp_namespace = true;
+
+        return $this;
     }
 
     public function hasCsharpNamespace()
@@ -709,6 +748,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->swift_prefix = $var;
         $this->has_swift_prefix = true;
+
+        return $this;
     }
 
     public function hasSwiftPrefix()
@@ -742,6 +783,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->php_class_prefix = $var;
         $this->has_php_class_prefix = true;
+
+        return $this;
     }
 
     public function hasPhpClassPrefix()
@@ -749,6 +792,43 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         return $this->has_php_class_prefix;
     }
 
+    /**
+     * 
+     * Use this option to change the namespace of php generated classes. Default
+     * is empty. When this option is empty, the package name will be used for
+     * determining the namespace.
+     * 
+ * + * optional string php_namespace = 41; + */ + public function getPhpNamespace() + { + return $this->php_namespace; + } + + /** + *
+     * Use this option to change the namespace of php generated classes. Default
+     * is empty. When this option is empty, the package name will be used for
+     * determining the namespace.
+     * 
+ * + * optional string php_namespace = 41; + */ + public function setPhpNamespace($var) + { + GPBUtil::checkString($var, True); + $this->php_namespace = $var; + $this->has_php_namespace = true; + + return $this; + } + + public function hasPhpNamespace() + { + return $this->has_php_namespace; + } + /** *
      * The parser stores options it doesn't recognize here. See above.
@@ -773,6 +853,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
         $this->uninterpreted_option = $arr;
         $this->has_uninterpreted_option = true;
+
+        return $this;
     }
 
     public function hasUninterpretedOption()
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
index 450854f1..1e666f31 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
@@ -64,6 +64,8 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
         $this->annotation = $arr;
         $this->has_annotation = true;
+
+        return $this;
     }
 
     public function hasAnnotation()
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
index ed22cc38..8d227e1c 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
@@ -88,6 +88,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
         $this->path = $arr;
         $this->has_path = true;
+
+        return $this;
     }
 
     public function hasPath()
@@ -119,6 +121,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->source_file = $var;
         $this->has_source_file = true;
+
+        return $this;
     }
 
     public function hasSourceFile()
@@ -152,6 +156,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
         GPBUtil::checkInt32($var);
         $this->begin = $var;
         $this->has_begin = true;
+
+        return $this;
     }
 
     public function hasBegin()
@@ -187,6 +193,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
         GPBUtil::checkInt32($var);
         $this->end = $var;
         $this->has_end = true;
+
+        return $this;
     }
 
     public function hasEnd()
diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php
index 747f3294..a5835358 100644
--- a/php/src/Google/Protobuf/Internal/MessageOptions.php
+++ b/php/src/Google/Protobuf/Internal/MessageOptions.php
@@ -155,6 +155,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->message_set_wire_format = $var;
         $this->has_message_set_wire_format = true;
+
+        return $this;
     }
 
     public function hasMessageSetWireFormat()
@@ -190,6 +192,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->no_standard_descriptor_accessor = $var;
         $this->has_no_standard_descriptor_accessor = true;
+
+        return $this;
     }
 
     public function hasNoStandardDescriptorAccessor()
@@ -227,6 +231,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->deprecated = $var;
         $this->has_deprecated = true;
+
+        return $this;
     }
 
     public function hasDeprecated()
@@ -292,6 +298,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->map_entry = $var;
         $this->has_map_entry = true;
+
+        return $this;
     }
 
     public function hasMapEntry()
@@ -323,6 +331,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
         $this->uninterpreted_option = $arr;
         $this->has_uninterpreted_option = true;
+
+        return $this;
     }
 
     public function hasUninterpretedOption()
diff --git a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
index 3d8df7af..c3f9f064 100644
--- a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
@@ -85,6 +85,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->name = $var;
         $this->has_name = true;
+
+        return $this;
     }
 
     public function hasName()
@@ -118,6 +120,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->input_type = $var;
         $this->has_input_type = true;
+
+        return $this;
     }
 
     public function hasInputType()
@@ -141,6 +145,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->output_type = $var;
         $this->has_output_type = true;
+
+        return $this;
     }
 
     public function hasOutputType()
@@ -164,6 +170,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class);
         $this->options = $var;
         $this->has_options = true;
+
+        return $this;
     }
 
     public function hasOptions()
@@ -195,6 +203,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->client_streaming = $var;
         $this->has_client_streaming = true;
+
+        return $this;
     }
 
     public function hasClientStreaming()
@@ -226,6 +236,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->server_streaming = $var;
         $this->has_server_streaming = true;
+
+        return $this;
     }
 
     public function hasServerStreaming()
diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php
index 6dca5854..e8d36d3c 100644
--- a/php/src/Google/Protobuf/Internal/MethodOptions.php
+++ b/php/src/Google/Protobuf/Internal/MethodOptions.php
@@ -78,6 +78,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->deprecated = $var;
         $this->has_deprecated = true;
+
+        return $this;
     }
 
     public function hasDeprecated()
@@ -101,6 +103,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkEnum($var, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class);
         $this->idempotency_level = $var;
         $this->has_idempotency_level = true;
+
+        return $this;
     }
 
     public function hasIdempotencyLevel()
@@ -132,6 +136,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
         $this->uninterpreted_option = $arr;
         $this->has_uninterpreted_option = true;
+
+        return $this;
     }
 
     public function hasUninterpretedOption()
diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
index e5fbe370..744ca638 100644
--- a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
@@ -52,6 +52,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->name = $var;
         $this->has_name = true;
+
+        return $this;
     }
 
     public function hasName()
@@ -75,6 +77,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class);
         $this->options = $var;
         $this->has_options = true;
+
+        return $this;
     }
 
     public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php
index b61325d2..b3cd51ed 100644
--- a/php/src/Google/Protobuf/Internal/OneofOptions.php
+++ b/php/src/Google/Protobuf/Internal/OneofOptions.php
@@ -55,6 +55,8 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
         $this->uninterpreted_option = $arr;
         $this->has_uninterpreted_option = true;
+
+        return $this;
     }
 
     public function hasUninterpretedOption()
diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
index 47776202..7c85728a 100644
--- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
@@ -57,6 +57,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->name = $var;
         $this->has_name = true;
+
+        return $this;
     }
 
     public function hasName()
@@ -80,6 +82,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class);
         $this->method = $arr;
         $this->has_method = true;
+
+        return $this;
     }
 
     public function hasMethod()
@@ -103,6 +107,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
         GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class);
         $this->options = $var;
         $this->has_options = true;
+
+        return $this;
     }
 
     public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php
index 62323dba..0f3a8d74 100644
--- a/php/src/Google/Protobuf/Internal/ServiceOptions.php
+++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php
@@ -73,6 +73,8 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->deprecated = $var;
         $this->has_deprecated = true;
+
+        return $this;
     }
 
     public function hasDeprecated()
@@ -104,6 +106,8 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
         $this->uninterpreted_option = $arr;
         $this->has_uninterpreted_option = true;
+
+        return $this;
     }
 
     public function hasUninterpretedOption()
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
index eab60880..7eef3424 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
@@ -180,6 +180,8 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
         $this->location = $arr;
         $this->has_location = true;
+
+        return $this;
     }
 
     public function hasLocation()
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
index 5a02b26c..cf23e38b 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
@@ -182,6 +182,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
         $this->path = $arr;
         $this->has_path = true;
+
+        return $this;
     }
 
     public function hasPath()
@@ -221,6 +223,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
         $this->span = $arr;
         $this->has_span = true;
+
+        return $this;
     }
 
     public function hasSpan()
@@ -322,6 +326,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->leading_comments = $var;
         $this->has_leading_comments = true;
+
+        return $this;
     }
 
     public function hasLeadingComments()
@@ -345,6 +351,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->trailing_comments = $var;
         $this->has_trailing_comments = true;
+
+        return $this;
     }
 
     public function hasTrailingComments()
@@ -368,6 +376,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
         $this->leading_detached_comments = $arr;
         $this->has_leading_detached_comments = true;
+
+        return $this;
     }
 
     public function hasLeadingDetachedComments()
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
index 28655019..08e071d4 100644
--- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
@@ -87,6 +87,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
         $this->name = $arr;
         $this->has_name = true;
+
+        return $this;
     }
 
     public function hasName()
@@ -120,6 +122,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->identifier_value = $var;
         $this->has_identifier_value = true;
+
+        return $this;
     }
 
     public function hasIdentifierValue()
@@ -143,6 +147,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkUint64($var);
         $this->positive_int_value = $var;
         $this->has_positive_int_value = true;
+
+        return $this;
     }
 
     public function hasPositiveIntValue()
@@ -166,6 +172,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkInt64($var);
         $this->negative_int_value = $var;
         $this->has_negative_int_value = true;
+
+        return $this;
     }
 
     public function hasNegativeIntValue()
@@ -189,6 +197,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkDouble($var);
         $this->double_value = $var;
         $this->has_double_value = true;
+
+        return $this;
     }
 
     public function hasDoubleValue()
@@ -212,6 +222,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, False);
         $this->string_value = $var;
         $this->has_string_value = true;
+
+        return $this;
     }
 
     public function hasStringValue()
@@ -235,6 +247,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->aggregate_value = $var;
         $this->has_aggregate_value = true;
+
+        return $this;
     }
 
     public function hasAggregateValue()
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
index 86484d23..eb27754c 100644
--- a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
@@ -56,6 +56,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
         GPBUtil::checkString($var, True);
         $this->name_part = $var;
         $this->has_name_part = true;
+
+        return $this;
     }
 
     public function hasNamePart()
@@ -79,6 +81,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
         GPBUtil::checkBool($var);
         $this->is_extension = $var;
         $this->has_is_extension = true;
+
+        return $this;
     }
 
     public function hasIsExtension()
diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php
index 35e4929b..b7a3a550 100644
--- a/php/src/Google/Protobuf/descriptor.php
+++ b/php/src/Google/Protobuf/descriptor.php
@@ -282,6 +282,19 @@ function getFullClassName(
 
     $class_name_without_package =
         getClassNameWithoutPackage($message_name_without_package, $file_proto);
+
+    $option = $file_proto->getOptions();
+    if (!is_null($option) && $option->hasPhpNamespace()) {
+        $namespace = $option->getPhpNamespace();
+        if ($namespace !== "") {
+            $classname = $namespace . "\\" . $class_name_without_package;
+            return;
+        } else {
+            $classname = $class_name_without_package;
+            return;
+        }
+    }
+
     if ($package === "") {
         $classname = $class_name_without_package;
     } else {
diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php
index be641b6e..f7e645b3 100644
--- a/php/tests/generated_class_test.php
+++ b/php/tests/generated_class_test.php
@@ -9,9 +9,11 @@ use Google\Protobuf\Internal\RepeatedField;
 use Google\Protobuf\Internal\MapField;
 use Google\Protobuf\Internal\GPBType;
 use Foo\TestEnum;
+use Foo\TestIncludeNamespaceMessage;
 use Foo\TestIncludePrefixMessage;
 use Foo\TestMessage;
 use Foo\TestMessage_Sub;
+use Php\Test\TestNamespace;
 
 class GeneratedClassTest extends TestBase
 {
@@ -867,6 +869,25 @@ class GeneratedClassTest extends TestBase
         $this->assertSame(1, $m->getPrefixMessage()->getA());
     }
 
+    #########################################################
+    # Test message with given namespace.
+    #########################################################
+
+    public function testNamespaceMessage()
+    {
+        $m = new TestIncludeNamespaceMessage();
+
+        $n = new TestNamespace();
+        $n->setA(1);
+        $m->setNamespaceMessage($n);
+        $this->assertSame(1, $m->getNamespaceMessage()->getA());
+
+        $n = new TestEmptyNamespace();
+        $n->setA(1);
+        $m->setEmptyNamespaceMessage($n);
+        $this->assertSame(1, $m->getEmptyNamespaceMessage()->getA());
+    }
+
     #########################################################
     # Test prefix for reserved words.
     #########################################################
diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php
index 5eac56f0..4f951a89 100644
--- a/php/tests/memory_leak_test.php
+++ b/php/tests/memory_leak_test.php
@@ -7,10 +7,12 @@ require_once('generated/NoNamespaceMessage.php');
 require_once('generated/NoNamespaceMessage_NestedEnum.php');
 require_once('generated/PrefixEmpty.php');
 require_once('generated/PrefixTestPrefix.php');
+require_once('generated/TestEmptyNamespace.php');
 require_once('generated/Bar/TestInclude.php');
 require_once('generated/Foo/PBARRAY.php');
 require_once('generated/Foo/PBEmpty.php');
 require_once('generated/Foo/TestEnum.php');
+require_once('generated/Foo/TestIncludeNamespaceMessage.php');
 require_once('generated/Foo/TestIncludePrefixMessage.php');
 require_once('generated/Foo/TestMessage.php');
 require_once('generated/Foo/TestMessage_Empty.php');
@@ -20,9 +22,12 @@ require_once('generated/Foo/TestPackedMessage.php');
 require_once('generated/Foo/TestPhpDoc.php');
 require_once('generated/Foo/TestUnpackedMessage.php');
 require_once('generated/GPBMetadata/Proto/Test.php');
+require_once('generated/GPBMetadata/Proto/TestEmptyPhpNamespace.php');
 require_once('generated/GPBMetadata/Proto/TestInclude.php');
 require_once('generated/GPBMetadata/Proto/TestNoNamespace.php');
+require_once('generated/GPBMetadata/Proto/TestPhpNamespace.php');
 require_once('generated/GPBMetadata/Proto/TestPrefix.php');
+require_once('generated/Php/Test/TestNamespace.php');
 require_once('test_util.php');
 
 use Google\Protobuf\Internal\RepeatedField;
diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto
index 583bf8e1..dada8b48 100644
--- a/php/tests/proto/test.proto
+++ b/php/tests/proto/test.proto
@@ -2,6 +2,8 @@ syntax = "proto3";
 
 import 'proto/test_include.proto';
 import 'proto/test_no_namespace.proto';
+import 'proto/test_php_namespace.proto';
+import 'proto/test_empty_php_namespace.proto';
 import 'proto/test_prefix.proto';
 
 package foo;
@@ -174,3 +176,8 @@ message TestPhpDoc {
 message TestIncludePrefixMessage {
   TestPrefix prefix_message = 1;
 }
+
+message TestIncludeNamespaceMessage {
+  TestNamespace namespace_message = 1;
+  TestEmptyNamespace empty_namespace_message = 2;
+}
diff --git a/php/tests/proto/test_empty_php_namespace.proto b/php/tests/proto/test_empty_php_namespace.proto
new file mode 100644
index 00000000..7b4bc74d
--- /dev/null
+++ b/php/tests/proto/test_empty_php_namespace.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+
+package foo;
+option php_namespace = "";
+
+message TestEmptyNamespace {
+  int32 a = 1;
+}
diff --git a/php/tests/proto/test_php_namespace.proto b/php/tests/proto/test_php_namespace.proto
new file mode 100644
index 00000000..713187b9
--- /dev/null
+++ b/php/tests/proto/test_php_namespace.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+
+package foo;
+option php_namespace = "Php\\Test";
+
+message TestNamespace {
+  int32 a = 1;
+}
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index cbddee9e..78252817 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -145,6 +145,15 @@ std::string FullClassName(const DescriptorType* desc, bool is_descriptor) {
   }
   classname = ClassNamePrefix(classname, desc) + classname;
 
+  if (desc->file()->options().has_php_namespace()) {
+    const string& php_namespace = desc->file()->options().php_namespace();
+    if (php_namespace != "") {
+      return php_namespace + '\\' + classname;
+    } else {
+      return classname;
+    }
+  }
+
   if (desc->file()->package() == "") {
     return classname;
   } else {
@@ -822,7 +831,14 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
   std::string fullname = FilenameToClassname(filename);
   int lastindex = fullname.find_last_of("\\");
 
-  if (!file->package().empty()) {
+  if (file->options().has_php_namespace()) {
+    const string& php_namespace = file->options().php_namespace();
+    if (!php_namespace.empty()) {
+      printer.Print(
+          "namespace ^name^;\n\n",
+          "name", php_namespace);
+    }
+  } else if (!file->package().empty()) {
     printer.Print(
         "namespace ^name^;\n\n",
         "name", fullname.substr(0, lastindex));
@@ -874,7 +890,14 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
   std::string fullname = FilenameToClassname(filename);
   int lastindex = fullname.find_last_of("\\");
 
-  if (!file->package().empty()) {
+  if (file->options().has_php_namespace()) {
+    const string& php_namespace = file->options().php_namespace();
+    if (!php_namespace.empty()) {
+      printer.Print(
+          "namespace ^name^;\n\n",
+          "name", php_namespace);
+    }
+  } else if (!file->package().empty()) {
     printer.Print(
         "namespace ^name^;\n\n",
         "name", fullname.substr(0, lastindex));
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index 56c395e6..ff0819ec 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -303,23 +303,25 @@ const ::google::protobuf::uint32 TableStruct::offsets[] = {
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, swift_prefix_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_class_prefix_),
+  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_namespace_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_),
   0,
   1,
-  7,
   8,
   9,
-  15,
-  2,
   10,
+  16,
+  2,
   11,
   12,
   13,
   14,
+  15,
   3,
   4,
   5,
   6,
+  7,
   ~0u,
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _has_bits_),
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MessageOptions, _internal_metadata_),
@@ -486,20 +488,20 @@ static const ::google::protobuf::internal::MigrationSchema schemas[] = {
   { 124, 132, sizeof(EnumValueDescriptorProto)},
   { 135, 143, sizeof(ServiceDescriptorProto)},
   { 146, 157, sizeof(MethodDescriptorProto)},
-  { 163, 185, sizeof(FileOptions)},
-  { 202, 212, sizeof(MessageOptions)},
-  { 217, 229, sizeof(FieldOptions)},
-  { 236, 242, sizeof(OneofOptions)},
-  { 243, 251, sizeof(EnumOptions)},
-  { 254, 261, sizeof(EnumValueOptions)},
-  { 263, 270, sizeof(ServiceOptions)},
-  { 272, 280, sizeof(MethodOptions)},
-  { 283, 290, sizeof(UninterpretedOption_NamePart)},
-  { 292, 304, sizeof(UninterpretedOption)},
-  { 311, 321, sizeof(SourceCodeInfo_Location)},
-  { 326, 332, sizeof(SourceCodeInfo)},
-  { 333, 342, sizeof(GeneratedCodeInfo_Annotation)},
-  { 346, 352, sizeof(GeneratedCodeInfo)},
+  { 163, 186, sizeof(FileOptions)},
+  { 204, 214, sizeof(MessageOptions)},
+  { 219, 231, sizeof(FieldOptions)},
+  { 238, 244, sizeof(OneofOptions)},
+  { 245, 253, sizeof(EnumOptions)},
+  { 256, 263, sizeof(EnumValueOptions)},
+  { 265, 272, sizeof(ServiceOptions)},
+  { 274, 282, sizeof(MethodOptions)},
+  { 285, 292, sizeof(UninterpretedOption_NamePart)},
+  { 294, 306, sizeof(UninterpretedOption)},
+  { 313, 323, sizeof(SourceCodeInfo_Location)},
+  { 328, 334, sizeof(SourceCodeInfo)},
+  { 335, 344, sizeof(GeneratedCodeInfo_Annotation)},
+  { 348, 354, sizeof(GeneratedCodeInfo)},
 };
 
 static ::google::protobuf::Message const * const file_default_instances[] = {
@@ -727,7 +729,7 @@ void AddDescriptorsImpl() {
       "\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.g"
       "oogle.protobuf.MethodOptions\022\037\n\020client_s"
       "treaming\030\005 \001(\010:\005false\022\037\n\020server_streamin"
-      "g\030\006 \001(\010:\005false\"\264\005\n\013FileOptions\022\024\n\014java_p"
+      "g\030\006 \001(\010:\005false\"\313\005\n\013FileOptions\022\024\n\014java_p"
       "ackage\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001"
       "(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false\022)"
       "\n\035java_generate_equals_and_hash\030\024 \001(\010B\002\030"
@@ -741,70 +743,71 @@ void AddDescriptorsImpl() {
       "le_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pre"
       "fix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014s"
       "wift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( "
-      "\001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo"
-      "gle.protobuf.UninterpretedOption\":\n\014Opti"
-      "mizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LI"
-      "TE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016Messag"
-      "eOptions\022&\n\027message_set_wire_format\030\001 \001("
-      "\010:\005false\022.\n\037no_standard_descriptor_acces"
-      "sor\030\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005fa"
-      "lse\022\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterpreted_"
-      "option\030\347\007 \003(\0132$.google.protobuf.Uninterp"
-      "retedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014F"
-      "ieldOptions\022:\n\005ctype\030\001 \001(\0162#.google.prot"
-      "obuf.FieldOptions.CType:\006STRING\022\016\n\006packe"
-      "d\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.google.protobu"
-      "f.FieldOptions.JSType:\tJS_NORMAL\022\023\n\004lazy"
-      "\030\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false"
-      "\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_o"
-      "ption\030\347\007 \003(\0132$.google.protobuf.Uninterpr"
-      "etedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020"
-      "\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORM"
-      "AL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020"
-      "\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninterpr"
-      "eted_option\030\347\007 \003(\0132$.google.protobuf.Uni"
-      "nterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOpti"
-      "ons\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003"
-      " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003"
-      "(\0132$.google.protobuf.UninterpretedOption"
-      "*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumValueOptions\022\031\n"
-      "\ndeprecated\030\001 \001(\010:\005false\022C\n\024uninterprete"
-      "d_option\030\347\007 \003(\0132$.google.protobuf.Uninte"
-      "rpretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptio"
-      "ns\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninter"
-      "preted_option\030\347\007 \003(\0132$.google.protobuf.U"
-      "ninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethod"
-      "Options\022\031\n\ndeprecated\030! \001(\010:\005false\022_\n\021id"
-      "empotency_level\030\" \001(\0162/.google.protobuf."
-      "MethodOptions.IdempotencyLevel:\023IDEMPOTE"
-      "NCY_UNKNOWN\022C\n\024uninterpreted_option\030\347\007 \003"
-      "(\0132$.google.protobuf.UninterpretedOption"
-      "\"P\n\020IdempotencyLevel\022\027\n\023IDEMPOTENCY_UNKN"
-      "OWN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTENT"
-      "\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022;\n"
-      "\004name\030\002 \003(\0132-.google.protobuf.Uninterpre"
-      "tedOption.NamePart\022\030\n\020identifier_value\030\003"
-      " \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022nega"
-      "tive_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 \001"
-      "(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_va"
-      "lue\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002(\t"
-      "\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeInf"
-      "o\022:\n\010location\030\001 \003(\0132(.google.protobuf.So"
-      "urceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004pa"
-      "th\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leadin"
-      "g_comments\030\003 \001(\t\022\031\n\021trailing_comments\030\004 "
-      "\001(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"\247"
-      "\001\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\013"
-      "2-.google.protobuf.GeneratedCodeInfo.Ann"
-      "otation\032O\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022"
-      "\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003e"
-      "nd\030\004 \001(\005B\214\001\n\023com.google.protobufB\020Descri"
-      "ptorProtosH\001Z>github.com/golang/protobuf"
-      "/protoc-gen-go/descriptor;descriptor\242\002\003G"
-      "PB\252\002\032Google.Protobuf.Reflection"
+      "\001(\t\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpre"
+      "ted_option\030\347\007 \003(\0132$.google.protobuf.Unin"
+      "terpretedOption\":\n\014OptimizeMode\022\t\n\005SPEED"
+      "\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007"
+      "\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027messa"
+      "ge_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_st"
+      "andard_descriptor_accessor\030\002 \001(\010:\005false\022"
+      "\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030"
+      "\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.g"
+      "oogle.protobuf.UninterpretedOption*\t\010\350\007\020"
+      "\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005ct"
+      "ype\030\001 \001(\0162#.google.protobuf.FieldOptions"
+      ".CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype"
+      "\030\006 \001(\0162$.google.protobuf.FieldOptions.JS"
+      "Type:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\n"
+      "deprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005f"
+      "alse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go"
+      "ogle.protobuf.UninterpretedOption\"/\n\005CTy"
+      "pe\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE"
+      "\020\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING"
+      "\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014On"
+      "eofOptions\022C\n\024uninterpreted_option\030\347\007 \003("
+      "\0132$.google.protobuf.UninterpretedOption*"
+      "\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alia"
+      "s\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024un"
+      "interpreted_option\030\347\007 \003(\0132$.google.proto"
+      "buf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006"
+      "\"}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010"
+      ":\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$"
+      ".google.protobuf.UninterpretedOption*\t\010\350"
+      "\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030"
+      "! \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 "
+      "\003(\0132$.google.protobuf.UninterpretedOptio"
+      "n*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprec"
+      "ated\030! \001(\010:\005false\022_\n\021idempotency_level\030\""
+      " \001(\0162/.google.protobuf.MethodOptions.Ide"
+      "mpotencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024un"
+      "interpreted_option\030\347\007 \003(\0132$.google.proto"
+      "buf.UninterpretedOption\"P\n\020IdempotencyLe"
+      "vel\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_"
+      "EFFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n"
+      "\023UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goo"
+      "gle.protobuf.UninterpretedOption.NamePar"
+      "t\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_"
+      "int_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 "
+      "\001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_valu"
+      "e\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010Name"
+      "Part\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030"
+      "\002 \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003"
+      "(\0132(.google.protobuf.SourceCodeInfo.Loca"
+      "tion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004s"
+      "pan\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022"
+      "\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_de"
+      "tached_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeI"
+      "nfo\022A\n\nannotation\030\001 \003(\0132-.google.protobu"
+      "f.GeneratedCodeInfo.Annotation\032O\n\nAnnota"
+      "tion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 "
+      "\001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com."
+      "google.protobufB\020DescriptorProtosH\001Z>git"
+      "hub.com/golang/protobuf/protoc-gen-go/de"
+      "scriptor;descriptor\242\002\003GPB\252\002\032Google.Proto"
+      "buf.Reflection"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 5591);
+      descriptor, 5614);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
@@ -8255,6 +8258,7 @@ const int FileOptions::kObjcClassPrefixFieldNumber;
 const int FileOptions::kCsharpNamespaceFieldNumber;
 const int FileOptions::kSwiftPrefixFieldNumber;
 const int FileOptions::kPhpClassPrefixFieldNumber;
+const int FileOptions::kPhpNamespaceFieldNumber;
 const int FileOptions::kUninterpretedOptionFieldNumber;
 #endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
 
@@ -8302,6 +8306,10 @@ FileOptions::FileOptions(const FileOptions& from)
   if (from.has_php_class_prefix()) {
     php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
   }
+  php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.has_php_namespace()) {
+    php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_);
+  }
   ::memcpy(&java_multiple_files_, &from.java_multiple_files_,
     reinterpret_cast(&optimize_for_) -
     reinterpret_cast(&java_multiple_files_) + sizeof(optimize_for_));
@@ -8317,6 +8325,7 @@ void FileOptions::SharedCtor() {
   csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) -
     reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_));
   optimize_for_ = 1;
@@ -8335,6 +8344,7 @@ void FileOptions::SharedDtor() {
   csharp_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   swift_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   php_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  php_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
 }
 
 void FileOptions::SetCachedSize(int size) const {
@@ -8364,7 +8374,7 @@ void FileOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
   _extensions_.Clear();
   uninterpreted_option_.Clear();
-  if (_has_bits_[0 / 32] & 127u) {
+  if (_has_bits_[0 / 32] & 255u) {
     if (has_java_package()) {
       GOOGLE_DCHECK(!java_package_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
       (*java_package_.UnsafeRawStringPointer())->clear();
@@ -8393,13 +8403,16 @@ void FileOptions::Clear() {
       GOOGLE_DCHECK(!php_class_prefix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
       (*php_class_prefix_.UnsafeRawStringPointer())->clear();
     }
+    if (has_php_namespace()) {
+      GOOGLE_DCHECK(!php_namespace_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
+      (*php_namespace_.UnsafeRawStringPointer())->clear();
+    }
   }
-  java_multiple_files_ = false;
   if (_has_bits_[8 / 32] & 65280u) {
-    ::memset(&java_generate_equals_and_hash_, 0, reinterpret_cast(&cc_enable_arenas_) -
-      reinterpret_cast(&java_generate_equals_and_hash_) + sizeof(cc_enable_arenas_));
-    optimize_for_ = 1;
+    ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) -
+      reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_));
   }
+  optimize_for_ = 1;
   _has_bits_.Clear();
   _internal_metadata_.Clear();
 }
@@ -8657,6 +8670,22 @@ bool FileOptions::MergePartialFromCodedStream(
         break;
       }
 
+      // optional string php_namespace = 41;
+      case 41: {
+        if (static_cast< ::google::protobuf::uint8>(tag) ==
+            static_cast< ::google::protobuf::uint8>(330u)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_php_namespace()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+            this->php_namespace().data(), this->php_namespace().length(),
+            ::google::protobuf::internal::WireFormat::PARSE,
+            "google.protobuf.FileOptions.php_namespace");
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999: {
         if (static_cast< ::google::protobuf::uint8>(tag) ==
@@ -8724,13 +8753,13 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
-  if (cached_has_bits & 0x00008000u) {
+  if (cached_has_bits & 0x00010000u) {
     ::google::protobuf::internal::WireFormatLite::WriteEnum(
       9, this->optimize_for(), output);
   }
 
   // optional bool java_multiple_files = 10 [default = false];
-  if (cached_has_bits & 0x00000080u) {
+  if (cached_has_bits & 0x00000100u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output);
   }
 
@@ -8745,37 +8774,37 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // optional bool cc_generic_services = 16 [default = false];
-  if (cached_has_bits & 0x00000400u) {
+  if (cached_has_bits & 0x00000800u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output);
   }
 
   // optional bool java_generic_services = 17 [default = false];
-  if (cached_has_bits & 0x00000800u) {
+  if (cached_has_bits & 0x00001000u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output);
   }
 
   // optional bool py_generic_services = 18 [default = false];
-  if (cached_has_bits & 0x00001000u) {
+  if (cached_has_bits & 0x00002000u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output);
   }
 
   // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
-  if (cached_has_bits & 0x00000100u) {
+  if (cached_has_bits & 0x00000200u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output);
   }
 
   // optional bool deprecated = 23 [default = false];
-  if (cached_has_bits & 0x00002000u) {
+  if (cached_has_bits & 0x00004000u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(23, this->deprecated(), output);
   }
 
   // optional bool java_string_check_utf8 = 27 [default = false];
-  if (cached_has_bits & 0x00000200u) {
+  if (cached_has_bits & 0x00000400u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(27, this->java_string_check_utf8(), output);
   }
 
   // optional bool cc_enable_arenas = 31 [default = false];
-  if (cached_has_bits & 0x00004000u) {
+  if (cached_has_bits & 0x00008000u) {
     ::google::protobuf::internal::WireFormatLite::WriteBool(31, this->cc_enable_arenas(), output);
   }
 
@@ -8819,6 +8848,16 @@ void FileOptions::SerializeWithCachedSizes(
       40, this->php_class_prefix(), output);
   }
 
+  // optional string php_namespace = 41;
+  if (cached_has_bits & 0x00000080u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->php_namespace().data(), this->php_namespace().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "google.protobuf.FileOptions.php_namespace");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      41, this->php_namespace(), output);
+  }
+
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
@@ -8866,13 +8905,13 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
-  if (cached_has_bits & 0x00008000u) {
+  if (cached_has_bits & 0x00010000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
       9, this->optimize_for(), target);
   }
 
   // optional bool java_multiple_files = 10 [default = false];
-  if (cached_has_bits & 0x00000080u) {
+  if (cached_has_bits & 0x00000100u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target);
   }
 
@@ -8888,37 +8927,37 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // optional bool cc_generic_services = 16 [default = false];
-  if (cached_has_bits & 0x00000400u) {
+  if (cached_has_bits & 0x00000800u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target);
   }
 
   // optional bool java_generic_services = 17 [default = false];
-  if (cached_has_bits & 0x00000800u) {
+  if (cached_has_bits & 0x00001000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target);
   }
 
   // optional bool py_generic_services = 18 [default = false];
-  if (cached_has_bits & 0x00001000u) {
+  if (cached_has_bits & 0x00002000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target);
   }
 
   // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
-  if (cached_has_bits & 0x00000100u) {
+  if (cached_has_bits & 0x00000200u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target);
   }
 
   // optional bool deprecated = 23 [default = false];
-  if (cached_has_bits & 0x00002000u) {
+  if (cached_has_bits & 0x00004000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target);
   }
 
   // optional bool java_string_check_utf8 = 27 [default = false];
-  if (cached_has_bits & 0x00000200u) {
+  if (cached_has_bits & 0x00000400u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(27, this->java_string_check_utf8(), target);
   }
 
   // optional bool cc_enable_arenas = 31 [default = false];
-  if (cached_has_bits & 0x00004000u) {
+  if (cached_has_bits & 0x00008000u) {
     target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target);
   }
 
@@ -8966,6 +9005,17 @@ void FileOptions::SerializeWithCachedSizes(
         40, this->php_class_prefix(), target);
   }
 
+  // optional string php_namespace = 41;
+  if (cached_has_bits & 0x00000080u) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
+      this->php_namespace().data(), this->php_namespace().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE,
+      "google.protobuf.FileOptions.php_namespace");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        41, this->php_namespace(), target);
+  }
+
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
@@ -9057,13 +9107,20 @@ size_t FileOptions::ByteSizeLong() const {
           this->php_class_prefix());
     }
 
+    // optional string php_namespace = 41;
+    if (has_php_namespace()) {
+      total_size += 2 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->php_namespace());
+    }
+
+  }
+  if (_has_bits_[8 / 32] & 65280u) {
     // optional bool java_multiple_files = 10 [default = false];
     if (has_java_multiple_files()) {
       total_size += 1 + 1;
     }
 
-  }
-  if (_has_bits_[8 / 32] & 65280u) {
     // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
     if (has_java_generate_equals_and_hash()) {
       total_size += 2 + 1;
@@ -9099,13 +9156,13 @@ size_t FileOptions::ByteSizeLong() const {
       total_size += 2 + 1;
     }
 
-    // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
-    if (has_optimize_for()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for());
-    }
-
   }
+  // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
+  if (has_optimize_for()) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for());
+  }
+
   int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
   GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
   _cached_size_ = cached_size;
@@ -9168,37 +9225,40 @@ void FileOptions::MergeFrom(const FileOptions& from) {
       php_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix_);
     }
     if (cached_has_bits & 0x00000080u) {
-      java_multiple_files_ = from.java_multiple_files_;
+      set_has_php_namespace();
+      php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_);
     }
-    _has_bits_[0] |= cached_has_bits;
   }
   if (cached_has_bits & 65280u) {
     if (cached_has_bits & 0x00000100u) {
-      java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_;
+      java_multiple_files_ = from.java_multiple_files_;
     }
     if (cached_has_bits & 0x00000200u) {
-      java_string_check_utf8_ = from.java_string_check_utf8_;
+      java_generate_equals_and_hash_ = from.java_generate_equals_and_hash_;
     }
     if (cached_has_bits & 0x00000400u) {
-      cc_generic_services_ = from.cc_generic_services_;
+      java_string_check_utf8_ = from.java_string_check_utf8_;
     }
     if (cached_has_bits & 0x00000800u) {
-      java_generic_services_ = from.java_generic_services_;
+      cc_generic_services_ = from.cc_generic_services_;
     }
     if (cached_has_bits & 0x00001000u) {
-      py_generic_services_ = from.py_generic_services_;
+      java_generic_services_ = from.java_generic_services_;
     }
     if (cached_has_bits & 0x00002000u) {
-      deprecated_ = from.deprecated_;
+      py_generic_services_ = from.py_generic_services_;
     }
     if (cached_has_bits & 0x00004000u) {
-      cc_enable_arenas_ = from.cc_enable_arenas_;
+      deprecated_ = from.deprecated_;
     }
     if (cached_has_bits & 0x00008000u) {
-      optimize_for_ = from.optimize_for_;
+      cc_enable_arenas_ = from.cc_enable_arenas_;
     }
     _has_bits_[0] |= cached_has_bits;
   }
+  if (cached_has_bits & 0x00010000u) {
+    set_optimize_for(from.optimize_for());
+  }
 }
 
 void FileOptions::CopyFrom(const ::google::protobuf::Message& from) {
@@ -9237,6 +9297,7 @@ void FileOptions::InternalSwap(FileOptions* other) {
   csharp_namespace_.Swap(&other->csharp_namespace_);
   swift_prefix_.Swap(&other->swift_prefix_);
   php_class_prefix_.Swap(&other->php_class_prefix_);
+  php_namespace_.Swap(&other->php_namespace_);
   std::swap(java_multiple_files_, other->java_multiple_files_);
   std::swap(java_generate_equals_and_hash_, other->java_generate_equals_and_hash_);
   std::swap(java_string_check_utf8_, other->java_string_check_utf8_);
@@ -9388,13 +9449,13 @@ void FileOptions::set_allocated_java_outer_classname(::std::string* java_outer_c
 
 // optional bool java_multiple_files = 10 [default = false];
 bool FileOptions::has_java_multiple_files() const {
-  return (_has_bits_[0] & 0x00000080u) != 0;
+  return (_has_bits_[0] & 0x00000100u) != 0;
 }
 void FileOptions::set_has_java_multiple_files() {
-  _has_bits_[0] |= 0x00000080u;
+  _has_bits_[0] |= 0x00000100u;
 }
 void FileOptions::clear_has_java_multiple_files() {
-  _has_bits_[0] &= ~0x00000080u;
+  _has_bits_[0] &= ~0x00000100u;
 }
 void FileOptions::clear_java_multiple_files() {
   java_multiple_files_ = false;
@@ -9412,13 +9473,13 @@ void FileOptions::set_java_multiple_files(bool value) {
 
 // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
 bool FileOptions::has_java_generate_equals_and_hash() const {
-  return (_has_bits_[0] & 0x00000100u) != 0;
+  return (_has_bits_[0] & 0x00000200u) != 0;
 }
 void FileOptions::set_has_java_generate_equals_and_hash() {
-  _has_bits_[0] |= 0x00000100u;
+  _has_bits_[0] |= 0x00000200u;
 }
 void FileOptions::clear_has_java_generate_equals_and_hash() {
-  _has_bits_[0] &= ~0x00000100u;
+  _has_bits_[0] &= ~0x00000200u;
 }
 void FileOptions::clear_java_generate_equals_and_hash() {
   java_generate_equals_and_hash_ = false;
@@ -9436,13 +9497,13 @@ void FileOptions::set_java_generate_equals_and_hash(bool value) {
 
 // optional bool java_string_check_utf8 = 27 [default = false];
 bool FileOptions::has_java_string_check_utf8() const {
-  return (_has_bits_[0] & 0x00000200u) != 0;
+  return (_has_bits_[0] & 0x00000400u) != 0;
 }
 void FileOptions::set_has_java_string_check_utf8() {
-  _has_bits_[0] |= 0x00000200u;
+  _has_bits_[0] |= 0x00000400u;
 }
 void FileOptions::clear_has_java_string_check_utf8() {
-  _has_bits_[0] &= ~0x00000200u;
+  _has_bits_[0] &= ~0x00000400u;
 }
 void FileOptions::clear_java_string_check_utf8() {
   java_string_check_utf8_ = false;
@@ -9460,13 +9521,13 @@ void FileOptions::set_java_string_check_utf8(bool value) {
 
 // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
 bool FileOptions::has_optimize_for() const {
-  return (_has_bits_[0] & 0x00008000u) != 0;
+  return (_has_bits_[0] & 0x00010000u) != 0;
 }
 void FileOptions::set_has_optimize_for() {
-  _has_bits_[0] |= 0x00008000u;
+  _has_bits_[0] |= 0x00010000u;
 }
 void FileOptions::clear_has_optimize_for() {
-  _has_bits_[0] &= ~0x00008000u;
+  _has_bits_[0] &= ~0x00010000u;
 }
 void FileOptions::clear_optimize_for() {
   optimize_for_ = 1;
@@ -9548,13 +9609,13 @@ void FileOptions::set_allocated_go_package(::std::string* go_package) {
 
 // optional bool cc_generic_services = 16 [default = false];
 bool FileOptions::has_cc_generic_services() const {
-  return (_has_bits_[0] & 0x00000400u) != 0;
+  return (_has_bits_[0] & 0x00000800u) != 0;
 }
 void FileOptions::set_has_cc_generic_services() {
-  _has_bits_[0] |= 0x00000400u;
+  _has_bits_[0] |= 0x00000800u;
 }
 void FileOptions::clear_has_cc_generic_services() {
-  _has_bits_[0] &= ~0x00000400u;
+  _has_bits_[0] &= ~0x00000800u;
 }
 void FileOptions::clear_cc_generic_services() {
   cc_generic_services_ = false;
@@ -9572,13 +9633,13 @@ void FileOptions::set_cc_generic_services(bool value) {
 
 // optional bool java_generic_services = 17 [default = false];
 bool FileOptions::has_java_generic_services() const {
-  return (_has_bits_[0] & 0x00000800u) != 0;
+  return (_has_bits_[0] & 0x00001000u) != 0;
 }
 void FileOptions::set_has_java_generic_services() {
-  _has_bits_[0] |= 0x00000800u;
+  _has_bits_[0] |= 0x00001000u;
 }
 void FileOptions::clear_has_java_generic_services() {
-  _has_bits_[0] &= ~0x00000800u;
+  _has_bits_[0] &= ~0x00001000u;
 }
 void FileOptions::clear_java_generic_services() {
   java_generic_services_ = false;
@@ -9596,13 +9657,13 @@ void FileOptions::set_java_generic_services(bool value) {
 
 // optional bool py_generic_services = 18 [default = false];
 bool FileOptions::has_py_generic_services() const {
-  return (_has_bits_[0] & 0x00001000u) != 0;
+  return (_has_bits_[0] & 0x00002000u) != 0;
 }
 void FileOptions::set_has_py_generic_services() {
-  _has_bits_[0] |= 0x00001000u;
+  _has_bits_[0] |= 0x00002000u;
 }
 void FileOptions::clear_has_py_generic_services() {
-  _has_bits_[0] &= ~0x00001000u;
+  _has_bits_[0] &= ~0x00002000u;
 }
 void FileOptions::clear_py_generic_services() {
   py_generic_services_ = false;
@@ -9620,13 +9681,13 @@ void FileOptions::set_py_generic_services(bool value) {
 
 // optional bool deprecated = 23 [default = false];
 bool FileOptions::has_deprecated() const {
-  return (_has_bits_[0] & 0x00002000u) != 0;
+  return (_has_bits_[0] & 0x00004000u) != 0;
 }
 void FileOptions::set_has_deprecated() {
-  _has_bits_[0] |= 0x00002000u;
+  _has_bits_[0] |= 0x00004000u;
 }
 void FileOptions::clear_has_deprecated() {
-  _has_bits_[0] &= ~0x00002000u;
+  _has_bits_[0] &= ~0x00004000u;
 }
 void FileOptions::clear_deprecated() {
   deprecated_ = false;
@@ -9644,13 +9705,13 @@ void FileOptions::set_deprecated(bool value) {
 
 // optional bool cc_enable_arenas = 31 [default = false];
 bool FileOptions::has_cc_enable_arenas() const {
-  return (_has_bits_[0] & 0x00004000u) != 0;
+  return (_has_bits_[0] & 0x00008000u) != 0;
 }
 void FileOptions::set_has_cc_enable_arenas() {
-  _has_bits_[0] |= 0x00004000u;
+  _has_bits_[0] |= 0x00008000u;
 }
 void FileOptions::clear_has_cc_enable_arenas() {
-  _has_bits_[0] &= ~0x00004000u;
+  _has_bits_[0] &= ~0x00008000u;
 }
 void FileOptions::clear_cc_enable_arenas() {
   cc_enable_arenas_ = false;
@@ -9918,6 +9979,69 @@ void FileOptions::set_allocated_php_class_prefix(::std::string* php_class_prefix
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
 }
 
+// optional string php_namespace = 41;
+bool FileOptions::has_php_namespace() const {
+  return (_has_bits_[0] & 0x00000080u) != 0;
+}
+void FileOptions::set_has_php_namespace() {
+  _has_bits_[0] |= 0x00000080u;
+}
+void FileOptions::clear_has_php_namespace() {
+  _has_bits_[0] &= ~0x00000080u;
+}
+void FileOptions::clear_php_namespace() {
+  php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_php_namespace();
+}
+const ::std::string& FileOptions::php_namespace() const {
+  // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace)
+  return php_namespace_.GetNoArena();
+}
+void FileOptions::set_php_namespace(const ::std::string& value) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
+}
+#if LANG_CXX11
+void FileOptions::set_php_namespace(::std::string&& value) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace)
+}
+#endif
+void FileOptions::set_php_namespace(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace)
+}
+void FileOptions::set_php_namespace(const char* value, size_t size) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast(value), size));
+  // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace)
+}
+::std::string* FileOptions::mutable_php_namespace() {
+  set_has_php_namespace();
+  // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
+  return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+::std::string* FileOptions::release_php_namespace() {
+  // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
+  clear_has_php_namespace();
+  return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) {
+  if (php_namespace != NULL) {
+    set_has_php_namespace();
+  } else {
+    clear_has_php_namespace();
+  }
+  php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace);
+  // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
+}
+
 // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
 int FileOptions::uninterpreted_option_size() const {
   return uninterpreted_option_.size();
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index d1ed2b1f..f64a339c 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -2233,6 +2233,21 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
   ::std::string* release_php_class_prefix();
   void set_allocated_php_class_prefix(::std::string* php_class_prefix);
 
+  // optional string php_namespace = 41;
+  bool has_php_namespace() const;
+  void clear_php_namespace();
+  static const int kPhpNamespaceFieldNumber = 41;
+  const ::std::string& php_namespace() const;
+  void set_php_namespace(const ::std::string& value);
+  #if LANG_CXX11
+  void set_php_namespace(::std::string&& value);
+  #endif
+  void set_php_namespace(const char* value);
+  void set_php_namespace(const char* value, size_t size);
+  ::std::string* mutable_php_namespace();
+  ::std::string* release_php_namespace();
+  void set_allocated_php_namespace(::std::string* php_namespace);
+
   // optional bool java_multiple_files = 10 [default = false];
   bool has_java_multiple_files() const;
   void clear_java_multiple_files();
@@ -2331,6 +2346,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
   void clear_has_swift_prefix();
   void set_has_php_class_prefix();
   void clear_has_php_class_prefix();
+  void set_has_php_namespace();
+  void clear_has_php_namespace();
 
   ::google::protobuf::internal::ExtensionSet _extensions_;
 
@@ -2345,6 +2362,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
   ::google::protobuf::internal::ArenaStringPtr csharp_namespace_;
   ::google::protobuf::internal::ArenaStringPtr swift_prefix_;
   ::google::protobuf::internal::ArenaStringPtr php_class_prefix_;
+  ::google::protobuf::internal::ArenaStringPtr php_namespace_;
   bool java_multiple_files_;
   bool java_generate_equals_and_hash_;
   bool java_string_check_utf8_;
@@ -6554,13 +6572,13 @@ inline void FileOptions::set_allocated_java_outer_classname(::std::string* java_
 
 // optional bool java_multiple_files = 10 [default = false];
 inline bool FileOptions::has_java_multiple_files() const {
-  return (_has_bits_[0] & 0x00000080u) != 0;
+  return (_has_bits_[0] & 0x00000100u) != 0;
 }
 inline void FileOptions::set_has_java_multiple_files() {
-  _has_bits_[0] |= 0x00000080u;
+  _has_bits_[0] |= 0x00000100u;
 }
 inline void FileOptions::clear_has_java_multiple_files() {
-  _has_bits_[0] &= ~0x00000080u;
+  _has_bits_[0] &= ~0x00000100u;
 }
 inline void FileOptions::clear_java_multiple_files() {
   java_multiple_files_ = false;
@@ -6578,13 +6596,13 @@ inline void FileOptions::set_java_multiple_files(bool value) {
 
 // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
 inline bool FileOptions::has_java_generate_equals_and_hash() const {
-  return (_has_bits_[0] & 0x00000100u) != 0;
+  return (_has_bits_[0] & 0x00000200u) != 0;
 }
 inline void FileOptions::set_has_java_generate_equals_and_hash() {
-  _has_bits_[0] |= 0x00000100u;
+  _has_bits_[0] |= 0x00000200u;
 }
 inline void FileOptions::clear_has_java_generate_equals_and_hash() {
-  _has_bits_[0] &= ~0x00000100u;
+  _has_bits_[0] &= ~0x00000200u;
 }
 inline void FileOptions::clear_java_generate_equals_and_hash() {
   java_generate_equals_and_hash_ = false;
@@ -6602,13 +6620,13 @@ inline void FileOptions::set_java_generate_equals_and_hash(bool value) {
 
 // optional bool java_string_check_utf8 = 27 [default = false];
 inline bool FileOptions::has_java_string_check_utf8() const {
-  return (_has_bits_[0] & 0x00000200u) != 0;
+  return (_has_bits_[0] & 0x00000400u) != 0;
 }
 inline void FileOptions::set_has_java_string_check_utf8() {
-  _has_bits_[0] |= 0x00000200u;
+  _has_bits_[0] |= 0x00000400u;
 }
 inline void FileOptions::clear_has_java_string_check_utf8() {
-  _has_bits_[0] &= ~0x00000200u;
+  _has_bits_[0] &= ~0x00000400u;
 }
 inline void FileOptions::clear_java_string_check_utf8() {
   java_string_check_utf8_ = false;
@@ -6626,13 +6644,13 @@ inline void FileOptions::set_java_string_check_utf8(bool value) {
 
 // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
 inline bool FileOptions::has_optimize_for() const {
-  return (_has_bits_[0] & 0x00008000u) != 0;
+  return (_has_bits_[0] & 0x00010000u) != 0;
 }
 inline void FileOptions::set_has_optimize_for() {
-  _has_bits_[0] |= 0x00008000u;
+  _has_bits_[0] |= 0x00010000u;
 }
 inline void FileOptions::clear_has_optimize_for() {
-  _has_bits_[0] &= ~0x00008000u;
+  _has_bits_[0] &= ~0x00010000u;
 }
 inline void FileOptions::clear_optimize_for() {
   optimize_for_ = 1;
@@ -6714,13 +6732,13 @@ inline void FileOptions::set_allocated_go_package(::std::string* go_package) {
 
 // optional bool cc_generic_services = 16 [default = false];
 inline bool FileOptions::has_cc_generic_services() const {
-  return (_has_bits_[0] & 0x00000400u) != 0;
+  return (_has_bits_[0] & 0x00000800u) != 0;
 }
 inline void FileOptions::set_has_cc_generic_services() {
-  _has_bits_[0] |= 0x00000400u;
+  _has_bits_[0] |= 0x00000800u;
 }
 inline void FileOptions::clear_has_cc_generic_services() {
-  _has_bits_[0] &= ~0x00000400u;
+  _has_bits_[0] &= ~0x00000800u;
 }
 inline void FileOptions::clear_cc_generic_services() {
   cc_generic_services_ = false;
@@ -6738,13 +6756,13 @@ inline void FileOptions::set_cc_generic_services(bool value) {
 
 // optional bool java_generic_services = 17 [default = false];
 inline bool FileOptions::has_java_generic_services() const {
-  return (_has_bits_[0] & 0x00000800u) != 0;
+  return (_has_bits_[0] & 0x00001000u) != 0;
 }
 inline void FileOptions::set_has_java_generic_services() {
-  _has_bits_[0] |= 0x00000800u;
+  _has_bits_[0] |= 0x00001000u;
 }
 inline void FileOptions::clear_has_java_generic_services() {
-  _has_bits_[0] &= ~0x00000800u;
+  _has_bits_[0] &= ~0x00001000u;
 }
 inline void FileOptions::clear_java_generic_services() {
   java_generic_services_ = false;
@@ -6762,13 +6780,13 @@ inline void FileOptions::set_java_generic_services(bool value) {
 
 // optional bool py_generic_services = 18 [default = false];
 inline bool FileOptions::has_py_generic_services() const {
-  return (_has_bits_[0] & 0x00001000u) != 0;
+  return (_has_bits_[0] & 0x00002000u) != 0;
 }
 inline void FileOptions::set_has_py_generic_services() {
-  _has_bits_[0] |= 0x00001000u;
+  _has_bits_[0] |= 0x00002000u;
 }
 inline void FileOptions::clear_has_py_generic_services() {
-  _has_bits_[0] &= ~0x00001000u;
+  _has_bits_[0] &= ~0x00002000u;
 }
 inline void FileOptions::clear_py_generic_services() {
   py_generic_services_ = false;
@@ -6786,13 +6804,13 @@ inline void FileOptions::set_py_generic_services(bool value) {
 
 // optional bool deprecated = 23 [default = false];
 inline bool FileOptions::has_deprecated() const {
-  return (_has_bits_[0] & 0x00002000u) != 0;
+  return (_has_bits_[0] & 0x00004000u) != 0;
 }
 inline void FileOptions::set_has_deprecated() {
-  _has_bits_[0] |= 0x00002000u;
+  _has_bits_[0] |= 0x00004000u;
 }
 inline void FileOptions::clear_has_deprecated() {
-  _has_bits_[0] &= ~0x00002000u;
+  _has_bits_[0] &= ~0x00004000u;
 }
 inline void FileOptions::clear_deprecated() {
   deprecated_ = false;
@@ -6810,13 +6828,13 @@ inline void FileOptions::set_deprecated(bool value) {
 
 // optional bool cc_enable_arenas = 31 [default = false];
 inline bool FileOptions::has_cc_enable_arenas() const {
-  return (_has_bits_[0] & 0x00004000u) != 0;
+  return (_has_bits_[0] & 0x00008000u) != 0;
 }
 inline void FileOptions::set_has_cc_enable_arenas() {
-  _has_bits_[0] |= 0x00004000u;
+  _has_bits_[0] |= 0x00008000u;
 }
 inline void FileOptions::clear_has_cc_enable_arenas() {
-  _has_bits_[0] &= ~0x00004000u;
+  _has_bits_[0] &= ~0x00008000u;
 }
 inline void FileOptions::clear_cc_enable_arenas() {
   cc_enable_arenas_ = false;
@@ -7084,6 +7102,69 @@ inline void FileOptions::set_allocated_php_class_prefix(::std::string* php_class
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
 }
 
+// optional string php_namespace = 41;
+inline bool FileOptions::has_php_namespace() const {
+  return (_has_bits_[0] & 0x00000080u) != 0;
+}
+inline void FileOptions::set_has_php_namespace() {
+  _has_bits_[0] |= 0x00000080u;
+}
+inline void FileOptions::clear_has_php_namespace() {
+  _has_bits_[0] &= ~0x00000080u;
+}
+inline void FileOptions::clear_php_namespace() {
+  php_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  clear_has_php_namespace();
+}
+inline const ::std::string& FileOptions::php_namespace() const {
+  // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace)
+  return php_namespace_.GetNoArena();
+}
+inline void FileOptions::set_php_namespace(const ::std::string& value) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
+}
+#if LANG_CXX11
+inline void FileOptions::set_php_namespace(::std::string&& value) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:google.protobuf.FileOptions.php_namespace)
+}
+#endif
+inline void FileOptions::set_php_namespace(const char* value) {
+  GOOGLE_DCHECK(value != NULL);
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.php_namespace)
+}
+inline void FileOptions::set_php_namespace(const char* value, size_t size) {
+  set_has_php_namespace();
+  php_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast(value), size));
+  // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace)
+}
+inline ::std::string* FileOptions::mutable_php_namespace() {
+  set_has_php_namespace();
+  // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
+  return php_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* FileOptions::release_php_namespace() {
+  // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
+  clear_has_php_namespace();
+  return php_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void FileOptions::set_allocated_php_namespace(::std::string* php_namespace) {
+  if (php_namespace != NULL) {
+    set_has_php_namespace();
+  } else {
+    clear_has_php_namespace();
+  }
+  php_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), php_namespace);
+  // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
+}
+
 // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
 inline int FileOptions::uninterpreted_option_size() const {
   return uninterpreted_option_.size();
diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto
index f859c429..c7fbaaf6 100644
--- a/src/google/protobuf/descriptor.proto
+++ b/src/google/protobuf/descriptor.proto
@@ -380,6 +380,11 @@ message FileOptions {
   // from this .proto. Default is empty.
   optional string php_class_prefix = 40;
 
+  // Use this option to change the namespace of php generated classes. Default
+  // is empty. When this option is empty, the package name will be used for
+  // determining the namespace.
+  optional string php_namespace = 41;
+
   // The parser stores options it doesn't recognize here. See above.
   repeated UninterpretedOption uninterpreted_option = 999;
 
diff --git a/tests.sh b/tests.sh
index 710389bc..5d11c857 100755
--- a/tests.sh
+++ b/tests.sh
@@ -346,7 +346,7 @@ generate_php_test_proto() {
   # Generate test file
   rm -rf generated
   mkdir generated
-  ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto
+  ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_empty_php_namespace.proto
   pushd ../../src
   ./protoc --php_out=../php/tests/generated google/protobuf/empty.proto
   ./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
-- 
cgit v1.2.3


From 9ba7d1c03810b47e535018d0362a8affef6f7f56 Mon Sep 17 00:00:00 2001
From: Gergely Nagy 
Date: Wed, 12 Apr 2017 13:55:29 +0200
Subject: C++: Do not forward-declare dependencies in generated .h files

---
 src/google/protobuf/api.pb.h                 | 18 -------
 src/google/protobuf/compiler/cpp/cpp_file.cc |  8 ---
 src/google/protobuf/compiler/plugin.pb.h     | 75 ----------------------------
 src/google/protobuf/type.pb.h                |  6 ---
 4 files changed, 107 deletions(-)

(limited to 'src/google')

diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 108c63a4..729e4ad1 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -37,30 +37,12 @@ namespace protobuf {
 class Api;
 class ApiDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern ApiDefaultTypeInternal _Api_default_instance_;
-class Enum;
-class EnumDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern EnumDefaultTypeInternal _Enum_default_instance_;
-class EnumValue;
-class EnumValueDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern EnumValueDefaultTypeInternal _EnumValue_default_instance_;
-class Field;
-class FieldDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern FieldDefaultTypeInternal _Field_default_instance_;
 class Method;
 class MethodDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_;
 class Mixin;
 class MixinDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_;
-class Option;
-class OptionDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern OptionDefaultTypeInternal _Option_default_instance_;
-class SourceContext;
-class SourceContextDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_;
-class Type;
-class TypeDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_;
 }  // namespace protobuf
 }  // namespace google
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index e0542ae8..1f7a66c5 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -925,19 +925,11 @@ void FileGenerator::GenerateNamespaceClosers(io::Printer* printer) {
 
 void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) {
   ForwardDeclarations decls;
-  for (int i = 0; i < file_->dependency_count(); i++) {
-    FileGenerator dependency(file_->dependency(i), options_);
-    dependency.FillForwardDeclarations(&decls);
-  }
   FillForwardDeclarations(&decls);
   decls.Print(printer, options_);
 }
 
 void FileGenerator::FillForwardDeclarations(ForwardDeclarations* decls) {
-  for (int i = 0; i < file_->public_dependency_count(); i++) {
-    FileGenerator dependency(file_->public_dependency(i), options_);
-    dependency.FillForwardDeclarations(decls);
-  }
   for (int i = 0; i < package_parts_.size(); i++) {
     decls = decls->AddOrGetNamespace(package_parts_[i]);
   }
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 4f8befb6..c8ae8774 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -39,81 +39,6 @@
 #endif
 namespace google {
 namespace protobuf {
-class DescriptorProto;
-class DescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern DescriptorProtoDefaultTypeInternal _DescriptorProto_default_instance_;
-class DescriptorProto_ExtensionRange;
-class DescriptorProto_ExtensionRangeDefaultTypeInternal;
-LIBPROTOC_EXPORT extern DescriptorProto_ExtensionRangeDefaultTypeInternal _DescriptorProto_ExtensionRange_default_instance_;
-class DescriptorProto_ReservedRange;
-class DescriptorProto_ReservedRangeDefaultTypeInternal;
-LIBPROTOC_EXPORT extern DescriptorProto_ReservedRangeDefaultTypeInternal _DescriptorProto_ReservedRange_default_instance_;
-class EnumDescriptorProto;
-class EnumDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_;
-class EnumOptions;
-class EnumOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_;
-class EnumValueDescriptorProto;
-class EnumValueDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern EnumValueDescriptorProtoDefaultTypeInternal _EnumValueDescriptorProto_default_instance_;
-class EnumValueOptions;
-class EnumValueOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern EnumValueOptionsDefaultTypeInternal _EnumValueOptions_default_instance_;
-class FieldDescriptorProto;
-class FieldDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_;
-class FieldOptions;
-class FieldOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern FieldOptionsDefaultTypeInternal _FieldOptions_default_instance_;
-class FileDescriptorProto;
-class FileDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern FileDescriptorProtoDefaultTypeInternal _FileDescriptorProto_default_instance_;
-class FileDescriptorSet;
-class FileDescriptorSetDefaultTypeInternal;
-LIBPROTOC_EXPORT extern FileDescriptorSetDefaultTypeInternal _FileDescriptorSet_default_instance_;
-class FileOptions;
-class FileOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern FileOptionsDefaultTypeInternal _FileOptions_default_instance_;
-class GeneratedCodeInfo;
-class GeneratedCodeInfoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern GeneratedCodeInfoDefaultTypeInternal _GeneratedCodeInfo_default_instance_;
-class GeneratedCodeInfo_Annotation;
-class GeneratedCodeInfo_AnnotationDefaultTypeInternal;
-LIBPROTOC_EXPORT extern GeneratedCodeInfo_AnnotationDefaultTypeInternal _GeneratedCodeInfo_Annotation_default_instance_;
-class MessageOptions;
-class MessageOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern MessageOptionsDefaultTypeInternal _MessageOptions_default_instance_;
-class MethodDescriptorProto;
-class MethodDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern MethodDescriptorProtoDefaultTypeInternal _MethodDescriptorProto_default_instance_;
-class MethodOptions;
-class MethodOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_;
-class OneofDescriptorProto;
-class OneofDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern OneofDescriptorProtoDefaultTypeInternal _OneofDescriptorProto_default_instance_;
-class OneofOptions;
-class OneofOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern OneofOptionsDefaultTypeInternal _OneofOptions_default_instance_;
-class ServiceDescriptorProto;
-class ServiceDescriptorProtoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_;
-class ServiceOptions;
-class ServiceOptionsDefaultTypeInternal;
-LIBPROTOC_EXPORT extern ServiceOptionsDefaultTypeInternal _ServiceOptions_default_instance_;
-class SourceCodeInfo;
-class SourceCodeInfoDefaultTypeInternal;
-LIBPROTOC_EXPORT extern SourceCodeInfoDefaultTypeInternal _SourceCodeInfo_default_instance_;
-class SourceCodeInfo_Location;
-class SourceCodeInfo_LocationDefaultTypeInternal;
-LIBPROTOC_EXPORT extern SourceCodeInfo_LocationDefaultTypeInternal _SourceCodeInfo_Location_default_instance_;
-class UninterpretedOption;
-class UninterpretedOptionDefaultTypeInternal;
-LIBPROTOC_EXPORT extern UninterpretedOptionDefaultTypeInternal _UninterpretedOption_default_instance_;
-class UninterpretedOption_NamePart;
-class UninterpretedOption_NamePartDefaultTypeInternal;
-LIBPROTOC_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_;
 namespace compiler {
 class CodeGeneratorRequest;
 class CodeGeneratorRequestDefaultTypeInternal;
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index c1cd4164..5ac80bb9 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -35,9 +35,6 @@
 // @@protoc_insertion_point(includes)
 namespace google {
 namespace protobuf {
-class Any;
-class AnyDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
 class Enum;
 class EnumDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern EnumDefaultTypeInternal _Enum_default_instance_;
@@ -50,9 +47,6 @@ LIBPROTOBUF_EXPORT extern FieldDefaultTypeInternal _Field_default_instance_;
 class Option;
 class OptionDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern OptionDefaultTypeInternal _Option_default_instance_;
-class SourceContext;
-class SourceContextDefaultTypeInternal;
-LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_;
 class Type;
 class TypeDefaultTypeInternal;
 LIBPROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_;
-- 
cgit v1.2.3


From 9094bf0f7e638f68cae72581ae8416e7c2721b41 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro 
Date: Mon, 12 Jun 2017 17:09:55 +0200
Subject: Export symbols used in inline functions

fixed_address_empty_string symbol is used in an inline function.
We have to export it to avoid undefined reference link errors.
---
 src/google/protobuf/generated_message_util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/google')

diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 44174466..a7154b40 100644
--- a/src/google/protobuf/generated_message_util.h
+++ b/src/google/protobuf/generated_message_util.h
@@ -164,7 +164,7 @@ class ExplicitlyConstructed {
 
 // Default empty string object. Don't use this directly. Instead, call
 // GetEmptyString() to get the reference.
-extern ExplicitlyConstructed< ::std::string> fixed_address_empty_string;
+LIBPROTOBUF_EXPORT extern ExplicitlyConstructed< ::std::string> fixed_address_empty_string;
 LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_;
 LIBPROTOBUF_EXPORT void InitEmptyString();
 
-- 
cgit v1.2.3


From 4b36d4006b55375e6bfb9902b49b9bcf43c96f4c Mon Sep 17 00:00:00 2001
From: Calder Coalson 
Date: Fri, 16 Jun 2017 07:06:09 -0700
Subject: Qualify string in java_options.h

Building the protobuf compiler with Bazel fails to resolve the unqualifed "string"s in java_options.h:

```
ERROR: .../external/com_google_protobuf/BUILD:248:1: C++ compilation of rule '@com_google_protobuf//:protoc_lib' failed: Process exited with status 1 [sandboxed].
In file included from external/com_google_protobuf/src/google/protobuf/compiler/java/java_context.h:41:0,
                 from external/com_google_protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc:38:
external/com_google_protobuf/src/google/protobuf/compiler/java/java_options.h:59:3: error: 'string' does not name a type
   string annotation_list_file;
   ^
external/com_google_protobuf/src/google/protobuf/compiler/java/java_options.h:62:3: error: 'string' does not name a type
   string output_list_file;
   ^
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
INFO: Elapsed time: 41.487s, Critical Path: 6.20s
//interpreter:eval_test                                               NO STATUS

Executed 0 out of 1 test: 1 was skipped.
```
---
 src/google/protobuf/compiler/java/java_options.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/google')

diff --git a/src/google/protobuf/compiler/java/java_options.h b/src/google/protobuf/compiler/java/java_options.h
index 7bce1447..e4e7d5e2 100644
--- a/src/google/protobuf/compiler/java/java_options.h
+++ b/src/google/protobuf/compiler/java/java_options.h
@@ -59,10 +59,10 @@ struct Options {
   bool annotate_code;
   // Name of a file where we will write a list of generated .meta file names,
   // one per line.
-  string annotation_list_file;
+  std::string annotation_list_file;
   // Name of a file where we will write a list of generated file names, one
   // per line.
-  string output_list_file;
+  std::string output_list_file;
 };
 
 }  // namespace java
-- 
cgit v1.2.3


From dd19b876d4c9a604946f6c4e39cc4eac5f12cfb9 Mon Sep 17 00:00:00 2001
From: Thomas Van Lenten 
Date: Fri, 16 Jun 2017 12:30:08 -0400
Subject: Raise the number of digits used for floats.

About 1.5% of all IEEE754 single-precision numbers require nine
decimal digits to represent accurately.
---
 conformance/conformance_test.cc      | 1 +
 conformance/failure_list_ruby.txt    | 1 +
 src/google/protobuf/stubs/strutil.cc | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/google')

diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index 0dd7787c..a899435d 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -759,6 +759,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
   });
   TestValidDataForType(FieldDescriptor::TYPE_FLOAT, {
     {flt(0.1), "0.1"},
+    {flt(1.00000075e-36), "1.00000075e-36"},
     {flt(3.402823e+38), "3.402823e+38"},  // 3.40282347e+38
     {flt(1.17549435e-38f), "1.17549435e-38"}
   });
diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt
index 1de6c439..4bac533e 100644
--- a/conformance/failure_list_ruby.txt
+++ b/conformance/failure_list_ruby.txt
@@ -199,5 +199,6 @@ Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
 Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
 Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
 Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
+Required.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
 Required.TimestampProtoInputTooLarge.JsonOutput
 Required.TimestampProtoInputTooSmall.JsonOutput
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 336894b5..1a4d71c8 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1401,7 +1401,7 @@ char* FloatToBuffer(float value, char* buffer) {
   float parsed_value;
   if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) {
     int snprintf_result =
-      snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+2, value);
+      snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+3, value);
 
     // Should never overflow; see above.
     GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize);
-- 
cgit v1.2.3


From 9c0b35cf620c4904a18e25733f50c9c0474fefa6 Mon Sep 17 00:00:00 2001
From: Bo Yang 
Date: Thu, 22 Jun 2017 15:39:19 -0700
Subject: Enusre public header and generated code have no implicit converion.

---
 src/Makefile.am                                    |   2 +-
 src/google/protobuf/any.pb.cc                      |   6 +-
 src/google/protobuf/api.pb.cc                      |  42 ++---
 src/google/protobuf/compiler/cpp/cpp_enum_field.cc |   3 +-
 src/google/protobuf/compiler/cpp/cpp_map_field.cc  |  27 +--
 .../protobuf/compiler/cpp/cpp_primitive_field.cc   |   3 +-
 .../protobuf/compiler/cpp/cpp_string_field.cc      |  20 +-
 src/google/protobuf/compiler/plugin.pb.cc          |  42 ++---
 src/google/protobuf/compiler/profile.pb.cc         |  12 +-
 src/google/protobuf/descriptor.pb.cc               | 207 +++++++++++----------
 src/google/protobuf/field_mask.pb.cc               |   6 +-
 src/google/protobuf/generated_message_reflection.h |   3 +-
 src/google/protobuf/map_entry_lite.h               |   6 +-
 src/google/protobuf/map_field_inl.h                |   2 +-
 src/google/protobuf/map_field_lite.h               |   2 +-
 src/google/protobuf/map_type_handler.h             |   7 +-
 src/google/protobuf/source_context.pb.cc           |   6 +-
 src/google/protobuf/struct.pb.cc                   |  12 +-
 src/google/protobuf/type.pb.cc                     |  54 +++---
 src/google/protobuf/wire_format_lite_inl.h         |   8 +-
 src/google/protobuf/wrappers.pb.cc                 |   6 +-
 21 files changed, 247 insertions(+), 229 deletions(-)

(limited to 'src/google')

diff --git a/src/Makefile.am b/src/Makefile.am
index bfb875ac..45a8a79b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -924,7 +924,7 @@ no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la      \
                         ../gmock/gtest/lib/libgtest_main.la
 no_warning_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include
 no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \
-                           -Wall -Werror
+                           -Wall -Wconversion -Werror
 nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs)
 
 TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index 6c80aaa2..f1cf6d46 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -240,7 +240,7 @@ bool Any::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_type_url()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->type_url().data(), this->type_url().length(),
+            this->type_url().data(), static_cast(this->type_url().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Any.type_url"));
         } else {
@@ -291,7 +291,7 @@ void Any::SerializeWithCachedSizes(
   // string type_url = 1;
   if (this->type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->type_url().data(), this->type_url().length(),
+      this->type_url().data(), static_cast(this->type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Any.type_url");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -316,7 +316,7 @@ void Any::SerializeWithCachedSizes(
   // string type_url = 1;
   if (this->type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->type_url().data(), this->type_url().length(),
+      this->type_url().data(), static_cast(this->type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Any.type_url");
     target =
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 94c6685f..ce937cd1 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -312,7 +312,7 @@ bool Api::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Api.name"));
         } else {
@@ -352,7 +352,7 @@ bool Api::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_version()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->version().data(), this->version().length(),
+            this->version().data(), static_cast(this->version().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Api.version"));
         } else {
@@ -430,7 +430,7 @@ void Api::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Api.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -452,7 +452,7 @@ void Api::SerializeWithCachedSizes(
   // string version = 4;
   if (this->version().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->version().data(), this->version().length(),
+      this->version().data(), static_cast(this->version().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Api.version");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -489,7 +489,7 @@ void Api::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Api.name");
     target =
@@ -514,7 +514,7 @@ void Api::SerializeWithCachedSizes(
   // string version = 4;
   if (this->version().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->version().data(), this->version().length(),
+      this->version().data(), static_cast(this->version().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Api.version");
     target =
@@ -1064,7 +1064,7 @@ bool Method::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Method.name"));
         } else {
@@ -1080,7 +1080,7 @@ bool Method::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_request_type_url()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->request_type_url().data(), this->request_type_url().length(),
+            this->request_type_url().data(), static_cast(this->request_type_url().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Method.request_type_url"));
         } else {
@@ -1110,7 +1110,7 @@ bool Method::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_response_type_url()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->response_type_url().data(), this->response_type_url().length(),
+            this->response_type_url().data(), static_cast(this->response_type_url().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Method.response_type_url"));
         } else {
@@ -1190,7 +1190,7 @@ void Method::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1200,7 +1200,7 @@ void Method::SerializeWithCachedSizes(
   // string request_type_url = 2;
   if (this->request_type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->request_type_url().data(), this->request_type_url().length(),
+      this->request_type_url().data(), static_cast(this->request_type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.request_type_url");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1215,7 +1215,7 @@ void Method::SerializeWithCachedSizes(
   // string response_type_url = 4;
   if (this->response_type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->response_type_url().data(), this->response_type_url().length(),
+      this->response_type_url().data(), static_cast(this->response_type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.response_type_url");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1251,7 +1251,7 @@ void Method::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.name");
     target =
@@ -1262,7 +1262,7 @@ void Method::SerializeWithCachedSizes(
   // string request_type_url = 2;
   if (this->request_type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->request_type_url().data(), this->request_type_url().length(),
+      this->request_type_url().data(), static_cast(this->request_type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.request_type_url");
     target =
@@ -1278,7 +1278,7 @@ void Method::SerializeWithCachedSizes(
   // string response_type_url = 4;
   if (this->response_type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->response_type_url().data(), this->response_type_url().length(),
+      this->response_type_url().data(), static_cast(this->response_type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Method.response_type_url");
     target =
@@ -1780,7 +1780,7 @@ bool Mixin::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Mixin.name"));
         } else {
@@ -1796,7 +1796,7 @@ bool Mixin::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_root()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->root().data(), this->root().length(),
+            this->root().data(), static_cast(this->root().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Mixin.root"));
         } else {
@@ -1835,7 +1835,7 @@ void Mixin::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Mixin.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1845,7 +1845,7 @@ void Mixin::SerializeWithCachedSizes(
   // string root = 2;
   if (this->root().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->root().data(), this->root().length(),
+      this->root().data(), static_cast(this->root().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Mixin.root");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1864,7 +1864,7 @@ void Mixin::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Mixin.name");
     target =
@@ -1875,7 +1875,7 @@ void Mixin::SerializeWithCachedSizes(
   // string root = 2;
   if (this->root().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->root().data(), this->root().length(),
+      this->root().data(), static_cast(this->root().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Mixin.root");
     target =
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index c15be942..023213a9 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -488,7 +488,8 @@ GenerateByteSize(io::Printer* printer) const {
     printer->Print(variables_,
       "if (data_size > 0) {\n"
       "  total_size += $tag_size$ +\n"
-      "    ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n"
+      "    ::google::protobuf::internal::WireFormatLite::Int32Size(\n"
+      "        static_cast(data_size));\n"
       "}\n"
       "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n"
       "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index 52a3b8b0..ee0ed164 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -256,7 +256,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
     } else {
       printer->Print(variables_,
           "    unknown_fields_stream.WriteVarint32($tag$u);\n"
-          "    unknown_fields_stream.WriteVarint32(data.size());\n"
+          "    unknown_fields_stream.WriteVarint32(\n"
+          "        static_cast(data.size()));\n"
           "    unknown_fields_stream.WriteString(data);\n");
     }
 
@@ -267,12 +268,16 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
 
   if (key_field->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
-    key_field, options_, true, variables_,
-        StrCat(key, ".data(), ", key, ".length(),\n").data(), printer);
+        key_field, options_, true, variables_,
+        StrCat(key, ".data(), static_cast(", key, ".length()),\n").data(),
+        printer);
   }
   if (value_field->type() == FieldDescriptor::TYPE_STRING) {
-    GenerateUtf8CheckCodeForString(value_field, options_, true, variables_,
-        StrCat(value, ".data(), ", value, ".length(),\n").data(), printer);
+    GenerateUtf8CheckCodeForString(
+        value_field, options_, true, variables_,
+        StrCat(value, ".data(), static_cast(", value, ".length()),\n")
+            .data(),
+        printer);
   }
 
   // If entry is allocated by arena, its desctructor should be avoided.
@@ -376,14 +381,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
     printer->Indent();
     printer->Indent();
     if (string_key) {
-      GenerateUtf8CheckCodeForString(key_field, options_, false, variables,
-                                     "p->first.data(), p->first.length(),\n",
-                                     printer);
+      GenerateUtf8CheckCodeForString(
+          key_field, options_, false, variables,
+          "p->first.data(), static_cast(p->first.length()),\n", printer);
     }
     if (string_value) {
-      GenerateUtf8CheckCodeForString(value_field, options_, false, variables,
-                                     "p->second.data(), p->second.length(),\n",
-                                     printer);
+      GenerateUtf8CheckCodeForString(
+          value_field, options_, false, variables,
+          "p->second.data(), static_cast(p->second.length()),\n", printer);
     }
     printer->Outdent();
     printer->Outdent();
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index 020c1941..df7c1730 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -452,7 +452,8 @@ GenerateByteSize(io::Printer* printer) const {
     printer->Print(variables_,
       "if (data_size > 0) {\n"
       "  total_size += $tag_size$ +\n"
-      "    ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);\n"
+      "    ::google::protobuf::internal::WireFormatLite::Int32Size(\n"
+      "        static_cast(data_size));\n"
       "}\n"
       "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n"
       "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n"
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index 7a849e2e..6a710888 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -477,7 +477,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, true, variables_,
-        "this->$name$().data(), this->$name$().length(),\n", printer);
+        "this->$name$().data(), static_cast(this->$name$().length()),\n",
+        printer);
   }
 }
 
@@ -486,7 +487,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, false, variables_,
-        "this->$name$().data(), this->$name$().length(),\n", printer);
+        "this->$name$().data(), static_cast(this->$name$().length()),\n",
+        printer);
   }
   printer->Print(variables_,
     "::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(\n"
@@ -498,7 +500,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, false, variables_,
-        "this->$name$().data(), this->$name$().length(),\n", printer);
+        "this->$name$().data(), static_cast(this->$name$().length()),\n",
+        printer);
   }
   printer->Print(variables_,
     "target =\n"
@@ -797,7 +800,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, true, variables_,
-        "this->$name$().data(), this->$name$().length(),\n", printer);
+        "this->$name$().data(), static_cast(this->$name$().length()),\n",
+        printer);
   }
 }
 
@@ -969,7 +973,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, true, variables_,
         "this->$name$(this->$name$_size() - 1).data(),\n"
-        "this->$name$(this->$name$_size() - 1).length(),\n",
+        "static_cast(this->$name$(this->$name$_size() - 1).length()),\n",
         printer);
   }
 }
@@ -982,7 +986,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, false, variables_,
-        "this->$name$(i).data(), this->$name$(i).length(),\n", printer);
+        "this->$name$(i).data(), static_cast(this->$name$(i).length()),\n",
+        printer);
   }
   printer->Outdent();
   printer->Print(variables_,
@@ -999,7 +1004,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
   if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
     GenerateUtf8CheckCodeForString(
         descriptor_, options_, false, variables_,
-        "this->$name$(i).data(), this->$name$(i).length(),\n", printer);
+        "this->$name$(i).data(), static_cast(this->$name$(i).length()),\n",
+        printer);
   }
   printer->Outdent();
   printer->Print(variables_,
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index f7dc1b70..1f6755ff 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -356,7 +356,7 @@ bool Version::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_suffix()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->suffix().data(), this->suffix().length(),
+            this->suffix().data(), static_cast(this->suffix().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.Version.suffix");
         } else {
@@ -412,7 +412,7 @@ void Version::SerializeWithCachedSizes(
   // optional string suffix = 4;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->suffix().data(), this->suffix().length(),
+      this->suffix().data(), static_cast(this->suffix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.Version.suffix");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -451,7 +451,7 @@ void Version::SerializeWithCachedSizes(
   // optional string suffix = 4;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->suffix().data(), this->suffix().length(),
+      this->suffix().data(), static_cast(this->suffix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.Version.suffix");
     target =
@@ -845,7 +845,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
                 input, this->add_file_to_generate()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
             this->file_to_generate(this->file_to_generate_size() - 1).data(),
-            this->file_to_generate(this->file_to_generate_size() - 1).length(),
+            static_cast(this->file_to_generate(this->file_to_generate_size() - 1).length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
         } else {
@@ -861,7 +861,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_parameter()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->parameter().data(), this->parameter().length(),
+            this->parameter().data(), static_cast(this->parameter().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorRequest.parameter");
         } else {
@@ -925,7 +925,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   // repeated string file_to_generate = 1;
   for (int i = 0, n = this->file_to_generate_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->file_to_generate(i).data(), this->file_to_generate(i).length(),
+      this->file_to_generate(i).data(), static_cast(this->file_to_generate(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -936,7 +936,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   // optional string parameter = 2;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->parameter().data(), this->parameter().length(),
+      this->parameter().data(), static_cast(this->parameter().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorRequest.parameter");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -971,7 +971,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   // repeated string file_to_generate = 1;
   for (int i = 0, n = this->file_to_generate_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->file_to_generate(i).data(), this->file_to_generate(i).length(),
+      this->file_to_generate(i).data(), static_cast(this->file_to_generate(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
     target = ::google::protobuf::internal::WireFormatLite::
@@ -982,7 +982,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   // optional string parameter = 2;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->parameter().data(), this->parameter().length(),
+      this->parameter().data(), static_cast(this->parameter().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorRequest.parameter");
     target =
@@ -1464,7 +1464,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorResponse.File.name");
         } else {
@@ -1480,7 +1480,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_insertion_point()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->insertion_point().data(), this->insertion_point().length(),
+            this->insertion_point().data(), static_cast(this->insertion_point().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
         } else {
@@ -1496,7 +1496,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_content()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->content().data(), this->content().length(),
+            this->content().data(), static_cast(this->content().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorResponse.File.content");
         } else {
@@ -1537,7 +1537,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1547,7 +1547,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string insertion_point = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->insertion_point().data(), this->insertion_point().length(),
+      this->insertion_point().data(), static_cast(this->insertion_point().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1557,7 +1557,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string content = 15;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->content().data(), this->content().length(),
+      this->content().data(), static_cast(this->content().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.content");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1581,7 +1581,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.name");
     target =
@@ -1592,7 +1592,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string insertion_point = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->insertion_point().data(), this->insertion_point().length(),
+      this->insertion_point().data(), static_cast(this->insertion_point().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
     target =
@@ -1603,7 +1603,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
   // optional string content = 15;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->content().data(), this->content().length(),
+      this->content().data(), static_cast(this->content().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.File.content");
     target =
@@ -2021,7 +2021,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_error()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->error().data(), this->error().length(),
+            this->error().data(), static_cast(this->error().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.CodeGeneratorResponse.error");
         } else {
@@ -2074,7 +2074,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
   // optional string error = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->error().data(), this->error().length(),
+      this->error().data(), static_cast(this->error().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.error");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -2104,7 +2104,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
   // optional string error = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->error().data(), this->error().length(),
+      this->error().data(), static_cast(this->error().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.CodeGeneratorResponse.error");
     target =
diff --git a/src/google/protobuf/compiler/profile.pb.cc b/src/google/protobuf/compiler/profile.pb.cc
index c185e4f9..1f1d72fb 100644
--- a/src/google/protobuf/compiler/profile.pb.cc
+++ b/src/google/protobuf/compiler/profile.pb.cc
@@ -280,7 +280,7 @@ bool FieldAccessInfo::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.FieldAccessInfo.name");
         } else {
@@ -363,7 +363,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.FieldAccessInfo.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -402,7 +402,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.FieldAccessInfo.name");
     target =
@@ -795,7 +795,7 @@ bool MessageAccessInfo::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.compiler.MessageAccessInfo.name");
         } else {
@@ -862,7 +862,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.MessageAccessInfo.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -897,7 +897,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.compiler.MessageAccessInfo.name");
     target =
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index ff0819ec..dbe56986 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -1431,7 +1431,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileDescriptorProto.name");
         } else {
@@ -1447,7 +1447,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_package()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->package().data(), this->package().length(),
+            this->package().data(), static_cast(this->package().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileDescriptorProto.package");
         } else {
@@ -1464,7 +1464,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
                 input, this->add_dependency()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
             this->dependency(this->dependency_size() - 1).data(),
-            this->dependency(this->dependency_size() - 1).length(),
+            static_cast(this->dependency(this->dependency_size() - 1).length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileDescriptorProto.dependency");
         } else {
@@ -1588,7 +1588,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_syntax()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->syntax().data(), this->syntax().length(),
+            this->syntax().data(), static_cast(this->syntax().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileDescriptorProto.syntax");
         } else {
@@ -1629,7 +1629,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1639,7 +1639,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string package = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->package().data(), this->package().length(),
+      this->package().data(), static_cast(this->package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.package");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1649,7 +1649,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // repeated string dependency = 3;
   for (int i = 0, n = this->dependency_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->dependency(i).data(), this->dependency(i).length(),
+      this->dependency(i).data(), static_cast(this->dependency(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.dependency");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -1707,7 +1707,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string syntax = 12;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->syntax().data(), this->syntax().length(),
+      this->syntax().data(), static_cast(this->syntax().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.syntax");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1731,7 +1731,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.name");
     target =
@@ -1742,7 +1742,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string package = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->package().data(), this->package().length(),
+      this->package().data(), static_cast(this->package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.package");
     target =
@@ -1753,7 +1753,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // repeated string dependency = 3;
   for (int i = 0, n = this->dependency_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->dependency(i).data(), this->dependency(i).length(),
+      this->dependency(i).data(), static_cast(this->dependency(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.dependency");
     target = ::google::protobuf::internal::WireFormatLite::
@@ -1813,7 +1813,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   // optional string syntax = 12;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->syntax().data(), this->syntax().length(),
+      this->syntax().data(), static_cast(this->syntax().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileDescriptorProto.syntax");
     target =
@@ -3394,7 +3394,7 @@ bool DescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.DescriptorProto.name");
         } else {
@@ -3507,7 +3507,7 @@ bool DescriptorProto::MergePartialFromCodedStream(
                 input, this->add_reserved_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
             this->reserved_name(this->reserved_name_size() - 1).data(),
-            this->reserved_name(this->reserved_name_size() - 1).length(),
+            static_cast(this->reserved_name(this->reserved_name_size() - 1).length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.DescriptorProto.reserved_name");
         } else {
@@ -3548,7 +3548,7 @@ void DescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.DescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -3606,7 +3606,7 @@ void DescriptorProto::SerializeWithCachedSizes(
   // repeated string reserved_name = 10;
   for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->reserved_name(i).data(), this->reserved_name(i).length(),
+      this->reserved_name(i).data(), static_cast(this->reserved_name(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.DescriptorProto.reserved_name");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -3630,7 +3630,7 @@ void DescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.DescriptorProto.name");
     target =
@@ -3697,7 +3697,7 @@ void DescriptorProto::SerializeWithCachedSizes(
   // repeated string reserved_name = 10;
   for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->reserved_name(i).data(), this->reserved_name(i).length(),
+      this->reserved_name(i).data(), static_cast(this->reserved_name(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.DescriptorProto.reserved_name");
     target = ::google::protobuf::internal::WireFormatLite::
@@ -4483,7 +4483,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FieldDescriptorProto.name");
         } else {
@@ -4499,7 +4499,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_extendee()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->extendee().data(), this->extendee().length(),
+            this->extendee().data(), static_cast(this->extendee().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FieldDescriptorProto.extendee");
         } else {
@@ -4567,7 +4567,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_type_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->type_name().data(), this->type_name().length(),
+            this->type_name().data(), static_cast(this->type_name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FieldDescriptorProto.type_name");
         } else {
@@ -4583,7 +4583,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_default_value()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->default_value().data(), this->default_value().length(),
+            this->default_value().data(), static_cast(this->default_value().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FieldDescriptorProto.default_value");
         } else {
@@ -4625,7 +4625,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_json_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->json_name().data(), this->json_name().length(),
+            this->json_name().data(), static_cast(this->json_name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FieldDescriptorProto.json_name");
         } else {
@@ -4666,7 +4666,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -4676,7 +4676,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string extendee = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->extendee().data(), this->extendee().length(),
+      this->extendee().data(), static_cast(this->extendee().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.extendee");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -4703,7 +4703,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string type_name = 6;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->type_name().data(), this->type_name().length(),
+      this->type_name().data(), static_cast(this->type_name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.type_name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -4713,7 +4713,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string default_value = 7;
   if (cached_has_bits & 0x00000008u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->default_value().data(), this->default_value().length(),
+      this->default_value().data(), static_cast(this->default_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.default_value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -4734,7 +4734,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string json_name = 10;
   if (cached_has_bits & 0x00000010u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->json_name().data(), this->json_name().length(),
+      this->json_name().data(), static_cast(this->json_name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.json_name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -4758,7 +4758,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.name");
     target =
@@ -4769,7 +4769,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string extendee = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->extendee().data(), this->extendee().length(),
+      this->extendee().data(), static_cast(this->extendee().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.extendee");
     target =
@@ -4797,7 +4797,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string type_name = 6;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->type_name().data(), this->type_name().length(),
+      this->type_name().data(), static_cast(this->type_name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.type_name");
     target =
@@ -4808,7 +4808,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string default_value = 7;
   if (cached_has_bits & 0x00000008u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->default_value().data(), this->default_value().length(),
+      this->default_value().data(), static_cast(this->default_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.default_value");
     target =
@@ -4831,7 +4831,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
   // optional string json_name = 10;
   if (cached_has_bits & 0x00000010u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->json_name().data(), this->json_name().length(),
+      this->json_name().data(), static_cast(this->json_name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FieldDescriptorProto.json_name");
     target =
@@ -5617,7 +5617,7 @@ bool OneofDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.OneofDescriptorProto.name");
         } else {
@@ -5670,7 +5670,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.OneofDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -5700,7 +5700,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.OneofDescriptorProto.name");
     target =
@@ -6050,7 +6050,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.EnumDescriptorProto.name");
         } else {
@@ -6115,7 +6115,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.EnumDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -6151,7 +6151,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.EnumDescriptorProto.name");
     target =
@@ -6553,7 +6553,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.EnumValueDescriptorProto.name");
         } else {
@@ -6620,7 +6620,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.EnumValueDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -6655,7 +6655,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.EnumValueDescriptorProto.name");
     target =
@@ -7046,7 +7046,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.ServiceDescriptorProto.name");
         } else {
@@ -7111,7 +7111,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.ServiceDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -7147,7 +7147,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.ServiceDescriptorProto.name");
     target =
@@ -7577,7 +7577,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.MethodDescriptorProto.name");
         } else {
@@ -7593,7 +7593,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_input_type()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->input_type().data(), this->input_type().length(),
+            this->input_type().data(), static_cast(this->input_type().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.MethodDescriptorProto.input_type");
         } else {
@@ -7609,7 +7609,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_output_type()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->output_type().data(), this->output_type().length(),
+            this->output_type().data(), static_cast(this->output_type().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.MethodDescriptorProto.output_type");
         } else {
@@ -7690,7 +7690,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -7700,7 +7700,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string input_type = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->input_type().data(), this->input_type().length(),
+      this->input_type().data(), static_cast(this->input_type().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.input_type");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -7710,7 +7710,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string output_type = 3;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->output_type().data(), this->output_type().length(),
+      this->output_type().data(), static_cast(this->output_type().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.output_type");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -7750,7 +7750,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string name = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.name");
     target =
@@ -7761,7 +7761,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string input_type = 2;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->input_type().data(), this->input_type().length(),
+      this->input_type().data(), static_cast(this->input_type().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.input_type");
     target =
@@ -7772,7 +7772,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
   // optional string output_type = 3;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->output_type().data(), this->output_type().length(),
+      this->output_type().data(), static_cast(this->output_type().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.MethodDescriptorProto.output_type");
     target =
@@ -8434,7 +8434,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_java_package()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->java_package().data(), this->java_package().length(),
+            this->java_package().data(), static_cast(this->java_package().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.java_package");
         } else {
@@ -8450,7 +8450,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_java_outer_classname()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->java_outer_classname().data(), this->java_outer_classname().length(),
+            this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.java_outer_classname");
         } else {
@@ -8499,7 +8499,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_go_package()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->go_package().data(), this->go_package().length(),
+            this->go_package().data(), static_cast(this->go_package().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.go_package");
         } else {
@@ -8613,7 +8613,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_objc_class_prefix()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->objc_class_prefix().data(), this->objc_class_prefix().length(),
+            this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.objc_class_prefix");
         } else {
@@ -8629,7 +8629,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_csharp_namespace()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->csharp_namespace().data(), this->csharp_namespace().length(),
+            this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.csharp_namespace");
         } else {
@@ -8645,7 +8645,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_swift_prefix()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->swift_prefix().data(), this->swift_prefix().length(),
+            this->swift_prefix().data(), static_cast(this->swift_prefix().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.swift_prefix");
         } else {
@@ -8661,7 +8661,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_php_class_prefix()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->php_class_prefix().data(), this->php_class_prefix().length(),
+            this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.php_class_prefix");
         } else {
@@ -8677,7 +8677,7 @@ bool FileOptions::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_php_namespace()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->php_namespace().data(), this->php_namespace().length(),
+            this->php_namespace().data(), static_cast(this->php_namespace().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.FileOptions.php_namespace");
         } else {
@@ -8735,7 +8735,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string java_package = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->java_package().data(), this->java_package().length(),
+      this->java_package().data(), static_cast(this->java_package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.java_package");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8745,7 +8745,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string java_outer_classname = 8;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->java_outer_classname().data(), this->java_outer_classname().length(),
+      this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.java_outer_classname");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8766,7 +8766,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string go_package = 11;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->go_package().data(), this->go_package().length(),
+      this->go_package().data(), static_cast(this->go_package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.go_package");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8811,7 +8811,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string objc_class_prefix = 36;
   if (cached_has_bits & 0x00000008u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->objc_class_prefix().data(), this->objc_class_prefix().length(),
+      this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.objc_class_prefix");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8821,7 +8821,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string csharp_namespace = 37;
   if (cached_has_bits & 0x00000010u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->csharp_namespace().data(), this->csharp_namespace().length(),
+      this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.csharp_namespace");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8831,7 +8831,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string swift_prefix = 39;
   if (cached_has_bits & 0x00000020u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->swift_prefix().data(), this->swift_prefix().length(),
+      this->swift_prefix().data(), static_cast(this->swift_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.swift_prefix");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8841,7 +8841,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string php_class_prefix = 40;
   if (cached_has_bits & 0x00000040u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->php_class_prefix().data(), this->php_class_prefix().length(),
+      this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.php_class_prefix");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8851,7 +8851,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string php_namespace = 41;
   if (cached_has_bits & 0x00000080u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->php_namespace().data(), this->php_namespace().length(),
+      this->php_namespace().data(), static_cast(this->php_namespace().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.php_namespace");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -8885,7 +8885,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string java_package = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->java_package().data(), this->java_package().length(),
+      this->java_package().data(), static_cast(this->java_package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.java_package");
     target =
@@ -8896,7 +8896,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string java_outer_classname = 8;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->java_outer_classname().data(), this->java_outer_classname().length(),
+      this->java_outer_classname().data(), static_cast(this->java_outer_classname().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.java_outer_classname");
     target =
@@ -8918,7 +8918,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string go_package = 11;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->go_package().data(), this->go_package().length(),
+      this->go_package().data(), static_cast(this->go_package().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.go_package");
     target =
@@ -8964,7 +8964,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string objc_class_prefix = 36;
   if (cached_has_bits & 0x00000008u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->objc_class_prefix().data(), this->objc_class_prefix().length(),
+      this->objc_class_prefix().data(), static_cast(this->objc_class_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.objc_class_prefix");
     target =
@@ -8975,7 +8975,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string csharp_namespace = 37;
   if (cached_has_bits & 0x00000010u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->csharp_namespace().data(), this->csharp_namespace().length(),
+      this->csharp_namespace().data(), static_cast(this->csharp_namespace().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.csharp_namespace");
     target =
@@ -8986,7 +8986,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string swift_prefix = 39;
   if (cached_has_bits & 0x00000020u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->swift_prefix().data(), this->swift_prefix().length(),
+      this->swift_prefix().data(), static_cast(this->swift_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.swift_prefix");
     target =
@@ -8997,7 +8997,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string php_class_prefix = 40;
   if (cached_has_bits & 0x00000040u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->php_class_prefix().data(), this->php_class_prefix().length(),
+      this->php_class_prefix().data(), static_cast(this->php_class_prefix().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.php_class_prefix");
     target =
@@ -9008,7 +9008,7 @@ void FileOptions::SerializeWithCachedSizes(
   // optional string php_namespace = 41;
   if (cached_has_bits & 0x00000080u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->php_namespace().data(), this->php_namespace().length(),
+      this->php_namespace().data(), static_cast(this->php_namespace().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.FileOptions.php_namespace");
     target =
@@ -13267,7 +13267,7 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name_part()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name_part().data(), this->name_part().length(),
+            this->name_part().data(), static_cast(this->name_part().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.UninterpretedOption.NamePart.name_part");
         } else {
@@ -13322,7 +13322,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes(
   // required string name_part = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name_part().data(), this->name_part().length(),
+      this->name_part().data(), static_cast(this->name_part().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.NamePart.name_part");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -13351,7 +13351,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes(
   // required string name_part = 1;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name_part().data(), this->name_part().length(),
+      this->name_part().data(), static_cast(this->name_part().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.NamePart.name_part");
     target =
@@ -13723,7 +13723,7 @@ bool UninterpretedOption::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_identifier_value()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->identifier_value().data(), this->identifier_value().length(),
+            this->identifier_value().data(), static_cast(this->identifier_value().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.UninterpretedOption.identifier_value");
         } else {
@@ -13793,7 +13793,7 @@ bool UninterpretedOption::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_aggregate_value()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->aggregate_value().data(), this->aggregate_value().length(),
+            this->aggregate_value().data(), static_cast(this->aggregate_value().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.UninterpretedOption.aggregate_value");
         } else {
@@ -13840,7 +13840,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
   // optional string identifier_value = 3;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->identifier_value().data(), this->identifier_value().length(),
+      this->identifier_value().data(), static_cast(this->identifier_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.identifier_value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -13871,7 +13871,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
   // optional string aggregate_value = 8;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->aggregate_value().data(), this->aggregate_value().length(),
+      this->aggregate_value().data(), static_cast(this->aggregate_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.aggregate_value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -13902,7 +13902,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
   // optional string identifier_value = 3;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->identifier_value().data(), this->identifier_value().length(),
+      this->identifier_value().data(), static_cast(this->identifier_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.identifier_value");
     target =
@@ -13935,7 +13935,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
   // optional string aggregate_value = 8;
   if (cached_has_bits & 0x00000004u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->aggregate_value().data(), this->aggregate_value().length(),
+      this->aggregate_value().data(), static_cast(this->aggregate_value().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.UninterpretedOption.aggregate_value");
     target =
@@ -14556,7 +14556,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_leading_comments()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->leading_comments().data(), this->leading_comments().length(),
+            this->leading_comments().data(), static_cast(this->leading_comments().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.SourceCodeInfo.Location.leading_comments");
         } else {
@@ -14572,7 +14572,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_trailing_comments()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->trailing_comments().data(), this->trailing_comments().length(),
+            this->trailing_comments().data(), static_cast(this->trailing_comments().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.SourceCodeInfo.Location.trailing_comments");
         } else {
@@ -14589,7 +14589,7 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream(
                 input, this->add_leading_detached_comments()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
             this->leading_detached_comments(this->leading_detached_comments_size() - 1).data(),
-            this->leading_detached_comments(this->leading_detached_comments_size() - 1).length(),
+            static_cast(this->leading_detached_comments(this->leading_detached_comments_size() - 1).length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
         } else {
@@ -14650,7 +14650,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // optional string leading_comments = 3;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->leading_comments().data(), this->leading_comments().length(),
+      this->leading_comments().data(), static_cast(this->leading_comments().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.leading_comments");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -14660,7 +14660,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // optional string trailing_comments = 4;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->trailing_comments().data(), this->trailing_comments().length(),
+      this->trailing_comments().data(), static_cast(this->trailing_comments().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.trailing_comments");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -14670,7 +14670,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // repeated string leading_detached_comments = 6;
   for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(),
+      this->leading_detached_comments(i).data(), static_cast(this->leading_detached_comments(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -14718,7 +14718,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // optional string leading_comments = 3;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->leading_comments().data(), this->leading_comments().length(),
+      this->leading_comments().data(), static_cast(this->leading_comments().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.leading_comments");
     target =
@@ -14729,7 +14729,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // optional string trailing_comments = 4;
   if (cached_has_bits & 0x00000002u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->trailing_comments().data(), this->trailing_comments().length(),
+      this->trailing_comments().data(), static_cast(this->trailing_comments().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.trailing_comments");
     target =
@@ -14740,7 +14740,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // repeated string leading_detached_comments = 6;
   for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->leading_detached_comments(i).data(), this->leading_detached_comments(i).length(),
+      this->leading_detached_comments(i).data(), static_cast(this->leading_detached_comments(i).length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
     target = ::google::protobuf::internal::WireFormatLite::
@@ -14770,7 +14770,8 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
       Int32Size(this->path_);
     if (data_size > 0) {
       total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+            static_cast(data_size));
     }
     int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
     GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -14785,7 +14786,8 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
       Int32Size(this->span_);
     if (data_size > 0) {
       total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+            static_cast(data_size));
     }
     int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
     GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -15555,7 +15557,7 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_source_file()));
           ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->source_file().data(), this->source_file().length(),
+            this->source_file().data(), static_cast(this->source_file().length()),
             ::google::protobuf::internal::WireFormat::PARSE,
             "google.protobuf.GeneratedCodeInfo.Annotation.source_file");
         } else {
@@ -15634,7 +15636,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
   // optional string source_file = 2;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->source_file().data(), this->source_file().length(),
+      this->source_file().data(), static_cast(this->source_file().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.GeneratedCodeInfo.Annotation.source_file");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -15680,7 +15682,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
   // optional string source_file = 2;
   if (cached_has_bits & 0x00000001u) {
     ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->source_file().data(), this->source_file().length(),
+      this->source_file().data(), static_cast(this->source_file().length()),
       ::google::protobuf::internal::WireFormat::SERIALIZE,
       "google.protobuf.GeneratedCodeInfo.Annotation.source_file");
     target =
@@ -15721,7 +15723,8 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const {
       Int32Size(this->path_);
     if (data_size > 0) {
       total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+            static_cast(data_size));
     }
     int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
     GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc
index 094c4cc9..d7efd083 100644
--- a/src/google/protobuf/field_mask.pb.cc
+++ b/src/google/protobuf/field_mask.pb.cc
@@ -213,7 +213,7 @@ bool FieldMask::MergePartialFromCodedStream(
                 input, this->add_paths()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
             this->paths(this->paths_size() - 1).data(),
-            this->paths(this->paths_size() - 1).length(),
+            static_cast(this->paths(this->paths_size() - 1).length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.FieldMask.paths"));
         } else {
@@ -252,7 +252,7 @@ void FieldMask::SerializeWithCachedSizes(
   // repeated string paths = 1;
   for (int i = 0, n = this->paths_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->paths(i).data(), this->paths(i).length(),
+      this->paths(i).data(), static_cast(this->paths(i).length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.FieldMask.paths");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -271,7 +271,7 @@ void FieldMask::SerializeWithCachedSizes(
   // repeated string paths = 1;
   for (int i = 0, n = this->paths_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->paths(i).data(), this->paths(i).length(),
+      this->paths(i).data(), static_cast(this->paths(i).length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.FieldMask.paths");
     target = ::google::protobuf::internal::WireFormatLite::
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h
index 12b73ca3..abeb3d55 100644
--- a/src/google/protobuf/generated_message_reflection.h
+++ b/src/google/protobuf/generated_message_reflection.h
@@ -150,7 +150,8 @@ struct ReflectionSchema {
   }
 
   uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const {
-    return oneof_case_offset_ + (oneof_descriptor->index() * sizeof(uint32));
+    return oneof_case_offset_ +
+           static_cast(oneof_descriptor->index() * sizeof(uint32));
   }
 
   bool HasHasbits() const { return has_bits_offset_ != -1; }
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index c466cc7b..7aad9a1c 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -250,11 +250,11 @@ class MapEntryImpl : public Base {
   int GetCachedSize() const {
     int size = 0;
     size += has_key()
-        ? kTagSize + KeyTypeHandler::GetCachedSize(key())
+        ? static_cast(kTagSize + KeyTypeHandler::GetCachedSize(key()))
         : 0;
     size += has_value()
-        ? kTagSize + ValueTypeHandler::GetCachedSize(
-            value())
+        ? static_cast(kTagSize + ValueTypeHandler::GetCachedSize(
+            value()))
         : 0;
     return size;
   }
diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h
index 8c5da3c6..0cfed72f 100644
--- a/src/google/protobuf/map_field_inl.h
+++ b/src/google/protobuf/map_field_inl.h
@@ -168,7 +168,7 @@ template ::size() const {
   MapFieldBase::SyncMapWithRepeatedField();
-  return impl_.GetMap().size();
+  return static_cast(impl_.GetMap().size());
 }
 
 template * MutableMap() { return &map_; }
 
   // Convenient methods for generated message implementation.
-  int size() const { return map_.size(); }
+  int size() const { return static_cast(map_.size()); }
   void Clear() { return map_.clear(); }
   void MergeFrom(const MapFieldLite& other) {
     for (typename Map::const_iterator it = other.map_.begin();
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index 301b37fe..990136ff 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -284,7 +284,7 @@ MapTypeHandler::ByteSize(
   template                                                      \
   inline int MapTypeHandler::ByteSize( \
       const MapEntryAccessorType& value) {                                     \
-    return WireFormatLite::DeclaredType##Size(value);                          \
+    return static_cast(WireFormatLite::DeclaredType##Size(value));        \
   }
 
 GOOGLE_PROTOBUF_BYTE_SIZE(STRING, String)
@@ -320,7 +320,8 @@ template 
 inline int
 MapTypeHandler::GetCachedSize(
     const MapEntryAccessorType& value) {
-  return WireFormatLite::LengthDelimitedSize(value.GetCachedSize());
+  return static_cast(
+      WireFormatLite::LengthDelimitedSize(value.GetCachedSize()));
 }
 
 #define GET_CACHED_SIZE(FieldType, DeclaredType)                         \
@@ -328,7 +329,7 @@ MapTypeHandler::GetCachedSize(
   inline int                                                             \
   MapTypeHandler::GetCachedSize( \
       const MapEntryAccessorType& value) {                               \
-    return WireFormatLite::DeclaredType##Size(value);                    \
+    return static_cast(WireFormatLite::DeclaredType##Size(value));  \
   }
 
 GET_CACHED_SIZE(STRING, String)
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index 3244444a..8ecb2d19 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -218,7 +218,7 @@ bool SourceContext::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_file_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->file_name().data(), this->file_name().length(),
+            this->file_name().data(), static_cast(this->file_name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.SourceContext.file_name"));
         } else {
@@ -257,7 +257,7 @@ void SourceContext::SerializeWithCachedSizes(
   // string file_name = 1;
   if (this->file_name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->file_name().data(), this->file_name().length(),
+      this->file_name().data(), static_cast(this->file_name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.SourceContext.file_name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -276,7 +276,7 @@ void SourceContext::SerializeWithCachedSizes(
   // string file_name = 1;
   if (this->file_name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->file_name().data(), this->file_name().length(),
+      this->file_name().data(), static_cast(this->file_name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.SourceContext.file_name");
     target =
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index 207e9efe..3905d891 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -340,7 +340,7 @@ bool Struct::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
               input, &parser));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            parser.key().data(), parser.key().length(),
+            parser.key().data(), static_cast(parser.key().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Struct.FieldsEntry.key"));
         } else {
@@ -385,7 +385,7 @@ void Struct::SerializeWithCachedSizes(
     struct Utf8Check {
       static void Check(ConstPtr p) {
         ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-          p->first.data(), p->first.length(),
+          p->first.data(), static_cast(p->first.length()),
           ::google::protobuf::internal::WireFormatLite::SERIALIZE,
           "google.protobuf.Struct.FieldsEntry.key");
       }
@@ -449,7 +449,7 @@ void Struct::SerializeWithCachedSizes(
     struct Utf8Check {
       static void Check(ConstPtr p) {
         ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-          p->first.data(), p->first.length(),
+          p->first.data(), static_cast(p->first.length()),
           ::google::protobuf::internal::WireFormatLite::SERIALIZE,
           "google.protobuf.Struct.FieldsEntry.key");
       }
@@ -834,7 +834,7 @@ bool Value::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_string_value()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->string_value().data(), this->string_value().length(),
+            this->string_value().data(), static_cast(this->string_value().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Value.string_value"));
         } else {
@@ -923,7 +923,7 @@ void Value::SerializeWithCachedSizes(
   // string string_value = 3;
   if (has_string_value()) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->string_value().data(), this->string_value().length(),
+      this->string_value().data(), static_cast(this->string_value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Value.string_value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -970,7 +970,7 @@ void Value::SerializeWithCachedSizes(
   // string string_value = 3;
   if (has_string_value()) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->string_value().data(), this->string_value().length(),
+      this->string_value().data(), static_cast(this->string_value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Value.string_value");
     target =
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 8f017a89..0344a6a1 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -514,7 +514,7 @@ bool Type::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Type.name"));
         } else {
@@ -543,7 +543,7 @@ bool Type::MergePartialFromCodedStream(
                 input, this->add_oneofs()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
             this->oneofs(this->oneofs_size() - 1).data(),
-            this->oneofs(this->oneofs_size() - 1).length(),
+            static_cast(this->oneofs(this->oneofs_size() - 1).length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Type.oneofs"));
         } else {
@@ -621,7 +621,7 @@ void Type::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Type.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -637,7 +637,7 @@ void Type::SerializeWithCachedSizes(
   // repeated string oneofs = 3;
   for (int i = 0, n = this->oneofs_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->oneofs(i).data(), this->oneofs(i).length(),
+      this->oneofs(i).data(), static_cast(this->oneofs(i).length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Type.oneofs");
     ::google::protobuf::internal::WireFormatLite::WriteString(
@@ -674,7 +674,7 @@ void Type::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Type.name");
     target =
@@ -692,7 +692,7 @@ void Type::SerializeWithCachedSizes(
   // repeated string oneofs = 3;
   for (int i = 0, n = this->oneofs_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->oneofs(i).data(), this->oneofs(i).length(),
+      this->oneofs(i).data(), static_cast(this->oneofs(i).length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Type.oneofs");
     target = ::google::protobuf::internal::WireFormatLite::
@@ -1328,7 +1328,7 @@ bool Field::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Field.name"));
         } else {
@@ -1344,7 +1344,7 @@ bool Field::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_type_url()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->type_url().data(), this->type_url().length(),
+            this->type_url().data(), static_cast(this->type_url().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Field.type_url"));
         } else {
@@ -1400,7 +1400,7 @@ bool Field::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_json_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->json_name().data(), this->json_name().length(),
+            this->json_name().data(), static_cast(this->json_name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Field.json_name"));
         } else {
@@ -1416,7 +1416,7 @@ bool Field::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_default_value()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->default_value().data(), this->default_value().length(),
+            this->default_value().data(), static_cast(this->default_value().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Field.default_value"));
         } else {
@@ -1472,7 +1472,7 @@ void Field::SerializeWithCachedSizes(
   // string name = 4;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1482,7 +1482,7 @@ void Field::SerializeWithCachedSizes(
   // string type_url = 6;
   if (this->type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->type_url().data(), this->type_url().length(),
+      this->type_url().data(), static_cast(this->type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.type_url");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1508,7 +1508,7 @@ void Field::SerializeWithCachedSizes(
   // string json_name = 10;
   if (this->json_name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->json_name().data(), this->json_name().length(),
+      this->json_name().data(), static_cast(this->json_name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.json_name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1518,7 +1518,7 @@ void Field::SerializeWithCachedSizes(
   // string default_value = 11;
   if (this->default_value().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->default_value().data(), this->default_value().length(),
+      this->default_value().data(), static_cast(this->default_value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.default_value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -1554,7 +1554,7 @@ void Field::SerializeWithCachedSizes(
   // string name = 4;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.name");
     target =
@@ -1565,7 +1565,7 @@ void Field::SerializeWithCachedSizes(
   // string type_url = 6;
   if (this->type_url().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->type_url().data(), this->type_url().length(),
+      this->type_url().data(), static_cast(this->type_url().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.type_url");
     target =
@@ -1593,7 +1593,7 @@ void Field::SerializeWithCachedSizes(
   // string json_name = 10;
   if (this->json_name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->json_name().data(), this->json_name().length(),
+      this->json_name().data(), static_cast(this->json_name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.json_name");
     target =
@@ -1604,7 +1604,7 @@ void Field::SerializeWithCachedSizes(
   // string default_value = 11;
   if (this->default_value().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->default_value().data(), this->default_value().length(),
+      this->default_value().data(), static_cast(this->default_value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Field.default_value");
     target =
@@ -2340,7 +2340,7 @@ bool Enum::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Enum.name"));
         } else {
@@ -2430,7 +2430,7 @@ void Enum::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Enum.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -2473,7 +2473,7 @@ void Enum::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Enum.name");
     target =
@@ -2959,7 +2959,7 @@ bool EnumValue::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.EnumValue.name"));
         } else {
@@ -3024,7 +3024,7 @@ void EnumValue::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.EnumValue.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -3054,7 +3054,7 @@ void EnumValue::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.EnumValue.name");
     target =
@@ -3460,7 +3460,7 @@ bool Option::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_name()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->name().data(), this->name().length(),
+            this->name().data(), static_cast(this->name().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.Option.name"));
         } else {
@@ -3511,7 +3511,7 @@ void Option::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Option.name");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -3536,7 +3536,7 @@ void Option::SerializeWithCachedSizes(
   // string name = 1;
   if (this->name().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->name().data(), this->name().length(),
+      this->name().data(), static_cast(this->name().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.Option.name");
     target =
diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h
index 05049017..f7b98d1d 100644
--- a/src/google/protobuf/wire_format_lite_inl.h
+++ b/src/google/protobuf/wire_format_lite_inl.h
@@ -268,7 +268,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive(
   if (size > 0) {
     const uint8* buffer = reinterpret_cast(void_pointer);
     // The number of bytes each type occupies on the wire.
-    const int per_value_size = tag_size + sizeof(value);
+    const int per_value_size = tag_size + static_cast(sizeof(value));
 
     // parentheses around (std::min) prevents macro expansion of min(...)
     int elements_available =
@@ -344,8 +344,8 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
   int length;
   if (!input->ReadVarintSizeAsInt(&length)) return false;
   const int old_entries = values->size();
-  const int new_entries = length / sizeof(CType);
-  const int new_bytes = new_entries * sizeof(CType);
+  const int new_entries = length / static_cast(sizeof(CType));
+  const int new_bytes = new_entries * static_cast(sizeof(CType));
   if (new_bytes != length) return false;
   // We would *like* to pre-allocate the buffer to write into (for
   // speed), but *must* avoid performing a very large allocation due
@@ -695,7 +695,7 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray(
   GOOGLE_DCHECK_GT(n, 0);
 
   const T* ii = value.unsafe_data();
-  const int bytes = n * sizeof(ii[0]);
+  const int bytes = n * static_cast(sizeof(ii[0]));
   memcpy(target, ii, bytes);
   return target + bytes;
 #else
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index 12c04fd5..245f7653 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -2209,7 +2209,7 @@ bool StringValue::MergePartialFromCodedStream(
           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                 input, this->mutable_value()));
           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-            this->value().data(), this->value().length(),
+            this->value().data(), static_cast(this->value().length()),
             ::google::protobuf::internal::WireFormatLite::PARSE,
             "google.protobuf.StringValue.value"));
         } else {
@@ -2248,7 +2248,7 @@ void StringValue::SerializeWithCachedSizes(
   // string value = 1;
   if (this->value().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->value().data(), this->value().length(),
+      this->value().data(), static_cast(this->value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.StringValue.value");
     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
@@ -2267,7 +2267,7 @@ void StringValue::SerializeWithCachedSizes(
   // string value = 1;
   if (this->value().size() > 0) {
     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
-      this->value().data(), this->value().length(),
+      this->value().data(), static_cast(this->value().length()),
       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
       "google.protobuf.StringValue.value");
     target =
-- 
cgit v1.2.3


From e3c807d4e752b477b707f5d021264faf9b127304 Mon Sep 17 00:00:00 2001
From: Bo Yang 
Date: Fri, 23 Jun 2017 12:56:44 -0700
Subject: Fix more implicit type conversions in public headers and generated
 code.

---
 src/google/protobuf/api.pb.cc                      |  75 +--
 src/google/protobuf/compiler/cpp/cpp_enum_field.cc |  30 +-
 src/google/protobuf/compiler/cpp/cpp_map_field.cc  |   9 +-
 src/google/protobuf/compiler/cpp/cpp_message.cc    |  14 +-
 .../protobuf/compiler/cpp/cpp_message_field.cc     |  14 +-
 .../protobuf/compiler/cpp/cpp_primitive_field.cc   |   8 +-
 src/google/protobuf/compiler/plugin.pb.cc          |  42 +-
 src/google/protobuf/compiler/profile.pb.cc         |  42 +-
 src/google/protobuf/descriptor.pb.cc               | 550 ++++++++++++---------
 src/google/protobuf/duration.pb.cc                 |  14 +-
 src/google/protobuf/dynamic_message.h              |   8 +-
 src/google/protobuf/generated_message_reflection.h |  18 +-
 src/google/protobuf/map.h                          |   2 +-
 src/google/protobuf/map_entry_lite.h               |  11 +-
 src/google/protobuf/map_type_handler.h             |   3 +-
 src/google/protobuf/repeated_field.h               |   6 +-
 src/google/protobuf/struct.pb.cc                   |  30 +-
 src/google/protobuf/stubs/fastmem.h                |   3 +-
 src/google/protobuf/stubs/hash.h                   |   2 +-
 src/google/protobuf/stubs/port.h                   |   8 +-
 src/google/protobuf/stubs/stringpiece.h            |  20 +-
 src/google/protobuf/timestamp.pb.cc                |  14 +-
 src/google/protobuf/type.pb.cc                     | 108 ++--
 src/google/protobuf/unknown_field_set.h            |   6 +-
 src/google/protobuf/wire_format_lite.h             |  10 +-
 src/google/protobuf/wire_format_lite_inl.h         |   8 +-
 26 files changed, 606 insertions(+), 449 deletions(-)

(limited to 'src/google')

diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index ce937cd1..30dd8dbc 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -240,8 +240,9 @@ Api::Api(const Api& from)
 void Api::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&source_context_, 0, reinterpret_cast(&syntax_) -
-    reinterpret_cast(&source_context_) + sizeof(syntax_));
+  ::memset(&source_context_, 0, static_cast(
+      reinterpret_cast(&syntax_) -
+      reinterpret_cast(&source_context_)) + sizeof(syntax_));
   _cached_size_ = 0;
 }
 
@@ -438,15 +439,17 @@ void Api::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Method methods = 2;
-  for (unsigned int i = 0, n = this->methods_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->methods_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->methods(i), output);
+      2, this->methods(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->options(i), output);
+      3, this->options(static_cast(i)), output);
   }
 
   // string version = 4;
@@ -466,9 +469,10 @@ void Api::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Mixin mixins = 6;
-  for (unsigned int i = 0, n = this->mixins_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->mixins_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      6, this->mixins(i), output);
+      6, this->mixins(static_cast(i)), output);
   }
 
   // .google.protobuf.Syntax syntax = 7;
@@ -498,17 +502,19 @@ void Api::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Method methods = 2;
-  for (unsigned int i = 0, n = this->methods_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->methods_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->methods(i), deterministic, target);
+        2, this->methods(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        3, this->options(i), deterministic, target);
+        3, this->options(static_cast(i)), deterministic, target);
   }
 
   // string version = 4;
@@ -530,10 +536,11 @@ void Api::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Mixin mixins = 6;
-  for (unsigned int i = 0, n = this->mixins_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->mixins_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        6, this->mixins(i), deterministic, target);
+        6, this->mixins(static_cast(i)), deterministic, target);
   }
 
   // .google.protobuf.Syntax syntax = 7;
@@ -552,34 +559,34 @@ size_t Api::ByteSizeLong() const {
 
   // repeated .google.protobuf.Method methods = 2;
   {
-    unsigned int count = this->methods_size();
+    unsigned int count = static_cast(this->methods_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->methods(i));
+          this->methods(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.Option options = 3;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.Mixin mixins = 6;
   {
-    unsigned int count = this->mixins_size();
+    unsigned int count = static_cast(this->mixins_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->mixins(i));
+          this->mixins(static_cast(i)));
     }
   }
 
@@ -989,8 +996,8 @@ Method::Method(const Method& from)
     response_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.response_type_url_);
   }
   ::memcpy(&request_streaming_, &from.request_streaming_,
-    reinterpret_cast(&syntax_) -
-    reinterpret_cast(&request_streaming_) + sizeof(syntax_));
+    static_cast(reinterpret_cast(&syntax_) -
+    reinterpret_cast(&request_streaming_)) + sizeof(syntax_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Method)
 }
 
@@ -998,8 +1005,9 @@ void Method::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   request_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   response_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&request_streaming_, 0, reinterpret_cast(&syntax_) -
-    reinterpret_cast(&request_streaming_) + sizeof(syntax_));
+  ::memset(&request_streaming_, 0, static_cast(
+      reinterpret_cast(&syntax_) -
+      reinterpret_cast(&request_streaming_)) + sizeof(syntax_));
   _cached_size_ = 0;
 }
 
@@ -1043,8 +1051,9 @@ void Method::Clear() {
   name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&request_streaming_, 0, reinterpret_cast(&syntax_) -
-    reinterpret_cast(&request_streaming_) + sizeof(syntax_));
+  ::memset(&request_streaming_, 0, static_cast(
+      reinterpret_cast(&syntax_) -
+      reinterpret_cast(&request_streaming_)) + sizeof(syntax_));
 }
 
 bool Method::MergePartialFromCodedStream(
@@ -1228,9 +1237,10 @@ void Method::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 6;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      6, this->options(i), output);
+      6, this->options(static_cast(i)), output);
   }
 
   // .google.protobuf.Syntax syntax = 7;
@@ -1292,10 +1302,11 @@ void Method::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 6;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        6, this->options(i), deterministic, target);
+        6, this->options(static_cast(i)), deterministic, target);
   }
 
   // .google.protobuf.Syntax syntax = 7;
@@ -1314,12 +1325,12 @@ size_t Method::ByteSizeLong() const {
 
   // repeated .google.protobuf.Option options = 6;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index 023213a9..0d3fdcbe 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -143,12 +143,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
     if (UseUnknownFieldSet(descriptor_->file(), options_)) {
       printer->Print(variables_,
         "} else {\n"
-        "  mutable_unknown_fields()->AddVarint($number$, value);\n");
+        "  mutable_unknown_fields()->AddVarint(\n"
+        "      $number$, static_cast<::google::protobuf::uint64>(value));\n");
     } else {
       printer->Print(
         "} else {\n"
         "  unknown_fields_stream.WriteVarint32($tag$u);\n"
-        "  unknown_fields_stream.WriteVarint32(value);\n",
+        "  unknown_fields_stream.WriteVarint32(\n"
+        "      static_cast<::google::protobuf::uint32>(value));\n",
         "tag", SimpleItoa(internal::WireFormat::MakeTag(descriptor_)));
     }
     printer->Print(variables_,
@@ -344,12 +346,14 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
     if (UseUnknownFieldSet(descriptor_->file(), options_)) {
       printer->Print(variables_,
         "} else {\n"
-        "  mutable_unknown_fields()->AddVarint($number$, value);\n");
+        "  mutable_unknown_fields()->AddVarint(\n"
+        "      $number$, static_cast<::google::protobuf::uint64>(value));\n");
     } else {
       printer->Print(
         "} else {\n"
         "  unknown_fields_stream.WriteVarint32(tag);\n"
-        "  unknown_fields_stream.WriteVarint32(value);\n");
+        "  unknown_fields_stream.WriteVarint32(\n"
+        "      static_cast<::google::protobuf::uint32>(value));\n");
     }
     printer->Print("}\n");
   }
@@ -391,7 +395,7 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
       "::google::protobuf::uint32 length;\n"
       "DO_(input->ReadVarint32(&length));\n"
       "::google::protobuf::io::CodedInputStream::Limit limit = "
-          "input->PushLimit(length);\n"
+          "input->PushLimit(static_cast(length));\n"
       "while (input->BytesUntilLimit() > 0) {\n"
       "  int value;\n"
       "  DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
@@ -407,11 +411,13 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
       "  } else {\n");
       if (UseUnknownFieldSet(descriptor_->file(), options_)) {
         printer->Print(variables_,
-        "    mutable_unknown_fields()->AddVarint($number$, value);\n");
+        "  mutable_unknown_fields()->AddVarint(\n"
+        "      $number$, static_cast<::google::protobuf::uint64>(value));\n");
       } else {
         printer->Print(variables_,
         "    unknown_fields_stream.WriteVarint32(tag);\n"
-        "    unknown_fields_stream.WriteVarint32(value);\n");
+        "    unknown_fields_stream.WriteVarint32(\n"
+        "        static_cast<::google::protobuf::uint32>(value));\n");
       }
       printer->Print(
       "  }\n");
@@ -432,7 +438,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
       "    $number$,\n"
       "    ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
       "    output);\n"
-      "  output->WriteVarint32(_$name$_cached_byte_size_);\n"
+      "  output->WriteVarint32(\n"
+      "      static_cast<::google::protobuf::uint32>(_$name$_cached_byte_size_));\n"
       "}\n");
   }
   printer->Print(variables_,
@@ -460,7 +467,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
       "    ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
       "    target);\n"
       "  target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray("
-      "    _$name$_cached_byte_size_, target);\n"
+      "      static_cast<::google::protobuf::uint32>(\n"
+      "          _$name$_cached_byte_size_), target);\n"
       "  target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n"
       "    this->$name$_, target);\n"
       "}\n");
@@ -476,12 +484,12 @@ GenerateByteSize(io::Printer* printer) const {
   printer->Print(variables_,
     "{\n"
     "  size_t data_size = 0;\n"
-    "  unsigned int count = this->$name$_size();");
+    "  unsigned int count = static_cast(this->$name$_size());");
   printer->Indent();
   printer->Print(variables_,
       "for (unsigned int i = 0; i < count; i++) {\n"
       "  data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(\n"
-      "    this->$name$(i));\n"
+      "    this->$name$(static_cast(i)));\n"
       "}\n");
 
   if (descriptor_->is_packed()) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index ee0ed164..d76db169 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -409,13 +409,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
       "  for (::google::protobuf::Map< $key_cpp$, $val_cpp$ >::const_iterator\n"
       "      it = this->$name$().begin();\n"
       "      it != this->$name$().end(); ++it, ++n) {\n"
-      "    items[n] = SortItem(&*it);\n"
+      "    items[static_cast(n)] = SortItem(&*it);\n"
       "  }\n"
-      "  ::std::sort(&items[0], &items[n], Less());\n");
+      "  ::std::sort(&items[0], &items[static_cast(n)], Less());\n");
   printer->Indent();
   GenerateSerializationLoop(printer, variables, SupportsArenas(descriptor_),
-                            utf8_check, "for (size_type i = 0; i < n; i++)",
-                            string_key ? "items[i]" : "items[i].second", false);
+      utf8_check, "for (size_type i = 0; i < n; i++)",
+      string_key ? "items[static_cast(i)]" :
+                   "items[static_cast(i)].second", false);
   printer->Outdent();
   printer->Print(
       "} else {\n");
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index d9524f64..1ab87638 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -2308,12 +2308,13 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer,
   if (copy_constructor) {
     pod_template =
         "::memcpy(&$first$_, &from.$first$_,\n"
-        "  reinterpret_cast(&$last$_) -\n"
-        "  reinterpret_cast(&$first$_) + sizeof($last$_));\n";
+        "  static_cast(reinterpret_cast(&$last$_) -\n"
+        "  reinterpret_cast(&$first$_)) + sizeof($last$_));\n";
   } else {
     pod_template =
-        "::memset(&$first$_, 0, reinterpret_cast(&$last$_) -\n"
-        "  reinterpret_cast(&$first$_) + sizeof($last$_));\n";
+        "::memset(&$first$_, 0, static_cast(\n"
+        "    reinterpret_cast(&$last$_) -\n"
+        "    reinterpret_cast(&$first$_)) + sizeof($last$_));\n";
   }
 
   for (int i = 0; i < optimized_order_.size(); ++i) {
@@ -2750,8 +2751,9 @@ GenerateClear(io::Printer* printer) {
               FieldName(optimized_order_[memset_run_end]);
 
           printer->Print(
-            "::memset(&$first$_, 0, reinterpret_cast(&$last$_) -\n"
-            "  reinterpret_cast(&$first$_) + sizeof($last$_));\n",
+            "::memset(&$first$_, 0, static_cast(\n"
+            "    reinterpret_cast(&$last$_) -\n"
+            "    reinterpret_cast(&$first$_)) + sizeof($last$_));\n",
             "first", first_field_name,
             "last", last_field_name);
         }
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index fc3c4564..ed1719cc 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -1084,19 +1084,21 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
 void RepeatedMessageFieldGenerator::
 GenerateSerializeWithCachedSizes(io::Printer* printer) const {
   printer->Print(variables_,
-    "for (unsigned int i = 0, n = this->$name$_size(); i < n; i++) {\n"
+    "for (unsigned int i = 0,\n"
+    "    n = static_cast(this->$name$_size()); i < n; i++) {\n"
     "  ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n"
-    "    $number$, this->$name$(i), output);\n"
+    "    $number$, this->$name$(static_cast(i)), output);\n"
     "}\n");
 }
 
 void RepeatedMessageFieldGenerator::
 GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
   printer->Print(variables_,
-    "for (unsigned int i = 0, n = this->$name$_size(); i < n; i++) {\n"
+    "for (unsigned int i = 0,\n"
+    "    n = static_cast(this->$name$_size()); i < n; i++) {\n"
     "  target = ::google::protobuf::internal::WireFormatLite::\n"
     "    InternalWrite$declared_type$NoVirtualToArray(\n"
-    "      $number$, this->$name$(i), deterministic, target);\n"
+    "      $number$, this->$name$(static_cast(i)), deterministic, target);\n"
     "}\n");
 }
 
@@ -1104,14 +1106,14 @@ void RepeatedMessageFieldGenerator::
 GenerateByteSize(io::Printer* printer) const {
   printer->Print(variables_,
     "{\n"
-    "  unsigned int count = this->$name$_size();\n");
+    "  unsigned int count = static_cast(this->$name$_size());\n");
   printer->Indent();
   printer->Print(variables_,
     "total_size += $tag_size$UL * count;\n"
     "for (unsigned int i = 0; i < count; i++) {\n"
     "  total_size +=\n"
     "    ::google::protobuf::internal::WireFormatLite::$declared_type$SizeNoVirtual(\n"
-    "      this->$name$(i));\n"
+    "      this->$name$(static_cast(i)));\n"
     "}\n");
   printer->Outdent();
   printer->Print("}\n");
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index df7c1730..83bc096f 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -382,7 +382,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
           "$number$, "
           "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, "
           "output);\n"
-      "  output->WriteVarint32(_$name$_cached_byte_size_);\n");
+      "  output->WriteVarint32(static_cast<::google::protobuf::uint32>(\n"
+      "      _$name$_cached_byte_size_));\n");
 
     if (FixedSize(descriptor_->type()) > 0) {
       // TODO(ckennelly): Use RepeatedField::unsafe_data() via
@@ -422,7 +423,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
       "    ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n"
       "    target);\n"
       "  target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n"
-      "    _$name$_cached_byte_size_, target);\n"
+      "      static_cast<::google::protobuf::uint32>(\n"
+      "          _$name$_cached_byte_size_), target);\n"
       "  target = ::google::protobuf::internal::WireFormatLite::\n"
       "    Write$declared_type$NoTagToArray(this->$name$_, target);\n"
       "}\n");
@@ -444,7 +446,7 @@ GenerateByteSize(io::Printer* printer) const {
       "  $declared_type$Size(this->$name$_);\n");
   } else {
     printer->Print(variables_,
-      "unsigned int count = this->$name$_size();\n"
+      "unsigned int count = static_cast(this->$name$_size());\n"
       "size_t data_size = $fixed_size$UL * count;\n");
   }
 
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index 1f6755ff..87fcc40f 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -239,16 +239,17 @@ Version::Version(const Version& from)
     suffix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.suffix_);
   }
   ::memcpy(&major_, &from.major_,
-    reinterpret_cast(&patch_) -
-    reinterpret_cast(&major_) + sizeof(patch_));
+    static_cast(reinterpret_cast(&patch_) -
+    reinterpret_cast(&major_)) + sizeof(patch_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version)
 }
 
 void Version::SharedCtor() {
   _cached_size_ = 0;
   suffix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&major_, 0, reinterpret_cast(&patch_) -
-    reinterpret_cast(&major_) + sizeof(patch_));
+  ::memset(&major_, 0, static_cast(
+      reinterpret_cast(&patch_) -
+      reinterpret_cast(&major_)) + sizeof(patch_));
 }
 
 Version::~Version() {
@@ -290,8 +291,9 @@ void Version::Clear() {
     (*suffix_.UnsafeRawStringPointer())->clear();
   }
   if (_has_bits_[0 / 32] & 14u) {
-    ::memset(&major_, 0, reinterpret_cast(&patch_) -
-      reinterpret_cast(&major_) + sizeof(patch_));
+    ::memset(&major_, 0, static_cast(
+        reinterpret_cast(&patch_) -
+        reinterpret_cast(&major_)) + sizeof(patch_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -950,9 +952,10 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
-  for (unsigned int i = 0, n = this->proto_file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->proto_file_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      15, this->proto_file(i), output);
+      15, this->proto_file(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -998,10 +1001,11 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
-  for (unsigned int i = 0, n = this->proto_file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->proto_file_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        15, this->proto_file(i), deterministic, target);
+        15, this->proto_file(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -1031,12 +1035,12 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
 
   // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
   {
-    unsigned int count = this->proto_file_size();
+    unsigned int count = static_cast(this->proto_file_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->proto_file(i));
+          this->proto_file(static_cast(i)));
     }
   }
 
@@ -2082,9 +2086,10 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
-  for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->file_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      15, this->file(i), output);
+      15, this->file(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -2113,10 +2118,11 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
-  for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->file_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        15, this->file(i), deterministic, target);
+        15, this->file(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -2138,12 +2144,12 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
   }
   // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
   {
-    unsigned int count = this->file_size();
+    unsigned int count = static_cast(this->file_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->file(i));
+          this->file(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/compiler/profile.pb.cc b/src/google/protobuf/compiler/profile.pb.cc
index 1f1d72fb..223dcc21 100644
--- a/src/google/protobuf/compiler/profile.pb.cc
+++ b/src/google/protobuf/compiler/profile.pb.cc
@@ -205,16 +205,17 @@ FieldAccessInfo::FieldAccessInfo(const FieldAccessInfo& from)
     name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
   }
   ::memcpy(&getters_count_, &from.getters_count_,
-    reinterpret_cast(&configs_count_) -
-    reinterpret_cast(&getters_count_) + sizeof(configs_count_));
+    static_cast(reinterpret_cast(&configs_count_) -
+    reinterpret_cast(&getters_count_)) + sizeof(configs_count_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.FieldAccessInfo)
 }
 
 void FieldAccessInfo::SharedCtor() {
   _cached_size_ = 0;
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&getters_count_, 0, reinterpret_cast(&configs_count_) -
-    reinterpret_cast(&getters_count_) + sizeof(configs_count_));
+  ::memset(&getters_count_, 0, static_cast(
+      reinterpret_cast(&configs_count_) -
+      reinterpret_cast(&getters_count_)) + sizeof(configs_count_));
 }
 
 FieldAccessInfo::~FieldAccessInfo() {
@@ -256,8 +257,9 @@ void FieldAccessInfo::Clear() {
     (*name_.UnsafeRawStringPointer())->clear();
   }
   if (_has_bits_[0 / 32] & 14u) {
-    ::memset(&getters_count_, 0, reinterpret_cast(&configs_count_) -
-      reinterpret_cast(&getters_count_) + sizeof(configs_count_));
+    ::memset(&getters_count_, 0, static_cast(
+        reinterpret_cast(&configs_count_) -
+        reinterpret_cast(&getters_count_)) + sizeof(configs_count_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -875,9 +877,10 @@ void MessageAccessInfo::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
-  for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->field_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->field(i), output);
+      3, this->field(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -911,10 +914,11 @@ void MessageAccessInfo::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
-  for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->field_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        3, this->field(i), deterministic, target);
+        3, this->field(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -936,12 +940,12 @@ size_t MessageAccessInfo::ByteSizeLong() const {
   }
   // repeated .google.protobuf.compiler.FieldAccessInfo field = 3;
   {
-    unsigned int count = this->field_size();
+    unsigned int count = static_cast(this->field_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->field(i));
+          this->field(static_cast(i)));
     }
   }
 
@@ -1279,9 +1283,10 @@ void AccessInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
-  for (unsigned int i = 0, n = this->message_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->message_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      1, this->message(i), output);
+      1, this->message(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -1298,10 +1303,11 @@ void AccessInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
-  for (unsigned int i = 0, n = this->message_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->message_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        1, this->message(i), deterministic, target);
+        1, this->message(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -1323,12 +1329,12 @@ size_t AccessInfo::ByteSizeLong() const {
   }
   // repeated .google.protobuf.compiler.MessageAccessInfo message = 1;
   {
-    unsigned int count = this->message_size();
+    unsigned int count = static_cast(this->message_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->message(i));
+          this->message(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index dbe56986..6e4e4088 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -1112,9 +1112,10 @@ void FileDescriptorSet::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.FileDescriptorProto file = 1;
-  for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->file_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      1, this->file(i), output);
+      1, this->file(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -1131,10 +1132,11 @@ void FileDescriptorSet::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.FileDescriptorProto file = 1;
-  for (unsigned int i = 0, n = this->file_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->file_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        1, this->file(i), deterministic, target);
+        1, this->file(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -1156,12 +1158,12 @@ size_t FileDescriptorSet::ByteSizeLong() const {
   }
   // repeated .google.protobuf.FileDescriptorProto file = 1;
   {
-    unsigned int count = this->file_size();
+    unsigned int count = static_cast(this->file_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->file(i));
+          this->file(static_cast(i)));
     }
   }
 
@@ -1335,8 +1337,9 @@ void FileDescriptorProto::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   package_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   syntax_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&options_, 0, reinterpret_cast(&source_code_info_) -
-    reinterpret_cast(&options_) + sizeof(source_code_info_));
+  ::memset(&options_, 0, static_cast(
+      reinterpret_cast(&source_code_info_) -
+      reinterpret_cast(&options_)) + sizeof(source_code_info_));
 }
 
 FileDescriptorProto::~FileDescriptorProto() {
@@ -1657,27 +1660,31 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.DescriptorProto message_type = 4;
-  for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->message_type_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      4, this->message_type(i), output);
+      4, this->message_type(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
-  for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enum_type_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      5, this->enum_type(i), output);
+      5, this->enum_type(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.ServiceDescriptorProto service = 6;
-  for (unsigned int i = 0, n = this->service_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->service_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      6, this->service(i), output);
+      6, this->service(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 7;
-  for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      7, this->extension(i), output);
+      7, this->extension(static_cast(i)), output);
   }
 
   // optional .google.protobuf.FileOptions options = 8;
@@ -1761,31 +1768,35 @@ void FileDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.DescriptorProto message_type = 4;
-  for (unsigned int i = 0, n = this->message_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->message_type_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        4, this->message_type(i), deterministic, target);
+        4, this->message_type(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
-  for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enum_type_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        5, this->enum_type(i), deterministic, target);
+        5, this->enum_type(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.ServiceDescriptorProto service = 6;
-  for (unsigned int i = 0, n = this->service_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->service_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        6, this->service(i), deterministic, target);
+        6, this->service(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 7;
-  for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        7, this->extension(i), deterministic, target);
+        7, this->extension(static_cast(i)), deterministic, target);
   }
 
   // optional .google.protobuf.FileOptions options = 8;
@@ -1848,45 +1859,45 @@ size_t FileDescriptorProto::ByteSizeLong() const {
 
   // repeated .google.protobuf.DescriptorProto message_type = 4;
   {
-    unsigned int count = this->message_type_size();
+    unsigned int count = static_cast(this->message_type_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->message_type(i));
+          this->message_type(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
   {
-    unsigned int count = this->enum_type_size();
+    unsigned int count = static_cast(this->enum_type_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->enum_type(i));
+          this->enum_type(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.ServiceDescriptorProto service = 6;
   {
-    unsigned int count = this->service_size();
+    unsigned int count = static_cast(this->service_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->service(i));
+          this->service(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 7;
   {
-    unsigned int count = this->extension_size();
+    unsigned int count = static_cast(this->extension_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->extension(i));
+          this->extension(static_cast(i)));
     }
   }
 
@@ -2611,15 +2622,16 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP
       _cached_size_(0) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   ::memcpy(&start_, &from.start_,
-    reinterpret_cast(&end_) -
-    reinterpret_cast(&start_) + sizeof(end_));
+    static_cast(reinterpret_cast(&end_) -
+    reinterpret_cast(&start_)) + sizeof(end_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange)
 }
 
 void DescriptorProto_ExtensionRange::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&start_, 0, reinterpret_cast(&end_) -
-    reinterpret_cast(&start_) + sizeof(end_));
+  ::memset(&start_, 0, static_cast(
+      reinterpret_cast(&end_) -
+      reinterpret_cast(&start_)) + sizeof(end_));
 }
 
 DescriptorProto_ExtensionRange::~DescriptorProto_ExtensionRange() {
@@ -2656,8 +2668,9 @@ DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::pr
 void DescriptorProto_ExtensionRange::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
   if (_has_bits_[0 / 32] & 3u) {
-    ::memset(&start_, 0, reinterpret_cast(&end_) -
-      reinterpret_cast(&start_) + sizeof(end_));
+    ::memset(&start_, 0, static_cast(
+        reinterpret_cast(&end_) -
+        reinterpret_cast(&start_)) + sizeof(end_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -2948,15 +2961,16 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro
       _cached_size_(0) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   ::memcpy(&start_, &from.start_,
-    reinterpret_cast(&end_) -
-    reinterpret_cast(&start_) + sizeof(end_));
+    static_cast(reinterpret_cast(&end_) -
+    reinterpret_cast(&start_)) + sizeof(end_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange)
 }
 
 void DescriptorProto_ReservedRange::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&start_, 0, reinterpret_cast(&end_) -
-    reinterpret_cast(&start_) + sizeof(end_));
+  ::memset(&start_, 0, static_cast(
+      reinterpret_cast(&end_) -
+      reinterpret_cast(&start_)) + sizeof(end_));
 }
 
 DescriptorProto_ReservedRange::~DescriptorProto_ReservedRange() {
@@ -2993,8 +3007,9 @@ DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::prot
 void DescriptorProto_ReservedRange::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
   if (_has_bits_[0 / 32] & 3u) {
-    ::memset(&start_, 0, reinterpret_cast(&end_) -
-      reinterpret_cast(&start_) + sizeof(end_));
+    ::memset(&start_, 0, static_cast(
+        reinterpret_cast(&end_) -
+        reinterpret_cast(&start_)) + sizeof(end_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -3556,33 +3571,38 @@ void DescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.FieldDescriptorProto field = 2;
-  for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->field_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->field(i), output);
+      2, this->field(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.DescriptorProto nested_type = 3;
-  for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->nested_type_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->nested_type(i), output);
+      3, this->nested_type(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
-  for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enum_type_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      4, this->enum_type(i), output);
+      4, this->enum_type(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
-  for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_range_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      5, this->extension_range(i), output);
+      5, this->extension_range(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 6;
-  for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      6, this->extension(i), output);
+      6, this->extension(static_cast(i)), output);
   }
 
   // optional .google.protobuf.MessageOptions options = 7;
@@ -3592,15 +3612,17 @@ void DescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
-  for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->oneof_decl_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      8, this->oneof_decl(i), output);
+      8, this->oneof_decl(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
-  for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->reserved_range_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      9, this->reserved_range(i), output);
+      9, this->reserved_range(static_cast(i)), output);
   }
 
   // repeated string reserved_name = 10;
@@ -3639,38 +3661,43 @@ void DescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.FieldDescriptorProto field = 2;
-  for (unsigned int i = 0, n = this->field_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->field_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->field(i), deterministic, target);
+        2, this->field(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.DescriptorProto nested_type = 3;
-  for (unsigned int i = 0, n = this->nested_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->nested_type_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        3, this->nested_type(i), deterministic, target);
+        3, this->nested_type(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
-  for (unsigned int i = 0, n = this->enum_type_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enum_type_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        4, this->enum_type(i), deterministic, target);
+        4, this->enum_type(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
-  for (unsigned int i = 0, n = this->extension_range_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_range_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        5, this->extension_range(i), deterministic, target);
+        5, this->extension_range(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 6;
-  for (unsigned int i = 0, n = this->extension_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->extension_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        6, this->extension(i), deterministic, target);
+        6, this->extension(static_cast(i)), deterministic, target);
   }
 
   // optional .google.protobuf.MessageOptions options = 7;
@@ -3681,17 +3708,19 @@ void DescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
-  for (unsigned int i = 0, n = this->oneof_decl_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->oneof_decl_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        8, this->oneof_decl(i), deterministic, target);
+        8, this->oneof_decl(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
-  for (unsigned int i = 0, n = this->reserved_range_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->reserved_range_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        9, this->reserved_range(i), deterministic, target);
+        9, this->reserved_range(static_cast(i)), deterministic, target);
   }
 
   // repeated string reserved_name = 10;
@@ -3723,78 +3752,78 @@ size_t DescriptorProto::ByteSizeLong() const {
   }
   // repeated .google.protobuf.FieldDescriptorProto field = 2;
   {
-    unsigned int count = this->field_size();
+    unsigned int count = static_cast(this->field_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->field(i));
+          this->field(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.DescriptorProto nested_type = 3;
   {
-    unsigned int count = this->nested_type_size();
+    unsigned int count = static_cast(this->nested_type_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->nested_type(i));
+          this->nested_type(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
   {
-    unsigned int count = this->enum_type_size();
+    unsigned int count = static_cast(this->enum_type_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->enum_type(i));
+          this->enum_type(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
   {
-    unsigned int count = this->extension_range_size();
+    unsigned int count = static_cast(this->extension_range_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->extension_range(i));
+          this->extension_range(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.FieldDescriptorProto extension = 6;
   {
-    unsigned int count = this->extension_size();
+    unsigned int count = static_cast(this->extension_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->extension(i));
+          this->extension(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
   {
-    unsigned int count = this->oneof_decl_size();
+    unsigned int count = static_cast(this->oneof_decl_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->oneof_decl(i));
+          this->oneof_decl(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
   {
-    unsigned int count = this->reserved_range_size();
+    unsigned int count = static_cast(this->reserved_range_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->reserved_range(i));
+          this->reserved_range(static_cast(i)));
     }
   }
 
@@ -4369,8 +4398,8 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
     options_ = NULL;
   }
   ::memcpy(&number_, &from.number_,
-    reinterpret_cast(&type_) -
-    reinterpret_cast(&number_) + sizeof(type_));
+    static_cast(reinterpret_cast(&type_) -
+    reinterpret_cast(&number_)) + sizeof(type_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto)
 }
 
@@ -4381,8 +4410,9 @@ void FieldDescriptorProto::SharedCtor() {
   type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&options_, 0, reinterpret_cast(&oneof_index_) -
-    reinterpret_cast(&options_) + sizeof(oneof_index_));
+  ::memset(&options_, 0, static_cast(
+      reinterpret_cast(&oneof_index_) -
+      reinterpret_cast(&options_)) + sizeof(oneof_index_));
   label_ = 1;
   type_ = 1;
 }
@@ -4455,8 +4485,9 @@ void FieldDescriptorProto::Clear() {
     }
   }
   if (_has_bits_[0 / 32] & 192u) {
-    ::memset(&number_, 0, reinterpret_cast(&oneof_index_) -
-      reinterpret_cast(&number_) + sizeof(oneof_index_));
+    ::memset(&number_, 0, static_cast(
+        reinterpret_cast(&oneof_index_) -
+        reinterpret_cast(&number_)) + sizeof(oneof_index_));
   }
   if (_has_bits_[8 / 32] & 768u) {
     label_ = 1;
@@ -4533,7 +4564,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           if (::google::protobuf::FieldDescriptorProto_Label_IsValid(value)) {
             set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(4, value);
+            mutable_unknown_fields()->AddVarint(
+                4, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -4552,7 +4584,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
           if (::google::protobuf::FieldDescriptorProto_Type_IsValid(value)) {
             set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(5, value);
+            mutable_unknown_fields()->AddVarint(
+                5, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -6123,9 +6156,10 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.EnumValueDescriptorProto value = 2;
-  for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->value_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->value(i), output);
+      2, this->value(static_cast(i)), output);
   }
 
   // optional .google.protobuf.EnumOptions options = 3;
@@ -6160,10 +6194,11 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.EnumValueDescriptorProto value = 2;
-  for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->value_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->value(i), deterministic, target);
+        2, this->value(static_cast(i)), deterministic, target);
   }
 
   // optional .google.protobuf.EnumOptions options = 3;
@@ -6192,12 +6227,12 @@ size_t EnumDescriptorProto::ByteSizeLong() const {
   }
   // repeated .google.protobuf.EnumValueDescriptorProto value = 2;
   {
-    unsigned int count = this->value_size();
+    unsigned int count = static_cast(this->value_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->value(i));
+          this->value(static_cast(i)));
     }
   }
 
@@ -6480,8 +6515,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
 void EnumValueDescriptorProto::SharedCtor() {
   _cached_size_ = 0;
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&options_, 0, reinterpret_cast(&number_) -
-    reinterpret_cast(&options_) + sizeof(number_));
+  ::memset(&options_, 0, static_cast(
+      reinterpret_cast(&number_) -
+      reinterpret_cast(&options_)) + sizeof(number_));
 }
 
 EnumValueDescriptorProto::~EnumValueDescriptorProto() {
@@ -7119,9 +7155,10 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.MethodDescriptorProto method = 2;
-  for (unsigned int i = 0, n = this->method_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->method_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->method(i), output);
+      2, this->method(static_cast(i)), output);
   }
 
   // optional .google.protobuf.ServiceOptions options = 3;
@@ -7156,10 +7193,11 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.MethodDescriptorProto method = 2;
-  for (unsigned int i = 0, n = this->method_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->method_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->method(i), deterministic, target);
+        2, this->method(static_cast(i)), deterministic, target);
   }
 
   // optional .google.protobuf.ServiceOptions options = 3;
@@ -7188,12 +7226,12 @@ size_t ServiceDescriptorProto::ByteSizeLong() const {
   }
   // repeated .google.protobuf.MethodDescriptorProto method = 2;
   {
-    unsigned int count = this->method_size();
+    unsigned int count = static_cast(this->method_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->method(i));
+          this->method(static_cast(i)));
     }
   }
 
@@ -7481,8 +7519,8 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
     options_ = NULL;
   }
   ::memcpy(&client_streaming_, &from.client_streaming_,
-    reinterpret_cast(&server_streaming_) -
-    reinterpret_cast(&client_streaming_) + sizeof(server_streaming_));
+    static_cast(reinterpret_cast(&server_streaming_) -
+    reinterpret_cast(&client_streaming_)) + sizeof(server_streaming_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto)
 }
 
@@ -7491,8 +7529,9 @@ void MethodDescriptorProto::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   input_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   output_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&options_, 0, reinterpret_cast(&server_streaming_) -
-    reinterpret_cast(&options_) + sizeof(server_streaming_));
+  ::memset(&options_, 0, static_cast(
+      reinterpret_cast(&server_streaming_) -
+      reinterpret_cast(&options_)) + sizeof(server_streaming_));
 }
 
 MethodDescriptorProto::~MethodDescriptorProto() {
@@ -7553,8 +7592,9 @@ void MethodDescriptorProto::Clear() {
     }
   }
   if (_has_bits_[0 / 32] & 48u) {
-    ::memset(&client_streaming_, 0, reinterpret_cast(&server_streaming_) -
-      reinterpret_cast(&client_streaming_) + sizeof(server_streaming_));
+    ::memset(&client_streaming_, 0, static_cast(
+        reinterpret_cast(&server_streaming_) -
+        reinterpret_cast(&client_streaming_)) + sizeof(server_streaming_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -8311,8 +8351,8 @@ FileOptions::FileOptions(const FileOptions& from)
     php_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.php_namespace_);
   }
   ::memcpy(&java_multiple_files_, &from.java_multiple_files_,
-    reinterpret_cast(&optimize_for_) -
-    reinterpret_cast(&java_multiple_files_) + sizeof(optimize_for_));
+    static_cast(reinterpret_cast(&optimize_for_) -
+    reinterpret_cast(&java_multiple_files_)) + sizeof(optimize_for_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions)
 }
 
@@ -8326,8 +8366,9 @@ void FileOptions::SharedCtor() {
   swift_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   php_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   php_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) -
-    reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_));
+  ::memset(&java_multiple_files_, 0, static_cast(
+      reinterpret_cast(&cc_enable_arenas_) -
+      reinterpret_cast(&java_multiple_files_)) + sizeof(cc_enable_arenas_));
   optimize_for_ = 1;
 }
 
@@ -8409,8 +8450,9 @@ void FileOptions::Clear() {
     }
   }
   if (_has_bits_[8 / 32] & 65280u) {
-    ::memset(&java_multiple_files_, 0, reinterpret_cast(&cc_enable_arenas_) -
-      reinterpret_cast(&java_multiple_files_) + sizeof(cc_enable_arenas_));
+    ::memset(&java_multiple_files_, 0, static_cast(
+        reinterpret_cast(&cc_enable_arenas_) -
+        reinterpret_cast(&java_multiple_files_)) + sizeof(cc_enable_arenas_));
   }
   optimize_for_ = 1;
   _has_bits_.Clear();
@@ -8470,7 +8512,8 @@ bool FileOptions::MergePartialFromCodedStream(
           if (::google::protobuf::FileOptions_OptimizeMode_IsValid(value)) {
             set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(9, value);
+            mutable_unknown_fields()->AddVarint(
+                9, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -8859,9 +8902,10 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -9017,10 +9061,11 @@ void FileOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -9048,12 +9093,12 @@ size_t FileOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -10101,15 +10146,16 @@ MessageOptions::MessageOptions(const MessageOptions& from)
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   _extensions_.MergeFrom(from._extensions_);
   ::memcpy(&message_set_wire_format_, &from.message_set_wire_format_,
-    reinterpret_cast(&map_entry_) -
-    reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_));
+    static_cast(reinterpret_cast(&map_entry_) -
+    reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions)
 }
 
 void MessageOptions::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&message_set_wire_format_, 0, reinterpret_cast(&map_entry_) -
-    reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_));
+  ::memset(&message_set_wire_format_, 0, static_cast(
+      reinterpret_cast(&map_entry_) -
+      reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_));
 }
 
 MessageOptions::~MessageOptions() {
@@ -10148,8 +10194,9 @@ void MessageOptions::Clear() {
   _extensions_.Clear();
   uninterpreted_option_.Clear();
   if (_has_bits_[0 / 32] & 15u) {
-    ::memset(&message_set_wire_format_, 0, reinterpret_cast(&map_entry_) -
-      reinterpret_cast(&message_set_wire_format_) + sizeof(map_entry_));
+    ::memset(&message_set_wire_format_, 0, static_cast(
+        reinterpret_cast(&map_entry_) -
+        reinterpret_cast(&message_set_wire_format_)) + sizeof(map_entry_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -10288,9 +10335,10 @@ void MessageOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -10332,10 +10380,11 @@ void MessageOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -10363,12 +10412,12 @@ size_t MessageOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -10647,15 +10696,16 @@ FieldOptions::FieldOptions(const FieldOptions& from)
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   _extensions_.MergeFrom(from._extensions_);
   ::memcpy(&ctype_, &from.ctype_,
-    reinterpret_cast(&jstype_) -
-    reinterpret_cast(&ctype_) + sizeof(jstype_));
+    static_cast(reinterpret_cast(&jstype_) -
+    reinterpret_cast(&ctype_)) + sizeof(jstype_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions)
 }
 
 void FieldOptions::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&ctype_, 0, reinterpret_cast(&jstype_) -
-    reinterpret_cast(&ctype_) + sizeof(jstype_));
+  ::memset(&ctype_, 0, static_cast(
+      reinterpret_cast(&jstype_) -
+      reinterpret_cast(&ctype_)) + sizeof(jstype_));
 }
 
 FieldOptions::~FieldOptions() {
@@ -10694,8 +10744,9 @@ void FieldOptions::Clear() {
   _extensions_.Clear();
   uninterpreted_option_.Clear();
   if (_has_bits_[0 / 32] & 63u) {
-    ::memset(&ctype_, 0, reinterpret_cast(&jstype_) -
-      reinterpret_cast(&ctype_) + sizeof(jstype_));
+    ::memset(&ctype_, 0, static_cast(
+        reinterpret_cast(&jstype_) -
+        reinterpret_cast(&ctype_)) + sizeof(jstype_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -10722,7 +10773,8 @@ bool FieldOptions::MergePartialFromCodedStream(
           if (::google::protobuf::FieldOptions_CType_IsValid(value)) {
             set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(1, value);
+            mutable_unknown_fields()->AddVarint(
+                1, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -10783,7 +10835,8 @@ bool FieldOptions::MergePartialFromCodedStream(
           if (::google::protobuf::FieldOptions_JSType_IsValid(value)) {
             set_jstype(static_cast< ::google::protobuf::FieldOptions_JSType >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(6, value);
+            mutable_unknown_fields()->AddVarint(
+                6, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -10884,9 +10937,10 @@ void FieldOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -10940,10 +10994,11 @@ void FieldOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -10971,12 +11026,12 @@ size_t FieldOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -11420,9 +11475,10 @@ void OneofOptions::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -11443,10 +11499,11 @@ void OneofOptions::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -11474,12 +11531,12 @@ size_t OneofOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -11616,15 +11673,16 @@ EnumOptions::EnumOptions(const EnumOptions& from)
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   _extensions_.MergeFrom(from._extensions_);
   ::memcpy(&allow_alias_, &from.allow_alias_,
-    reinterpret_cast(&deprecated_) -
-    reinterpret_cast(&allow_alias_) + sizeof(deprecated_));
+    static_cast(reinterpret_cast(&deprecated_) -
+    reinterpret_cast(&allow_alias_)) + sizeof(deprecated_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions)
 }
 
 void EnumOptions::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&allow_alias_, 0, reinterpret_cast(&deprecated_) -
-    reinterpret_cast(&allow_alias_) + sizeof(deprecated_));
+  ::memset(&allow_alias_, 0, static_cast(
+      reinterpret_cast(&deprecated_) -
+      reinterpret_cast(&allow_alias_)) + sizeof(deprecated_));
 }
 
 EnumOptions::~EnumOptions() {
@@ -11663,8 +11721,9 @@ void EnumOptions::Clear() {
   _extensions_.Clear();
   uninterpreted_option_.Clear();
   if (_has_bits_[0 / 32] & 3u) {
-    ::memset(&allow_alias_, 0, reinterpret_cast(&deprecated_) -
-      reinterpret_cast(&allow_alias_) + sizeof(deprecated_));
+    ::memset(&allow_alias_, 0, static_cast(
+        reinterpret_cast(&deprecated_) -
+        reinterpret_cast(&allow_alias_)) + sizeof(deprecated_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -11765,9 +11824,10 @@ void EnumOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -11799,10 +11859,11 @@ void EnumOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -11830,12 +11891,12 @@ size_t EnumOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -12167,9 +12228,10 @@ void EnumValueOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -12196,10 +12258,11 @@ void EnumValueOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -12227,12 +12290,12 @@ size_t EnumValueOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -12525,9 +12588,10 @@ void ServiceOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -12554,10 +12618,11 @@ void ServiceOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -12585,12 +12650,12 @@ size_t ServiceOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -12760,15 +12825,16 @@ MethodOptions::MethodOptions(const MethodOptions& from)
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   _extensions_.MergeFrom(from._extensions_);
   ::memcpy(&deprecated_, &from.deprecated_,
-    reinterpret_cast(&idempotency_level_) -
-    reinterpret_cast(&deprecated_) + sizeof(idempotency_level_));
+    static_cast(reinterpret_cast(&idempotency_level_) -
+    reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions)
 }
 
 void MethodOptions::SharedCtor() {
   _cached_size_ = 0;
-  ::memset(&deprecated_, 0, reinterpret_cast(&idempotency_level_) -
-    reinterpret_cast(&deprecated_) + sizeof(idempotency_level_));
+  ::memset(&deprecated_, 0, static_cast(
+      reinterpret_cast(&idempotency_level_) -
+      reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_));
 }
 
 MethodOptions::~MethodOptions() {
@@ -12807,8 +12873,9 @@ void MethodOptions::Clear() {
   _extensions_.Clear();
   uninterpreted_option_.Clear();
   if (_has_bits_[0 / 32] & 3u) {
-    ::memset(&deprecated_, 0, reinterpret_cast(&idempotency_level_) -
-      reinterpret_cast(&deprecated_) + sizeof(idempotency_level_));
+    ::memset(&deprecated_, 0, static_cast(
+        reinterpret_cast(&idempotency_level_) -
+        reinterpret_cast(&deprecated_)) + sizeof(idempotency_level_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -12849,7 +12916,8 @@ bool MethodOptions::MergePartialFromCodedStream(
           if (::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value)) {
             set_idempotency_level(static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(value));
           } else {
-            mutable_unknown_fields()->AddVarint(34, value);
+            mutable_unknown_fields()->AddVarint(
+                34, static_cast<::google::protobuf::uint64>(value));
           }
         } else {
           goto handle_unusual;
@@ -12915,9 +12983,10 @@ void MethodOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      999, this->uninterpreted_option(i), output);
+      999, this->uninterpreted_option(static_cast(i)), output);
   }
 
   // Extension range [1000, 536870912)
@@ -12950,10 +13019,11 @@ void MethodOptions::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
-  for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->uninterpreted_option_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        999, this->uninterpreted_option(i), deterministic, target);
+        999, this->uninterpreted_option(static_cast(i)), deterministic, target);
   }
 
   // Extension range [1000, 536870912)
@@ -12981,12 +13051,12 @@ size_t MethodOptions::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
   {
-    unsigned int count = this->uninterpreted_option_size();
+    unsigned int count = static_cast(this->uninterpreted_option_size());
     total_size += 2UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->uninterpreted_option(i));
+          this->uninterpreted_option(static_cast(i)));
     }
   }
 
@@ -13621,8 +13691,8 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
     aggregate_value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.aggregate_value_);
   }
   ::memcpy(&positive_int_value_, &from.positive_int_value_,
-    reinterpret_cast(&double_value_) -
-    reinterpret_cast(&positive_int_value_) + sizeof(double_value_));
+    static_cast(reinterpret_cast(&double_value_) -
+    reinterpret_cast(&positive_int_value_)) + sizeof(double_value_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption)
 }
 
@@ -13631,8 +13701,9 @@ void UninterpretedOption::SharedCtor() {
   identifier_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   aggregate_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&positive_int_value_, 0, reinterpret_cast(&double_value_) -
-    reinterpret_cast(&positive_int_value_) + sizeof(double_value_));
+  ::memset(&positive_int_value_, 0, static_cast(
+      reinterpret_cast(&double_value_) -
+      reinterpret_cast(&positive_int_value_)) + sizeof(double_value_));
 }
 
 UninterpretedOption::~UninterpretedOption() {
@@ -13687,8 +13758,9 @@ void UninterpretedOption::Clear() {
     }
   }
   if (_has_bits_[0 / 32] & 56u) {
-    ::memset(&positive_int_value_, 0, reinterpret_cast(&double_value_) -
-      reinterpret_cast(&positive_int_value_) + sizeof(double_value_));
+    ::memset(&positive_int_value_, 0, static_cast(
+        reinterpret_cast(&double_value_) -
+        reinterpret_cast(&positive_int_value_)) + sizeof(double_value_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -13831,9 +13903,10 @@ void UninterpretedOption::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
-  for (unsigned int i = 0, n = this->name_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->name_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->name(i), output);
+      2, this->name(static_cast(i)), output);
   }
 
   cached_has_bits = _has_bits_[0];
@@ -13892,10 +13965,11 @@ void UninterpretedOption::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
-  for (unsigned int i = 0, n = this->name_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->name_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->name(i), deterministic, target);
+        2, this->name(static_cast(i)), deterministic, target);
   }
 
   cached_has_bits = _has_bits_[0];
@@ -13962,12 +14036,12 @@ size_t UninterpretedOption::ByteSizeLong() const {
   }
   // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
   {
-    unsigned int count = this->name_size();
+    unsigned int count = static_cast(this->name_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->name(i));
+          this->name(static_cast(i)));
     }
   }
 
@@ -14629,7 +14703,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // repeated int32 path = 1 [packed = true];
   if (this->path_size() > 0) {
     ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
-    output->WriteVarint32(_path_cached_byte_size_);
+    output->WriteVarint32(static_cast<::google::protobuf::uint32>(
+        _path_cached_byte_size_));
   }
   for (int i = 0, n = this->path_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
@@ -14639,7 +14714,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
   // repeated int32 span = 2 [packed = true];
   if (this->span_size() > 0) {
     ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
-    output->WriteVarint32(_span_cached_byte_size_);
+    output->WriteVarint32(static_cast<::google::protobuf::uint32>(
+        _span_cached_byte_size_));
   }
   for (int i = 0, n = this->span_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
@@ -14697,7 +14773,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
       ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
       target);
     target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
-      _path_cached_byte_size_, target);
+        static_cast<::google::protobuf::uint32>(
+            _path_cached_byte_size_), target);
     target = ::google::protobuf::internal::WireFormatLite::
       WriteInt32NoTagToArray(this->path_, target);
   }
@@ -14709,7 +14786,8 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes(
       ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
       target);
     target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
-      _span_cached_byte_size_, target);
+        static_cast<::google::protobuf::uint32>(
+            _span_cached_byte_size_), target);
     target = ::google::protobuf::internal::WireFormatLite::
       WriteInt32NoTagToArray(this->span_, target);
   }
@@ -15280,9 +15358,10 @@ void SourceCodeInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
-  for (unsigned int i = 0, n = this->location_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->location_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      1, this->location(i), output);
+      1, this->location(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -15299,10 +15378,11 @@ void SourceCodeInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
-  for (unsigned int i = 0, n = this->location_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->location_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        1, this->location(i), deterministic, target);
+        1, this->location(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -15324,12 +15404,12 @@ size_t SourceCodeInfo::ByteSizeLong() const {
   }
   // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
   {
-    unsigned int count = this->location_size();
+    unsigned int count = static_cast(this->location_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->location(i));
+          this->location(static_cast(i)));
     }
   }
 
@@ -15463,16 +15543,17 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
     source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_);
   }
   ::memcpy(&begin_, &from.begin_,
-    reinterpret_cast(&end_) -
-    reinterpret_cast(&begin_) + sizeof(end_));
+    static_cast(reinterpret_cast(&end_) -
+    reinterpret_cast(&begin_)) + sizeof(end_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation)
 }
 
 void GeneratedCodeInfo_Annotation::SharedCtor() {
   _cached_size_ = 0;
   source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&begin_, 0, reinterpret_cast(&end_) -
-    reinterpret_cast(&begin_) + sizeof(end_));
+  ::memset(&begin_, 0, static_cast(
+      reinterpret_cast(&end_) -
+      reinterpret_cast(&begin_)) + sizeof(end_));
 }
 
 GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() {
@@ -15515,8 +15596,9 @@ void GeneratedCodeInfo_Annotation::Clear() {
     (*source_file_.UnsafeRawStringPointer())->clear();
   }
   if (_has_bits_[0 / 32] & 6u) {
-    ::memset(&begin_, 0, reinterpret_cast(&end_) -
-      reinterpret_cast(&begin_) + sizeof(end_));
+    ::memset(&begin_, 0, static_cast(
+        reinterpret_cast(&end_) -
+        reinterpret_cast(&begin_)) + sizeof(end_));
   }
   _has_bits_.Clear();
   _internal_metadata_.Clear();
@@ -15625,7 +15707,8 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
   // repeated int32 path = 1 [packed = true];
   if (this->path_size() > 0) {
     ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
-    output->WriteVarint32(_path_cached_byte_size_);
+    output->WriteVarint32(static_cast<::google::protobuf::uint32>(
+        _path_cached_byte_size_));
   }
   for (int i = 0, n = this->path_size(); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
@@ -15673,7 +15756,8 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes(
       ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
       target);
     target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
-      _path_cached_byte_size_, target);
+        static_cast<::google::protobuf::uint32>(
+            _path_cached_byte_size_), target);
     target = ::google::protobuf::internal::WireFormatLite::
       WriteInt32NoTagToArray(this->path_, target);
   }
@@ -16102,9 +16186,10 @@ void GeneratedCodeInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
-  for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->annotation_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      1, this->annotation(i), output);
+      1, this->annotation(static_cast(i)), output);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -16121,10 +16206,11 @@ void GeneratedCodeInfo::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
-  for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->annotation_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        1, this->annotation(i), deterministic, target);
+        1, this->annotation(static_cast(i)), deterministic, target);
   }
 
   if (_internal_metadata_.have_unknown_fields()) {
@@ -16146,12 +16232,12 @@ size_t GeneratedCodeInfo::ByteSizeLong() const {
   }
   // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
   {
-    unsigned int count = this->annotation_size();
+    unsigned int count = static_cast(this->annotation_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->annotation(i));
+          this->annotation(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc
index ae1a5e08..1933c6d2 100644
--- a/src/google/protobuf/duration.pb.cc
+++ b/src/google/protobuf/duration.pb.cc
@@ -164,14 +164,15 @@ Duration::Duration(const Duration& from)
       _cached_size_(0) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   ::memcpy(&seconds_, &from.seconds_,
-    reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+    static_cast(reinterpret_cast(&nanos_) -
+    reinterpret_cast(&seconds_)) + sizeof(nanos_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
 }
 
 void Duration::SharedCtor() {
-  ::memset(&seconds_, 0, reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+  ::memset(&seconds_, 0, static_cast(
+      reinterpret_cast(&nanos_) -
+      reinterpret_cast(&seconds_)) + sizeof(nanos_));
   _cached_size_ = 0;
 }
 
@@ -215,8 +216,9 @@ Duration* Duration::New(::google::protobuf::Arena* arena) const {
 
 void Duration::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
-  ::memset(&seconds_, 0, reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+  ::memset(&seconds_, 0, static_cast(
+      reinterpret_cast(&nanos_) -
+      reinterpret_cast(&seconds_)) + sizeof(nanos_));
 }
 
 bool Duration::MergePartialFromCodedStream(
diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h
index 816170ea..eed8e5bd 100644
--- a/src/google/protobuf/dynamic_message.h
+++ b/src/google/protobuf/dynamic_message.h
@@ -156,20 +156,20 @@ class LIBPROTOBUF_EXPORT DynamicMapSorter {
                                           int map_size,
                                           const Reflection* reflection,
                                           const FieldDescriptor* field) {
-    std::vector result(map_size);
+    std::vector result(static_cast(map_size));
     const RepeatedPtrField& map_field =
         reflection->GetRepeatedPtrField(message, field);
-    int i = 0;
+    size_t i = 0;
     for (RepeatedPtrField::const_pointer_iterator it =
              map_field.pointer_begin(); it != map_field.pointer_end(); ) {
       result[i++] = *it++;
     }
-    GOOGLE_DCHECK_EQ(result.size(), static_cast(i));
+    GOOGLE_DCHECK_EQ(result.size(), i);
     MapEntryMessageComparator comparator(field->message_type());
     std::sort(result.begin(), result.end(), comparator);
     // Complain if the keys aren't in ascending order.
 #ifndef NDEBUG
-    for (int j = 1; j < map_size; j++) {
+    for (size_t j = 1; j < static_cast(map_size); j++) {
       if (!comparator(result[j - 1], result[j])) {
         GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) ?
                        "internal error in map key sorting" :
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h
index abeb3d55..6045b3aa 100644
--- a/src/google/protobuf/generated_message_reflection.h
+++ b/src/google/protobuf/generated_message_reflection.h
@@ -129,7 +129,7 @@ class WeakFieldMap;             // weak_field_map.h
 struct ReflectionSchema {
  public:
   // Size of a google::protobuf::Message object of this type.
-  uint32 GetObjectSize() const { return object_size_; }
+  uint32 GetObjectSize() const { return static_cast(object_size_); }
 
   // Offset of a non-oneof field.  Getting a field offset is slightly more
   // efficient when we know statically that it is not a oneof field.
@@ -141,8 +141,9 @@ struct ReflectionSchema {
   // Offset of any field.
   uint32 GetFieldOffset(const FieldDescriptor* field) const {
     if (field->containing_oneof()) {
-      size_t offset = field->containing_type()->field_count() +
-                      field->containing_oneof()->index();
+      size_t offset =
+          static_cast(field->containing_type()->field_count() +
+          field->containing_oneof()->index());
       return offsets_[offset];
     } else {
       return GetFieldOffsetNonOneof(field);
@@ -150,8 +151,9 @@ struct ReflectionSchema {
   }
 
   uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const {
-    return oneof_case_offset_ +
-           static_cast(oneof_descriptor->index() * sizeof(uint32));
+    return static_cast(oneof_case_offset_) +
+           static_cast(
+               static_cast(oneof_descriptor->index()) * sizeof(uint32));
   }
 
   bool HasHasbits() const { return has_bits_offset_ != -1; }
@@ -165,7 +167,7 @@ struct ReflectionSchema {
   // Byte offset of the hasbits array.
   uint32 HasBitsOffset() const {
     GOOGLE_DCHECK(HasHasbits());
-    return has_bits_offset_;
+    return static_cast(has_bits_offset_);
   }
 
   // The offset of the InternalMetadataWithArena member.
@@ -173,7 +175,7 @@ struct ReflectionSchema {
   // The schema doesn't contain enough information to distinguish between
   // these two cases.
   uint32 GetMetadataOffset() const {
-    return metadata_offset_;
+    return static_cast(metadata_offset_);
   }
 
   // Whether this message has an ExtensionSet.
@@ -182,7 +184,7 @@ struct ReflectionSchema {
   // The offset of the ExtensionSet in this message.
   uint32 GetExtensionSetOffset() const {
     GOOGLE_DCHECK(HasExtensionSet());
-    return extensions_offset_;
+    return static_cast(extensions_offset_);
   }
 
   // The off set of WeakFieldMap when the message contains weak fields.
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index e5a32c5c..28eaf031 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -158,7 +158,7 @@ class Map {
 
  private:
   void Init() {
-    elements_ = Arena::Create(arena_, 0, hasher(), Allocator(arena_));
+    elements_ = Arena::Create(arena_, 0u, hasher(), Allocator(arena_));
   }
 
   // re-implement std::allocator to use arena allocator for memory allocation.
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 7aad9a1c..15104490 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -226,8 +226,10 @@ class MapEntryImpl : public Base {
 
   size_t ByteSizeLong() const {
     size_t size = 0;
-    size += has_key() ? kTagSize + KeyTypeHandler::ByteSize(key()) : 0;
-    size += has_value() ? kTagSize + ValueTypeHandler::ByteSize(value()) : 0;
+    size += has_key() ?
+        kTagSize + static_cast(KeyTypeHandler::ByteSize(key())) : 0;
+    size += has_value() ?
+        kTagSize + static_cast(ValueTypeHandler::ByteSize(value())) : 0;
     return size;
   }
 
@@ -250,11 +252,10 @@ class MapEntryImpl : public Base {
   int GetCachedSize() const {
     int size = 0;
     size += has_key()
-        ? static_cast(kTagSize + KeyTypeHandler::GetCachedSize(key()))
+        ? static_cast(kTagSize) + KeyTypeHandler::GetCachedSize(key())
         : 0;
     size += has_value()
-        ? static_cast(kTagSize + ValueTypeHandler::GetCachedSize(
-            value()))
+        ? static_cast(kTagSize) + ValueTypeHandler::GetCachedSize(value())
         : 0;
     return size;
   }
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index 990136ff..aa365991 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -321,7 +321,8 @@ inline int
 MapTypeHandler::GetCachedSize(
     const MapEntryAccessorType& value) {
   return static_cast(
-      WireFormatLite::LengthDelimitedSize(value.GetCachedSize()));
+      WireFormatLite::LengthDelimitedSize(
+          static_cast(value.GetCachedSize())));
 }
 
 #define GET_CACHED_SIZE(FieldType, DeclaredType)                         \
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index a1013f63..02ee3cc9 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -1335,7 +1335,7 @@ void RepeatedField::Reserve(int new_size) {
       static_cast(new_size),
       (std::numeric_limits::max() - kRepHeaderSize) / sizeof(Element))
       << "Requested size is too large to fit into size_t.";
-  size_t bytes = kRepHeaderSize + sizeof(Element) * new_size;
+  size_t bytes = kRepHeaderSize + sizeof(Element) * static_cast(new_size);
   if (arena == NULL) {
     rep_ = static_cast(::operator new(bytes));
   } else {
@@ -1399,7 +1399,7 @@ void ElementCopier::operator()(
 template 
 struct ElementCopier {
   void operator()(Element* to, const Element* from, int array_size) {
-    memcpy(to, from, array_size * sizeof(Element));
+    memcpy(to, from, static_cast(array_size) * sizeof(Element));
   }
 };
 
@@ -1651,7 +1651,7 @@ inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) {
 
 template 
 inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const {
-  size_t allocated_bytes = total_size_ * sizeof(void*);
+  size_t allocated_bytes = static_cast(total_size_) * sizeof(void*);
   if (rep_ != NULL) {
     for (int i = 0; i < rep_->allocated_size; ++i) {
       allocated_bytes += TypeHandler::SpaceUsedLong(
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index 3905d891..26684c57 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -400,19 +400,19 @@ void Struct::SerializeWithCachedSizes(
       for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
           it = this->fields().begin();
           it != this->fields().end(); ++it, ++n) {
-        items[n] = SortItem(&*it);
+        items[static_cast(n)] = SortItem(&*it);
       }
-      ::std::sort(&items[0], &items[n], Less());
+      ::std::sort(&items[0], &items[static_cast(n)], Less());
       ::google::protobuf::scoped_ptr entry;
       for (size_type i = 0; i < n; i++) {
         entry.reset(fields_.NewEntryWrapper(
-            items[i]->first, items[i]->second));
+            items[static_cast(i)]->first, items[static_cast(i)]->second));
         ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
             1, *entry, output);
         if (entry->GetArena() != NULL) {
           entry.release();
         }
-        Utf8Check::Check(items[i]);
+        Utf8Check::Check(items[static_cast(i)]);
       }
     } else {
       ::google::protobuf::scoped_ptr entry;
@@ -464,13 +464,13 @@ void Struct::SerializeWithCachedSizes(
       for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
           it = this->fields().begin();
           it != this->fields().end(); ++it, ++n) {
-        items[n] = SortItem(&*it);
+        items[static_cast(n)] = SortItem(&*it);
       }
-      ::std::sort(&items[0], &items[n], Less());
+      ::std::sort(&items[0], &items[static_cast(n)], Less());
       ::google::protobuf::scoped_ptr entry;
       for (size_type i = 0; i < n; i++) {
         entry.reset(fields_.NewEntryWrapper(
-            items[i]->first, items[i]->second));
+            items[static_cast(i)]->first, items[static_cast(i)]->second));
         target = ::google::protobuf::internal::WireFormatLite::
                    InternalWriteMessageNoVirtualToArray(
                        1, *entry, deterministic, target);
@@ -478,7 +478,7 @@ void Struct::SerializeWithCachedSizes(
         if (entry->GetArena() != NULL) {
           entry.release();
         }
-        Utf8Check::Check(items[i]);
+        Utf8Check::Check(items[static_cast(i)]);
       }
     } else {
       ::google::protobuf::scoped_ptr entry;
@@ -1673,9 +1673,10 @@ void ListValue::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.Value values = 1;
-  for (unsigned int i = 0, n = this->values_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->values_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      1, this->values(i), output);
+      1, this->values(static_cast(i)), output);
   }
 
   // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue)
@@ -1688,10 +1689,11 @@ void ListValue::SerializeWithCachedSizes(
   (void) cached_has_bits;
 
   // repeated .google.protobuf.Value values = 1;
-  for (unsigned int i = 0, n = this->values_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->values_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        1, this->values(i), deterministic, target);
+        1, this->values(static_cast(i)), deterministic, target);
   }
 
   // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue)
@@ -1704,12 +1706,12 @@ size_t ListValue::ByteSizeLong() const {
 
   // repeated .google.protobuf.Value values = 1;
   {
-    unsigned int count = this->values_size();
+    unsigned int count = static_cast(this->values_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->values(i));
+          this->values(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/stubs/fastmem.h b/src/google/protobuf/stubs/fastmem.h
index 763a6e60..1f1f6ed3 100644
--- a/src/google/protobuf/stubs/fastmem.h
+++ b/src/google/protobuf/stubs/fastmem.h
@@ -111,7 +111,8 @@ inline int fastmemcmp_inlined(const char *a, const char *b, size_t n) {
     b += sizeof(uint32);
   }
   while (a < a_limit) {
-    int d = static_cast(*a++) - static_cast(*b++);
+    int d =
+        static_cast(static_cast(*a++) - static_cast(*b++));
     if (d) return d;
   }
   return 0;
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h
index be998b29..a997e04b 100644
--- a/src/google/protobuf/stubs/hash.h
+++ b/src/google/protobuf/stubs/hash.h
@@ -348,7 +348,7 @@ struct hash {
   inline size_t operator()(const char* str) const {
     size_t result = 0;
     for (; *str != '\0'; str++) {
-      result = 5 * result + *str;
+      result = 5 * result + static_cast(*str);
     }
     return result;
   }
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index 0afd55d7..7879aed4 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -354,7 +354,7 @@ class Bits {
  public:
   static uint32 Log2FloorNonZero(uint32 n) {
 #if defined(__GNUC__)
-  return 31 ^ __builtin_clz(n);
+  return 31 ^ static_cast(__builtin_clz(n));
 #elif defined(COMPILER_MSVC) && defined(_M_IX86)
   _asm {
     bsr ebx, n
@@ -373,7 +373,7 @@ class Bits {
     // To work around this, when we build for NaCl we use the portable
     // implementation instead.
 #if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL)
-  return 63 ^ __builtin_clzll(n);
+  return 63 ^ static_cast(__builtin_clzll(n));
 #else
   return Log2FloorNonZero64_Portable(n);
 #endif
@@ -400,9 +400,9 @@ class Bits {
     const uint32 topbits = static_cast(n >> 32);
     if (topbits == 0) {
       // Top bits are zero, so scan in bottom bits
-      return Log2FloorNonZero(static_cast(n));
+      return static_cast(Log2FloorNonZero(static_cast(n)));
     } else {
-      return 32 + Log2FloorNonZero(topbits);
+      return 32 + static_cast(Log2FloorNonZero(topbits));
     }
   }
 };
diff --git a/src/google/protobuf/stubs/stringpiece.h b/src/google/protobuf/stubs/stringpiece.h
index 8910688b..563ff75d 100644
--- a/src/google/protobuf/stubs/stringpiece.h
+++ b/src/google/protobuf/stubs/stringpiece.h
@@ -292,7 +292,7 @@ class LIBPROTOBUF_EXPORT StringPiece {
   int compare(StringPiece x) const {
     const stringpiece_ssize_type min_size =
         length_ < x.length_ ? length_ : x.length_;
-    int r = memcmp(ptr_, x.ptr_, min_size);
+    int r = memcmp(ptr_, x.ptr_, static_cast(min_size));
     if (r < 0) return -1;
     if (r > 0) return 1;
     if (length_ < x.length_) return -1;
@@ -310,7 +310,7 @@ class LIBPROTOBUF_EXPORT StringPiece {
   // "as_string()" method defined here for existing code.
   string ToString() const {
     if (ptr_ == NULL) return string();
-    return string(data(), size());
+    return string(data(), static_cast(size()));
   }
 
   operator string() const {
@@ -321,12 +321,14 @@ class LIBPROTOBUF_EXPORT StringPiece {
   void AppendToString(string* target) const;
 
   bool starts_with(StringPiece x) const {
-    return (length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0);
+    return (length_ >= x.length_) &&
+           (memcmp(ptr_, x.ptr_, static_cast(x.length_)) == 0);
   }
 
   bool ends_with(StringPiece x) const {
     return ((length_ >= x.length_) &&
-            (memcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0));
+            (memcmp(ptr_ + (length_-x.length_), x.ptr_,
+                 static_cast(x.length_)) == 0));
   }
 
   // Checks whether StringPiece starts with x and if so advances the beginning
@@ -398,7 +400,7 @@ inline bool operator==(StringPiece x, StringPiece y) {
   }
 
   return x.data() == y.data() || len <= 0 ||
-      memcmp(x.data(), y.data(), len) == 0;
+      memcmp(x.data(), y.data(), static_cast(len)) == 0;
 }
 
 inline bool operator!=(StringPiece x, StringPiece y) {
@@ -408,7 +410,7 @@ inline bool operator!=(StringPiece x, StringPiece y) {
 inline bool operator<(StringPiece x, StringPiece y) {
   const stringpiece_ssize_type min_size =
       x.size() < y.size() ? x.size() : y.size();
-  const int r = memcmp(x.data(), y.data(), min_size);
+  const int r = memcmp(x.data(), y.data(), static_cast(min_size));
   return (r < 0) || (r == 0 && x.size() < y.size());
 }
 
@@ -458,7 +460,9 @@ struct StringPiecePod {
     return size_;
   }
 
-  std::string ToString() const { return std::string(data_, size_); }
+  std::string ToString() const {
+    return std::string(data_, static_cast(size_));
+  }
  private:
   const char* data_;
   stringpiece_ssize_type size_;
@@ -473,7 +477,7 @@ template<> struct hash {
   size_t operator()(const StringPiece& s) const {
     size_t result = 0;
     for (const char *str = s.data(), *end = str + s.size(); str < end; str++) {  
-      result = 5 * result + *str;
+      result = 5 * result + static_cast(*str);
     }
     return result;
   }
diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc
index b2fe28a4..80ddc5bf 100644
--- a/src/google/protobuf/timestamp.pb.cc
+++ b/src/google/protobuf/timestamp.pb.cc
@@ -164,14 +164,15 @@ Timestamp::Timestamp(const Timestamp& from)
       _cached_size_(0) {
   _internal_metadata_.MergeFrom(from._internal_metadata_);
   ::memcpy(&seconds_, &from.seconds_,
-    reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+    static_cast(reinterpret_cast(&nanos_) -
+    reinterpret_cast(&seconds_)) + sizeof(nanos_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp)
 }
 
 void Timestamp::SharedCtor() {
-  ::memset(&seconds_, 0, reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+  ::memset(&seconds_, 0, static_cast(
+      reinterpret_cast(&nanos_) -
+      reinterpret_cast(&seconds_)) + sizeof(nanos_));
   _cached_size_ = 0;
 }
 
@@ -215,8 +216,9 @@ Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const {
 
 void Timestamp::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp)
-  ::memset(&seconds_, 0, reinterpret_cast(&nanos_) -
-    reinterpret_cast(&seconds_) + sizeof(nanos_));
+  ::memset(&seconds_, 0, static_cast(
+      reinterpret_cast(&nanos_) -
+      reinterpret_cast(&seconds_)) + sizeof(nanos_));
 }
 
 bool Timestamp::MergePartialFromCodedStream(
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 0344a6a1..8a53d76a 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -437,8 +437,9 @@ Type::Type(const Type& from)
 
 void Type::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&source_context_, 0, reinterpret_cast(&syntax_) -
-    reinterpret_cast(&source_context_) + sizeof(syntax_));
+  ::memset(&source_context_, 0, static_cast(
+      reinterpret_cast(&syntax_) -
+      reinterpret_cast(&source_context_)) + sizeof(syntax_));
   _cached_size_ = 0;
 }
 
@@ -629,9 +630,10 @@ void Type::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Field fields = 2;
-  for (unsigned int i = 0, n = this->fields_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->fields_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->fields(i), output);
+      2, this->fields(static_cast(i)), output);
   }
 
   // repeated string oneofs = 3;
@@ -645,9 +647,10 @@ void Type::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 4;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      4, this->options(i), output);
+      4, this->options(static_cast(i)), output);
   }
 
   // .google.protobuf.SourceContext source_context = 5;
@@ -683,10 +686,11 @@ void Type::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Field fields = 2;
-  for (unsigned int i = 0, n = this->fields_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->fields_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->fields(i), deterministic, target);
+        2, this->fields(static_cast(i)), deterministic, target);
   }
 
   // repeated string oneofs = 3;
@@ -700,10 +704,11 @@ void Type::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 4;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        4, this->options(i), deterministic, target);
+        4, this->options(static_cast(i)), deterministic, target);
   }
 
   // .google.protobuf.SourceContext source_context = 5;
@@ -729,12 +734,12 @@ size_t Type::ByteSizeLong() const {
 
   // repeated .google.protobuf.Field fields = 2;
   {
-    unsigned int count = this->fields_size();
+    unsigned int count = static_cast(this->fields_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->fields(i));
+          this->fields(static_cast(i)));
     }
   }
 
@@ -748,12 +753,12 @@ size_t Type::ByteSizeLong() const {
 
   // repeated .google.protobuf.Option options = 4;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
@@ -1199,8 +1204,8 @@ Field::Field(const Field& from)
       GetArenaNoVirtual());
   }
   ::memcpy(&kind_, &from.kind_,
-    reinterpret_cast(&packed_) -
-    reinterpret_cast(&kind_) + sizeof(packed_));
+    static_cast(reinterpret_cast(&packed_) -
+    reinterpret_cast(&kind_)) + sizeof(packed_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Field)
 }
 
@@ -1209,8 +1214,9 @@ void Field::SharedCtor() {
   type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   json_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
   default_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&kind_, 0, reinterpret_cast(&packed_) -
-    reinterpret_cast(&kind_) + sizeof(packed_));
+  ::memset(&kind_, 0, static_cast(
+      reinterpret_cast(&packed_) -
+      reinterpret_cast(&kind_)) + sizeof(packed_));
   _cached_size_ = 0;
 }
 
@@ -1263,8 +1269,9 @@ void Field::Clear() {
   type_url_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
   json_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
   default_value_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
-  ::memset(&kind_, 0, reinterpret_cast(&packed_) -
-    reinterpret_cast(&kind_) + sizeof(packed_));
+  ::memset(&kind_, 0, static_cast(
+      reinterpret_cast(&packed_) -
+      reinterpret_cast(&kind_)) + sizeof(packed_));
 }
 
 bool Field::MergePartialFromCodedStream(
@@ -1500,9 +1507,10 @@ void Field::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 9;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      9, this->options(i), output);
+      9, this->options(static_cast(i)), output);
   }
 
   // string json_name = 10;
@@ -1584,10 +1592,11 @@ void Field::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 9;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        9, this->options(i), deterministic, target);
+        9, this->options(static_cast(i)), deterministic, target);
   }
 
   // string json_name = 10;
@@ -1622,12 +1631,12 @@ size_t Field::ByteSizeLong() const {
 
   // repeated .google.protobuf.Option options = 9;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
@@ -2264,8 +2273,9 @@ Enum::Enum(const Enum& from)
 
 void Enum::SharedCtor() {
   name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(&source_context_, 0, reinterpret_cast(&syntax_) -
-    reinterpret_cast(&source_context_) + sizeof(syntax_));
+  ::memset(&source_context_, 0, static_cast(
+      reinterpret_cast(&syntax_) -
+      reinterpret_cast(&source_context_)) + sizeof(syntax_));
   _cached_size_ = 0;
 }
 
@@ -2438,15 +2448,17 @@ void Enum::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.EnumValue enumvalue = 2;
-  for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enumvalue_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->enumvalue(i), output);
+      2, this->enumvalue(static_cast(i)), output);
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->options(i), output);
+      3, this->options(static_cast(i)), output);
   }
 
   // .google.protobuf.SourceContext source_context = 4;
@@ -2482,17 +2494,19 @@ void Enum::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.EnumValue enumvalue = 2;
-  for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->enumvalue_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        2, this->enumvalue(i), deterministic, target);
+        2, this->enumvalue(static_cast(i)), deterministic, target);
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        3, this->options(i), deterministic, target);
+        3, this->options(static_cast(i)), deterministic, target);
   }
 
   // .google.protobuf.SourceContext source_context = 4;
@@ -2518,23 +2532,23 @@ size_t Enum::ByteSizeLong() const {
 
   // repeated .google.protobuf.EnumValue enumvalue = 2;
   {
-    unsigned int count = this->enumvalue_size();
+    unsigned int count = static_cast(this->enumvalue_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->enumvalue(i));
+          this->enumvalue(static_cast(i)));
     }
   }
 
   // repeated .google.protobuf.Option options = 3;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
@@ -3037,9 +3051,10 @@ void EnumValue::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      3, this->options(i), output);
+      3, this->options(static_cast(i)), output);
   }
 
   // @@protoc_insertion_point(serialize_end:google.protobuf.EnumValue)
@@ -3068,10 +3083,11 @@ void EnumValue::SerializeWithCachedSizes(
   }
 
   // repeated .google.protobuf.Option options = 3;
-  for (unsigned int i = 0, n = this->options_size(); i < n; i++) {
+  for (unsigned int i = 0,
+      n = static_cast(this->options_size()); i < n; i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       InternalWriteMessageNoVirtualToArray(
-        3, this->options(i), deterministic, target);
+        3, this->options(static_cast(i)), deterministic, target);
   }
 
   // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue)
@@ -3084,12 +3100,12 @@ size_t EnumValue::ByteSizeLong() const {
 
   // repeated .google.protobuf.Option options = 3;
   {
-    unsigned int count = this->options_size();
+    unsigned int count = static_cast(this->options_size());
     total_size += 1UL * count;
     for (unsigned int i = 0; i < count; i++) {
       total_size +=
         ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->options(i));
+          this->options(static_cast(i)));
     }
   }
 
diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h
index 002ea8e8..beb4c9ec 100644
--- a/src/google/protobuf/unknown_field_set.h
+++ b/src/google/protobuf/unknown_field_set.h
@@ -282,10 +282,10 @@ inline int UnknownFieldSet::field_count() const {
 }
 inline const UnknownField& UnknownFieldSet::field(int index) const {
   GOOGLE_DCHECK(fields_ != NULL);
-  return (*fields_)[index];
+  return (*fields_)[static_cast(index)];
 }
 inline UnknownField* UnknownFieldSet::mutable_field(int index) {
-  return &(*fields_)[index];
+  return &(*fields_)[static_cast(index)];
 }
 
 inline void UnknownFieldSet::AddLengthDelimited(
@@ -296,7 +296,7 @@ inline void UnknownFieldSet::AddLengthDelimited(
 
 
 
-inline int UnknownField::number() const { return number_; }
+inline int UnknownField::number() const { return static_cast(number_); }
 inline UnknownField::Type UnknownField::type() const {
   return static_cast(type_);
 }
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index ce55f266..56c6f7fc 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -787,7 +787,7 @@ inline int WireFormatLite::GetTagFieldNumber(uint32 tag) {
 inline size_t WireFormatLite::TagSize(int field_number,
                                       WireFormatLite::FieldType type) {
   size_t result = io::CodedOutputStream::VarintSize32(
-    field_number << kTagTypeBits);
+    static_cast(field_number << kTagTypeBits));
   if (type == TYPE_GROUP) {
     // Groups have both a start and an end tag.
     return result * 2;
@@ -846,20 +846,20 @@ inline double WireFormatLite::DecodeDouble(uint64 value) {
 
 inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
   // Note:  the right-shift must be arithmetic
-  return (static_cast(n) << 1) ^ (n >> 31);
+  return static_cast((n << 1) ^ (n >> 31));
 }
 
 inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
-  return (n >> 1) ^ -static_cast(n & 1);
+  return static_cast(n >> 1) ^ -static_cast(n & 1);
 }
 
 inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
   // Note:  the right-shift must be arithmetic
-  return (static_cast(n) << 1) ^ (n >> 63);
+  return static_cast((n << 1) ^ (n >> 63));
 }
 
 inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {
-  return (n >> 1) ^ -static_cast(n & 1);
+  return static_cast(n >> 1) ^ -static_cast(n & 1);
 }
 
 // String is for UTF-8 text only, but, even so, ReadString() can simply
diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h
index f7b98d1d..c044def8 100644
--- a/src/google/protobuf/wire_format_lite_inl.h
+++ b/src/google/protobuf/wire_format_lite_inl.h
@@ -696,7 +696,7 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray(
 
   const T* ii = value.unsafe_data();
   const int bytes = n * static_cast(sizeof(ii[0]));
-  memcpy(target, ii, bytes);
+  memcpy(target, ii, static_cast(bytes));
   return target + bytes;
 #else
   return WritePrimitiveNoTagToArray(value, Writer, target);
@@ -954,7 +954,7 @@ inline uint8* WireFormatLite::InternalWriteMessageToArray(
     uint8* target) {
   target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
   target = io::CodedOutputStream::WriteVarint32ToArray(
-    value.GetCachedSize(), target);
+    static_cast(value.GetCachedSize()), target);
   return value.InternalSerializeWithCachedSizesToArray(deterministic, target);
 }
 
@@ -975,7 +975,9 @@ inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray(
     bool deterministic, uint8* target) {
   target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
   target = io::CodedOutputStream::WriteVarint32ToArray(
-    value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target);
+        static_cast(
+            value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()),
+        target);
   return value.MessageType_WorkAroundCppLookupDefect::
       InternalSerializeWithCachedSizesToArray(deterministic, target);
 }
-- 
cgit v1.2.3


From 12acbc2678073c3439b427be0b713b97e2074bfb Mon Sep 17 00:00:00 2001
From: Brent Shaffer 
Date: Tue, 27 Jun 2017 16:28:28 -0700
Subject: adds PHPDoc @return and @param for getters and setters respectively
 (#3131)

* adds PHPDoc @return and @param for getters and setters respectively

* addresses changes in PR review

* adds documentation tests

* Update php_generator:

- Prepend \ to names where required
- Remove 
 tags
- Update protobuf field comments

* Updates class files with the protobuf changes

* Addresses review comments

* removes Protobuf Type line from PHP generated classes

* fixes phpdoc test

* adds array types to phpdoc
---
 Makefile.am                                        |   1 +
 php/phpunit.xml                                    |   1 +
 .../Google/Protobuf/Internal/DescriptorProto.php   | 100 +++---
 .../Internal/DescriptorProto_ExtensionRange.php    |  20 +-
 .../Internal/DescriptorProto_ReservedRange.php     |  34 +--
 .../Protobuf/Internal/EnumDescriptorProto.php      |  31 +-
 php/src/Google/Protobuf/Internal/EnumOptions.php   |  47 ++-
 .../Protobuf/Internal/EnumValueDescriptorProto.php |  31 +-
 .../Google/Protobuf/Internal/EnumValueOptions.php  |  32 +-
 .../Protobuf/Internal/FieldDescriptorProto.php     | 136 ++++-----
 .../Internal/FieldDescriptorProto_Label.php        |  10 +-
 .../Internal/FieldDescriptorProto_Type.php         |  54 ++--
 php/src/Google/Protobuf/Internal/FieldOptions.php  | 107 +++----
 .../Protobuf/Internal/FieldOptions_CType.php       |  10 +-
 .../Protobuf/Internal/FieldOptions_JSType.php      |  14 +-
 .../Protobuf/Internal/FileDescriptorProto.php      | 160 +++++-----
 .../Google/Protobuf/Internal/FileDescriptorSet.php |  13 +-
 php/src/Google/Protobuf/Internal/FileOptions.php   | 254 +++++++---------
 .../Protobuf/Internal/FileOptions_OptimizeMode.php |  16 +-
 .../Google/Protobuf/Internal/GeneratedCodeInfo.php |  19 +-
 .../Internal/GeneratedCodeInfo_Annotation.php      |  62 ++--
 .../Google/Protobuf/Internal/MessageOptions.php    |  83 +++--
 .../Protobuf/Internal/MethodDescriptorProto.php    |  76 +++--
 php/src/Google/Protobuf/Internal/MethodOptions.php |  41 ++-
 .../Internal/MethodOptions_IdempotencyLevel.php    |  14 +-
 .../Protobuf/Internal/OneofDescriptorProto.php     |  22 +-
 php/src/Google/Protobuf/Internal/OneofOptions.php  |  17 +-
 .../Protobuf/Internal/ServiceDescriptorProto.php   |  31 +-
 .../Google/Protobuf/Internal/ServiceOptions.php    |  32 +-
 .../Google/Protobuf/Internal/SourceCodeInfo.php    |  19 +-
 .../Protobuf/Internal/SourceCodeInfo_Location.php  |  65 ++--
 .../Protobuf/Internal/UninterpretedOption.php      |  73 +++--
 .../Internal/UninterpretedOption_NamePart.php      |  22 +-
 php/tests/generated_phpdoc_test.php                | 337 +++++++++++++++++++++
 php/tests/test.sh                                  |   2 +-
 src/google/protobuf/compiler/php/php_generator.cc  | 159 +++++++---
 36 files changed, 1220 insertions(+), 925 deletions(-)
 create mode 100644 php/tests/generated_phpdoc_test.php

(limited to 'src/google')

diff --git a/Makefile.am b/Makefile.am
index 47fe4bb9..0142bed1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -658,6 +658,7 @@ php_EXTRA_DIST=                                                       \
   php/tests/encode_decode_test.php                                    \
   php/tests/gdb_test.sh                                               \
   php/tests/generated_class_test.php                                  \
+  php/tests/generated_phpdoc_test.php                                 \
   php/tests/map_field_test.php                                        \
   php/tests/memory_leak_test.php                                      \
   php/tests/php_implementation_test.php                               \
diff --git a/php/phpunit.xml b/php/phpunit.xml
index 0191a601..7cb1e2a3 100644
--- a/php/phpunit.xml
+++ b/php/phpunit.xml
@@ -7,6 +7,7 @@
       tests/array_test.php
       tests/encode_decode_test.php
       tests/generated_class_test.php
+      tests/generated_phpdoc_test.php
       tests/map_field_test.php
       tests/well_known_test.php
     
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php
index c72c0962..0fdaecfc 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php
@@ -12,66 +12,62 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * 
  * Describes a message type.
- * 
* - * Protobuf type google.protobuf.DescriptorProto + * Generated from protobuf message google.protobuf.DescriptorProto */ class DescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; */ private $field; private $has_field = false; /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; */ private $extension; private $has_extension = false; /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; */ private $nested_type; private $has_nested_type = false; /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; */ private $enum_type; private $has_enum_type = false; /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; */ private $extension_range; private $has_extension_range = false; /** - * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; */ private $oneof_decl; private $has_oneof_decl = false; /** - * optional .google.protobuf.MessageOptions options = 7; + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; */ private $options = null; private $has_options = false; /** - * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; */ private $reserved_range; private $has_reserved_range = false; /** - *
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * 
* - * repeated string reserved_name = 10; + * Generated from protobuf field repeated string reserved_name = 10; */ private $reserved_name; private $has_reserved_name = false; @@ -82,7 +78,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -90,7 +87,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -107,7 +106,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getField() { @@ -115,7 +115,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto field = 2; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto field = 2; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setField(&$var) { @@ -132,7 +134,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getExtension() { @@ -140,7 +143,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto extension = 6; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 6; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setExtension(&$var) { @@ -157,7 +162,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getNestedType() { @@ -165,7 +171,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto nested_type = 3; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto nested_type = 3; + * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setNestedType(&$var) { @@ -182,7 +190,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getEnumType() { @@ -190,7 +199,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setEnumType(&$var) { @@ -207,7 +218,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getExtensionRange() { @@ -215,7 +227,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + * @param \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setExtensionRange(&$var) { @@ -232,7 +246,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getOneofDecl() { @@ -240,7 +255,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * Generated from protobuf field repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + * @param \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setOneofDecl(&$var) { @@ -257,7 +274,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MessageOptions options = 7; + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; + * @return \Google\Protobuf\Internal\MessageOptions */ public function getOptions() { @@ -265,7 +283,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MessageOptions options = 7; + * Generated from protobuf field optional .google.protobuf.MessageOptions options = 7; + * @param \Google\Protobuf\Internal\MessageOptions $var + * @return $this */ public function setOptions(&$var) { @@ -282,7 +302,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getReservedRange() { @@ -290,7 +311,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + * @param \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setReservedRange(&$var) { @@ -307,12 +330,11 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * 
* - * repeated string reserved_name = 10; + * Generated from protobuf field repeated string reserved_name = 10; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getReservedName() { @@ -320,12 +342,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * 
* - * repeated string reserved_name = 10; + * Generated from protobuf field repeated string reserved_name = 10; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setReservedName(&$var) { diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php index b5e5453e..bbd34824 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php @@ -12,17 +12,17 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.DescriptorProto.ExtensionRange + * Generated from protobuf message google.protobuf.DescriptorProto.ExtensionRange */ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message { /** - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; */ private $start = 0; private $has_start = false; /** - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; */ private $end = 0; private $has_end = false; @@ -33,7 +33,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message } /** - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; + * @return int */ public function getStart() { @@ -41,7 +42,9 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message } /** - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this */ public function setStart($var) { @@ -58,7 +61,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message } /** - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; + * @return int */ public function getEnd() { @@ -66,7 +70,9 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message } /** - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this */ public function setEnd($var) { diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php index e5b7b05a..3d613133 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php @@ -12,31 +12,25 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Range of reserved tag numbers. Reserved tag numbers may not be used by
  * fields or extension ranges in the same message. Reserved ranges may
  * not overlap.
- * 
* - * Protobuf type google.protobuf.DescriptorProto.ReservedRange + * Generated from protobuf message google.protobuf.DescriptorProto.ReservedRange */ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message { /** - *
      * Inclusive.
-     * 
* - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; */ private $start = 0; private $has_start = false; /** - *
      * Exclusive.
-     * 
* - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; */ private $end = 0; private $has_end = false; @@ -47,11 +41,10 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message } /** - *
      * Inclusive.
-     * 
* - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; + * @return int */ public function getStart() { @@ -59,11 +52,11 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message } /** - *
      * Inclusive.
-     * 
* - * optional int32 start = 1; + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this */ public function setStart($var) { @@ -80,11 +73,10 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message } /** - *
      * Exclusive.
-     * 
* - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; + * @return int */ public function getEnd() { @@ -92,11 +84,11 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message } /** - *
      * Exclusive.
-     * 
* - * optional int32 end = 2; + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this */ public function setEnd($var) { diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index bf597436..6cdaf2df 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes an enum type.
- * 
* - * Protobuf type google.protobuf.EnumDescriptorProto + * Generated from protobuf message google.protobuf.EnumDescriptorProto */ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; */ private $value; private $has_value = false; /** - * optional .google.protobuf.EnumOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; */ private $options = null; private $has_options = false; @@ -42,7 +40,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -50,7 +49,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -67,7 +68,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getValue() { @@ -75,7 +77,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * Generated from protobuf field repeated .google.protobuf.EnumValueDescriptorProto value = 2; + * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setValue(&$var) { @@ -92,7 +96,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.EnumOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; + * @return \Google\Protobuf\Internal\EnumOptions */ public function getOptions() { @@ -100,7 +105,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.EnumOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumOptions options = 3; + * @param \Google\Protobuf\Internal\EnumOptions $var + * @return $this */ public function setOptions(&$var) { diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php index cfa0cb3e..3c3a9e22 100644 --- a/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -12,38 +12,32 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.EnumOptions + * Generated from protobuf message google.protobuf.EnumOptions */ class EnumOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * 
* - * optional bool allow_alias = 2; + * Generated from protobuf field optional bool allow_alias = 2; */ private $allow_alias = false; private $has_allow_alias = false; /** - *
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -54,12 +48,11 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * 
* - * optional bool allow_alias = 2; + * Generated from protobuf field optional bool allow_alias = 2; + * @return bool */ public function getAllowAlias() { @@ -67,12 +60,12 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * 
* - * optional bool allow_alias = 2; + * Generated from protobuf field optional bool allow_alias = 2; + * @param bool $var + * @return $this */ public function setAllowAlias($var) { @@ -89,14 +82,13 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool */ public function getDeprecated() { @@ -104,14 +96,14 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -128,11 +120,10 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -140,11 +131,11 @@ class EnumOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php index 43eee73f..89d6707f 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a value within an enum.
- * 
* - * Protobuf type google.protobuf.EnumValueDescriptorProto + * Generated from protobuf message google.protobuf.EnumValueDescriptorProto */ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * optional int32 number = 2; + * Generated from protobuf field optional int32 number = 2; */ private $number = 0; private $has_number = false; /** - * optional .google.protobuf.EnumValueOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; */ private $options = null; private $has_options = false; @@ -42,7 +40,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -50,7 +49,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -67,7 +68,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional int32 number = 2; + * Generated from protobuf field optional int32 number = 2; + * @return int */ public function getNumber() { @@ -75,7 +77,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional int32 number = 2; + * Generated from protobuf field optional int32 number = 2; + * @param int $var + * @return $this */ public function setNumber($var) { @@ -92,7 +96,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.EnumValueOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; + * @return \Google\Protobuf\Internal\EnumValueOptions */ public function getOptions() { @@ -100,7 +105,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.EnumValueOptions options = 3; + * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; + * @param \Google\Protobuf\Internal\EnumValueOptions $var + * @return $this */ public function setOptions(&$var) { diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php index d66c7684..3b5c58e4 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -12,28 +12,24 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.EnumValueOptions + * Generated from protobuf message google.protobuf.EnumValueOptions */ class EnumValueOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * 
* - * optional bool deprecated = 1 [default = false]; + * Generated from protobuf field optional bool deprecated = 1 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -44,14 +40,13 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * 
* - * optional bool deprecated = 1 [default = false]; + * Generated from protobuf field optional bool deprecated = 1 [default = false]; + * @return bool */ public function getDeprecated() { @@ -59,14 +54,14 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * 
* - * optional bool deprecated = 1 [default = false]; + * Generated from protobuf field optional bool deprecated = 1 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -83,11 +78,10 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -95,11 +89,11 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php index 2af9c0a0..ae61be47 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -12,99 +12,85 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a field within a message.
- * 
* - * Protobuf type google.protobuf.FieldDescriptorProto + * Generated from protobuf message google.protobuf.FieldDescriptorProto */ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * optional int32 number = 3; + * Generated from protobuf field optional int32 number = 3; */ private $number = 0; private $has_number = false; /** - * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; */ private $label = 0; private $has_label = false; /** - *
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * 
* - * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; */ private $type = 0; private $has_type = false; /** - *
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * 
* - * optional string type_name = 6; + * Generated from protobuf field optional string type_name = 6; */ private $type_name = ''; private $has_type_name = false; /** - *
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * 
* - * optional string extendee = 2; + * Generated from protobuf field optional string extendee = 2; */ private $extendee = ''; private $has_extendee = false; /** - *
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * 
* - * optional string default_value = 7; + * Generated from protobuf field optional string default_value = 7; */ private $default_value = ''; private $has_default_value = false; /** - *
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * 
* - * optional int32 oneof_index = 9; + * Generated from protobuf field optional int32 oneof_index = 9; */ private $oneof_index = 0; private $has_oneof_index = false; /** - *
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * 
* - * optional string json_name = 10; + * Generated from protobuf field optional string json_name = 10; */ private $json_name = ''; private $has_json_name = false; /** - * optional .google.protobuf.FieldOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; */ private $options = null; private $has_options = false; @@ -115,7 +101,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -123,7 +110,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -140,7 +129,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional int32 number = 3; + * Generated from protobuf field optional int32 number = 3; + * @return int */ public function getNumber() { @@ -148,7 +138,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional int32 number = 3; + * Generated from protobuf field optional int32 number = 3; + * @param int $var + * @return $this */ public function setNumber($var) { @@ -165,7 +157,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * @return int */ public function getLabel() { @@ -173,7 +166,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Label label = 4; + * @param int $var + * @return $this */ public function setLabel($var) { @@ -190,12 +185,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * 
* - * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * @return int */ public function getType() { @@ -203,12 +197,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * 
* - * optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * Generated from protobuf field optional .google.protobuf.FieldDescriptorProto.Type type = 5; + * @param int $var + * @return $this */ public function setType($var) { @@ -225,15 +219,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * 
* - * optional string type_name = 6; + * Generated from protobuf field optional string type_name = 6; + * @return string */ public function getTypeName() { @@ -241,15 +234,15 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * 
* - * optional string type_name = 6; + * Generated from protobuf field optional string type_name = 6; + * @param string $var + * @return $this */ public function setTypeName($var) { @@ -266,12 +259,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * 
* - * optional string extendee = 2; + * Generated from protobuf field optional string extendee = 2; + * @return string */ public function getExtendee() { @@ -279,12 +271,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * 
* - * optional string extendee = 2; + * Generated from protobuf field optional string extendee = 2; + * @param string $var + * @return $this */ public function setExtendee($var) { @@ -301,15 +293,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * 
* - * optional string default_value = 7; + * Generated from protobuf field optional string default_value = 7; + * @return string */ public function getDefaultValue() { @@ -317,15 +308,15 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * 
* - * optional string default_value = 7; + * Generated from protobuf field optional string default_value = 7; + * @param string $var + * @return $this */ public function setDefaultValue($var) { @@ -342,12 +333,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * 
* - * optional int32 oneof_index = 9; + * Generated from protobuf field optional int32 oneof_index = 9; + * @return int */ public function getOneofIndex() { @@ -355,12 +345,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * 
* - * optional int32 oneof_index = 9; + * Generated from protobuf field optional int32 oneof_index = 9; + * @param int $var + * @return $this */ public function setOneofIndex($var) { @@ -377,14 +367,13 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * 
* - * optional string json_name = 10; + * Generated from protobuf field optional string json_name = 10; + * @return string */ public function getJsonName() { @@ -392,14 +381,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * 
* - * optional string json_name = 10; + * Generated from protobuf field optional string json_name = 10; + * @param string $var + * @return $this */ public function setJsonName($var) { @@ -416,7 +405,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FieldOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; + * @return \Google\Protobuf\Internal\FieldOptions */ public function getOptions() { @@ -424,7 +414,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FieldOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FieldOptions options = 8; + * @param \Google\Protobuf\Internal\FieldOptions $var + * @return $this */ public function setOptions(&$var) { diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php index a3cd8ef9..f2a32fdf 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php @@ -5,24 +5,22 @@ namespace Google\Protobuf\Internal; /** - * Protobuf enum google.protobuf.FieldDescriptorProto.Label + * Protobuf enum Google\Protobuf\Internal */ class FieldDescriptorProto_Label { /** - *
      * 0 is reserved for errors
-     * 
* - * LABEL_OPTIONAL = 1; + * Generated from protobuf enum LABEL_OPTIONAL = 1; */ const LABEL_OPTIONAL = 1; /** - * LABEL_REQUIRED = 2; + * Generated from protobuf enum LABEL_REQUIRED = 2; */ const LABEL_REQUIRED = 2; /** - * LABEL_REPEATED = 3; + * Generated from protobuf enum LABEL_REPEATED = 3; */ const LABEL_REPEATED = 3; } diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php index 8335f9b1..1b022deb 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php @@ -5,118 +5,102 @@ namespace Google\Protobuf\Internal; /** - * Protobuf enum google.protobuf.FieldDescriptorProto.Type + * Protobuf enum Google\Protobuf\Internal */ class FieldDescriptorProto_Type { /** - *
      * 0 is reserved for errors.
      * Order is weird for historical reasons.
-     * 
* - * TYPE_DOUBLE = 1; + * Generated from protobuf enum TYPE_DOUBLE = 1; */ const TYPE_DOUBLE = 1; /** - * TYPE_FLOAT = 2; + * Generated from protobuf enum TYPE_FLOAT = 2; */ const TYPE_FLOAT = 2; /** - *
      * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
      * negative values are likely.
-     * 
* - * TYPE_INT64 = 3; + * Generated from protobuf enum TYPE_INT64 = 3; */ const TYPE_INT64 = 3; /** - * TYPE_UINT64 = 4; + * Generated from protobuf enum TYPE_UINT64 = 4; */ const TYPE_UINT64 = 4; /** - *
      * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
      * negative values are likely.
-     * 
* - * TYPE_INT32 = 5; + * Generated from protobuf enum TYPE_INT32 = 5; */ const TYPE_INT32 = 5; /** - * TYPE_FIXED64 = 6; + * Generated from protobuf enum TYPE_FIXED64 = 6; */ const TYPE_FIXED64 = 6; /** - * TYPE_FIXED32 = 7; + * Generated from protobuf enum TYPE_FIXED32 = 7; */ const TYPE_FIXED32 = 7; /** - * TYPE_BOOL = 8; + * Generated from protobuf enum TYPE_BOOL = 8; */ const TYPE_BOOL = 8; /** - * TYPE_STRING = 9; + * Generated from protobuf enum TYPE_STRING = 9; */ const TYPE_STRING = 9; /** - *
      * Tag-delimited aggregate.
      * Group type is deprecated and not supported in proto3. However, Proto3
      * implementations should still be able to parse the group wire format and
      * treat group fields as unknown fields.
-     * 
* - * TYPE_GROUP = 10; + * Generated from protobuf enum TYPE_GROUP = 10; */ const TYPE_GROUP = 10; /** - *
      * Length-delimited aggregate.
-     * 
* - * TYPE_MESSAGE = 11; + * Generated from protobuf enum TYPE_MESSAGE = 11; */ const TYPE_MESSAGE = 11; /** - *
      * New in version 2.
-     * 
* - * TYPE_BYTES = 12; + * Generated from protobuf enum TYPE_BYTES = 12; */ const TYPE_BYTES = 12; /** - * TYPE_UINT32 = 13; + * Generated from protobuf enum TYPE_UINT32 = 13; */ const TYPE_UINT32 = 13; /** - * TYPE_ENUM = 14; + * Generated from protobuf enum TYPE_ENUM = 14; */ const TYPE_ENUM = 14; /** - * TYPE_SFIXED32 = 15; + * Generated from protobuf enum TYPE_SFIXED32 = 15; */ const TYPE_SFIXED32 = 15; /** - * TYPE_SFIXED64 = 16; + * Generated from protobuf enum TYPE_SFIXED64 = 16; */ const TYPE_SFIXED64 = 16; /** - *
      * Uses ZigZag encoding.
-     * 
* - * TYPE_SINT32 = 17; + * Generated from protobuf enum TYPE_SINT32 = 17; */ const TYPE_SINT32 = 17; /** - *
      * Uses ZigZag encoding.
-     * 
* - * TYPE_SINT64 = 18; + * Generated from protobuf enum TYPE_SINT64 = 18; */ const TYPE_SINT64 = 18; } diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index b30caa75..157c0f82 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -12,37 +12,32 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.FieldOptions + * Generated from protobuf message google.protobuf.FieldOptions */ class FieldOptions extends \Google\Protobuf\Internal\Message { /** - *
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * 
* - * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; */ private $ctype = 0; private $has_ctype = false; /** - *
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * 
* - * optional bool packed = 2; + * Generated from protobuf field optional bool packed = 2; */ private $packed = false; private $has_packed = false; /** - *
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -52,14 +47,12 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * 
* - * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; */ private $jstype = 0; private $has_jstype = false; /** - *
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -84,39 +77,32 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * 
* - * optional bool lazy = 5 [default = false]; + * Generated from protobuf field optional bool lazy = 5 [default = false]; */ private $lazy = false; private $has_lazy = false; /** - *
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * For Google-internal migration only. Do not use.
-     * 
* - * optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false]; */ private $weak = false; private $has_weak = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -127,14 +113,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * 
* - * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * @return int */ public function getCtype() { @@ -142,14 +127,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * 
* - * optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + * @param int $var + * @return $this */ public function setCtype($var) { @@ -166,15 +151,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * 
* - * optional bool packed = 2; + * Generated from protobuf field optional bool packed = 2; + * @return bool */ public function getPacked() { @@ -182,15 +166,15 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * 
* - * optional bool packed = 2; + * Generated from protobuf field optional bool packed = 2; + * @param bool $var + * @return $this */ public function setPacked($var) { @@ -207,7 +191,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -217,9 +200,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * 
* - * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * @return int */ public function getJstype() { @@ -227,7 +210,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -237,9 +219,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * 
* - * optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * Generated from protobuf field optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + * @param int $var + * @return $this */ public function setJstype($var) { @@ -256,7 +239,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -281,9 +263,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * 
* - * optional bool lazy = 5 [default = false]; + * Generated from protobuf field optional bool lazy = 5 [default = false]; + * @return bool */ public function getLazy() { @@ -291,7 +273,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -316,9 +297,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * 
* - * optional bool lazy = 5 [default = false]; + * Generated from protobuf field optional bool lazy = 5 [default = false]; + * @param bool $var + * @return $this */ public function setLazy($var) { @@ -335,14 +317,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool */ public function getDeprecated() { @@ -350,14 +331,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -374,11 +355,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * For Google-internal migration only. Do not use.
-     * 
* - * optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false]; + * @return bool */ public function getWeak() { @@ -386,11 +366,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * For Google-internal migration only. Do not use.
-     * 
* - * optional bool weak = 10 [default = false]; + * Generated from protobuf field optional bool weak = 10 [default = false]; + * @param bool $var + * @return $this */ public function setWeak($var) { @@ -407,11 +387,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -419,11 +398,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php index f59f20be..0f33072d 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php @@ -5,24 +5,22 @@ namespace Google\Protobuf\Internal; /** - * Protobuf enum google.protobuf.FieldOptions.CType + * Protobuf enum Google\Protobuf\Internal */ class FieldOptions_CType { /** - *
      * Default mode.
-     * 
* - * STRING = 0; + * Generated from protobuf enum STRING = 0; */ const STRING = 0; /** - * CORD = 1; + * Generated from protobuf enum CORD = 1; */ const CORD = 1; /** - * STRING_PIECE = 2; + * Generated from protobuf enum STRING_PIECE = 2; */ const STRING_PIECE = 2; } diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php index 0c6995b7..73bdf3f2 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php @@ -5,32 +5,26 @@ namespace Google\Protobuf\Internal; /** - * Protobuf enum google.protobuf.FieldOptions.JSType + * Protobuf enum Google\Protobuf\Internal */ class FieldOptions_JSType { /** - *
      * Use the default type.
-     * 
* - * JS_NORMAL = 0; + * Generated from protobuf enum JS_NORMAL = 0; */ const JS_NORMAL = 0; /** - *
      * Use JavaScript strings.
-     * 
* - * JS_STRING = 1; + * Generated from protobuf enum JS_STRING = 1; */ const JS_STRING = 1; /** - *
      * Use JavaScript numbers.
-     * 
* - * JS_NUMBER = 2; + * Generated from protobuf enum JS_NUMBER = 2; */ const JS_NUMBER = 2; } diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index b229522a..3b1567d1 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -12,108 +12,90 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a complete .proto file.
- * 
* - * Protobuf type google.protobuf.FileDescriptorProto + * Generated from protobuf message google.protobuf.FileDescriptorProto */ class FileDescriptorProto extends \Google\Protobuf\Internal\Message { /** - *
      * file name, relative to root of source tree
-     * 
* - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - *
      * e.g. "foo", "foo.bar", etc.
-     * 
* - * optional string package = 2; + * Generated from protobuf field optional string package = 2; */ private $package = ''; private $has_package = false; /** - *
      * Names of files imported by this file.
-     * 
* - * repeated string dependency = 3; + * Generated from protobuf field repeated string dependency = 3; */ private $dependency; private $has_dependency = false; /** - *
      * Indexes of the public imported files in the dependency list above.
-     * 
* - * repeated int32 public_dependency = 10; + * Generated from protobuf field repeated int32 public_dependency = 10; */ private $public_dependency; private $has_public_dependency = false; /** - *
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * 
* - * repeated int32 weak_dependency = 11; + * Generated from protobuf field repeated int32 weak_dependency = 11; */ private $weak_dependency; private $has_weak_dependency = false; /** - *
      * All top-level definitions in this file.
-     * 
* - * repeated .google.protobuf.DescriptorProto message_type = 4; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; */ private $message_type; private $has_message_type = false; /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; */ private $enum_type; private $has_enum_type = false; /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; */ private $service; private $has_service = false; /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; */ private $extension; private $has_extension = false; /** - * optional .google.protobuf.FileOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; */ private $options = null; private $has_options = false; /** - *
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * 
* - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; */ private $source_code_info = null; private $has_source_code_info = false; /** - *
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * 
* - * optional string syntax = 12; + * Generated from protobuf field optional string syntax = 12; */ private $syntax = ''; private $has_syntax = false; @@ -124,11 +106,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * file name, relative to root of source tree
-     * 
* - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -136,11 +117,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * file name, relative to root of source tree
-     * 
* - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -157,11 +138,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * e.g. "foo", "foo.bar", etc.
-     * 
* - * optional string package = 2; + * Generated from protobuf field optional string package = 2; + * @return string */ public function getPackage() { @@ -169,11 +149,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * e.g. "foo", "foo.bar", etc.
-     * 
* - * optional string package = 2; + * Generated from protobuf field optional string package = 2; + * @param string $var + * @return $this */ public function setPackage($var) { @@ -190,11 +170,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Names of files imported by this file.
-     * 
* - * repeated string dependency = 3; + * Generated from protobuf field repeated string dependency = 3; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getDependency() { @@ -202,11 +181,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Names of files imported by this file.
-     * 
* - * repeated string dependency = 3; + * Generated from protobuf field repeated string dependency = 3; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setDependency(&$var) { @@ -223,11 +202,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Indexes of the public imported files in the dependency list above.
-     * 
* - * repeated int32 public_dependency = 10; + * Generated from protobuf field repeated int32 public_dependency = 10; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getPublicDependency() { @@ -235,11 +213,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Indexes of the public imported files in the dependency list above.
-     * 
* - * repeated int32 public_dependency = 10; + * Generated from protobuf field repeated int32 public_dependency = 10; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setPublicDependency(&$var) { @@ -256,12 +234,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * 
* - * repeated int32 weak_dependency = 11; + * Generated from protobuf field repeated int32 weak_dependency = 11; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getWeakDependency() { @@ -269,12 +246,12 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * 
* - * repeated int32 weak_dependency = 11; + * Generated from protobuf field repeated int32 weak_dependency = 11; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setWeakDependency(&$var) { @@ -291,11 +268,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * All top-level definitions in this file.
-     * 
* - * repeated .google.protobuf.DescriptorProto message_type = 4; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getMessageType() { @@ -303,11 +279,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * All top-level definitions in this file.
-     * 
* - * repeated .google.protobuf.DescriptorProto message_type = 4; + * Generated from protobuf field repeated .google.protobuf.DescriptorProto message_type = 4; + * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setMessageType(&$var) { @@ -324,7 +300,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getEnumType() { @@ -332,7 +309,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * Generated from protobuf field repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setEnumType(&$var) { @@ -349,7 +328,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getService() { @@ -357,7 +337,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.ServiceDescriptorProto service = 6; + * Generated from protobuf field repeated .google.protobuf.ServiceDescriptorProto service = 6; + * @param \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setService(&$var) { @@ -374,7 +356,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getExtension() { @@ -382,7 +365,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FieldDescriptorProto extension = 7; + * Generated from protobuf field repeated .google.protobuf.FieldDescriptorProto extension = 7; + * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setExtension(&$var) { @@ -399,7 +384,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FileOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; + * @return \Google\Protobuf\Internal\FileOptions */ public function getOptions() { @@ -407,7 +393,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FileOptions options = 8; + * Generated from protobuf field optional .google.protobuf.FileOptions options = 8; + * @param \Google\Protobuf\Internal\FileOptions $var + * @return $this */ public function setOptions(&$var) { @@ -424,14 +412,13 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * 
* - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * @return \Google\Protobuf\Internal\SourceCodeInfo */ public function getSourceCodeInfo() { @@ -439,14 +426,14 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * 
* - * optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * Generated from protobuf field optional .google.protobuf.SourceCodeInfo source_code_info = 9; + * @param \Google\Protobuf\Internal\SourceCodeInfo $var + * @return $this */ public function setSourceCodeInfo(&$var) { @@ -463,12 +450,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * 
* - * optional string syntax = 12; + * Generated from protobuf field optional string syntax = 12; + * @return string */ public function getSyntax() { @@ -476,12 +462,12 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * 
* - * optional string syntax = 12; + * Generated from protobuf field optional string syntax = 12; + * @param string $var + * @return $this */ public function setSyntax($var) { diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 8271ee66..591e2a81 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -12,17 +12,15 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * The protocol compiler can output a FileDescriptorSet containing the .proto
  * files it parses.
- * 
* - * Protobuf type google.protobuf.FileDescriptorSet + * Generated from protobuf message google.protobuf.FileDescriptorSet */ class FileDescriptorSet extends \Google\Protobuf\Internal\Message { /** - * repeated .google.protobuf.FileDescriptorProto file = 1; + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; */ private $file; private $has_file = false; @@ -33,7 +31,8 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FileDescriptorProto file = 1; + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getFile() { @@ -41,7 +40,9 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.FileDescriptorProto file = 1; + * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; + * @param \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setFile(&$var) { diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 332da3dc..2202102b 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -12,92 +12,79 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.FileOptions + * Generated from protobuf message google.protobuf.FileOptions */ class FileOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * 
* - * optional string java_package = 1; + * Generated from protobuf field optional string java_package = 1; */ private $java_package = ''; private $has_java_package = false; /** - *
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * 
* - * optional string java_outer_classname = 8; + * Generated from protobuf field optional string java_outer_classname = 8; */ private $java_outer_classname = ''; private $has_java_outer_classname = false; /** - *
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * 
* - * optional bool java_multiple_files = 10 [default = false]; + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; */ private $java_multiple_files = false; private $has_java_multiple_files = false; /** - *
      * This option does nothing.
-     * 
* - * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; */ private $java_generate_equals_and_hash = false; private $has_java_generate_equals_and_hash = false; /** - *
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * 
* - * optional bool java_string_check_utf8 = 27 [default = false]; + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; */ private $java_string_check_utf8 = false; private $has_java_string_check_utf8 = false; /** - * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; */ private $optimize_for = 0; private $has_optimize_for = false; /** - *
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * 
* - * optional string go_package = 11; + * Generated from protobuf field optional string go_package = 11; */ private $go_package = ''; private $has_go_package = false; /** - *
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -107,102 +94,85 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * 
* - * optional bool cc_generic_services = 16 [default = false]; + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; */ private $cc_generic_services = false; private $has_cc_generic_services = false; /** - * optional bool java_generic_services = 17 [default = false]; + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; */ private $java_generic_services = false; private $has_java_generic_services = false; /** - * optional bool py_generic_services = 18 [default = false]; + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; */ private $py_generic_services = false; private $has_py_generic_services = false; /** - *
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * 
* - * optional bool deprecated = 23 [default = false]; + * Generated from protobuf field optional bool deprecated = 23 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * 
* - * optional bool cc_enable_arenas = 31 [default = false]; + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = false]; */ private $cc_enable_arenas = false; private $has_cc_enable_arenas = false; /** - *
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * 
* - * optional string objc_class_prefix = 36; + * Generated from protobuf field optional string objc_class_prefix = 36; */ private $objc_class_prefix = ''; private $has_objc_class_prefix = false; /** - *
      * Namespace for generated classes; defaults to the package.
-     * 
* - * optional string csharp_namespace = 37; + * Generated from protobuf field optional string csharp_namespace = 37; */ private $csharp_namespace = ''; private $has_csharp_namespace = false; /** - *
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * 
* - * optional string swift_prefix = 39; + * Generated from protobuf field optional string swift_prefix = 39; */ private $swift_prefix = ''; private $has_swift_prefix = false; /** - *
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * 
* - * optional string php_class_prefix = 40; + * Generated from protobuf field optional string php_class_prefix = 40; */ private $php_class_prefix = ''; private $has_php_class_prefix = false; /** - *
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * 
* - * optional string php_namespace = 41; + * Generated from protobuf field optional string php_namespace = 41; */ private $php_namespace = ''; private $has_php_namespace = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -213,14 +183,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * 
* - * optional string java_package = 1; + * Generated from protobuf field optional string java_package = 1; + * @return string */ public function getJavaPackage() { @@ -228,14 +197,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * 
* - * optional string java_package = 1; + * Generated from protobuf field optional string java_package = 1; + * @param string $var + * @return $this */ public function setJavaPackage($var) { @@ -252,15 +221,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * 
* - * optional string java_outer_classname = 8; + * Generated from protobuf field optional string java_outer_classname = 8; + * @return string */ public function getJavaOuterClassname() { @@ -268,15 +236,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * 
* - * optional string java_outer_classname = 8; + * Generated from protobuf field optional string java_outer_classname = 8; + * @param string $var + * @return $this */ public function setJavaOuterClassname($var) { @@ -293,16 +261,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * 
* - * optional bool java_multiple_files = 10 [default = false]; + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; + * @return bool */ public function getJavaMultipleFiles() { @@ -310,16 +277,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * 
* - * optional bool java_multiple_files = 10 [default = false]; + * Generated from protobuf field optional bool java_multiple_files = 10 [default = false]; + * @param bool $var + * @return $this */ public function setJavaMultipleFiles($var) { @@ -336,11 +303,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * This option does nothing.
-     * 
* - * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * @return bool */ public function getJavaGenerateEqualsAndHash() { @@ -348,11 +314,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * This option does nothing.
-     * 
* - * optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * Generated from protobuf field optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + * @param bool $var + * @return $this */ public function setJavaGenerateEqualsAndHash($var) { @@ -369,16 +335,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * 
* - * optional bool java_string_check_utf8 = 27 [default = false]; + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; + * @return bool */ public function getJavaStringCheckUtf8() { @@ -386,16 +351,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * 
* - * optional bool java_string_check_utf8 = 27 [default = false]; + * Generated from protobuf field optional bool java_string_check_utf8 = 27 [default = false]; + * @param bool $var + * @return $this */ public function setJavaStringCheckUtf8($var) { @@ -412,7 +377,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * @return int */ public function getOptimizeFor() { @@ -420,7 +386,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * Generated from protobuf field optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + * @param int $var + * @return $this */ public function setOptimizeFor($var) { @@ -437,15 +405,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * 
* - * optional string go_package = 11; + * Generated from protobuf field optional string go_package = 11; + * @return string */ public function getGoPackage() { @@ -453,15 +420,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * 
* - * optional string go_package = 11; + * Generated from protobuf field optional string go_package = 11; + * @param string $var + * @return $this */ public function setGoPackage($var) { @@ -478,7 +445,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -488,9 +454,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * 
* - * optional bool cc_generic_services = 16 [default = false]; + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; + * @return bool */ public function getCcGenericServices() { @@ -498,7 +464,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -508,9 +473,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * 
* - * optional bool cc_generic_services = 16 [default = false]; + * Generated from protobuf field optional bool cc_generic_services = 16 [default = false]; + * @param bool $var + * @return $this */ public function setCcGenericServices($var) { @@ -527,7 +493,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional bool java_generic_services = 17 [default = false]; + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; + * @return bool */ public function getJavaGenericServices() { @@ -535,7 +502,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional bool java_generic_services = 17 [default = false]; + * Generated from protobuf field optional bool java_generic_services = 17 [default = false]; + * @param bool $var + * @return $this */ public function setJavaGenericServices($var) { @@ -552,7 +521,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional bool py_generic_services = 18 [default = false]; + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; + * @return bool */ public function getPyGenericServices() { @@ -560,7 +530,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * optional bool py_generic_services = 18 [default = false]; + * Generated from protobuf field optional bool py_generic_services = 18 [default = false]; + * @param bool $var + * @return $this */ public function setPyGenericServices($var) { @@ -577,14 +549,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * 
* - * optional bool deprecated = 23 [default = false]; + * Generated from protobuf field optional bool deprecated = 23 [default = false]; + * @return bool */ public function getDeprecated() { @@ -592,14 +563,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * 
* - * optional bool deprecated = 23 [default = false]; + * Generated from protobuf field optional bool deprecated = 23 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -616,12 +587,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * 
* - * optional bool cc_enable_arenas = 31 [default = false]; + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = false]; + * @return bool */ public function getCcEnableArenas() { @@ -629,12 +599,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * 
* - * optional bool cc_enable_arenas = 31 [default = false]; + * Generated from protobuf field optional bool cc_enable_arenas = 31 [default = false]; + * @param bool $var + * @return $this */ public function setCcEnableArenas($var) { @@ -651,12 +621,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * 
* - * optional string objc_class_prefix = 36; + * Generated from protobuf field optional string objc_class_prefix = 36; + * @return string */ public function getObjcClassPrefix() { @@ -664,12 +633,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * 
* - * optional string objc_class_prefix = 36; + * Generated from protobuf field optional string objc_class_prefix = 36; + * @param string $var + * @return $this */ public function setObjcClassPrefix($var) { @@ -686,11 +655,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Namespace for generated classes; defaults to the package.
-     * 
* - * optional string csharp_namespace = 37; + * Generated from protobuf field optional string csharp_namespace = 37; + * @return string */ public function getCsharpNamespace() { @@ -698,11 +666,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Namespace for generated classes; defaults to the package.
-     * 
* - * optional string csharp_namespace = 37; + * Generated from protobuf field optional string csharp_namespace = 37; + * @param string $var + * @return $this */ public function setCsharpNamespace($var) { @@ -719,14 +687,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * 
* - * optional string swift_prefix = 39; + * Generated from protobuf field optional string swift_prefix = 39; + * @return string */ public function getSwiftPrefix() { @@ -734,14 +701,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * 
* - * optional string swift_prefix = 39; + * Generated from protobuf field optional string swift_prefix = 39; + * @param string $var + * @return $this */ public function setSwiftPrefix($var) { @@ -758,12 +725,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * 
* - * optional string php_class_prefix = 40; + * Generated from protobuf field optional string php_class_prefix = 40; + * @return string */ public function getPhpClassPrefix() { @@ -771,12 +737,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * 
* - * optional string php_class_prefix = 40; + * Generated from protobuf field optional string php_class_prefix = 40; + * @param string $var + * @return $this */ public function setPhpClassPrefix($var) { @@ -793,13 +759,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * 
* - * optional string php_namespace = 41; + * Generated from protobuf field optional string php_namespace = 41; + * @return string */ public function getPhpNamespace() { @@ -807,13 +772,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * 
* - * optional string php_namespace = 41; + * Generated from protobuf field optional string php_namespace = 41; + * @param string $var + * @return $this */ public function setPhpNamespace($var) { @@ -830,11 +795,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -842,11 +806,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php index b550e7f1..4dd56ef8 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php @@ -5,36 +5,28 @@ namespace Google\Protobuf\Internal; /** - *
  * Generated classes can be optimized for speed or code size.
- * 
* - * Protobuf enum google.protobuf.FileOptions.OptimizeMode + * Protobuf enum Google\Protobuf\Internal */ class FileOptions_OptimizeMode { /** - *
      * Generate complete code for parsing, serialization,
-     * 
* - * SPEED = 1; + * Generated from protobuf enum SPEED = 1; */ const SPEED = 1; /** - *
      * etc.
-     * 
* - * CODE_SIZE = 2; + * Generated from protobuf enum CODE_SIZE = 2; */ const CODE_SIZE = 2; /** - *
      * Generate code using MessageLite and the lite runtime.
-     * 
* - * LITE_RUNTIME = 3; + * Generated from protobuf enum LITE_RUNTIME = 3; */ const LITE_RUNTIME = 3; } diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index 1e666f31..35b47526 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -12,23 +12,19 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes the relationship between generated code and its original source
  * file. A GeneratedCodeInfo message is associated with only one generated
  * source file, but may contain references to different source .proto files.
- * 
* - * Protobuf type google.protobuf.GeneratedCodeInfo + * Generated from protobuf message google.protobuf.GeneratedCodeInfo */ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message { /** - *
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * 
* - * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; */ private $annotation; private $has_annotation = false; @@ -39,12 +35,11 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message } /** - *
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * 
* - * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getAnnotation() { @@ -52,12 +47,12 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message } /** - *
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * 
* - * repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setAnnotation(&$var) { diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php index 8d227e1c..c2e22e89 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php @@ -12,47 +12,39 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.GeneratedCodeInfo.Annotation + * Generated from protobuf message google.protobuf.GeneratedCodeInfo.Annotation */ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message { /** - *
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; */ private $path; private $has_path = false; /** - *
      * Identifies the filesystem path to the original source .proto.
-     * 
* - * optional string source_file = 2; + * Generated from protobuf field optional string source_file = 2; */ private $source_file = ''; private $has_source_file = false; /** - *
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * 
* - * optional int32 begin = 3; + * Generated from protobuf field optional int32 begin = 3; */ private $begin = 0; private $has_begin = false; /** - *
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * 
* - * optional int32 end = 4; + * Generated from protobuf field optional int32 end = 4; */ private $end = 0; private $has_end = false; @@ -63,12 +55,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getPath() { @@ -76,12 +67,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setPath(&$var) { @@ -98,11 +89,10 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the filesystem path to the original source .proto.
-     * 
* - * optional string source_file = 2; + * Generated from protobuf field optional string source_file = 2; + * @return string */ public function getSourceFile() { @@ -110,11 +100,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the filesystem path to the original source .proto.
-     * 
* - * optional string source_file = 2; + * Generated from protobuf field optional string source_file = 2; + * @param string $var + * @return $this */ public function setSourceFile($var) { @@ -131,12 +121,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * 
* - * optional int32 begin = 3; + * Generated from protobuf field optional int32 begin = 3; + * @return int */ public function getBegin() { @@ -144,12 +133,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * 
* - * optional int32 begin = 3; + * Generated from protobuf field optional int32 begin = 3; + * @param int $var + * @return $this */ public function setBegin($var) { @@ -166,13 +155,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * 
* - * optional int32 end = 4; + * Generated from protobuf field optional int32 end = 4; + * @return int */ public function getEnd() { @@ -180,13 +168,13 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * 
* - * optional int32 end = 4; + * Generated from protobuf field optional int32 end = 4; + * @param int $var + * @return $this */ public function setEnd($var) { diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php index a5835358..3677ca38 100644 --- a/php/src/Google/Protobuf/Internal/MessageOptions.php +++ b/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -12,12 +12,11 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.MessageOptions + * Generated from protobuf message google.protobuf.MessageOptions */ class MessageOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -33,41 +32,35 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * 
* - * optional bool message_set_wire_format = 1 [default = false]; + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; */ private $message_set_wire_format = false; private $has_message_set_wire_format = false; /** - *
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * 
* - * optional bool no_standard_descriptor_accessor = 2 [default = false]; + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; */ private $no_standard_descriptor_accessor = false; private $has_no_standard_descriptor_accessor = false; /** - *
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map<KeyType, ValueType> map_field = 1;
+     *     map map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -82,18 +75,15 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * 
* - * optional bool map_entry = 7; + * Generated from protobuf field optional bool map_entry = 7; */ private $map_entry = false; private $has_map_entry = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -104,7 +94,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -120,9 +109,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * 
* - * optional bool message_set_wire_format = 1 [default = false]; + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; + * @return bool */ public function getMessageSetWireFormat() { @@ -130,7 +119,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -146,9 +134,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * 
* - * optional bool message_set_wire_format = 1 [default = false]; + * Generated from protobuf field optional bool message_set_wire_format = 1 [default = false]; + * @param bool $var + * @return $this */ public function setMessageSetWireFormat($var) { @@ -165,13 +154,12 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * 
* - * optional bool no_standard_descriptor_accessor = 2 [default = false]; + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; + * @return bool */ public function getNoStandardDescriptorAccessor() { @@ -179,13 +167,13 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * 
* - * optional bool no_standard_descriptor_accessor = 2 [default = false]; + * Generated from protobuf field optional bool no_standard_descriptor_accessor = 2 [default = false]; + * @param bool $var + * @return $this */ public function setNoStandardDescriptorAccessor($var) { @@ -202,14 +190,13 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @return bool */ public function getDeprecated() { @@ -217,14 +204,14 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * 
* - * optional bool deprecated = 3 [default = false]; + * Generated from protobuf field optional bool deprecated = 3 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -241,11 +228,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map<KeyType, ValueType> map_field = 1;
+     *     map map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -260,9 +246,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * 
* - * optional bool map_entry = 7; + * Generated from protobuf field optional bool map_entry = 7; + * @return bool */ public function getMapEntry() { @@ -270,11 +256,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map<KeyType, ValueType> map_field = 1;
+     *     map map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -289,9 +274,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * 
* - * optional bool map_entry = 7; + * Generated from protobuf field optional bool map_entry = 7; + * @param bool $var + * @return $this */ public function setMapEntry($var) { @@ -308,11 +294,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -320,11 +305,11 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php index c3f9f064..69c25b69 100644 --- a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php @@ -12,54 +12,46 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a method of a service.
- * 
* - * Protobuf type google.protobuf.MethodDescriptorProto + * Generated from protobuf message google.protobuf.MethodDescriptorProto */ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - *
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * 
* - * optional string input_type = 2; + * Generated from protobuf field optional string input_type = 2; */ private $input_type = ''; private $has_input_type = false; /** - * optional string output_type = 3; + * Generated from protobuf field optional string output_type = 3; */ private $output_type = ''; private $has_output_type = false; /** - * optional .google.protobuf.MethodOptions options = 4; + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; */ private $options = null; private $has_options = false; /** - *
      * Identifies if client streams multiple client messages
-     * 
* - * optional bool client_streaming = 5 [default = false]; + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; */ private $client_streaming = false; private $has_client_streaming = false; /** - *
      * Identifies if server streams multiple server messages
-     * 
* - * optional bool server_streaming = 6 [default = false]; + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; */ private $server_streaming = false; private $has_server_streaming = false; @@ -70,7 +62,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -78,7 +71,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -95,12 +90,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * 
* - * optional string input_type = 2; + * Generated from protobuf field optional string input_type = 2; + * @return string */ public function getInputType() { @@ -108,12 +102,12 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * 
* - * optional string input_type = 2; + * Generated from protobuf field optional string input_type = 2; + * @param string $var + * @return $this */ public function setInputType($var) { @@ -130,7 +124,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string output_type = 3; + * Generated from protobuf field optional string output_type = 3; + * @return string */ public function getOutputType() { @@ -138,7 +133,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string output_type = 3; + * Generated from protobuf field optional string output_type = 3; + * @param string $var + * @return $this */ public function setOutputType($var) { @@ -155,7 +152,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MethodOptions options = 4; + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; + * @return \Google\Protobuf\Internal\MethodOptions */ public function getOptions() { @@ -163,7 +161,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MethodOptions options = 4; + * Generated from protobuf field optional .google.protobuf.MethodOptions options = 4; + * @param \Google\Protobuf\Internal\MethodOptions $var + * @return $this */ public function setOptions(&$var) { @@ -180,11 +180,10 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies if client streams multiple client messages
-     * 
* - * optional bool client_streaming = 5 [default = false]; + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; + * @return bool */ public function getClientStreaming() { @@ -192,11 +191,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies if client streams multiple client messages
-     * 
* - * optional bool client_streaming = 5 [default = false]; + * Generated from protobuf field optional bool client_streaming = 5 [default = false]; + * @param bool $var + * @return $this */ public function setClientStreaming($var) { @@ -213,11 +212,10 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies if server streams multiple server messages
-     * 
* - * optional bool server_streaming = 6 [default = false]; + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; + * @return bool */ public function getServerStreaming() { @@ -225,11 +223,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies if server streams multiple server messages
-     * 
* - * optional bool server_streaming = 6 [default = false]; + * Generated from protobuf field optional bool server_streaming = 6 [default = false]; + * @param bool $var + * @return $this */ public function setServerStreaming($var) { diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php index e8d36d3c..5b2db776 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -12,33 +12,29 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.MethodOptions + * Generated from protobuf message google.protobuf.MethodOptions */ class MethodOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; */ private $idempotency_level = 0; private $has_idempotency_level = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -49,14 +45,13 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @return bool */ public function getDeprecated() { @@ -64,14 +59,14 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -88,7 +83,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * @return int */ public function getIdempotencyLevel() { @@ -96,7 +92,9 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * Generated from protobuf field optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + * @param int $var + * @return $this */ public function setIdempotencyLevel($var) { @@ -113,11 +111,10 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -125,11 +122,11 @@ class MethodOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php index ce4adfe7..9e06d8ee 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php @@ -5,34 +5,28 @@ namespace Google\Protobuf\Internal; /** - *
  * Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
  * or neither? HTTP based RPC implementation may choose GET verb for safe
  * methods, and PUT verb for idempotent methods instead of the default POST.
- * 
* - * Protobuf enum google.protobuf.MethodOptions.IdempotencyLevel + * Protobuf enum Google\Protobuf\Internal */ class MethodOptions_IdempotencyLevel { /** - * IDEMPOTENCY_UNKNOWN = 0; + * Generated from protobuf enum IDEMPOTENCY_UNKNOWN = 0; */ const IDEMPOTENCY_UNKNOWN = 0; /** - *
      * implies idempotent
-     * 
* - * NO_SIDE_EFFECTS = 1; + * Generated from protobuf enum NO_SIDE_EFFECTS = 1; */ const NO_SIDE_EFFECTS = 1; /** - *
      * idempotent, but may have side effects
-     * 
* - * IDEMPOTENT = 2; + * Generated from protobuf enum IDEMPOTENT = 2; */ const IDEMPOTENT = 2; } diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php index 744ca638..0d4f3bdc 100644 --- a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php @@ -12,21 +12,19 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a oneof.
- * 
* - * Protobuf type google.protobuf.OneofDescriptorProto + * Generated from protobuf message google.protobuf.OneofDescriptorProto */ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * optional .google.protobuf.OneofOptions options = 2; + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; */ private $options = null; private $has_options = false; @@ -37,7 +35,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -45,7 +44,9 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -62,7 +63,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.OneofOptions options = 2; + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; + * @return \Google\Protobuf\Internal\OneofOptions */ public function getOptions() { @@ -70,7 +72,9 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.OneofOptions options = 2; + * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; + * @param \Google\Protobuf\Internal\OneofOptions $var + * @return $this */ public function setOptions(&$var) { diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php index b3cd51ed..aa8c934c 100644 --- a/php/src/Google/Protobuf/Internal/OneofOptions.php +++ b/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -12,16 +12,14 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.OneofOptions + * Generated from protobuf message google.protobuf.OneofOptions */ class OneofOptions extends \Google\Protobuf\Internal\Message { /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -32,11 +30,10 @@ class OneofOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -44,11 +41,11 @@ class OneofOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php index 7c85728a..963cd650 100644 --- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Describes a service.
- * 
* - * Protobuf type google.protobuf.ServiceDescriptorProto + * Generated from protobuf message google.protobuf.ServiceDescriptorProto */ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message { /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; */ private $name = ''; private $has_name = false; /** - * repeated .google.protobuf.MethodDescriptorProto method = 2; + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; */ private $method; private $has_method = false; /** - * optional .google.protobuf.ServiceOptions options = 3; + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; */ private $options = null; private $has_options = false; @@ -42,7 +40,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @return string */ public function getName() { @@ -50,7 +49,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional string name = 1; + * Generated from protobuf field optional string name = 1; + * @param string $var + * @return $this */ public function setName($var) { @@ -67,7 +68,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.MethodDescriptorProto method = 2; + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getMethod() { @@ -75,7 +77,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.MethodDescriptorProto method = 2; + * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; + * @param \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setMethod(&$var) { @@ -92,7 +96,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.ServiceOptions options = 3; + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; + * @return \Google\Protobuf\Internal\ServiceOptions */ public function getOptions() { @@ -100,7 +105,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * optional .google.protobuf.ServiceOptions options = 3; + * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; + * @param \Google\Protobuf\Internal\ServiceOptions $var + * @return $this */ public function setOptions(&$var) { diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php index 0f3a8d74..ea649865 100644 --- a/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -12,28 +12,24 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.ServiceOptions + * Generated from protobuf message google.protobuf.ServiceOptions */ class ServiceOptions extends \Google\Protobuf\Internal\Message { /** - *
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; */ private $deprecated = false; private $has_deprecated = false; /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; */ private $uninterpreted_option; private $has_uninterpreted_option = false; @@ -44,14 +40,13 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @return bool */ public function getDeprecated() { @@ -59,14 +54,14 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message } /** - *
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * 
* - * optional bool deprecated = 33 [default = false]; + * Generated from protobuf field optional bool deprecated = 33 [default = false]; + * @param bool $var + * @return $this */ public function setDeprecated($var) { @@ -83,11 +78,10 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getUninterpretedOption() { @@ -95,11 +89,11 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message } /** - *
      * The parser stores options it doesn't recognize here. See above.
-     * 
* - * repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setUninterpretedOption(&$var) { diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index 7eef3424..65530586 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -12,17 +12,14 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Encapsulates information about the original source file from which a
  * FileDescriptorProto was generated.
- * 
* - * Protobuf type google.protobuf.SourceCodeInfo + * Generated from protobuf message google.protobuf.SourceCodeInfo */ class SourceCodeInfo extends \Google\Protobuf\Internal\Message { /** - *
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -64,9 +61,8 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * 
* - * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; */ private $location; private $has_location = false; @@ -77,7 +73,6 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message } /** - *
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -119,9 +114,9 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * 
* - * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getLocation() { @@ -129,7 +124,6 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message } /** - *
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -171,9 +165,10 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * 
* - * repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * Generated from protobuf field repeated .google.protobuf.SourceCodeInfo.Location location = 1; + * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setLocation(&$var) { diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php index cf23e38b..b33013b8 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php @@ -12,12 +12,11 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type google.protobuf.SourceCodeInfo.Location + * Generated from protobuf message google.protobuf.SourceCodeInfo.Location */ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message { /** - *
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -39,27 +38,23 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; */ private $path; private $has_path = false; /** - *
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * 
* - * repeated int32 span = 2 [packed = true]; + * Generated from protobuf field repeated int32 span = 2 [packed = true]; */ private $span; private $has_span = false; /** - *
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -96,19 +91,18 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. */
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * 
* - * optional string leading_comments = 3; + * Generated from protobuf field optional string leading_comments = 3; */ private $leading_comments = ''; private $has_leading_comments = false; /** - * optional string trailing_comments = 4; + * Generated from protobuf field optional string trailing_comments = 4; */ private $trailing_comments = ''; private $has_trailing_comments = false; /** - * repeated string leading_detached_comments = 6; + * Generated from protobuf field repeated string leading_detached_comments = 6; */ private $leading_detached_comments; private $has_leading_detached_comments = false; @@ -119,7 +113,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -141,9 +134,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getPath() { @@ -151,7 +144,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -173,9 +165,10 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * 
* - * repeated int32 path = 1 [packed = true]; + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setPath(&$var) { @@ -192,15 +185,14 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * 
* - * repeated int32 span = 2 [packed = true]; + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getSpan() { @@ -208,15 +200,15 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * 
* - * repeated int32 span = 2 [packed = true]; + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setSpan(&$var) { @@ -233,7 +225,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -270,9 +261,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. */
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * 
* - * optional string leading_comments = 3; + * Generated from protobuf field optional string leading_comments = 3; + * @return string */ public function getLeadingComments() { @@ -280,7 +271,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - *
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -317,9 +307,10 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. */
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * 
* - * optional string leading_comments = 3; + * Generated from protobuf field optional string leading_comments = 3; + * @param string $var + * @return $this */ public function setLeadingComments($var) { @@ -336,7 +327,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - * optional string trailing_comments = 4; + * Generated from protobuf field optional string trailing_comments = 4; + * @return string */ public function getTrailingComments() { @@ -344,7 +336,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - * optional string trailing_comments = 4; + * Generated from protobuf field optional string trailing_comments = 4; + * @param string $var + * @return $this */ public function setTrailingComments($var) { @@ -361,7 +355,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - * repeated string leading_detached_comments = 6; + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getLeadingDetachedComments() { @@ -369,7 +364,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } /** - * repeated string leading_detached_comments = 6; + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setLeadingDetachedComments(&$var) { diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php index 08e071d4..a4fab343 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -12,56 +12,52 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * A message representing a option the parser does not recognize. This only
  * appears in options protos created by the compiler::Parser class.
  * DescriptorPool resolves these when building Descriptor objects. Therefore,
  * options protos in descriptor objects (e.g. returned by Descriptor::options(),
  * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
  * in them.
- * 
* - * Protobuf type google.protobuf.UninterpretedOption + * Generated from protobuf message google.protobuf.UninterpretedOption */ class UninterpretedOption extends \Google\Protobuf\Internal\Message { /** - * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; */ private $name; private $has_name = false; /** - *
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * 
* - * optional string identifier_value = 3; + * Generated from protobuf field optional string identifier_value = 3; */ private $identifier_value = ''; private $has_identifier_value = false; /** - * optional uint64 positive_int_value = 4; + * Generated from protobuf field optional uint64 positive_int_value = 4; */ private $positive_int_value = 0; private $has_positive_int_value = false; /** - * optional int64 negative_int_value = 5; + * Generated from protobuf field optional int64 negative_int_value = 5; */ private $negative_int_value = 0; private $has_negative_int_value = false; /** - * optional double double_value = 6; + * Generated from protobuf field optional double double_value = 6; */ private $double_value = 0.0; private $has_double_value = false; /** - * optional bytes string_value = 7; + * Generated from protobuf field optional bytes string_value = 7; */ private $string_value = ''; private $has_string_value = false; /** - * optional string aggregate_value = 8; + * Generated from protobuf field optional string aggregate_value = 8; */ private $aggregate_value = ''; private $has_aggregate_value = false; @@ -72,7 +68,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getName() { @@ -80,7 +77,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * Generated from protobuf field repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ public function setName(&$var) { @@ -97,12 +96,11 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - *
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * 
* - * optional string identifier_value = 3; + * Generated from protobuf field optional string identifier_value = 3; + * @return string */ public function getIdentifierValue() { @@ -110,12 +108,12 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - *
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * 
* - * optional string identifier_value = 3; + * Generated from protobuf field optional string identifier_value = 3; + * @param string $var + * @return $this */ public function setIdentifierValue($var) { @@ -132,7 +130,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional uint64 positive_int_value = 4; + * Generated from protobuf field optional uint64 positive_int_value = 4; + * @return int|string */ public function getPositiveIntValue() { @@ -140,7 +139,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional uint64 positive_int_value = 4; + * Generated from protobuf field optional uint64 positive_int_value = 4; + * @param int|string $var + * @return $this */ public function setPositiveIntValue($var) { @@ -157,7 +158,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional int64 negative_int_value = 5; + * Generated from protobuf field optional int64 negative_int_value = 5; + * @return int|string */ public function getNegativeIntValue() { @@ -165,7 +167,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional int64 negative_int_value = 5; + * Generated from protobuf field optional int64 negative_int_value = 5; + * @param int|string $var + * @return $this */ public function setNegativeIntValue($var) { @@ -182,7 +186,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional double double_value = 6; + * Generated from protobuf field optional double double_value = 6; + * @return float */ public function getDoubleValue() { @@ -190,7 +195,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional double double_value = 6; + * Generated from protobuf field optional double double_value = 6; + * @param float $var + * @return $this */ public function setDoubleValue($var) { @@ -207,7 +214,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional bytes string_value = 7; + * Generated from protobuf field optional bytes string_value = 7; + * @return string */ public function getStringValue() { @@ -215,7 +223,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional bytes string_value = 7; + * Generated from protobuf field optional bytes string_value = 7; + * @param string $var + * @return $this */ public function setStringValue($var) { @@ -232,7 +242,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional string aggregate_value = 8; + * Generated from protobuf field optional string aggregate_value = 8; + * @return string */ public function getAggregateValue() { @@ -240,7 +251,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message } /** - * optional string aggregate_value = 8; + * Generated from protobuf field optional string aggregate_value = 8; + * @param string $var + * @return $this */ public function setAggregateValue($var) { diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php index eb27754c..69a96d45 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php @@ -12,25 +12,23 @@ use Google\Protobuf\Internal\InputStream; use Google\Protobuf\Internal\GPBUtil; /** - *
  * The name of the uninterpreted option.  Each string represents a segment in
  * a dot-separated name.  is_extension is true iff a segment represents an
  * extension (denoted with parentheses in options specs in .proto files).
  * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
  * "foo.(bar.baz).qux".
- * 
* - * Protobuf type google.protobuf.UninterpretedOption.NamePart + * Generated from protobuf message google.protobuf.UninterpretedOption.NamePart */ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message { /** - * required string name_part = 1; + * Generated from protobuf field required string name_part = 1; */ private $name_part = ''; private $has_name_part = false; /** - * required bool is_extension = 2; + * Generated from protobuf field required bool is_extension = 2; */ private $is_extension = false; private $has_is_extension = false; @@ -41,7 +39,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message } /** - * required string name_part = 1; + * Generated from protobuf field required string name_part = 1; + * @return string */ public function getNamePart() { @@ -49,7 +48,9 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message } /** - * required string name_part = 1; + * Generated from protobuf field required string name_part = 1; + * @param string $var + * @return $this */ public function setNamePart($var) { @@ -66,7 +67,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message } /** - * required bool is_extension = 2; + * Generated from protobuf field required bool is_extension = 2; + * @return bool */ public function getIsExtension() { @@ -74,7 +76,9 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message } /** - * required bool is_extension = 2; + * Generated from protobuf field required bool is_extension = 2; + * @param bool $var + * @return $this */ public function setIsExtension($var) { diff --git a/php/tests/generated_phpdoc_test.php b/php/tests/generated_phpdoc_test.php new file mode 100644 index 00000000..6c1a26f7 --- /dev/null +++ b/php/tests/generated_phpdoc_test.php @@ -0,0 +1,337 @@ +getDocComment(); + $this->assertContains('foo.TestMessage', $doc); + } + + /** + * @dataProvider providePhpDocForGettersAndSetters + */ + public function testPhpDocForIntGetters($methods, $expectedDoc) + { + $class = new ReflectionClass('Foo\TestMessage'); + foreach ($methods as $method) { + $doc = $class->getMethod($method)->getDocComment(); + $this->assertContains($expectedDoc, $doc); + } + } + + public function providePhpDocForGettersAndSetters() + { + return [ + [ + [ + 'setOptionalInt32', + 'setOptionalUint32', + 'setOptionalSint32', + 'setOptionalFixed32', + 'setOptionalSfixed32', + 'setOneofInt32', + 'setOneofUint32', + 'setOneofSint32', + 'setOneofFixed32', + 'setOneofSfixed32', + 'setOptionalEnum', + 'setOptionalNoNamespaceEnum', + 'setOptionalNestedEnum', + 'setOneofEnum' + ], + '@param int $var' + ], + [ + [ + 'setOptionalInt64', + 'setOptionalUint64', + 'setOptionalSint64', + 'setOptionalFixed64', + 'setOptionalSfixed64', + 'setOneofInt64', + 'setOneofUint64', + 'setOneofSint64', + 'setOneofFixed64', + 'setOneofSfixed64', + ], + '@param int|string $var' + ], + [ + [ + 'getOptionalInt32', + 'getOptionalUint32', + 'getOptionalSint32', + 'getOptionalFixed32', + 'getOptionalSfixed32', + 'getOneofInt32', + 'getOneofUint32', + 'getOneofSint32', + 'getOneofFixed32', + 'getOneofSfixed32', + 'getOptionalEnum', + 'getOptionalNoNamespaceEnum', + 'getOptionalNestedEnum', + 'getOneofEnum', + ], + '@return int' + ], + [ + [ + 'setOptionalInt64', + 'setOptionalUint64', + 'setOptionalSint64', + 'setOptionalFixed64', + 'setOptionalSfixed64', + 'setOneofInt64', + 'setOneofUint64', + 'setOneofSint64', + 'setOneofFixed64', + 'setOneofSfixed64', + ], + '@param int|string $var' + ], + [ + [ + 'getRepeatedInt32', + 'getRepeatedInt64', + 'getRepeatedUint32', + 'getRepeatedUint64', + 'getRepeatedSint32', + 'getRepeatedSint64', + 'getRepeatedFixed32', + 'getRepeatedFixed64', + 'getRepeatedSfixed32', + 'getRepeatedSfixed64', + 'getRepeatedFloat', + 'getRepeatedDouble', + 'getRepeatedBool', + 'getRepeatedString', + 'getRepeatedBytes', + 'getRepeatedEnum', + 'getRepeatedMessage', + 'getRepeatedRecursive', + 'getRepeatedNoNamespaceMessage', + 'getRepeatedNoNamespaceEnum', + ], + '@return \Google\Protobuf\Internal\RepeatedField' + ], + [ + [ + 'getMapInt32Int32', + 'getMapInt64Int64', + 'getMapUint32Uint32', + 'getMapUint64Uint64', + 'getMapSint32Sint32', + 'getMapSint64Sint64', + 'getMapFixed32Fixed32', + 'getMapFixed64Fixed64', + 'getMapSfixed32Sfixed32', + 'getMapSfixed64Sfixed64', + 'getMapInt32Float', + 'getMapInt32Double', + 'getMapBoolBool', + 'getMapStringString', + 'getMapInt32Bytes', + 'getMapInt32Enum', + 'getMapInt32Message', + 'getMapRecursive', + ], + '@return \Google\Protobuf\Internal\MapField' + ], + [ + [ + 'setRepeatedInt32', + 'setRepeatedUint32', + 'setRepeatedSint32', + 'setRepeatedFixed32', + 'setRepeatedSfixed32', + 'setRepeatedEnum', + 'setRepeatedNoNamespaceEnum', + ], + '@param int[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedInt64', + 'setRepeatedUint64', + 'setRepeatedSint64', + 'setRepeatedFixed64', + 'setRepeatedSfixed64', + ], + '@param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedFloat', + 'setRepeatedDouble', + ], + '@param float[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedBool', + ], + '@param bool[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedString', + 'setRepeatedBytes', + ], + '@param string[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedMessage', + ], + '@param \Foo\TestMessage_Sub[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedRecursive', + ], + '@param \Foo\TestMessage[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setRepeatedNoNamespaceMessage', + ], + '@param \NoNamespaceMessage[]|\Google\Protobuf\Internal\RepeatedField $var' + ], + [ + [ + 'setMapInt32Int32', + 'setMapInt64Int64', + 'setMapUint32Uint32', + 'setMapUint64Uint64', + 'setMapSint32Sint32', + 'setMapSint64Sint64', + 'setMapFixed32Fixed32', + 'setMapFixed64Fixed64', + 'setMapSfixed32Sfixed32', + 'setMapSfixed64Sfixed64', + 'setMapInt32Float', + 'setMapInt32Double', + 'setMapBoolBool', + 'setMapStringString', + 'setMapInt32Bytes', + 'setMapInt32Enum', + 'setMapInt32Message', + 'setMapRecursive', + ], + '@param array|\Google\Protobuf\Internal\MapField $var' + ], + [ + [ + 'getOptionalFloat', + 'getOptionalDouble', + 'getOneofDouble', + 'getOneofFloat', + ], + '@return float' + ], + [ + [ + 'setOptionalFloat', + 'setOptionalDouble', + 'setOneofDouble', + 'setOneofFloat', + ], + '@param float $var' + ], + [ + [ + 'getOptionalBool', + 'getOneofBool', + ], + '@return bool'], + [ + [ + 'setOptionalBool', + 'setOneofBool', + ], + '@param bool $var' + ], + [ + [ + 'getOptionalString', + 'getOptionalBytes', + 'getOneofString', + 'getOneofBytes', + 'getMyOneof', + ], + '@return string' + ], + [ + [ + 'setOptionalString', + 'setOptionalBytes', + 'setOneofString', + 'setOneofBytes', + ], + '@param string $var' + ], + + [ + [ + 'getOptionalMessage', + 'getOneofMessage' + ], + '@return \Foo\TestMessage_Sub' + ], + [ + [ + 'setOptionalMessage', + 'setOneofMessage' + ], + '@param \Foo\TestMessage_Sub $var' + ], + [ + [ + 'getOptionalIncludedMessage' + ], + '@return \Bar\TestInclude' + ], + [ + [ + 'setOptionalIncludedMessage' + ], + '@param \Bar\TestInclude $var' + ], + [ + [ + 'getRecursive' + ], + '@return \Foo\TestMessage' + ], + [ + [ + 'setRecursive' + ], + '@param \Foo\TestMessage $var' + ], + + [ + [ + 'getOptionalNoNamespaceMessage' + ], + '@return \NoNamespaceMessage' + ], + [ + [ + 'setOptionalNoNamespaceMessage' + ], + '@param \NoNamespaceMessage $var' + ], + ]; + } +} diff --git a/php/tests/test.sh b/php/tests/test.sh index 69849ab3..6c6edd56 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -8,7 +8,7 @@ set -e phpize && ./configure CFLAGS='-g -O0' && make popd -tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php ) +tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php ) for t in "${tests[@]}" do diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 78252817..03aebdb9 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -51,6 +51,9 @@ const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"}; const int kReservedNamesSize = 3; +const int kFieldSetter = 1; +const int kFieldGetter = 2; +const int kFieldProperty = 3; namespace google { namespace protobuf { @@ -71,10 +74,12 @@ std::string EscapeDollor(const string& to_escape); std::string BinaryToHex(const string& binary); void Indent(io::Printer* printer); void Outdent(io::Printer* printer); -void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message); -void GenerateFieldDocComment(io::Printer* printer, - const FieldDescriptor* field); -void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_); +void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message, + int is_descriptor); +void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, + int is_descriptor, int function_type); +void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, + int is_descriptor); void GenerateEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); @@ -306,6 +311,87 @@ std::string TypeName(const FieldDescriptor* field) { } } +std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) { + if (field->is_map()) { + return "array|\\Google\\Protobuf\\Internal\\MapField"; + } + string type; + switch (field->type()) { + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_ENUM: + type = "int"; + break; + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SFIXED64: + type = "int|string"; + break; + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + type = "float"; + break; + case FieldDescriptor::TYPE_BOOL: + type = "bool"; + break; + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: + type = "string"; + break; + case FieldDescriptor::TYPE_MESSAGE: + type = "\\" + FullClassName(field->message_type(), is_descriptor); + break; + case FieldDescriptor::TYPE_GROUP: + return "null"; + default: assert(false); return ""; + } + if (field->is_repeated()) { + // accommodate for edge case with multiple types. + size_t start_pos = type.find("|"); + if (start_pos != std::string::npos) { + type.replace(start_pos, 1, "[]|"); + } + type += "[]|\\Google\\Protobuf\\Internal\\RepeatedField"; + } + return type; +} + +std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor) { + if (field->is_map()) { + return "\\Google\\Protobuf\\Internal\\MapField"; + } + if (field->is_repeated()) { + return "\\Google\\Protobuf\\Internal\\RepeatedField"; + } + switch (field->type()) { + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_ENUM: return "int"; + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SFIXED64: return "int|string"; + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: return "float"; + case FieldDescriptor::TYPE_BOOL: return "bool"; + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: return "string"; + case FieldDescriptor::TYPE_MESSAGE: + return "\\" + FullClassName(field->message_type(), is_descriptor); + case FieldDescriptor::TYPE_GROUP: return "null"; + default: assert(false); return ""; + } +} + std::string EnumOrMessageSuffix( const FieldDescriptor* field, bool is_descriptor) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { @@ -390,7 +476,7 @@ void Outdent(io::Printer* printer) { void GenerateField(const FieldDescriptor* field, io::Printer* printer, bool is_descriptor) { if (field->is_repeated()) { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); printer->Print( "private $^name^;\n", "name", field->name()); @@ -398,7 +484,7 @@ void GenerateField(const FieldDescriptor* field, io::Printer* printer, // Oneof fields are handled by GenerateOneofField. return; } else { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); printer->Print( "private $^name^ = ^default^;\n", "name", field->name(), @@ -426,7 +512,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, // Generate getter. if (oneof != NULL) { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" @@ -435,7 +521,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "camel_name", UnderscoresToCamelCase(field->name(), true), "number", IntToString(field->number())); } else { - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" @@ -446,7 +532,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, } // Generate setter. - GenerateFieldDocComment(printer, field); + GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter); printer->Print( "public function set^camel_name^(^var^)\n" "{\n", @@ -844,7 +930,7 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, "name", fullname.substr(0, lastindex)); } - GenerateEnumDocComment(&printer, en); + GenerateEnumDocComment(&printer, en, is_descriptor); if (lastindex != string::npos) { printer.Print( @@ -905,7 +991,7 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, GenerateUseDeclaration(is_descriptor, &printer); - GenerateMessageDocComment(&printer, message); + GenerateMessageDocComment(&printer, message, is_descriptor); if (lastindex != string::npos) { printer.Print( "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" @@ -953,6 +1039,9 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, for (int i = 0; i < message->oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); printer.Print( + "/**\n" + " * @return string\n" + " */\n" "public function get^camel_name^()\n" "{\n" " return $this->whichOneof(\"^name^\");\n" @@ -1019,22 +1108,6 @@ static string EscapePhpdoc(const string& input) { // does not have a corresponding @Deprecated annotation. result.append("@"); break; - case '<': - // Avoid interpretation as HTML. - result.append("<"); - break; - case '>': - // Avoid interpretation as HTML. - result.append(">"); - break; - case '&': - // Avoid interpretation as HTML. - result.append("&"); - break; - case '\\': - // Java interprets Unicode escape sequences anywhere! - result.append("\"); - break; default: result.push_back(c); break; @@ -1053,7 +1126,7 @@ static void GenerateDocCommentBodyForLocation( if (!comments.empty()) { // TODO(teboring): Ideally we should parse the comment text as Markdown and // write it back as HTML, but this requires a Markdown parser. For now - // we just use
 to get fixed-width text formatting.
+    //   we just use the proto comments unchanged.
 
     // If the comment itself contains block comment start or end markers,
     // HTML-escape them so that they don't accidentally close the doc comment.
@@ -1064,7 +1137,6 @@ static void GenerateDocCommentBodyForLocation(
       lines.pop_back();
     }
 
-    printer->Print(" * 
\n");
     for (int i = 0; i < lines.size(); i++) {
       // Most lines should start with a space.  Watch out for lines that start
       // with a /, since putting that right after the leading asterisk will
@@ -1076,7 +1148,6 @@ static void GenerateDocCommentBodyForLocation(
       }
     }
     printer->Print(
-        " * 
\n" " *\n"); } } @@ -1102,17 +1173,18 @@ static string FirstLineOf(const string& value) { } void GenerateMessageDocComment(io::Printer* printer, - const Descriptor* message) { + const Descriptor* message, int is_descriptor) { printer->Print("/**\n"); GenerateDocCommentBody(printer, message); printer->Print( - " * Protobuf type ^fullname^\n" + " * Generated from protobuf message ^messagename^\n" " */\n", - "fullname", EscapePhpdoc(message->full_name())); + "fullname", EscapePhpdoc(PhpName(message->full_name(), is_descriptor)), + "messagename", EscapePhpdoc(message->full_name())); } -void GenerateFieldDocComment(io::Printer* printer, - const FieldDescriptor* field) { +void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, + int is_descriptor, int function_type) { // In theory we should have slightly different comments for setters, getters, // etc., but in practice everyone already knows the difference between these // so it's redundant information. @@ -1124,18 +1196,27 @@ void GenerateFieldDocComment(io::Printer* printer, printer->Print("/**\n"); GenerateDocCommentBody(printer, field); printer->Print( - " * ^def^\n", + " * Generated from protobuf field ^def^\n", "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); + if (function_type == kFieldSetter) { + printer->Print(" * @param ^php_type^ $var\n", + "php_type", PhpSetterTypeName(field, is_descriptor)); + printer->Print(" * @return $this\n"); + } else if (function_type == kFieldGetter) { + printer->Print(" * @return ^php_type^\n", + "php_type", PhpGetterTypeName(field, is_descriptor)); + } printer->Print(" */\n"); } -void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_) { +void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, + int is_descriptor) { printer->Print("/**\n"); GenerateDocCommentBody(printer, enum_); printer->Print( " * Protobuf enum ^fullname^\n" " */\n", - "fullname", EscapePhpdoc(enum_->full_name())); + "fullname", EscapePhpdoc(PhpName(enum_->full_name(), is_descriptor))); } void GenerateEnumValueDocComment(io::Printer* printer, @@ -1143,7 +1224,7 @@ void GenerateEnumValueDocComment(io::Printer* printer, printer->Print("/**\n"); GenerateDocCommentBody(printer, value); printer->Print( - " * ^def^\n" + " * Generated from protobuf enum ^def^\n" " */\n", "def", EscapePhpdoc(FirstLineOf(value->DebugString()))); } -- cgit v1.2.3 From e55782fa950b4dbdbefff8faaa22da1effd2368b Mon Sep 17 00:00:00 2001 From: Sergio Campama Date: Thu, 29 Jun 2017 11:49:36 -0400 Subject: Add initialized as a reserved keyword as that's the actual property name --- src/google/protobuf/compiler/objectivec/objectivec_helpers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 1ea2676a..bb8170a9 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -196,7 +196,7 @@ const char* const kReservedWordList[] = { // method declared in protos. The main cases are methods // that take no arguments, or setFoo:/hasFoo: type methods. "clear", "data", "delimitedData", "descriptor", "extensionRegistry", - "extensionsCurrentlySet", "isInitialized", "serializedSize", + "extensionsCurrentlySet", "initialized", "isInitialized", "serializedSize", "sortedExtensionsInUse", "unknownFields", // MacTypes.h names -- cgit v1.2.3 From f6ff32cd79f5de0da18b7c44b3908a520d9e93b2 Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Fri, 7 Jul 2017 09:56:32 -0400 Subject: Use consistent hash across NDEBUG/!NDEBUG builds. Fixes #3322. --- src/google/protobuf/map.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 28eaf031..6a88600c 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -862,14 +862,7 @@ class Map { size_type BucketNumber(const Key& k) const { // We inherit from hasher, so one-arg operator() provides a hash function. size_type h = (*const_cast(this))(k); - // To help prevent people from making assumptions about the hash function, - // we use the seed differently depending on NDEBUG. The default hash - // function, the seeding, etc., are all likely to change in the future. -#ifndef NDEBUG - return (h * (seed_ | 1)) & (num_buckets_ - 1); -#else return (h + seed_) & (num_buckets_ - 1); -#endif } bool IsMatch(const Key& k0, const Key& k1) const { -- cgit v1.2.3 From 126082c371d2320255ac8ff7d68bef25a919572d Mon Sep 17 00:00:00 2001 From: tanderson-google Date: Sun, 9 Jul 2017 20:31:50 -0700 Subject: Add std:: namespace prefix to set and map (#3332) * Remove using std::{set,map} --- conformance/conformance_test.cc | 6 +++--- conformance/conformance_test.h | 2 +- .../protobuf/compiler/csharp/csharp_field_base.cc | 4 ++-- .../protobuf/compiler/csharp/csharp_field_base.h | 6 +++--- src/google/protobuf/compiler/csharp/csharp_message.cc | 8 ++++---- .../protobuf/compiler/javanano/javanano_enum_field.cc | 2 +- .../protobuf/compiler/javanano/javanano_enum_field.h | 6 +++--- .../protobuf/compiler/javanano/javanano_extension.cc | 2 +- .../protobuf/compiler/javanano/javanano_extension.h | 2 +- .../protobuf/compiler/javanano/javanano_field.cc | 6 +++--- src/google/protobuf/compiler/javanano/javanano_field.h | 6 +++--- .../protobuf/compiler/javanano/javanano_helpers.cc | 2 +- .../protobuf/compiler/javanano/javanano_helpers.h | 2 +- .../protobuf/compiler/javanano/javanano_map_field.cc | 2 +- .../protobuf/compiler/javanano/javanano_map_field.h | 2 +- .../protobuf/compiler/javanano/javanano_message.cc | 2 +- .../compiler/javanano/javanano_message_field.cc | 2 +- .../compiler/javanano/javanano_message_field.h | 6 +++--- .../protobuf/compiler/javanano/javanano_params.h | 4 ++-- .../compiler/javanano/javanano_primitive_field.cc | 2 +- .../compiler/javanano/javanano_primitive_field.h | 8 ++++---- .../compiler/objectivec/objectivec_enum_field.cc | 4 ++-- .../compiler/objectivec/objectivec_enum_field.h | 2 +- .../compiler/objectivec/objectivec_extension.cc | 4 ++-- .../protobuf/compiler/objectivec/objectivec_field.cc | 4 ++-- .../protobuf/compiler/objectivec/objectivec_field.h | 4 ++-- .../protobuf/compiler/objectivec/objectivec_file.cc | 14 +++++++------- .../protobuf/compiler/objectivec/objectivec_helpers.cc | 18 +++++++++--------- .../protobuf/compiler/objectivec/objectivec_helpers.h | 6 +++--- .../compiler/objectivec/objectivec_map_field.cc | 2 +- .../compiler/objectivec/objectivec_map_field.h | 2 +- .../protobuf/compiler/objectivec/objectivec_message.cc | 4 ++-- .../protobuf/compiler/objectivec/objectivec_message.h | 2 +- .../compiler/objectivec/objectivec_message_field.cc | 6 +++--- .../compiler/objectivec/objectivec_message_field.h | 4 ++-- .../protobuf/compiler/objectivec/objectivec_oneof.h | 2 +- .../compiler/objectivec/objectivec_primitive_field.cc | 2 +- src/google/protobuf/stubs/common.h | 2 -- src/google/protobuf/testing/googletest.h | 2 +- 39 files changed, 82 insertions(+), 84 deletions(-) (limited to 'src/google') diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index 67c90397..8fa9f53c 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -677,7 +677,7 @@ void ConformanceTestSuite::SetFailureList(const string& filename, std::inserter(expected_to_fail_, expected_to_fail_.end())); } -bool ConformanceTestSuite::CheckSetEmpty(const set& set_to_check, +bool ConformanceTestSuite::CheckSetEmpty(const std::set& set_to_check, const std::string& write_to_file, const std::string& msg) { if (set_to_check.empty()) { @@ -685,7 +685,7 @@ bool ConformanceTestSuite::CheckSetEmpty(const set& set_to_check, } else { StringAppendF(&output_, "\n"); StringAppendF(&output_, "%s\n\n", msg.c_str()); - for (set::const_iterator iter = set_to_check.begin(); + for (std::set::const_iterator iter = set_to_check.begin(); iter != set_to_check.end(); ++iter) { StringAppendF(&output_, " %s\n", iter->c_str()); } @@ -694,7 +694,7 @@ bool ConformanceTestSuite::CheckSetEmpty(const set& set_to_check, if (!write_to_file.empty()) { std::ofstream os(write_to_file); if (os) { - for (set::const_iterator iter = set_to_check.begin(); + for (std::set::const_iterator iter = set_to_check.begin(); iter != set_to_check.end(); ++iter) { os << *iter << "\n"; } diff --git a/conformance/conformance_test.h b/conformance/conformance_test.h index 4e40a6ac..581c7472 100644 --- a/conformance/conformance_test.h +++ b/conformance/conformance_test.h @@ -205,7 +205,7 @@ class ConformanceTestSuite { void TestValidDataForType( google::protobuf::FieldDescriptor::Type, std::vector> values); - bool CheckSetEmpty(const set& set_to_check, + bool CheckSetEmpty(const std::set& set_to_check, const std::string& write_to_file, const std::string& msg); ConformanceTestRunner* runner_; int successes_; diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc index ebb8fbc2..ecf29ece 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -54,7 +54,7 @@ namespace compiler { namespace csharp { void FieldGeneratorBase::SetCommonFieldVariables( - map* variables) { + std::map* variables) { // Note: this will be valid even though the tag emitted for packed and unpacked versions of // repeated fields varies by wire format. The wire format is encoded in the bottom 3 bits, which // never effects the tag size. @@ -92,7 +92,7 @@ void FieldGeneratorBase::SetCommonFieldVariables( } void FieldGeneratorBase::SetCommonOneofFieldVariables( - map* variables) { + std::map* variables) { (*variables)["oneof_name"] = oneof_name(); (*variables)["has_property_check"] = oneof_name() + "Case_ == " + oneof_property_name() + diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h index 4109f3ca..df26853b 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -66,14 +66,14 @@ class FieldGeneratorBase : public SourceGeneratorBase { protected: const FieldDescriptor* descriptor_; const int fieldOrdinal_; - map variables_; + std::map variables_; void AddDeprecatedFlag(io::Printer* printer); void AddNullCheck(io::Printer* printer); void AddNullCheck(io::Printer* printer, const std::string& name); void AddPublicMemberAttributes(io::Printer* printer); - void SetCommonOneofFieldVariables(map* variables); + void SetCommonOneofFieldVariables(std::map* variables); std::string oneof_property_name(); std::string oneof_name(); @@ -89,7 +89,7 @@ class FieldGeneratorBase : public SourceGeneratorBase { std::string capitalized_type_name(); private: - void SetCommonFieldVariables(map* variables); + void SetCommonFieldVariables(std::map* variables); std::string GetStringDefaultValueInternal(); std::string GetBytesDefaultValueInternal(); diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index 0f00a438..5ef0e4e8 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -105,7 +105,7 @@ void MessageGenerator::AddDeprecatedFlag(io::Printer* printer) { } void MessageGenerator::Generate(io::Printer* printer) { - map vars; + std::map vars; vars["class_name"] = class_name(); vars["access_level"] = class_access_level(); @@ -280,7 +280,7 @@ bool MessageGenerator::HasNestedGeneratedTypes() } void MessageGenerator::GenerateCloningCode(io::Printer* printer) { - map vars; + std::map vars; WriteGeneratedCodeAttributes(printer); vars["class_name"] = class_name(); printer->Print( @@ -333,7 +333,7 @@ void MessageGenerator::GenerateFreezingCode(io::Printer* printer) { } void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { - map vars; + std::map vars; vars["class_name"] = class_name(); // Equality @@ -432,7 +432,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { // Note: These are separate from GenerateMessageSerializationMethods() // because they need to be generated even for messages that are optimized // for code size. - map vars; + std::map vars; vars["class_name"] = class_name(); WriteGeneratedCodeAttributes(printer); diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc index 7666db38..26bc7f85 100644 --- a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc @@ -52,7 +52,7 @@ namespace { // TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of // repeat code between this and the other field types. void SetEnumVariables(const Params& params, - const FieldDescriptor* descriptor, map* variables) { + const FieldDescriptor* descriptor, std::map* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.h b/src/google/protobuf/compiler/javanano/javanano_enum_field.h index b94790d6..1be25d10 100644 --- a/src/google/protobuf/compiler/javanano/javanano_enum_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.h @@ -62,7 +62,7 @@ class EnumFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; vector canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); @@ -85,7 +85,7 @@ class AccessorEnumFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; vector canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorEnumFieldGenerator); @@ -112,7 +112,7 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { void GenerateRepeatedDataSizeCode(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; vector canonical_values_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.cc b/src/google/protobuf/compiler/javanano/javanano_extension.cc index 0b9d1d8d..4c61f915 100644 --- a/src/google/protobuf/compiler/javanano/javanano_extension.cc +++ b/src/google/protobuf/compiler/javanano/javanano_extension.cc @@ -78,7 +78,7 @@ const char* GetTypeConstantName(const FieldDescriptor::Type type) { } // namespace void SetVariables(const FieldDescriptor* descriptor, const Params params, - map* variables) { + std::map* variables) { (*variables)["extends"] = ClassName(params, descriptor->containing_type()); (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); bool repeated = descriptor->is_repeated(); diff --git a/src/google/protobuf/compiler/javanano/javanano_extension.h b/src/google/protobuf/compiler/javanano/javanano_extension.h index 4843e296..f4e9eb2d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_extension.h +++ b/src/google/protobuf/compiler/javanano/javanano_extension.h @@ -61,7 +61,7 @@ class ExtensionGenerator { private: const Params& params_; const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_field.cc b/src/google/protobuf/compiler/javanano/javanano_field.cc index 85257f3f..e31d1177 100644 --- a/src/google/protobuf/compiler/javanano/javanano_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_field.cc @@ -151,7 +151,7 @@ const FieldGenerator& FieldGeneratorMap::get( } void SetCommonOneofVariables(const FieldDescriptor* descriptor, - map* variables) { + std::map* variables) { (*variables)["oneof_name"] = UnderscoresToCamelCase(descriptor->containing_oneof()); (*variables)["oneof_capitalized_name"] = @@ -169,7 +169,7 @@ void SetCommonOneofVariables(const FieldDescriptor* descriptor, } void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, - const map& variables, + const std::map& variables, io::Printer* printer) { if (GetJavaType(descriptor) == JAVATYPE_BYTES) { printer->Print(variables, @@ -190,7 +190,7 @@ void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, } void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor, - const map& variables, + const std::map& variables, io::Printer* printer) { if (GetJavaType(descriptor) == JAVATYPE_BYTES) { printer->Print(variables, diff --git a/src/google/protobuf/compiler/javanano/javanano_field.h b/src/google/protobuf/compiler/javanano/javanano_field.h index 57c221f4..347c888c 100644 --- a/src/google/protobuf/compiler/javanano/javanano_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_field.h @@ -114,12 +114,12 @@ class FieldGeneratorMap { }; void SetCommonOneofVariables(const FieldDescriptor* descriptor, - map* variables); + std::map* variables); void GenerateOneofFieldEquals(const FieldDescriptor* descriptor, - const map& variables, + const std::map& variables, io::Printer* printer); void GenerateOneofFieldHashCode(const FieldDescriptor* descriptor, - const map& variables, + const std::map& variables, io::Printer* printer); } // namespace javanano diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.cc b/src/google/protobuf/compiler/javanano/javanano_helpers.cc index 5018250c..1927ba12 100644 --- a/src/google/protobuf/compiler/javanano/javanano_helpers.cc +++ b/src/google/protobuf/compiler/javanano/javanano_helpers.cc @@ -567,7 +567,7 @@ string GenerateDifferentBit(int bit_index) { } void SetBitOperationVariables(const string name, - int bitIndex, map* variables) { + int bitIndex, std::map* variables) { (*variables)["get_" + name] = GenerateGetBit(bitIndex); (*variables)["set_" + name] = GenerateSetBit(bitIndex); (*variables)["clear_" + name] = GenerateClearBit(bitIndex); diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.h b/src/google/protobuf/compiler/javanano/javanano_helpers.h index 014c85ae..04b2d633 100644 --- a/src/google/protobuf/compiler/javanano/javanano_helpers.h +++ b/src/google/protobuf/compiler/javanano/javanano_helpers.h @@ -181,7 +181,7 @@ string GenerateDifferentBit(int bit_index); // the given name of the bit, to the appropriate Java expressions for the given // bit index. void SetBitOperationVariables(const string name, - int bitIndex, map* variables); + int bitIndex, std::map* variables); inline bool IsMapEntry(const Descriptor* descriptor) { // TODO(liujisi): Add an option to turn on maps for proto2 syntax as well. diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.cc b/src/google/protobuf/compiler/javanano/javanano_map_field.cc index 83b2b0ce..a4ab8858 100644 --- a/src/google/protobuf/compiler/javanano/javanano_map_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_map_field.cc @@ -84,7 +84,7 @@ const FieldDescriptor* ValueField(const FieldDescriptor* descriptor) { } void SetMapVariables(const Params& params, - const FieldDescriptor* descriptor, map* variables) { + const FieldDescriptor* descriptor, std::map* variables) { const FieldDescriptor* key = KeyField(descriptor); const FieldDescriptor* value = ValueField(descriptor); (*variables)["name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_map_field.h b/src/google/protobuf/compiler/javanano/javanano_map_field.h index c01bde38..81e5915d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_map_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_map_field.h @@ -58,7 +58,7 @@ class MapFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_message.cc b/src/google/protobuf/compiler/javanano/javanano_message.cc index f81f7f9a..78421887 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message.cc +++ b/src/google/protobuf/compiler/javanano/javanano_message.cc @@ -182,7 +182,7 @@ void MessageGenerator::Generate(io::Printer* printer) { } // oneof - map vars; + std::map vars; vars["message_name"] = descriptor_->name(); for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { const OneofDescriptor* oneof_desc = descriptor_->oneof_decl(i); diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.cc b/src/google/protobuf/compiler/javanano/javanano_message_field.cc index d1d04b52..2ed8a3aa 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_message_field.cc @@ -54,7 +54,7 @@ namespace { // TODO(kenton): Factor out a "SetCommonFieldVariables()" to get rid of // repeat code between this and the other field types. void SetMessageVariables(const Params& params, - const FieldDescriptor* descriptor, map* variables) { + const FieldDescriptor* descriptor, std::map* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.h b/src/google/protobuf/compiler/javanano/javanano_message_field.h index e074735c..0ae8879b 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_message_field.h @@ -62,7 +62,7 @@ class MessageFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); }; @@ -85,7 +85,7 @@ class MessageOneofFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); }; @@ -108,7 +108,7 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; diff --git a/src/google/protobuf/compiler/javanano/javanano_params.h b/src/google/protobuf/compiler/javanano/javanano_params.h index e3b4bb93..3594767d 100644 --- a/src/google/protobuf/compiler/javanano/javanano_params.h +++ b/src/google/protobuf/compiler/javanano/javanano_params.h @@ -47,8 +47,8 @@ enum eMultipleFiles { JAVANANO_MUL_UNSET, JAVANANO_MUL_FALSE, JAVANANO_MUL_TRUE // Parameters for used by the generators class Params { public: - typedef map NameMap; - typedef set NameSet; + typedef std::map NameMap; + typedef std::set NameSet; private: string empty_; string base_name_; diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc index 978abf2c..66a0ff05 100644 --- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc @@ -166,7 +166,7 @@ bool AllAscii(const string& text) { void SetPrimitiveVariables(const FieldDescriptor* descriptor, const Params params, - map* variables) { + std::map* variables) { (*variables)["name"] = RenameJavaKeywords(UnderscoresToCamelCase(descriptor)); (*variables)["capitalized_name"] = diff --git a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h index a01981dd..d7d72d57 100644 --- a/src/google/protobuf/compiler/javanano/javanano_primitive_field.h +++ b/src/google/protobuf/compiler/javanano/javanano_primitive_field.h @@ -65,7 +65,7 @@ class PrimitiveFieldGenerator : public FieldGenerator { void GenerateSerializationConditional(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); }; @@ -89,7 +89,7 @@ class AccessorPrimitiveFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorPrimitiveFieldGenerator); }; @@ -111,7 +111,7 @@ class PrimitiveOneofFieldGenerator : public FieldGenerator { private: const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); }; @@ -137,7 +137,7 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { void GenerateRepeatedDataSizeCode(io::Printer* printer) const; const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); }; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc index 7a774a09..8899a13a 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc @@ -46,7 +46,7 @@ namespace objectivec { namespace { void SetEnumVariables(const FieldDescriptor* descriptor, - map* variables) { + std::map* variables) { string type = EnumName(descriptor->enum_type()); (*variables)["storage_type"] = type; // For non repeated fields, if it was defined in a different file, the @@ -118,7 +118,7 @@ void EnumFieldGenerator::GenerateCFunctionImplementations( } void EnumFieldGenerator::DetermineForwardDeclarations( - set* fwd_decls) const { + std::set* fwd_decls) const { SingleFieldGenerator::DetermineForwardDeclarations(fwd_decls); // If it is an enum defined in a different file, then we'll need a forward // declaration for it. When it is in our file, all the enums are output diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h index 946faa81..ae56c069 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h @@ -47,7 +47,7 @@ class EnumFieldGenerator : public SingleFieldGenerator { public: virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; virtual void GenerateCFunctionImplementations(io::Printer* printer) const; - virtual void DetermineForwardDeclarations(set* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; protected: EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc index 73e4b86e..b788d0a3 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -59,7 +59,7 @@ ExtensionGenerator::ExtensionGenerator(const string& root_class_name, ExtensionGenerator::~ExtensionGenerator() {} void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { - map vars; + std::map vars; vars["method_name"] = method_name_; SourceLocation location; if (descriptor_->GetSourceLocation(&location)) { @@ -77,7 +77,7 @@ void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { void ExtensionGenerator::GenerateStaticVariablesInitialization( io::Printer* printer) { - map vars; + std::map vars; vars["root_class_and_method_name"] = root_class_and_method_name_; vars["extended_type"] = ClassName(descriptor_->containing_type()); vars["number"] = SimpleItoa(descriptor_->number()); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_field.cc index 9f7e84f2..b6123fad 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -49,7 +49,7 @@ namespace objectivec { namespace { void SetCommonFieldVariables(const FieldDescriptor* descriptor, - map* variables) { + std::map* variables) { string camel_case_name = FieldName(descriptor); string raw_field_name; if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { @@ -178,7 +178,7 @@ void FieldGenerator::GenerateCFunctionImplementations( } void FieldGenerator::DetermineForwardDeclarations( - set* fwd_decls) const { + std::set* fwd_decls) const { // Nothing } diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.h b/src/google/protobuf/compiler/objectivec/objectivec_field.h index a3a4b1b6..6bd5db2e 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -67,7 +67,7 @@ class FieldGenerator { virtual void GenerateCFunctionImplementations(io::Printer* printer) const; // Exposed for subclasses, should always call it on the parent class also. - virtual void DetermineForwardDeclarations(set* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; // Used during generation, not intended to be extended by subclasses. void GenerateFieldDescription( @@ -100,7 +100,7 @@ class FieldGenerator { virtual bool WantsHasProperty(void) const = 0; const FieldDescriptor* descriptor_; - map variables_; + std::map variables_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 7ad127bb..954b2688 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -89,7 +89,7 @@ bool FileContainsExtensions(const FileDescriptor* file) { void PruneFileAndDepsMarkingAsVisited( const FileDescriptor* file, vector* files, - set* files_visited) { + std::set* files_visited) { vector::iterator iter = std::find(files->begin(), files->end(), file); if (iter != files->end()) { @@ -105,7 +105,7 @@ void PruneFileAndDepsMarkingAsVisited( void CollectMinimalFileDepsContainingExtensionsWorker( const FileDescriptor* file, vector* files, - set* files_visited) { + std::set* files_visited) { if (files_visited->find(file) != files_visited->end()) { return; } @@ -138,7 +138,7 @@ void CollectMinimalFileDepsContainingExtensionsWorker( void CollectMinimalFileDepsContainingExtensions( const FileDescriptor* file, vector* files) { - set files_visited; + std::set files_visited; for (int i = 0; i < file->dependency_count(); i++) { const FileDescriptor* dep = file->dependency(i); CollectMinimalFileDepsContainingExtensionsWorker(dep, files, @@ -229,12 +229,12 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { "CF_EXTERN_C_BEGIN\n" "\n"); - set fwd_decls; + std::set fwd_decls; for (vector::iterator iter = message_generators_.begin(); iter != message_generators_.end(); ++iter) { (*iter)->DetermineForwardDeclarations(&fwd_decls); } - for (set::const_iterator i(fwd_decls.begin()); + for (std::set::const_iterator i(fwd_decls.begin()); i != fwd_decls.end(); ++i) { printer->Print("$value$;\n", "value", *i); } @@ -325,7 +325,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // #import the headers for anything that a plain dependency of this proto // file (that means they were just an include, not a "public" include). - set public_import_names; + std::set public_import_names; for (int i = 0; i < file_->public_dependency_count(); i++) { public_import_names.insert(file_->public_dependency(i)->name()); } @@ -468,7 +468,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // File descriptor only needed if there are messages to use it. if (message_generators_.size() > 0) { - map vars; + std::map vars; vars["root_class_name"] = root_class_name_; vars["package"] = file_->package(); vars["objc_prefix"] = FileClassPrefix(file_); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index bb8170a9..e347ef1e 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -980,13 +980,13 @@ namespace { class ExpectedPrefixesCollector : public LineConsumer { public: - ExpectedPrefixesCollector(map* inout_package_to_prefix_map) + ExpectedPrefixesCollector(std::map* inout_package_to_prefix_map) : prefix_map_(inout_package_to_prefix_map) {} virtual bool ConsumeLine(const StringPiece& line, string* out_error); private: - map* prefix_map_; + std::map* prefix_map_; }; bool ExpectedPrefixesCollector::ConsumeLine( @@ -1009,7 +1009,7 @@ bool ExpectedPrefixesCollector::ConsumeLine( } bool LoadExpectedPackagePrefixes(const Options &generation_options, - map* prefix_map, + std::map* prefix_map, string* out_error) { if (generation_options.expected_prefixes_path.empty()) { return true; @@ -1023,7 +1023,7 @@ bool LoadExpectedPackagePrefixes(const Options &generation_options, bool ValidateObjCClassPrefix( const FileDescriptor* file, const string& expected_prefixes_path, - const map& expected_package_prefixes, + const std::map& expected_package_prefixes, string* out_error) { const string prefix = file->options().objc_class_prefix(); const string package = file->package(); @@ -1033,7 +1033,7 @@ bool ValidateObjCClassPrefix( // Check: Error - See if there was an expected prefix for the package and // report if it doesn't match (wrong or missing). - map::const_iterator package_match = + std::map::const_iterator package_match = expected_package_prefixes.find(package); if (package_match != expected_package_prefixes.end()) { // There was an entry, and... @@ -1082,7 +1082,7 @@ bool ValidateObjCClassPrefix( // Look for any other package that uses the same prefix. string other_package_for_prefix; - for (map::const_iterator i = expected_package_prefixes.begin(); + for (std::map::const_iterator i = expected_package_prefixes.begin(); i != expected_package_prefixes.end(); ++i) { if (i->second == prefix) { other_package_for_prefix = i->first; @@ -1150,7 +1150,7 @@ bool ValidateObjCClassPrefixes(const vector& files, const Options& generation_options, string* out_error) { // Load the expected package prefixes, if available, to validate against. - map expected_package_prefixes; + std::map expected_package_prefixes; if (!LoadExpectedPackagePrefixes(generation_options, &expected_package_prefixes, out_error)) { @@ -1519,7 +1519,7 @@ void ImportWriter::AddFile(const FileDescriptor* file, ParseFrameworkMappings(); } - map::iterator proto_lookup = + std::map::iterator proto_lookup = proto_file_to_framework_name_.find(file->name()); if (proto_lookup != proto_file_to_framework_name_.end()) { other_framework_imports_.push_back( @@ -1640,7 +1640,7 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( StringPiece proto_file(proto_file_list, start, offset - start); StringPieceTrimWhitespace(&proto_file); if (proto_file.size() != 0) { - map::iterator existing_entry = + std::map::iterator existing_entry = map_->find(proto_file.ToString()); if (existing_entry != map_->end()) { std::cerr << "warning: duplicate proto file reference, replacing framework entry for '" diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index c99262a1..daea7609 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -262,20 +262,20 @@ class LIBPROTOC_EXPORT ImportWriter { private: class ProtoFrameworkCollector : public LineConsumer { public: - ProtoFrameworkCollector(map* inout_proto_file_to_framework_name) + ProtoFrameworkCollector(std::map* inout_proto_file_to_framework_name) : map_(inout_proto_file_to_framework_name) {} virtual bool ConsumeLine(const StringPiece& line, string* out_error); private: - map* map_; + std::map* map_; }; void ParseFrameworkMappings(); const string generate_for_named_framework_; const string named_framework_to_proto_path_mappings_path_; - map proto_file_to_framework_name_; + std::map proto_file_to_framework_name_; bool need_to_parse_mapping_file_; vector protobuf_framework_imports_; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc index 0bc9dc10..bcaf5709 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc @@ -162,7 +162,7 @@ void MapFieldGenerator::FinishInitialization(void) { } void MapFieldGenerator::DetermineForwardDeclarations( - set* fwd_decls) const { + std::set* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); const FieldDescriptor* value_descriptor = descriptor_->message_type()->FindFieldByName("value"); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h index bc68a682..6664d849 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h @@ -51,7 +51,7 @@ class MapFieldGenerator : public RepeatedFieldGenerator { MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); virtual ~MapFieldGenerator(); - virtual void DetermineForwardDeclarations(set* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; private: scoped_ptr value_field_generator_; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/src/google/protobuf/compiler/objectivec/objectivec_message.cc index 0a554a83..4f22e290 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_message.cc @@ -233,7 +233,7 @@ void MessageGenerator::GenerateStaticVariablesInitialization( } } -void MessageGenerator::DetermineForwardDeclarations(set* fwd_decls) { +void MessageGenerator::DetermineForwardDeclarations(std::set* fwd_decls) { if (!IsMapEntryMessage(descriptor_)) { for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* fieldDescriptor = descriptor_->field(i); @@ -514,7 +514,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " };\n"); } - map vars; + std::map vars; vars["classname"] = class_name_; vars["rootclassname"] = root_classname_; vars["fields"] = has_fields ? "fields" : "NULL"; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.h b/src/google/protobuf/compiler/objectivec/objectivec_message.h index 0fb78bc0..8f317ac0 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_message.h @@ -64,7 +64,7 @@ class MessageGenerator { void GenerateMessageHeader(io::Printer* printer); void GenerateSource(io::Printer* printer); void GenerateExtensionRegistrationSource(io::Printer* printer); - void DetermineForwardDeclarations(set* fwd_decls); + void DetermineForwardDeclarations(std::set* fwd_decls); // Checks if the message or a nested message includes a oneof definition. bool IncludesOneOfDefinition() const; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc index d6ccd6d1..699d25b3 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc @@ -45,7 +45,7 @@ namespace objectivec { namespace { void SetMessageVariables(const FieldDescriptor* descriptor, - map* variables) { + std::map* variables) { const string& message_type = ClassName(descriptor->message_type()); (*variables)["type"] = message_type; (*variables)["containing_class"] = ClassName(descriptor->containing_type()); @@ -67,7 +67,7 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, MessageFieldGenerator::~MessageFieldGenerator() {} void MessageFieldGenerator::DetermineForwardDeclarations( - set* fwd_decls) const { + std::set* fwd_decls) const { ObjCObjFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); @@ -95,7 +95,7 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( - set* fwd_decls) const { + std::set* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h index d2dba153..50f4b6d4 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h @@ -51,7 +51,7 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { virtual bool WantsHasProperty(void) const; public: - virtual void DetermineForwardDeclarations(set* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); @@ -67,7 +67,7 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { virtual ~RepeatedMessageFieldGenerator(); public: - virtual void DetermineForwardDeclarations(set* fwd_decls) const; + virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h index 3d9df4db..ff353a6c 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h @@ -67,7 +67,7 @@ class OneofGenerator { private: const OneofDescriptor* descriptor_; - map variables_; + std::map variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofGenerator); }; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc index d49350f4..aa8ac324 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc @@ -118,7 +118,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { } void SetPrimitiveVariables(const FieldDescriptor* descriptor, - map* variables) { + std::map* variables) { std::string primitive_name = PrimitiveTypeName(descriptor); (*variables)["type"] = primitive_name; (*variables)["storage_type"] = primitive_name; diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 60874e09..19d59843 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -227,10 +227,8 @@ class FatalException : public std::exception { // in some versions of MSVC. // TODO(acozzette): remove these using statements using std::istream; -using std::map; using std::ostream; using std::pair; -using std::set; using std::string; using std::vector; diff --git a/src/google/protobuf/testing/googletest.h b/src/google/protobuf/testing/googletest.h index c0d99e69..bf8bf282 100644 --- a/src/google/protobuf/testing/googletest.h +++ b/src/google/protobuf/testing/googletest.h @@ -85,7 +85,7 @@ class ScopedMemoryLog { const vector& GetMessages(LogLevel error); private: - map > messages_; + std::map > messages_; LogHandler* old_handler_; static void HandleLog(LogLevel level, const char* filename, int line, -- cgit v1.2.3 From 9ab7c73f7c989afa777a40ff2a7c5f0f138be22c Mon Sep 17 00:00:00 2001 From: Matt Hauck Date: Mon, 10 Jul 2017 16:43:18 -0700 Subject: Fix missing std::tr1::hash on GCC 4.1 (#2907) Rather than crashing on use (doh!) better to just declare this platform is missing a proper hash_map/hash_set implementation and use the std::map/std::set emulation. Fixes regression introduced by #1913 --- src/google/protobuf/stubs/hash.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index a997e04b..5924de98 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -40,7 +40,6 @@ #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 -#define GOOGLE_PROTOBUF_HAVE_64BIT_HASH 1 // Use C++11 unordered_{map|set} if available. #if ((_LIBCPP_STD_VER >= 11) || \ @@ -93,8 +92,11 @@ # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set # endif +// GCC <= 4.1 does not define std::tr1::hash for `long long int` or `long long unsigned int` # if __GNUC__ == 4 && __GNUC__MINOR__ <= 1 -# undef GOOGLE_PROTOBUF_HAVE_64BIT_HASH +# define GOOGLE_PROTOBUF_MISSING_HASH +# include +# include # endif // Version checks for MSC. -- cgit v1.2.3 From 2130feadcfdbe0268b1afe6b050e000c83120aba Mon Sep 17 00:00:00 2001 From: Matt Hauck Date: Tue, 11 Jul 2017 11:02:24 -0700 Subject: Fix map_field_inl.h for gcc 4.1 --- src/google/protobuf/map_field_inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 0cfed72f..e317b5ed 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -252,9 +252,9 @@ template void MapField::Swap(MapField* other) { - std::swap(MapFieldBase::repeated_field_, other->repeated_field_); + std::swap(this->MapFieldBase::repeated_field_, other->repeated_field_); impl_.Swap(&other->impl_); - std::swap(MapFieldBase::state_, other->state_); + std::swap(this->MapFieldBase::state_, other->state_); } template Date: Wed, 12 Jul 2017 14:45:19 -0500 Subject: Fix build when using -Werror=undef Correct a couple places where macros were being checked when they might not exist in some cases. Fixes #3356. --- src/google/protobuf/io/coded_stream.h | 2 +- src/google/protobuf/stubs/hash.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 20d86143..9f1cf88c 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -1434,7 +1434,7 @@ inline bool CodedInputStream::IsFlat() const { } // namespace protobuf -#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) +#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) #pragma runtime_checks("c", restore) #endif // _MSC_VER && !defined(__INTEL_COMPILER) diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index 5924de98..612b5861 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -42,7 +42,7 @@ #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 // Use C++11 unordered_{map|set} if available. -#if ((_LIBCPP_STD_VER >= 11) || \ +#if ((defined(_LIBCPP_STD_VER) && _LIBCPP_STD_VER >= 11) || \ (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ (__GLIBCXX__ > 20090421))) # define GOOGLE_PROTOBUF_HAS_CXX11_HASH -- cgit v1.2.3 From d3bbf1c8a98fe01c115f525c516e575d87c11a47 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 13 Jul 2017 11:20:11 -0700 Subject: Add space between arrow and casted type (#3353) --- src/google/protobuf/compiler/cpp/cpp_enum_field.cc | 18 ++++++------- .../protobuf/compiler/cpp/cpp_primitive_field.cc | 6 ++--- src/google/protobuf/descriptor.pb.cc | 30 +++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 0d3fdcbe..960730ca 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -144,13 +144,13 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, "} else {\n" " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\n" " unknown_fields_stream.WriteVarint32($tag$u);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n", + " static_cast< ::google::protobuf::uint32>(value));\n", "tag", SimpleItoa(internal::WireFormat::MakeTag(descriptor_))); } printer->Print(variables_, @@ -347,13 +347,13 @@ GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, "} else {\n" " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print( "} else {\n" " unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n"); + " static_cast< ::google::protobuf::uint32>(value));\n"); } printer->Print("}\n"); } @@ -412,12 +412,12 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { if (UseUnknownFieldSet(descriptor_->file(), options_)) { printer->Print(variables_, " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<::google::protobuf::uint64>(value));\n"); + " $number$, static_cast< ::google::protobuf::uint64>(value));\n"); } else { printer->Print(variables_, " unknown_fields_stream.WriteVarint32(tag);\n" " unknown_fields_stream.WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(value));\n"); + " static_cast< ::google::protobuf::uint32>(value));\n"); } printer->Print( " }\n"); @@ -439,7 +439,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " output);\n" " output->WriteVarint32(\n" - " static_cast<::google::protobuf::uint32>(_$name$_cached_byte_size_));\n" + " static_cast< ::google::protobuf::uint32>(_$name$_cached_byte_size_));\n" "}\n"); } printer->Print(variables_, @@ -467,7 +467,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(" - " static_cast<::google::protobuf::uint32>(\n" + " static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(\n" " this->$name$_, target);\n" @@ -497,7 +497,7 @@ GenerateByteSize(io::Printer* printer) const { "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" - " static_cast(data_size));\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index 83bc096f..e45f35b3 100644 --- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -382,7 +382,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const { "$number$, " "::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, " "output);\n" - " output->WriteVarint32(static_cast<::google::protobuf::uint32>(\n" + " output->WriteVarint32(static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_));\n"); if (FixedSize(descriptor_->type()) > 0) { @@ -423,7 +423,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const { " ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,\n" " target);\n" " target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(\n" - " static_cast<::google::protobuf::uint32>(\n" + " static_cast< ::google::protobuf::uint32>(\n" " _$name$_cached_byte_size_), target);\n" " target = ::google::protobuf::internal::WireFormatLite::\n" " Write$declared_type$NoTagToArray(this->$name$_, target);\n" @@ -455,7 +455,7 @@ GenerateByteSize(io::Printer* printer) const { "if (data_size > 0) {\n" " total_size += $tag_size$ +\n" " ::google::protobuf::internal::WireFormatLite::Int32Size(\n" - " static_cast(data_size));\n" + " static_cast< ::google::protobuf::int32>(data_size));\n" "}\n" "int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);\n" "GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();\n" diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 6e4e4088..48a256dd 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -4565,7 +4565,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( set_label(static_cast< ::google::protobuf::FieldDescriptorProto_Label >(value)); } else { mutable_unknown_fields()->AddVarint( - 4, static_cast<::google::protobuf::uint64>(value)); + 4, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -4585,7 +4585,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( set_type(static_cast< ::google::protobuf::FieldDescriptorProto_Type >(value)); } else { mutable_unknown_fields()->AddVarint( - 5, static_cast<::google::protobuf::uint64>(value)); + 5, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -8513,7 +8513,7 @@ bool FileOptions::MergePartialFromCodedStream( set_optimize_for(static_cast< ::google::protobuf::FileOptions_OptimizeMode >(value)); } else { mutable_unknown_fields()->AddVarint( - 9, static_cast<::google::protobuf::uint64>(value)); + 9, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10774,7 +10774,7 @@ bool FieldOptions::MergePartialFromCodedStream( set_ctype(static_cast< ::google::protobuf::FieldOptions_CType >(value)); } else { mutable_unknown_fields()->AddVarint( - 1, static_cast<::google::protobuf::uint64>(value)); + 1, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -10836,7 +10836,7 @@ bool FieldOptions::MergePartialFromCodedStream( set_jstype(static_cast< ::google::protobuf::FieldOptions_JSType >(value)); } else { mutable_unknown_fields()->AddVarint( - 6, static_cast<::google::protobuf::uint64>(value)); + 6, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -12917,7 +12917,7 @@ bool MethodOptions::MergePartialFromCodedStream( set_idempotency_level(static_cast< ::google::protobuf::MethodOptions_IdempotencyLevel >(value)); } else { mutable_unknown_fields()->AddVarint( - 34, static_cast<::google::protobuf::uint64>(value)); + 34, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; @@ -14703,7 +14703,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { @@ -14714,7 +14714,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( // repeated int32 span = 2 [packed = true]; if (this->span_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _span_cached_byte_size_)); } for (int i = 0, n = this->span_size(); i < n; i++) { @@ -14773,7 +14773,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -14786,7 +14786,7 @@ void SourceCodeInfo_Location::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _span_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->span_, target); @@ -14849,7 +14849,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -14865,7 +14865,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -15707,7 +15707,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( // repeated int32 path = 1 [packed = true]; if (this->path_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(static_cast<::google::protobuf::uint32>( + output->WriteVarint32(static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_)); } for (int i = 0, n = this->path_size(); i < n; i++) { @@ -15756,7 +15756,7 @@ void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - static_cast<::google::protobuf::uint32>( + static_cast< ::google::protobuf::uint32>( _path_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite:: WriteInt32NoTagToArray(this->path_, target); @@ -15808,7 +15808,7 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast(data_size)); + static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); -- cgit v1.2.3 From ec3f5dcc725c415cf6bbc8325adf731370a3507d Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 13 Jul 2017 11:29:28 -0700 Subject: removes an accidental newline in printing for the php generator (#3333) --- src/google/protobuf/compiler/php/php_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 03aebdb9..e20b89ae 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -844,7 +844,7 @@ void GenerateUseDeclaration(bool is_descriptor, io::Printer* printer) { "use Google\\Protobuf\\Internal\\GPBType;\n" "use Google\\Protobuf\\Internal\\GPBWire;\n" "use Google\\Protobuf\\Internal\\RepeatedField;\n" - "use Google\\Protobuf\\Internal\\InputStream;\n\n" + "use Google\\Protobuf\\Internal\\InputStream;\n" "use Google\\Protobuf\\Internal\\GPBUtil;\n\n"); } } -- cgit v1.2.3 From 324b20a49170cb38d15ef243bc044026adb54ae1 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 17 Jul 2017 09:14:46 -0700 Subject: remove pass by reference for php setters (#3344) * remove pass by reference for php setters * comments out memory leak test --- .../Google/Protobuf/Internal/DescriptorProto.php | 18 +++++------ .../Protobuf/Internal/EnumDescriptorProto.php | 4 +-- php/src/Google/Protobuf/Internal/EnumOptions.php | 2 +- .../Protobuf/Internal/EnumValueDescriptorProto.php | 2 +- .../Google/Protobuf/Internal/EnumValueOptions.php | 2 +- .../Protobuf/Internal/FieldDescriptorProto.php | 2 +- php/src/Google/Protobuf/Internal/FieldOptions.php | 2 +- .../Protobuf/Internal/FileDescriptorProto.php | 18 +++++------ .../Google/Protobuf/Internal/FileDescriptorSet.php | 2 +- php/src/Google/Protobuf/Internal/FileOptions.php | 2 +- .../Google/Protobuf/Internal/GeneratedCodeInfo.php | 2 +- .../Internal/GeneratedCodeInfo_Annotation.php | 2 +- .../Google/Protobuf/Internal/MessageOptions.php | 2 +- .../Protobuf/Internal/MethodDescriptorProto.php | 2 +- php/src/Google/Protobuf/Internal/MethodOptions.php | 2 +- .../Protobuf/Internal/OneofDescriptorProto.php | 2 +- php/src/Google/Protobuf/Internal/OneofOptions.php | 2 +- .../Protobuf/Internal/ServiceDescriptorProto.php | 4 +-- .../Google/Protobuf/Internal/ServiceOptions.php | 2 +- .../Google/Protobuf/Internal/SourceCodeInfo.php | 2 +- .../Protobuf/Internal/SourceCodeInfo_Location.php | 6 ++-- .../Protobuf/Internal/UninterpretedOption.php | 2 +- php/tests/array_test.php | 36 ++++++++++++---------- src/google/protobuf/compiler/php/php_generator.cc | 7 ++--- 24 files changed, 63 insertions(+), 64 deletions(-) (limited to 'src/google') diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index 0fdaecfc..3f975b8a 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -119,7 +119,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setField(&$var) + public function setField($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->field = $arr; @@ -147,7 +147,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setExtension(&$var) + public function setExtension($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->extension = $arr; @@ -175,7 +175,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setNestedType(&$var) + public function setNestedType($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); $this->nested_type = $arr; @@ -203,7 +203,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setEnumType(&$var) + public function setEnumType($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); $this->enum_type = $arr; @@ -231,7 +231,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setExtensionRange(&$var) + public function setExtensionRange($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); $this->extension_range = $arr; @@ -259,7 +259,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setOneofDecl(&$var) + public function setOneofDecl($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); $this->oneof_decl = $arr; @@ -287,7 +287,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\MessageOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); $this->options = $var; @@ -315,7 +315,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setReservedRange(&$var) + public function setReservedRange($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); $this->reserved_range = $arr; @@ -349,7 +349,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setReservedName(&$var) + public function setReservedName($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->reserved_name = $arr; diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index 6cdaf2df..adc21fc6 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -81,7 +81,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setValue(&$var) + public function setValue($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); $this->value = $arr; @@ -109,7 +109,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\EnumOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php index 3c3a9e22..6067d5a0 100644 --- a/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -137,7 +137,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php index 89d6707f..b761fbcf 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -109,7 +109,7 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\EnumValueOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php index 3b5c58e4..b7bcd237 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -95,7 +95,7 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php index ae61be47..fbe4e1bf 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -418,7 +418,7 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FieldOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index 157c0f82..593536ff 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -404,7 +404,7 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index 3b1567d1..c61cf917 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -187,7 +187,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setDependency(&$var) + public function setDependency($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->dependency = $arr; @@ -219,7 +219,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param int[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setPublicDependency(&$var) + public function setPublicDependency($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->public_dependency = $arr; @@ -253,7 +253,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param int[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setWeakDependency(&$var) + public function setWeakDependency($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->weak_dependency = $arr; @@ -285,7 +285,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setMessageType(&$var) + public function setMessageType($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); $this->message_type = $arr; @@ -313,7 +313,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setEnumType(&$var) + public function setEnumType($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); $this->enum_type = $arr; @@ -341,7 +341,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setService(&$var) + public function setService($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); $this->service = $arr; @@ -369,7 +369,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setExtension(&$var) + public function setExtension($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); $this->extension = $arr; @@ -397,7 +397,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FileOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); $this->options = $var; @@ -435,7 +435,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\SourceCodeInfo $var * @return $this */ - public function setSourceCodeInfo(&$var) + public function setSourceCodeInfo($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); $this->source_code_info = $var; diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 591e2a81..2b6ed0ab 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -44,7 +44,7 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setFile(&$var) + public function setFile($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); $this->file = $arr; diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 2202102b..200ee9de 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -812,7 +812,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index 35b47526..a69bef85 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -54,7 +54,7 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setAnnotation(&$var) + public function setAnnotation($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); $this->annotation = $arr; diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php index c2e22e89..86c9f629 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php @@ -74,7 +74,7 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message * @param int[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setPath(&$var) + public function setPath($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->path = $arr; diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php index 3677ca38..0a0bfb2d 100644 --- a/php/src/Google/Protobuf/Internal/MessageOptions.php +++ b/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -311,7 +311,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php index 69c25b69..95b614f3 100644 --- a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php @@ -165,7 +165,7 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\MethodOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php index 5b2db776..17a8b453 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -128,7 +128,7 @@ class MethodOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php index 0d4f3bdc..255ff572 100644 --- a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php @@ -76,7 +76,7 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\OneofOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php index aa8c934c..fb8c3bfa 100644 --- a/php/src/Google/Protobuf/Internal/OneofOptions.php +++ b/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -47,7 +47,7 @@ class OneofOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php index 963cd650..e10bd533 100644 --- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -81,7 +81,7 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setMethod(&$var) + public function setMethod($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); $this->method = $arr; @@ -109,7 +109,7 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\ServiceOptions $var * @return $this */ - public function setOptions(&$var) + public function setOptions($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); $this->options = $var; diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php index ea649865..a2319170 100644 --- a/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -95,7 +95,7 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setUninterpretedOption(&$var) + public function setUninterpretedOption($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index 65530586..d21fe8eb 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -170,7 +170,7 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setLocation(&$var) + public function setLocation($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); $this->location = $arr; diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php index b33013b8..210bf073 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php @@ -170,7 +170,7 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message * @param int[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setPath(&$var) + public function setPath($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->path = $arr; @@ -210,7 +210,7 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message * @param int[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setSpan(&$var) + public function setSpan($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->span = $arr; @@ -368,7 +368,7 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setLeadingDetachedComments(&$var) + public function setLeadingDetachedComments($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->leading_detached_comments = $arr; diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php index a4fab343..daa730d0 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -81,7 +81,7 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setName(&$var) + public function setName($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); $this->name = $arr; diff --git a/php/tests/array_test.php b/php/tests/array_test.php index 271389ba..e57f0a7e 100644 --- a/php/tests/array_test.php +++ b/php/tests/array_test.php @@ -521,21 +521,23 @@ class RepeatedFieldTest extends PHPUnit_Framework_TestCase # Test memory leak ######################################################### - public function testCycleLeak() - { - $arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class); - $arr[] = new TestMessage; - $arr[0]->SetRepeatedRecursive($arr); - - // Clean up memory before test. - gc_collect_cycles(); - $start = memory_get_usage(); - unset($arr); - - // Explicitly trigger garbage collection. - gc_collect_cycles(); - - $end = memory_get_usage(); - $this->assertLessThan($start, $end); - } + // COMMENTED OUT BY @bshaffer + // @see https://github.com/google/protobuf/pull/3344#issuecomment-315162761 + // public function testCycleLeak() + // { + // $arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class); + // $arr[] = new TestMessage; + // $arr[0]->SetRepeatedRecursive($arr); + + // // Clean up memory before test. + // gc_collect_cycles(); + // $start = memory_get_usage(); + // unset($arr); + + // // Explicitly trigger garbage collection. + // gc_collect_cycles(); + + // $end = memory_get_usage(); + // $this->assertLessThan($start, $end); + // } } diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index e20b89ae..17d8ebad 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -534,12 +534,9 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, // Generate setter. GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter); printer->Print( - "public function set^camel_name^(^var^)\n" + "public function set^camel_name^($var)\n" "{\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "var", (field->is_repeated() || - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ? - "&$var": "$var"); + "camel_name", UnderscoresToCamelCase(field->name(), true)); Indent(printer); -- cgit v1.2.3 From 9e745f771b2a0cde271b8283753c19014124ac95 Mon Sep 17 00:00:00 2001 From: Matt A Date: Tue, 18 Jul 2017 10:45:18 -0400 Subject: Support PHP generic services (#3269) * Add php_generic_services option * Generate PHP generic services * Respect namespaces for generated PHP services * Test PHP generated services * Rename PHP generator service method doc comment function * Correct phpdoc service method case * Test namespaced PHP generic services * Always use the FQCN for PHP generic service input/output * Add generated_service_test to php test.sh * Add php service test protos to CI * Add php service files to php_EXTRA_DIST * Use Interface suffix for php generic services --- Makefile.am | 3 + .../src/Google.Protobuf/Reflection/Descriptor.cs | 149 ++++++----- php/phpunit.xml | 1 + .../Google/Protobuf/Internal/Descriptor.php | 1 + php/src/Google/Protobuf/Internal/FileOptions.php | 33 +++ php/tests/generated_service_test.php | 110 ++++++++ php/tests/proto/test_service.proto | 18 ++ php/tests/proto/test_service_namespace.proto | 13 + php/tests/test.sh | 2 +- src/google/protobuf/compiler/php/php_generator.cc | 140 +++++++++- src/google/protobuf/descriptor.pb.cc | 289 +++++++++++++-------- src/google/protobuf/descriptor.pb.h | 52 +++- src/google/protobuf/descriptor.proto | 1 + tests.sh | 2 +- 14 files changed, 623 insertions(+), 191 deletions(-) create mode 100644 php/tests/generated_service_test.php create mode 100644 php/tests/proto/test_service.proto create mode 100644 php/tests/proto/test_service_namespace.proto (limited to 'src/google') diff --git a/Makefile.am b/Makefile.am index f613c0f8..7ffb202e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -662,6 +662,7 @@ php_EXTRA_DIST= \ php/tests/gdb_test.sh \ php/tests/generated_class_test.php \ php/tests/generated_phpdoc_test.php \ + php/tests/generated_service_test.php \ php/tests/map_field_test.php \ php/tests/memory_leak_test.php \ php/tests/php_implementation_test.php \ @@ -672,6 +673,8 @@ php_EXTRA_DIST= \ php/tests/proto/test_no_namespace.proto \ php/tests/proto/test_php_namespace.proto \ php/tests/proto/test_prefix.proto \ + php/tests/proto/test_service.proto \ + php/tests/proto/test_service_namespace.proto \ php/tests/test.sh \ php/tests/test_base.php \ php/tests/test_util.php \ diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index c3517802..6c605f3c 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -80,7 +80,7 @@ namespace Google.Protobuf.Reflection { "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n", "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt", "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm", - "YWxzZSLLBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", + "YWxzZSLwBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf", "ZmlsZXMYCiABKAg6BWZhbHNlEikKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu", "ZF9oYXNoGBQgASgIQgIYARIlChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsg", @@ -88,65 +88,66 @@ namespace Google.Protobuf.Reflection { "dG9idWYuRmlsZU9wdGlvbnMuT3B0aW1pemVNb2RlOgVTUEVFRBISCgpnb19w", "YWNrYWdlGAsgASgJEiIKE2NjX2dlbmVyaWNfc2VydmljZXMYECABKAg6BWZh", "bHNlEiQKFWphdmFfZ2VuZXJpY19zZXJ2aWNlcxgRIAEoCDoFZmFsc2USIgoT", - "cHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRl", - "ZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFs", - "c2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVz", - "cGFjZRglIAEoCRIUCgxzd2lmdF9wcmVmaXgYJyABKAkSGAoQcGhwX2NsYXNz", - "X3ByZWZpeBgoIAEoCRIVCg1waHBfbmFtZXNwYWNlGCkgASgJEkMKFHVuaW50", - "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", - "dGVycHJldGVkT3B0aW9uIjoKDE9wdGltaXplTW9kZRIJCgVTUEVFRBABEg0K", - "CUNPREVfU0laRRACEhAKDExJVEVfUlVOVElNRRADKgkI6AcQgICAgAJKBAgm", - "ECci8gEKDk1lc3NhZ2VPcHRpb25zEiYKF21lc3NhZ2Vfc2V0X3dpcmVfZm9y", - "bWF0GAEgASgIOgVmYWxzZRIuCh9ub19zdGFuZGFyZF9kZXNjcmlwdG9yX2Fj", - "Y2Vzc29yGAIgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxz", - "ZRIRCgltYXBfZW50cnkYByABKAgSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y", - "5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24q", - "CQjoBxCAgICAAkoECAgQCUoECAkQCiKeAwoMRmllbGRPcHRpb25zEjoKBWN0", - "eXBlGAEgASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlw", - "ZToGU1RSSU5HEg4KBnBhY2tlZBgCIAEoCBI/CgZqc3R5cGUYBiABKA4yJC5n", - "b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zLkpTVHlwZToJSlNfTk9STUFM", - "EhMKBGxhenkYBSABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZh", - "bHNlEhMKBHdlYWsYCiABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0", - "aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0", - "aW9uIi8KBUNUeXBlEgoKBlNUUklORxAAEggKBENPUkQQARIQCgxTVFJJTkdf", - "UElFQ0UQAiI1CgZKU1R5cGUSDQoJSlNfTk9STUFMEAASDQoJSlNfU1RSSU5H", - "EAESDQoJSlNfTlVNQkVSEAIqCQjoBxCAgICAAkoECAQQBSJeCgxPbmVvZk9w", - "dGlvbnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xl", - "LnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKTAQoL", - "RW51bU9wdGlvbnMSEwoLYWxsb3dfYWxpYXMYAiABKAgSGQoKZGVwcmVjYXRl", - "ZBgDIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygL", - "MiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCA", - "gICAAkoECAUQBiJ9ChBFbnVtVmFsdWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQY", - "ASABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", + "cHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USIwoUcGhwX2dlbmVy", + "aWNfc2VydmljZXMYEyABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYFyABKAg6", + "BWZhbHNlEh8KEGNjX2VuYWJsZV9hcmVuYXMYHyABKAg6BWZhbHNlEhkKEW9i", + "amNfY2xhc3NfcHJlZml4GCQgASgJEhgKEGNzaGFycF9uYW1lc3BhY2UYJSAB", + "KAkSFAoMc3dpZnRfcHJlZml4GCcgASgJEhgKEHBocF9jbGFzc19wcmVmaXgY", + "KCABKAkSFQoNcGhwX25hbWVzcGFjZRgpIAEoCRJDChR1bmludGVycHJldGVk", + "X29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRl", + "ZE9wdGlvbiI6CgxPcHRpbWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJ", + "WkUQAhIQCgxMSVRFX1JVTlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIvIBCg5N", + "ZXNzYWdlT3B0aW9ucxImChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEo", + "CDoFZmFsc2USLgofbm9fc3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgC", + "IAEoCDoFZmFsc2USGQoKZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFw", + "X2VudHJ5GAcgASgIEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA", - "gAIiewoOU2VydmljZU9wdGlvbnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFs", - "c2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy", - "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKtAgoNTWV0", - "aG9kT3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJfChFpZGVt", - "cG90ZW5jeV9sZXZlbBgiIAEoDjIvLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RP", - "cHRpb25zLklkZW1wb3RlbmN5TGV2ZWw6E0lERU1QT1RFTkNZX1VOS05PV04S", - "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv", - "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iUAoQSWRlbXBvdGVuY3lMZXZlbBIX", - "ChNJREVNUE9URU5DWV9VTktOT1dOEAASEwoPTk9fU0lERV9FRkZFQ1RTEAES", - "DgoKSURFTVBPVEVOVBACKgkI6AcQgICAgAIingIKE1VuaW50ZXJwcmV0ZWRP", - "cHRpb24SOwoEbmFtZRgCIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy", - "cHJldGVkT3B0aW9uLk5hbWVQYXJ0EhgKEGlkZW50aWZpZXJfdmFsdWUYAyAB", - "KAkSGgoScG9zaXRpdmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2lu", - "dF92YWx1ZRgFIAEoAxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5n", - "X3ZhbHVlGAcgASgMEhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1l", - "UGFydBIRCgluYW1lX3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigI", - "ItUBCg5Tb3VyY2VDb2RlSW5mbxI6Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2ds", - "ZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5mby5Mb2NhdGlvbhqGAQoITG9jYXRp", - "b24SEAoEcGF0aBgBIAMoBUICEAESEAoEc3BhbhgCIAMoBUICEAESGAoQbGVh", - "ZGluZ19jb21tZW50cxgDIAEoCRIZChF0cmFpbGluZ19jb21tZW50cxgEIAEo", - "CRIhChlsZWFkaW5nX2RldGFjaGVkX2NvbW1lbnRzGAYgAygJIqcBChFHZW5l", - "cmF0ZWRDb2RlSW5mbxJBCgphbm5vdGF0aW9uGAEgAygLMi0uZ29vZ2xlLnBy", - "b3RvYnVmLkdlbmVyYXRlZENvZGVJbmZvLkFubm90YXRpb24aTwoKQW5ub3Rh", - "dGlvbhIQCgRwYXRoGAEgAygFQgIQARITCgtzb3VyY2VfZmlsZRgCIAEoCRIN", - "CgViZWdpbhgDIAEoBRILCgNlbmQYBCABKAVCjAEKE2NvbS5nb29nbGUucHJv", - "dG9idWZCEERlc2NyaXB0b3JQcm90b3NIAVo+Z2l0aHViLmNvbS9nb2xhbmcv", - "cHJvdG9idWYvcHJvdG9jLWdlbi1nby9kZXNjcmlwdG9yO2Rlc2NyaXB0b3Ki", - "AgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg==")); + "gAJKBAgIEAlKBAgJEAoingMKDEZpZWxkT3B0aW9ucxI6CgVjdHlwZRgBIAEo", + "DjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMuQ1R5cGU6BlNUUklO", + "RxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBlGAYgASgOMiQuZ29vZ2xlLnBy", + "b3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6CUpTX05PUk1BTBITCgRsYXp5", + "GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxzZRITCgR3", + "ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByAD", + "KAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiIvCgVD", + "VHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAESEAoMU1RSSU5HX1BJRUNFEAIi", + "NQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0KCUpTX1NUUklORxABEg0KCUpT", + "X05VTUJFUhACKgkI6AcQgICAgAJKBAgEEAUiXgoMT25lb2ZPcHRpb25zEkMK", + "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1", + "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIikwEKC0VudW1PcHRp", + "b25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJlY2F0ZWQYAyABKAg6", + "BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2ds", + "ZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgF", + "EAYifQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVm", + "YWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUu", + "cHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNl", + "cnZpY2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVu", + "aW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5V", + "bmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIirQIKDU1ldGhvZE9wdGlv", + "bnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFsc2USXwoRaWRlbXBvdGVuY3lf", + "bGV2ZWwYIiABKA4yLy5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucy5J", + "ZGVtcG90ZW5jeUxldmVsOhNJREVNUE9URU5DWV9VTktOT1dOEkMKFHVuaW50", + "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", + "dGVycHJldGVkT3B0aW9uIlAKEElkZW1wb3RlbmN5TGV2ZWwSFwoTSURFTVBP", + "VEVOQ1lfVU5LTk9XThAAEhMKD05PX1NJREVfRUZGRUNUUxABEg4KCklERU1Q", + "T1RFTlQQAioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0aW9uEjsK", + "BG5hbWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w", + "dGlvbi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBv", + "c2l0aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUY", + "BSABKAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgH", + "IAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJ", + "bmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291", + "cmNlQ29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9i", + "dWYuU291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBh", + "dGgYASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29t", + "bWVudHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVh", + "ZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29k", + "ZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5H", + "ZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoE", + "cGF0aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4Y", + "AyABKAUSCwoDZW5kGAQgASgFQowBChNjb20uZ29vZ2xlLnByb3RvYnVmQhBE", + "ZXNjcmlwdG9yUHJvdG9zSAFaPmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVm", + "L3Byb3RvYy1nZW4tZ28vZGVzY3JpcHRvcjtkZXNjcmlwdG9yogIDR1BCqgIa", + "R29vZ2xlLlByb3RvYnVmLlJlZmxlY3Rpb24=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -160,7 +161,7 @@ namespace Google.Protobuf.Reflection { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), @@ -2804,6 +2805,7 @@ namespace Google.Protobuf.Reflection { ccGenericServices_ = other.ccGenericServices_; javaGenericServices_ = other.javaGenericServices_; pyGenericServices_ = other.pyGenericServices_; + phpGenericServices_ = other.phpGenericServices_; deprecated_ = other.deprecated_; ccEnableArenas_ = other.ccEnableArenas_; objcClassPrefix_ = other.objcClassPrefix_; @@ -2981,6 +2983,17 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "php_generic_services" field. + public const int PhpGenericServicesFieldNumber = 19; + private bool phpGenericServices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool PhpGenericServices { + get { return phpGenericServices_; } + set { + phpGenericServices_ = value; + } + } + /// Field number for the "deprecated" field. public const int DeprecatedFieldNumber = 23; private bool deprecated_; @@ -3126,6 +3139,7 @@ namespace Google.Protobuf.Reflection { if (CcGenericServices != other.CcGenericServices) return false; if (JavaGenericServices != other.JavaGenericServices) return false; if (PyGenericServices != other.PyGenericServices) return false; + if (PhpGenericServices != other.PhpGenericServices) return false; if (Deprecated != other.Deprecated) return false; if (CcEnableArenas != other.CcEnableArenas) return false; if (ObjcClassPrefix != other.ObjcClassPrefix) return false; @@ -3150,6 +3164,7 @@ namespace Google.Protobuf.Reflection { if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode(); + if (PhpGenericServices != false) hash ^= PhpGenericServices.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode(); if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode(); @@ -3200,6 +3215,10 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(144, 1); output.WriteBool(PyGenericServices); } + if (PhpGenericServices != false) { + output.WriteRawTag(152, 1); + output.WriteBool(PhpGenericServices); + } if (JavaGenerateEqualsAndHash != false) { output.WriteRawTag(160, 1); output.WriteBool(JavaGenerateEqualsAndHash); @@ -3272,6 +3291,9 @@ namespace Google.Protobuf.Reflection { if (PyGenericServices != false) { size += 2 + 1; } + if (PhpGenericServices != false) { + size += 2 + 1; + } if (Deprecated != false) { size += 2 + 1; } @@ -3332,6 +3354,9 @@ namespace Google.Protobuf.Reflection { if (other.PyGenericServices != false) { PyGenericServices = other.PyGenericServices; } + if (other.PhpGenericServices != false) { + PhpGenericServices = other.PhpGenericServices; + } if (other.Deprecated != false) { Deprecated = other.Deprecated; } @@ -3396,6 +3421,10 @@ namespace Google.Protobuf.Reflection { PyGenericServices = input.ReadBool(); break; } + case 152: { + PhpGenericServices = input.ReadBool(); + break; + } case 160: { JavaGenerateEqualsAndHash = input.ReadBool(); break; diff --git a/php/phpunit.xml b/php/phpunit.xml index 7cb1e2a3..637467be 100644 --- a/php/phpunit.xml +++ b/php/phpunit.xml @@ -10,6 +10,7 @@ tests/generated_phpdoc_test.php tests/map_field_test.php tests/well_known_test.php + tests/generated_service_test.php diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php index 636a0ad4..1e3c745e 100644 --- a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php +++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -139,6 +139,7 @@ class Descriptor ->optional('cc_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 16) ->optional('java_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 17) ->optional('py_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 18) + ->optional('php_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 19) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 23) ->optional('cc_enable_arenas', \Google\Protobuf\Internal\GPBType::BOOL, 31) ->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36) diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 200ee9de..c7972ca7 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -109,6 +109,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message */ private $py_generic_services = false; private $has_py_generic_services = false; + /** + * Generated from protobuf field optional bool php_generic_services = 19 [default = false]; + */ + private $php_generic_services = false; + private $has_php_generic_services = false; /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -548,6 +553,34 @@ class FileOptions extends \Google\Protobuf\Internal\Message return $this->has_py_generic_services; } + /** + * Generated from protobuf field optional bool php_generic_services = 19 [default = false]; + * @return bool + */ + public function getPhpGenericServices() + { + return $this->php_generic_services; + } + + /** + * Generated from protobuf field optional bool php_generic_services = 19 [default = false]; + * @param bool $var + * @return $this + */ + public function setPhpGenericServices($var) + { + GPBUtil::checkBool($var); + $this->php_generic_services = $var; + $this->has_php_generic_services = true; + + return $this; + } + + public function hasPhpGenericServices() + { + return $this->has_php_generic_services; + } + /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations diff --git a/php/tests/generated_service_test.php b/php/tests/generated_service_test.php new file mode 100644 index 00000000..5407db9a --- /dev/null +++ b/php/tests/generated_service_test.php @@ -0,0 +1,110 @@ +serviceClass = new ReflectionClass('Foo\GreeterInterface'); + + $this->namespacedServiceClass = new ReflectionClass('Bar\OtherGreeterInterface'); + } + + public function testIsInterface() + { + $this->assertTrue($this->serviceClass->isInterface()); + } + + public function testPhpDocForClass() + { + $this->assertContains('foo.Greeter', $this->serviceClass->getDocComment()); + } + + public function testPhpDocForNamespacedClass() + { + $this->assertContains('foo.OtherGreeter', $this->namespacedServiceClass->getDocComment()); + } + + public function testServiceMethodsAreGenerated() + { + $this->assertCount(count($this->methodNames), $this->serviceClass->getMethods()); + foreach ($this->methodNames as $methodName) { + $this->assertTrue($this->serviceClass->hasMethod($methodName)); + } + } + + public function testPhpDocForServiceMethod() + { + foreach ($this->methodNames as $methodName) { + $docComment = $this->serviceClass->getMethod($methodName)->getDocComment(); + $this->assertContains($methodName, $docComment); + $this->assertContains('@param \Foo\HelloRequest $request', $docComment); + $this->assertContains('@return \Foo\HelloReply', $docComment); + } + } + + public function testPhpDocForServiceMethodInNamespacedClass() + { + foreach ($this->methodNames as $methodName) { + $docComment = $this->namespacedServiceClass->getMethod($methodName)->getDocComment(); + $this->assertContains($methodName, $docComment); + $this->assertContains('@param \Foo\HelloRequest $request', $docComment); + $this->assertContains('@return \Foo\HelloReply', $docComment); + } + } + + public function testParamForServiceMethod() + { + foreach ($this->methodNames as $methodName) { + $method = $this->serviceClass->getMethod($methodName); + $this->assertCount(1, $method->getParameters()); + $param = $method->getParameters()[0]; + $this->assertFalse($param->isOptional()); + $this->assertSame('request', $param->getName()); + // ReflectionParameter::getType only exists in PHP 7+, so get the type from __toString + $this->assertContains('Foo\HelloRequest $request', (string) $param); + } + } + + public function testParamForServiceMethodInNamespacedClass() + { + foreach ($this->methodNames as $methodName) { + $method = $this->serviceClass->getMethod($methodName); + $this->assertCount(1, $method->getParameters()); + $param = $method->getParameters()[0]; + $this->assertFalse($param->isOptional()); + $this->assertSame('request', $param->getName()); + // ReflectionParameter::getType only exists in PHP 7+, so get the type from __toString + $this->assertContains('Foo\HelloRequest $request', (string) $param); + } + } +} diff --git a/php/tests/proto/test_service.proto b/php/tests/proto/test_service.proto new file mode 100644 index 00000000..a03dbc46 --- /dev/null +++ b/php/tests/proto/test_service.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package foo; + +option php_generic_services = true; + +service Greeter { + rpc SayHello (HelloRequest) returns (HelloReply) {} + rpc SayHelloAgain (HelloRequest) returns (HelloReply) {} +} + +message HelloRequest { + string name = 1; +} + +message HelloReply { + string message = 1; +} diff --git a/php/tests/proto/test_service_namespace.proto b/php/tests/proto/test_service_namespace.proto new file mode 100644 index 00000000..719aa484 --- /dev/null +++ b/php/tests/proto/test_service_namespace.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +import "proto/test_service.proto"; + +package foo; + +option php_generic_services = true; +option php_namespace = "Bar"; + +service OtherGreeter { + rpc SayHello (HelloRequest) returns (HelloReply) {} + rpc SayHelloAgain (HelloRequest) returns (HelloReply) {} +} diff --git a/php/tests/test.sh b/php/tests/test.sh index 6c6edd56..b640c143 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -8,7 +8,7 @@ set -e phpize && ./configure CFLAGS='-g -O0' && make popd -tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php ) +tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service_test.php ) for t in "${tests[@]}" do diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 17d8ebad..60e6fce9 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -82,6 +82,10 @@ void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, int is_descriptor); void GenerateEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); +void GenerateServiceDocComment(io::Printer* printer, + const ServiceDescriptor* service); +void GenerateServiceMethodDocComment(io::Printer* printer, + const MethodDescriptor* method); std::string RenameEmpty(const std::string& name) { if (name == "Empty") { @@ -139,17 +143,9 @@ std::string ClassNamePrefix(const string& classname, return ""; } - template -std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { - string classname = desc->name(); - const Descriptor* containing = desc->containing_type(); - while (containing != NULL) { - classname = containing->name() + '_' + classname; - containing = containing->containing_type(); - } - classname = ClassNamePrefix(classname, desc) + classname; - +std::string NamespacedName(const string& classname, + const DescriptorType* desc, bool is_descriptor) { if (desc->file()->options().has_php_namespace()) { const string& php_namespace = desc->file()->options().php_namespace(); if (php_namespace != "") { @@ -167,6 +163,24 @@ std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { } } +template +std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { + string classname = desc->name(); + const Descriptor* containing = desc->containing_type(); + while (containing != NULL) { + classname = containing->name() + '_' + classname; + containing = containing->containing_type(); + } + classname = ClassNamePrefix(classname, desc) + classname; + return NamespacedName(classname, desc, is_descriptor); +} + +std::string FullClassName(const ServiceDescriptor* desc, bool is_descriptor) { + string classname = desc->name(); + classname = ClassNamePrefix(classname, desc) + classname; + return NamespacedName(classname, desc, is_descriptor); +} + std::string PhpName(const std::string& full_name, bool is_descriptor) { if (is_descriptor) { return kDescriptorPackageName; @@ -272,6 +286,17 @@ std::string GeneratedEnumFileName(const EnumDescriptor* en, return result + ".php"; } +std::string GeneratedServiceFileName(const ServiceDescriptor* service, + bool is_descriptor) { + std::string result = FullClassName(service, is_descriptor) + "Interface"; + for (int i = 0; i < result.size(); i++) { + if (result[i] == '\\') { + result[i] = '/'; + } + } + return result + ".php"; +} + std::string IntToString(int32 value) { std::ostringstream os; os << value; @@ -660,6 +685,16 @@ void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) { Outdent(printer); } +void GenerateServiceMethod(const MethodDescriptor* method, + io::Printer* printer) { + printer->Print( + "public function ^camel_name^(\\^request_name^ $request);\n\n", + "camel_name", UnderscoresToCamelCase(method->name(), false), + "request_name", FullClassName( + method->input_type(), false) + ); +} + void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, io::Printer* printer) { // Don't generate MapEntry messages -- we use the PHP extension's native @@ -1061,6 +1096,58 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, } } +void GenerateServiceFile(const FileDescriptor* file, + const ServiceDescriptor* service, bool is_descriptor, + GeneratorContext* generator_context) { + std::string filename = GeneratedServiceFileName(service, is_descriptor); + scoped_ptr output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '^'); + + GenerateHead(file, &printer); + + std::string fullname = FilenameToClassname(filename); + int lastindex = fullname.find_last_of("\\"); + + if (file->options().has_php_namespace()) { + const string& php_namespace = file->options().php_namespace(); + if (!php_namespace.empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", php_namespace); + } + } else if (!file->package().empty()) { + printer.Print( + "namespace ^name^;\n\n", + "name", fullname.substr(0, lastindex)); + } + + GenerateServiceDocComment(&printer, service); + + if (lastindex != string::npos) { + printer.Print( + "interface ^name^\n" + "{\n", + "name", fullname.substr(lastindex + 1)); + } else { + printer.Print( + "interface ^name^\n" + "{\n", + "name", fullname); + } + + Indent(&printer); + + for (int i = 0; i < service->method_count(); i++) { + const MethodDescriptor* method = service->method(i); + GenerateServiceMethodDocComment(&printer, method); + GenerateServiceMethod(method, &printer); + } + + Outdent(&printer); + printer.Print("}\n\n"); +} + void GenerateFile(const FileDescriptor* file, bool is_descriptor, GeneratorContext* generator_context) { GenerateMetadataFile(file, is_descriptor, generator_context); @@ -1072,6 +1159,12 @@ void GenerateFile(const FileDescriptor* file, bool is_descriptor, GenerateEnumFile(file, file->enum_type(i), is_descriptor, generator_context); } + if (file->options().php_generic_services()) { + for (int i = 0; i < file->service_count(); i++) { + GenerateServiceFile(file, file->service(i), is_descriptor, + generator_context); + } + } } static string EscapePhpdoc(const string& input) { @@ -1180,6 +1273,16 @@ void GenerateMessageDocComment(io::Printer* printer, "messagename", EscapePhpdoc(message->full_name())); } +void GenerateServiceDocComment(io::Printer* printer, + const ServiceDescriptor* service) { + printer->Print("/**\n"); + GenerateDocCommentBody(printer, service); + printer->Print( + " * Protobuf type ^fullname^\n" + " */\n", + "fullname", EscapePhpdoc(service->full_name())); +} + void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, int is_descriptor, int function_type) { // In theory we should have slightly different comments for setters, getters, @@ -1226,6 +1329,23 @@ void GenerateEnumValueDocComment(io::Printer* printer, "def", EscapePhpdoc(FirstLineOf(value->DebugString()))); } +void GenerateServiceMethodDocComment(io::Printer* printer, + const MethodDescriptor* method) { + printer->Print("/**\n"); + GenerateDocCommentBody(printer, method); + printer->Print( + " * Method ^method_name^\n" + " *\n", + "method_name", EscapePhpdoc(UnderscoresToCamelCase(method->name(), false))); + printer->Print( + " * @param \\^input_type^ $request\n", + "input_type", EscapePhpdoc(FullClassName(method->input_type(), false))); + printer->Print( + " * @return \\^return_type^\n" + " */\n", + "return_type", EscapePhpdoc(FullClassName(method->output_type(), false))); +} + bool Generator::Generate(const FileDescriptor* file, const string& parameter, GeneratorContext* generator_context, string* error) const { diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 48a256dd..1a2c2ed3 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -297,6 +297,7 @@ const ::google::protobuf::uint32 TableStruct::offsets[] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, py_generic_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, php_generic_services_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_), @@ -310,13 +311,14 @@ const ::google::protobuf::uint32 TableStruct::offsets[] = { 8, 9, 10, - 16, + 17, 2, 11, 12, 13, 14, 15, + 16, 3, 4, 5, @@ -488,20 +490,20 @@ static const ::google::protobuf::internal::MigrationSchema schemas[] = { { 124, 132, sizeof(EnumValueDescriptorProto)}, { 135, 143, sizeof(ServiceDescriptorProto)}, { 146, 157, sizeof(MethodDescriptorProto)}, - { 163, 186, sizeof(FileOptions)}, - { 204, 214, sizeof(MessageOptions)}, - { 219, 231, sizeof(FieldOptions)}, - { 238, 244, sizeof(OneofOptions)}, - { 245, 253, sizeof(EnumOptions)}, - { 256, 263, sizeof(EnumValueOptions)}, - { 265, 272, sizeof(ServiceOptions)}, - { 274, 282, sizeof(MethodOptions)}, - { 285, 292, sizeof(UninterpretedOption_NamePart)}, - { 294, 306, sizeof(UninterpretedOption)}, - { 313, 323, sizeof(SourceCodeInfo_Location)}, - { 328, 334, sizeof(SourceCodeInfo)}, - { 335, 344, sizeof(GeneratedCodeInfo_Annotation)}, - { 348, 354, sizeof(GeneratedCodeInfo)}, + { 163, 187, sizeof(FileOptions)}, + { 206, 216, sizeof(MessageOptions)}, + { 221, 233, sizeof(FieldOptions)}, + { 240, 246, sizeof(OneofOptions)}, + { 247, 255, sizeof(EnumOptions)}, + { 258, 265, sizeof(EnumValueOptions)}, + { 267, 274, sizeof(ServiceOptions)}, + { 276, 284, sizeof(MethodOptions)}, + { 287, 294, sizeof(UninterpretedOption_NamePart)}, + { 296, 308, sizeof(UninterpretedOption)}, + { 315, 325, sizeof(SourceCodeInfo_Location)}, + { 330, 336, sizeof(SourceCodeInfo)}, + { 337, 346, sizeof(GeneratedCodeInfo_Annotation)}, + { 350, 356, sizeof(GeneratedCodeInfo)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { @@ -729,7 +731,7 @@ void AddDescriptorsImpl() { "\n\013output_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.g" "oogle.protobuf.MethodOptions\022\037\n\020client_s" "treaming\030\005 \001(\010:\005false\022\037\n\020server_streamin" - "g\030\006 \001(\010:\005false\"\313\005\n\013FileOptions\022\024\n\014java_p" + "g\030\006 \001(\010:\005false\"\360\005\n\013FileOptions\022\024\n\014java_p" "ackage\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001" "(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false\022)" "\n\035java_generate_equals_and_hash\030\024 \001(\010B\002\030" @@ -739,75 +741,76 @@ void AddDescriptorsImpl() { "ackage\030\013 \001(\t\022\"\n\023cc_generic_services\030\020 \001(" "\010:\005false\022$\n\025java_generic_services\030\021 \001(\010:" "\005false\022\"\n\023py_generic_services\030\022 \001(\010:\005fal" - "se\022\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enab" - "le_arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_pre" - "fix\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014s" - "wift_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( " - "\001(\t\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpre" - "ted_option\030\347\007 \003(\0132$.google.protobuf.Unin" - "terpretedOption\":\n\014OptimizeMode\022\t\n\005SPEED" - "\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007" - "\020\200\200\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027messa" - "ge_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_st" - "andard_descriptor_accessor\030\002 \001(\010:\005false\022" - "\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030" - "\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.g" - "oogle.protobuf.UninterpretedOption*\t\010\350\007\020" - "\200\200\200\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005ct" - "ype\030\001 \001(\0162#.google.protobuf.FieldOptions" - ".CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype" - "\030\006 \001(\0162$.google.protobuf.FieldOptions.JS" - "Type:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\n" - "deprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005f" - "alse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" - "ogle.protobuf.UninterpretedOption\"/\n\005CTy" - "pe\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE" - "\020\002\"5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING" - "\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014On" - "eofOptions\022C\n\024uninterpreted_option\030\347\007 \003(" - "\0132$.google.protobuf.UninterpretedOption*" - "\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alia" - "s\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024un" - "interpreted_option\030\347\007 \003(\0132$.google.proto" - "buf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006" - "\"}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010" - ":\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$" + "se\022#\n\024php_generic_services\030\023 \001(\010:\005false\022" + "\031\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_" + "arenas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix" + "\030$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\024\n\014swif" + "t_prefix\030\' \001(\t\022\030\n\020php_class_prefix\030( \001(\t" + "\022\025\n\rphp_namespace\030) \001(\t\022C\n\024uninterpreted" + "_option\030\347\007 \003(\0132$.google.protobuf.Uninter" + "pretedOption\":\n\014OptimizeMode\022\t\n\005SPEED\020\001\022" + "\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200" + "\200\200\002J\004\010&\020\'\"\362\001\n\016MessageOptions\022&\n\027message_" + "set_wire_format\030\001 \001(\010:\005false\022.\n\037no_stand" + "ard_descriptor_accessor\030\002 \001(\010:\005false\022\031\n\n" + "deprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007 \001" + "(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goog" + "le.protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200" + "\200\002J\004\010\010\020\tJ\004\010\t\020\n\"\236\003\n\014FieldOptions\022:\n\005ctype" + "\030\001 \001(\0162#.google.protobuf.FieldOptions.CT" + "ype:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 " + "\001(\0162$.google.protobuf.FieldOptions.JSTyp" + "e:\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndep" + "recated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005fals" + "e\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.googl" + "e.protobuf.UninterpretedOption\"/\n\005CType\022" + "\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"" + "5\n\006JSType\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022" + "\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014Oneof" + "Options\022C\n\024uninterpreted_option\030\347\007 \003(\0132$" ".google.protobuf.UninterpretedOption*\t\010\350" - "\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030" - "! \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 " - "\003(\0132$.google.protobuf.UninterpretedOptio" - "n*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprec" - "ated\030! \001(\010:\005false\022_\n\021idempotency_level\030\"" - " \001(\0162/.google.protobuf.MethodOptions.Ide" - "mpotencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024un" - "interpreted_option\030\347\007 \003(\0132$.google.proto" - "buf.UninterpretedOption\"P\n\020IdempotencyLe" - "vel\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_" - "EFFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n" - "\023UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goo" - "gle.protobuf.UninterpretedOption.NamePar" - "t\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_" - "int_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 " - "\001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_valu" - "e\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010Name" - "Part\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030" - "\002 \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003" - "(\0132(.google.protobuf.SourceCodeInfo.Loca" - "tion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004s" - "pan\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022" - "\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_de" - "tached_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeI" - "nfo\022A\n\nannotation\030\001 \003(\0132-.google.protobu" - "f.GeneratedCodeInfo.Annotation\032O\n\nAnnota" - "tion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 " - "\001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com." - "google.protobufB\020DescriptorProtosH\001Z>git" - "hub.com/golang/protobuf/protoc-gen-go/de" - "scriptor;descriptor\242\002\003GPB\252\002\032Google.Proto" - "buf.Reflection" + "\007\020\200\200\200\200\002\"\223\001\n\013EnumOptions\022\023\n\013allow_alias\030\002" + " \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n" + "\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:\005f" + "alse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030! \001" + "(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003(\013" + "2$.google.protobuf.UninterpretedOption*\t" + "\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprecate" + "d\030! \001(\010:\005false\022_\n\021idempotency_level\030\" \001(" + "\0162/.google.protobuf.MethodOptions.Idempo" + "tencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\"P\n\020IdempotencyLevel" + "\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_EFF" + "ECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Un" + "interpretedOption\022;\n\004name\030\002 \003(\0132-.google" + ".protobuf.UninterpretedOption.NamePart\022\030" + "\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_int" + "_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003" + "\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_value\030\007" + " \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePar" + "t\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002" + "(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132" + "(.google.protobuf.SourceCodeInfo.Locatio" + "n\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span" + "\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021" + "trailing_comments\030\004 \001(\t\022!\n\031leading_detac" + "hed_comments\030\006 \003(\t\"\247\001\n\021GeneratedCodeInfo" + "\022A\n\nannotation\030\001 \003(\0132-.google.protobuf.G" + "eneratedCodeInfo.Annotation\032O\n\nAnnotatio" + "n\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t" + "\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005B\214\001\n\023com.goo" + "gle.protobufB\020DescriptorProtosH\001Z>github" + ".com/golang/protobuf/protoc-gen-go/descr" + "iptor;descriptor\242\002\003GPB\252\002\032Google.Protobuf" + ".Reflection" }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - descriptor, 5614); + descriptor, 5651); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown); @@ -8292,6 +8295,7 @@ const int FileOptions::kGoPackageFieldNumber; const int FileOptions::kCcGenericServicesFieldNumber; const int FileOptions::kJavaGenericServicesFieldNumber; const int FileOptions::kPyGenericServicesFieldNumber; +const int FileOptions::kPhpGenericServicesFieldNumber; const int FileOptions::kDeprecatedFieldNumber; const int FileOptions::kCcEnableArenasFieldNumber; const int FileOptions::kObjcClassPrefixFieldNumber; @@ -8451,10 +8455,13 @@ void FileOptions::Clear() { } if (_has_bits_[8 / 32] & 65280u) { ::memset(&java_multiple_files_, 0, static_cast( - reinterpret_cast(&cc_enable_arenas_) - - reinterpret_cast(&java_multiple_files_)) + sizeof(cc_enable_arenas_)); + reinterpret_cast(&deprecated_) - + reinterpret_cast(&java_multiple_files_)) + sizeof(deprecated_)); + } + if (_has_bits_[16 / 32] & 196608u) { + cc_enable_arenas_ = false; + optimize_for_ = 1; } - optimize_for_ = 1; _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -8593,6 +8600,20 @@ bool FileOptions::MergePartialFromCodedStream( break; } + // optional bool php_generic_services = 19 [default = false]; + case 19: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(152u)) { + set_has_php_generic_services(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &php_generic_services_))); + } else { + goto handle_unusual; + } + break; + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; case 20: { if (static_cast< ::google::protobuf::uint8>(tag) == @@ -8796,7 +8817,7 @@ void FileOptions::SerializeWithCachedSizes( } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00010000u) { + if (cached_has_bits & 0x00020000u) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 9, this->optimize_for(), output); } @@ -8831,13 +8852,18 @@ void FileOptions::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output); } + // optional bool php_generic_services = 19 [default = false]; + if (cached_has_bits & 0x00004000u) { + ::google::protobuf::internal::WireFormatLite::WriteBool(19, this->php_generic_services(), output); + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; if (cached_has_bits & 0x00000200u) { ::google::protobuf::internal::WireFormatLite::WriteBool(20, this->java_generate_equals_and_hash(), output); } // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00004000u) { + if (cached_has_bits & 0x00008000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(23, this->deprecated(), output); } @@ -8847,7 +8873,7 @@ void FileOptions::SerializeWithCachedSizes( } // optional bool cc_enable_arenas = 31 [default = false]; - if (cached_has_bits & 0x00008000u) { + if (cached_has_bits & 0x00010000u) { ::google::protobuf::internal::WireFormatLite::WriteBool(31, this->cc_enable_arenas(), output); } @@ -8949,7 +8975,7 @@ void FileOptions::SerializeWithCachedSizes( } // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00010000u) { + if (cached_has_bits & 0x00020000u) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 9, this->optimize_for(), target); } @@ -8985,13 +9011,18 @@ void FileOptions::SerializeWithCachedSizes( target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target); } + // optional bool php_generic_services = 19 [default = false]; + if (cached_has_bits & 0x00004000u) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(19, this->php_generic_services(), target); + } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; if (cached_has_bits & 0x00000200u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->java_generate_equals_and_hash(), target); } // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00004000u) { + if (cached_has_bits & 0x00008000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(23, this->deprecated(), target); } @@ -9001,7 +9032,7 @@ void FileOptions::SerializeWithCachedSizes( } // optional bool cc_enable_arenas = 31 [default = false]; - if (cached_has_bits & 0x00008000u) { + if (cached_has_bits & 0x00010000u) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(31, this->cc_enable_arenas(), target); } @@ -9191,23 +9222,30 @@ size_t FileOptions::ByteSizeLong() const { total_size += 2 + 1; } + // optional bool php_generic_services = 19 [default = false]; + if (has_php_generic_services()) { + total_size += 2 + 1; + } + // optional bool deprecated = 23 [default = false]; if (has_deprecated()) { total_size += 2 + 1; } + } + if (_has_bits_[16 / 32] & 196608u) { // optional bool cc_enable_arenas = 31 [default = false]; if (has_cc_enable_arenas()) { total_size += 2 + 1; } - } - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (has_optimize_for()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for()); - } + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if (has_optimize_for()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->optimize_for()); + } + } int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = cached_size; @@ -9294,15 +9332,21 @@ void FileOptions::MergeFrom(const FileOptions& from) { py_generic_services_ = from.py_generic_services_; } if (cached_has_bits & 0x00004000u) { - deprecated_ = from.deprecated_; + php_generic_services_ = from.php_generic_services_; } if (cached_has_bits & 0x00008000u) { - cc_enable_arenas_ = from.cc_enable_arenas_; + deprecated_ = from.deprecated_; } _has_bits_[0] |= cached_has_bits; } - if (cached_has_bits & 0x00010000u) { - set_optimize_for(from.optimize_for()); + if (cached_has_bits & 196608u) { + if (cached_has_bits & 0x00010000u) { + cc_enable_arenas_ = from.cc_enable_arenas_; + } + if (cached_has_bits & 0x00020000u) { + optimize_for_ = from.optimize_for_; + } + _has_bits_[0] |= cached_has_bits; } } @@ -9349,6 +9393,7 @@ void FileOptions::InternalSwap(FileOptions* other) { std::swap(cc_generic_services_, other->cc_generic_services_); std::swap(java_generic_services_, other->java_generic_services_); std::swap(py_generic_services_, other->py_generic_services_); + std::swap(php_generic_services_, other->php_generic_services_); std::swap(deprecated_, other->deprecated_); std::swap(cc_enable_arenas_, other->cc_enable_arenas_); std::swap(optimize_for_, other->optimize_for_); @@ -9566,13 +9611,13 @@ void FileOptions::set_java_string_check_utf8(bool value) { // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00010000u) != 0; + return (_has_bits_[0] & 0x00020000u) != 0; } void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00010000u; + _has_bits_[0] |= 0x00020000u; } void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00010000u; + _has_bits_[0] &= ~0x00020000u; } void FileOptions::clear_optimize_for() { optimize_for_ = 1; @@ -9724,15 +9769,39 @@ void FileOptions::set_py_generic_services(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) } +// optional bool php_generic_services = 19 [default = false]; +bool FileOptions::has_php_generic_services() const { + return (_has_bits_[0] & 0x00004000u) != 0; +} +void FileOptions::set_has_php_generic_services() { + _has_bits_[0] |= 0x00004000u; +} +void FileOptions::clear_has_php_generic_services() { + _has_bits_[0] &= ~0x00004000u; +} +void FileOptions::clear_php_generic_services() { + php_generic_services_ = false; + clear_has_php_generic_services(); +} +bool FileOptions::php_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) + return php_generic_services_; +} +void FileOptions::set_php_generic_services(bool value) { + set_has_php_generic_services(); + php_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) +} + // optional bool deprecated = 23 [default = false]; bool FileOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00004000u) != 0; + return (_has_bits_[0] & 0x00008000u) != 0; } void FileOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00004000u; + _has_bits_[0] |= 0x00008000u; } void FileOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00004000u; + _has_bits_[0] &= ~0x00008000u; } void FileOptions::clear_deprecated() { deprecated_ = false; @@ -9750,13 +9819,13 @@ void FileOptions::set_deprecated(bool value) { // optional bool cc_enable_arenas = 31 [default = false]; bool FileOptions::has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00008000u) != 0; + return (_has_bits_[0] & 0x00010000u) != 0; } void FileOptions::set_has_cc_enable_arenas() { - _has_bits_[0] |= 0x00008000u; + _has_bits_[0] |= 0x00010000u; } void FileOptions::clear_has_cc_enable_arenas() { - _has_bits_[0] &= ~0x00008000u; + _has_bits_[0] &= ~0x00010000u; } void FileOptions::clear_cc_enable_arenas() { cc_enable_arenas_ = false; diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index f64a339c..6dd82d12 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -2290,6 +2290,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p bool py_generic_services() const; void set_py_generic_services(bool value); + // optional bool php_generic_services = 19 [default = false]; + bool has_php_generic_services() const; + void clear_php_generic_services(); + static const int kPhpGenericServicesFieldNumber = 19; + bool php_generic_services() const; + void set_php_generic_services(bool value); + // optional bool deprecated = 23 [default = false]; bool has_deprecated() const; void clear_deprecated(); @@ -2334,6 +2341,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p void clear_has_java_generic_services(); void set_has_py_generic_services(); void clear_has_py_generic_services(); + void set_has_php_generic_services(); + void clear_has_php_generic_services(); void set_has_deprecated(); void clear_has_deprecated(); void set_has_cc_enable_arenas(); @@ -2369,6 +2378,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p bool cc_generic_services_; bool java_generic_services_; bool py_generic_services_; + bool php_generic_services_; bool deprecated_; bool cc_enable_arenas_; int optimize_for_; @@ -6644,13 +6654,13 @@ inline void FileOptions::set_java_string_check_utf8(bool value) { // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; inline bool FileOptions::has_optimize_for() const { - return (_has_bits_[0] & 0x00010000u) != 0; + return (_has_bits_[0] & 0x00020000u) != 0; } inline void FileOptions::set_has_optimize_for() { - _has_bits_[0] |= 0x00010000u; + _has_bits_[0] |= 0x00020000u; } inline void FileOptions::clear_has_optimize_for() { - _has_bits_[0] &= ~0x00010000u; + _has_bits_[0] &= ~0x00020000u; } inline void FileOptions::clear_optimize_for() { optimize_for_ = 1; @@ -6802,15 +6812,39 @@ inline void FileOptions::set_py_generic_services(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.py_generic_services) } +// optional bool php_generic_services = 19 [default = false]; +inline bool FileOptions::has_php_generic_services() const { + return (_has_bits_[0] & 0x00004000u) != 0; +} +inline void FileOptions::set_has_php_generic_services() { + _has_bits_[0] |= 0x00004000u; +} +inline void FileOptions::clear_has_php_generic_services() { + _has_bits_[0] &= ~0x00004000u; +} +inline void FileOptions::clear_php_generic_services() { + php_generic_services_ = false; + clear_has_php_generic_services(); +} +inline bool FileOptions::php_generic_services() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_generic_services) + return php_generic_services_; +} +inline void FileOptions::set_php_generic_services(bool value) { + set_has_php_generic_services(); + php_generic_services_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_generic_services) +} + // optional bool deprecated = 23 [default = false]; inline bool FileOptions::has_deprecated() const { - return (_has_bits_[0] & 0x00004000u) != 0; + return (_has_bits_[0] & 0x00008000u) != 0; } inline void FileOptions::set_has_deprecated() { - _has_bits_[0] |= 0x00004000u; + _has_bits_[0] |= 0x00008000u; } inline void FileOptions::clear_has_deprecated() { - _has_bits_[0] &= ~0x00004000u; + _has_bits_[0] &= ~0x00008000u; } inline void FileOptions::clear_deprecated() { deprecated_ = false; @@ -6828,13 +6862,13 @@ inline void FileOptions::set_deprecated(bool value) { // optional bool cc_enable_arenas = 31 [default = false]; inline bool FileOptions::has_cc_enable_arenas() const { - return (_has_bits_[0] & 0x00008000u) != 0; + return (_has_bits_[0] & 0x00010000u) != 0; } inline void FileOptions::set_has_cc_enable_arenas() { - _has_bits_[0] |= 0x00008000u; + _has_bits_[0] |= 0x00010000u; } inline void FileOptions::clear_has_cc_enable_arenas() { - _has_bits_[0] &= ~0x00008000u; + _has_bits_[0] &= ~0x00010000u; } inline void FileOptions::clear_cc_enable_arenas() { cc_enable_arenas_ = false; diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index c7fbaaf6..70b82a4d 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -351,6 +351,7 @@ message FileOptions { optional bool cc_generic_services = 16 [default=false]; optional bool java_generic_services = 17 [default=false]; optional bool py_generic_services = 18 [default=false]; + optional bool php_generic_services = 19 [default=false]; // Is this file deprecated? // Depending on the target platform, this can emit Deprecated annotations diff --git a/tests.sh b/tests.sh index b40f0c5d..c458584a 100755 --- a/tests.sh +++ b/tests.sh @@ -346,7 +346,7 @@ generate_php_test_proto() { # Generate test file rm -rf generated mkdir generated - ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_empty_php_namespace.proto + ../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_empty_php_namespace.proto proto/test_service.proto proto/test_service_namespace.proto pushd ../../src ./protoc --php_out=../php/tests/generated google/protobuf/empty.proto ./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto -- cgit v1.2.3