diff options
author | Lukacs T. Berki <lberki@google.com> | 2016-04-07 11:45:35 +0200 |
---|---|---|
committer | Lukacs T. Berki <lberki@google.com> | 2016-04-07 11:46:26 +0200 |
commit | 93cd7c3ab4d6ee5f0649a56e83171d98cd452059 (patch) | |
tree | 1c738957b0e9f61ced892ad7cd7e8fa6e10dcb33 /third_party/protobuf | |
parent | 31b9fa4f384115e400c0a49b35730b42d07b6ff6 (diff) |
Update protobuf sources to v3.0.0-beta-2 (aka. d5fb408d)
Let's at least keep versions consistent within one third-party library.
Change-Id: I707fc6cd90dcc21e354ea91439417ffe3c9827a4
Diffstat (limited to 'third_party/protobuf')
63 files changed, 643 insertions, 2818 deletions
diff --git a/third_party/protobuf/src/google/protobuf/arena.h b/third_party/protobuf/src/google/protobuf/arena.h index 5ad94fa990..6a35183eba 100644 --- a/third_party/protobuf/src/google/protobuf/arena.h +++ b/third_party/protobuf/src/google/protobuf/arena.h @@ -76,7 +76,7 @@ template<typename T> void arena_destruct_object(void* object) { template<typename T> void arena_delete_object(void* object) { delete reinterpret_cast<T*>(object); } -inline void arena_free(void* object, size_t /* size */) { +inline void arena_free(void* object, size_t size) { free(object); } diff --git a/third_party/protobuf/src/google/protobuf/arenastring.h b/third_party/protobuf/src/google/protobuf/arenastring.h index e2e2f25468..ef57033b83 100755 --- a/third_party/protobuf/src/google/protobuf/arenastring.h +++ b/third_party/protobuf/src/google/protobuf/arenastring.h @@ -64,7 +64,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { } // Basic accessors. - inline const ::std::string& Get(const ::std::string* /* default_value */) const { + inline const ::std::string& Get(const ::std::string* default_value) const { return *ptr_; } @@ -102,7 +102,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // state. Used to implement unsafe_arena_release_<field>() methods on // generated classes. inline ::std::string* UnsafeArenaRelease(const ::std::string* default_value, - ::google::protobuf::Arena* /* arena */) { + ::google::protobuf::Arena* arena) { if (ptr_ == default_value) { return NULL; } @@ -134,7 +134,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // UnsafeArenaRelease() on another field of a message in the same arena. Used // to implement unsafe_arena_set_allocated_<field> in generated classes. inline void UnsafeArenaSetAllocated(const ::std::string* default_value, - ::std::string* value, ::google::protobuf::Arena* /* arena */) { + ::std::string* value, ::google::protobuf::Arena* arena) { if (value != NULL) { ptr_ = value; } else { @@ -163,7 +163,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // the user) will always be the empty string. Assumes that |default_value| // is an empty string. inline void ClearToEmpty(const ::std::string* default_value, - ::google::protobuf::Arena* /* arena */) { + ::google::protobuf::Arena* arena) { if (ptr_ == default_value) { // Already set to default (which is empty) -- do nothing. } else { @@ -175,7 +175,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // overhead of heap operations. After this returns, the content (as seen by // the user) will always be equal to |default_value|. inline void ClearToDefault(const ::std::string* default_value, - ::google::protobuf::Arena* /* arena */) { + ::google::protobuf::Arena* arena) { if (ptr_ == default_value) { // Already set to default -- do nothing. } else { @@ -215,7 +215,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { void AssignWithDefault(const ::std::string* default_value, ArenaStringPtr value); - inline const ::std::string& GetNoArena(const ::std::string* /* default_value */) const { + inline const ::std::string& GetNoArena(const ::std::string* default_value) const { return *ptr_; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc index 3a816b0563..deb3d0f19a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc @@ -33,7 +33,6 @@ // Sanjay Ghemawat, Jeff Dean, and others. #include <google/protobuf/compiler/command_line_interface.h> -#include <google/protobuf/stubs/platform_macros.h> #include <stdio.h> #include <sys/types.h> @@ -49,10 +48,6 @@ #include <iostream> #include <ctype.h> -#ifdef GOOGLE_PROTOBUF_ARCH_SPARC -#include <limits.h> //For PATH_MAX -#endif - #include <memory> #ifndef _SHARED_PTR_H #include <google/protobuf/stubs/shared_ptr.h> diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index 47729e1cb5..c3e9fe7448 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -107,7 +107,7 @@ class MockGeneratorContext : public GeneratorContext { virtual io::ZeroCopyOutputStream* Open(const string& filename) { string** map_slot = &files_[filename]; - delete *map_slot; + if (*map_slot != NULL) delete *map_slot; *map_slot = new string; return new io::StringOutputStream(*map_slot); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc index 5ee6f0003b..1a11bce857 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc @@ -178,13 +178,12 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) { map<string, string> vars; vars["nested_name"] = descriptor_->name(); vars["classname"] = classname_; - vars["constexpr"] = options_.proto_h ? "constexpr " : ""; printer->Print(vars, "typedef $classname$ $nested_name$;\n"); for (int j = 0; j < descriptor_->value_count(); j++) { vars["tag"] = EnumValueName(descriptor_->value(j)); printer->Print(vars, - "static $constexpr$const $nested_name$ $tag$ = $classname$_$tag$;\n"); + "static const $nested_name$ $tag$ = $classname$_$tag$;\n"); } printer->Print(vars, @@ -238,7 +237,6 @@ void EnumGenerator::GenerateDescriptorInitializer( void EnumGenerator::GenerateMethods(io::Printer* printer) { map<string, string> vars; vars["classname"] = classname_; - vars["constexpr"] = options_.proto_h ? "constexpr " : ""; if (HasDescriptorMethods(descriptor_->file())) { printer->Print(vars, @@ -289,7 +287,7 @@ void EnumGenerator::GenerateMethods(io::Printer* printer) { for (int i = 0; i < descriptor_->value_count(); i++) { vars["value"] = EnumValueName(descriptor_->value(i)); printer->Print(vars, - "$constexpr$const $classname$ $parent$::$value$;\n"); + "const $classname$ $parent$::$value$;\n"); } printer->Print(vars, "const $classname$ $parent$::$nested_name$_MIN;\n" diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc index 8304ebbdae..af409c290e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -1772,17 +1772,6 @@ GenerateShutdownCode(io::Printer* printer) { void MessageGenerator:: GenerateClassMethods(io::Printer* printer) { - // mutable_unknown_fields wrapper function for LazyStringOutputStream - // callback. - if (!UseUnknownFieldSet(descriptor_->file())) { - printer->Print( - "static ::std::string* MutableUnknownFieldsFor$classname$(\n" - " $classname$* ptr) {\n" - " return ptr->mutable_unknown_fields();\n" - "}\n" - "\n", - "classname", classname_); - } if (IsAnyMessage(descriptor_)) { printer->Print( "void $classname$::PackFrom(const ::google::protobuf::Message& message) {\n" @@ -2825,9 +2814,7 @@ GenerateMergeFrom(io::Printer* printer) { "}\n"); } else { printer->Print( - "if (!from.unknown_fields().empty()) {\n" - " mutable_unknown_fields()->append(from.unknown_fields());\n" - "}\n"); + "mutable_unknown_fields()->append(from.unknown_fields());\n"); } } @@ -2902,16 +2889,11 @@ GenerateMergeFromCodedStream(io::Printer* printer) { "classname", classname_); if (!UseUnknownFieldSet(descriptor_->file())) { - // Use LazyStringOutputString to avoid initializing unknown fields string - // unless it is actually needed. For the same reason, disable eager refresh - // on the CodedOutputStream. printer->Print( - " ::google::protobuf::io::LazyStringOutputStream unknown_fields_string(\n" - " ::google::protobuf::internal::NewPermanentCallback(\n" - " &MutableUnknownFieldsFor$classname$, this));\n" + " ::google::protobuf::io::StringOutputStream unknown_fields_string(\n" + " mutable_unknown_fields());\n" " ::google::protobuf::io::CodedOutputStream unknown_fields_stream(\n" - " &unknown_fields_string, false);\n", - "classname", classname_); + " &unknown_fields_string);\n"); } printer->Print( diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/metadata_test.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/metadata_test.cc deleted file mode 100644 index 422eb73b13..0000000000 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/metadata_test.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include <memory> -#ifndef _SHARED_PTR_H -#include <google/protobuf/stubs/shared_ptr.h> -#endif - -#include <google/protobuf/compiler/cpp/cpp_helpers.h> -#include <google/protobuf/compiler/cpp/cpp_generator.h> -#include <google/protobuf/compiler/command_line_interface.h> -#include <google/protobuf/io/zero_copy_stream.h> -#include <google/protobuf/io/zero_copy_stream_impl_lite.h> -#include <google/protobuf/io/printer.h> -#include <google/protobuf/descriptor.pb.h> - -#include <google/protobuf/testing/googletest.h> -#include <gtest/gtest.h> -#include <google/protobuf/testing/file.h> - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { -namespace { - -} // namespace -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc index 15c68b3f50..b493495da7 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc @@ -62,6 +62,7 @@ void MapFieldGenerator::GenerateMembers(io::Printer* printer) { descriptor_->message_type()->FindFieldByName("value"); variables_["key_type_name"] = type_name(key_descriptor); variables_["value_type_name"] = type_name(value_descriptor); + variables_["true_for_wrappers"] = IsWrapperType(value_descriptor) ? "true" : ""; scoped_ptr<FieldGeneratorBase> key_generator(CreateFieldGenerator(key_descriptor, 1)); scoped_ptr<FieldGeneratorBase> value_generator(CreateFieldGenerator(value_descriptor, 2)); @@ -75,7 +76,7 @@ void MapFieldGenerator::GenerateMembers(io::Printer* printer) { printer->Print( variables_, ", $tag$);\n" - "private readonly pbc::MapField<$key_type_name$, $value_type_name$> $name$_ = new pbc::MapField<$key_type_name$, $value_type_name$>();\n"); + "private readonly pbc::MapField<$key_type_name$, $value_type_name$> $name$_ = new pbc::MapField<$key_type_name$, $value_type_name$>($true_for_wrappers$);\n"); WritePropertyDocComment(printer, descriptor_); AddDeprecatedFlag(printer); printer->Print( diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc index 60afd892b3..76d5b2479b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -83,7 +83,7 @@ void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { } else { printer->Print( variables_, - " $name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); + " $name$_ = pb::Preconditions.CheckNotNull(value, \"value\");\n"); } printer->Print( " }\n" @@ -186,7 +186,7 @@ void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) { } else { printer->Print( variables_, - " $oneof_name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); + " $oneof_name$_ = pb::Preconditions.CheckNotNull(value, \"value\");\n"); } printer->Print( variables_, diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index 22dae43ba2..3862f00119 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -182,7 +182,7 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { } } printer->Print("},\n" - " new pbr::GeneratedClrTypeInfo("); + " new pbr::GeneratedCodeInfo("); // Specify all the generated code information, recursively. if (file_->enum_type_count() > 0) { printer->Print("new[] {"); @@ -195,7 +195,7 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { printer->Print("null, "); } if (file_->message_type_count() > 0) { - printer->Print("new pbr::GeneratedClrTypeInfo[] {\n"); + printer->Print("new pbr::GeneratedCodeInfo[] {\n"); printer->Indent(); printer->Indent(); printer->Indent(); @@ -232,7 +232,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript return; } // Generated message type - printer->Print("new pbr::GeneratedClrTypeInfo(typeof($type_name$), $type_name$.Parser, ", "type_name", GetClassName(descriptor)); + printer->Print("new pbr::GeneratedCodeInfo(typeof($type_name$), $type_name$.Parser, ", "type_name", GetClassName(descriptor)); // Fields if (descriptor->field_count() > 0) { @@ -273,7 +273,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript // Nested types if (descriptor->nested_type_count() > 0) { // Need to specify array type explicitly here, as all elements may be null. - printer->Print("new pbr::GeneratedClrTypeInfo[] { "); + printer->Print("new pbr::GeneratedCodeInfo[] { "); for (int i = 0; i < descriptor->nested_type_count(); i++) { WriteGeneratedCodeInfo(descriptor->nested_type(i), printer, i == descriptor->nested_type_count() - 1); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc deleted file mode 100644 index e69de29bb2..0000000000 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc +++ /dev/null diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.h deleted file mode 100644 index e69de29bb2..0000000000 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.h +++ /dev/null diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc index 22a70c3267..5715a43294 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc @@ -664,34 +664,34 @@ GenerateParseFromMethods(io::Printer* printer) { "}\n" "public static $classname$ parseFrom(java.io.InputStream input)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);" + " return PARSER.parseFrom(input);\n" "}\n" "public static $classname$ parseFrom(\n" " java.io.InputStream input,\n" " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input, extensionRegistry);" + " return PARSER.parseFrom(input, extensionRegistry);\n" "}\n" "public static $classname$ parseDelimitedFrom(java.io.InputStream input)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);" + " return PARSER.parseDelimitedFrom(input);\n" "}\n" "public static $classname$ parseDelimitedFrom(\n" " java.io.InputStream input,\n" " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input, extensionRegistry);" + " return PARSER.parseDelimitedFrom(input, extensionRegistry);\n" "}\n" "public static $classname$ parseFrom(\n" " com.google.protobuf.CodedInputStream input)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);" + " return PARSER.parseFrom(input);\n" "}\n" "public static $classname$ parseFrom(\n" " com.google.protobuf.CodedInputStream input,\n" " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" " throws java.io.IOException {\n" - " return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input, extensionRegistry);" + " return PARSER.parseFrom(input, extensionRegistry);\n" "}\n" "\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); @@ -1217,8 +1217,9 @@ GenerateParsingConstructor(io::Printer* printer) { "} catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" " throw new RuntimeException(e.setUnfinishedMessage(this));\n" "} catch (java.io.IOException e) {\n" - " throw new RuntimeException(new com.google.protobuf.InvalidProtocolBufferException(e)\n" - " .setUnfinishedMessage(this));\n" + " throw new RuntimeException(\n" + " new com.google.protobuf.InvalidProtocolBufferException(\n" + " e.getMessage()).setUnfinishedMessage(this));\n" "} finally {\n"); printer->Indent(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc index 5d53503491..7269411976 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc @@ -538,7 +538,7 @@ GenerateBuilderParsingMethods(io::Printer* printer) { " parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);\n" " } catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" " parsedMessage = ($classname$) e.getUnfinishedMessage();\n" - " throw e.unwrapIOException();\n" + " throw e;\n" " } finally {\n" " if (parsedMessage != null) {\n" " mergeFrom(parsedMessage);\n" diff --git a/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc index 0de7e2c6f4..e6c3b36aab 100755 --- a/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc @@ -134,51 +134,12 @@ bool IsReserved(const string& ident) { // Returns a copy of |filename| with any trailing ".protodevel" or ".proto // suffix stripped. -// TODO(robinson): Unify with copy in compiler/cpp/internal/helpers.cc. string StripProto(const string& filename) { const char* suffix = HasSuffixString(filename, ".protodevel") ? ".protodevel" : ".proto"; return StripSuffixString(filename, suffix); } -// Given a filename like foo/bar/baz.proto, returns the correspoding JavaScript -// file foo/bar/baz.js. -string GetJSFilename(const string& filename) { - const char* suffix = HasSuffixString(filename, ".protodevel") - ? ".protodevel" : ".proto"; - return StripSuffixString(filename, suffix) + "_pb.js"; -} - -// Given a filename like foo/bar/baz.proto, returns the root directory -// path ../../ -string GetRootPath(const string& filename) { - size_t slashes = std::count(filename.begin(), filename.end(), '/'); - if (slashes == 0) { - return "./"; - } - string result = ""; - for (size_t i = 0; i < slashes; i++) { - result += "../"; - } - return result; -} - -// Returns the alias we assign to the module of the given .proto filename -// when importing. -string ModuleAlias(const string& filename) { - // This scheme could technically cause problems if a file includes any 2 of: - // foo/bar_baz.proto - // foo_bar_baz.proto - // foo_bar/baz.proto - // - // We'll worry about this problem if/when we actually see it. This name isn't - // exposed to users so we can change it later if we need to. - string basename = StripProto(filename); - StripString(&basename, "-", '$'); - StripString(&basename, "/", '_'); - return basename + "_pb"; -} - // Returns the fully normalized JavaScript path for the given // file descriptor's package. string GetPath(const GeneratorOptions& options, @@ -254,26 +215,6 @@ string GetPath(const GeneratorOptions& options, value_descriptor->type()) + "." + value_descriptor->name(); } -string MaybeCrossFileRef(const GeneratorOptions& options, - const FileDescriptor* from_file, - const Descriptor* to_message) { - if (options.import_style == GeneratorOptions::IMPORT_COMMONJS && - from_file != to_message->file()) { - // Cross-file ref in CommonJS needs to use the module alias instead of - // the global name. - return ModuleAlias(to_message->file()->name()) + "." + to_message->name(); - } else { - // Within a single file we use a full name. - return GetPath(options, to_message); - } -} - -string SubmessageTypeRef(const GeneratorOptions& options, - const FieldDescriptor* field) { - GOOGLE_CHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE); - return MaybeCrossFileRef(options, field->file(), field->message_type()); -} - // - Object field name: LOWER_UNDERSCORE -> LOWER_CAMEL, except for group fields // (UPPER_CAMEL -> LOWER_CAMEL), with "List" (or "Map") appended if appropriate, // and with reserved words triggering a "pb_" prefix. @@ -1011,13 +952,11 @@ string RelativeTypeName(const FieldDescriptor* field) { } string JSExtensionsObjectName(const GeneratorOptions& options, - const FileDescriptor* from_file, const Descriptor* desc) { if (desc->full_name() == "google.protobuf.bridge.MessageSet") { - // TODO(haberman): fix this for the IMPORT_COMMONJS case. return "jspb.Message.messageSetExtensions"; } else { - return MaybeCrossFileRef(options, from_file, desc) + ".extensions"; + return GetPath(options, desc) + ".extensions"; } } @@ -1174,24 +1113,19 @@ void Generator::GenerateHeader(const GeneratorOptions& options, "\n"); } -void Generator::FindProvidesForFile(const GeneratorOptions& options, - io::Printer* printer, - const FileDescriptor* file, - std::set<string>* provided) const { - for (int i = 0; i < file->message_type_count(); i++) { - FindProvidesForMessage(options, printer, file->message_type(i), provided); - } - for (int i = 0; i < file->enum_type_count(); i++) { - FindProvidesForEnum(options, printer, file->enum_type(i), provided); - } -} - void Generator::FindProvides(const GeneratorOptions& options, io::Printer* printer, const vector<const FileDescriptor*>& files, std::set<string>* provided) const { for (int i = 0; i < files.size(); i++) { - FindProvidesForFile(options, printer, files[i], provided); + for (int j = 0; j < files[i]->message_type_count(); j++) { + FindProvidesForMessage(options, printer, files[i]->message_type(j), + provided); + } + for (int j = 0; j < files[i]->enum_type_count(); j++) { + FindProvidesForEnum(options, printer, files[i]->enum_type(j), + provided); + } } printer->Print("\n"); @@ -1270,45 +1204,38 @@ void Generator::GenerateRequires(const GeneratorOptions& options, io::Printer* printer, const vector<const FileDescriptor*>& files, std::set<string>* provided) const { - if (options.import_style == GeneratorOptions::IMPORT_BROWSER) { - return; - } else if (options.import_style == GeneratorOptions::IMPORT_CLOSURE) { - // For Closure imports we need to import every message type individually. - std::set<string> required; - std::set<string> forwards; - bool have_extensions = false; - bool have_message = false; + std::set<string> required; + std::set<string> forwards; + bool have_extensions = false; + bool have_message = false; - for (int i = 0; i < files.size(); i++) { - for (int j = 0; j < files[i]->message_type_count(); j++) { - FindRequiresForMessage(options, - files[i]->message_type(j), - &required, &forwards, &have_message); - } - if (!have_extensions && HasExtensions(files[i])) { - have_extensions = true; - } + for (int i = 0; i < files.size(); i++) { + for (int j = 0; j < files[i]->message_type_count(); j++) { + FindRequiresForMessage(options, + files[i]->message_type(j), + &required, &forwards, &have_message); + } + if (!have_extensions && HasExtensions(files[i])) { + have_extensions = true; + } - for (int j = 0; j < files[i]->extension_count(); j++) { - const FieldDescriptor* extension = files[i]->extension(j); - if (IgnoreField(extension)) { - continue; - } - if (extension->containing_type()->full_name() != - "google.protobuf.bridge.MessageSet") { - required.insert(GetPath(options, extension->containing_type())); - } - FindRequiresForField(options, extension, &required, &forwards); - have_extensions = true; + for (int j = 0; j < files[i]->extension_count(); j++) { + const FieldDescriptor* extension = files[i]->extension(j); + if (IgnoreField(extension)) { + continue; } + if (extension->containing_type()->full_name() != + "google.protobuf.bridge.MessageSet") { + required.insert(GetPath(options, extension->containing_type())); + } + FindRequiresForField(options, extension, &required, &forwards); + have_extensions = true; } - - GenerateRequiresImpl(options, printer, &required, &forwards, provided, - /* require_jspb = */ have_message, - /* require_extension = */ have_extensions); - } else if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) { - // CommonJS imports are based on files } + + GenerateRequiresImpl(options, printer, &required, &forwards, provided, + /* require_jspb = */ have_message, + /* require_extension = */ have_extensions); } void Generator::GenerateRequires(const GeneratorOptions& options, @@ -1479,12 +1406,6 @@ void Generator::GenerateClass(const GeneratorOptions& options, if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { GenerateClassExtensionFieldInfo(options, printer, desc); } - - if (options.import_style != GeneratorOptions:: IMPORT_CLOSURE) { - for (int i = 0; i < desc->extension_count(); i++) { - GenerateExtension(options, printer, desc->extension(i)); - } - } } // Recurse on nested types. @@ -1702,7 +1623,7 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, "obj,\n" " $extObject$, $class$.prototype.getExtension,\n" " includeInstance);\n", - "extObject", JSExtensionsObjectName(options, desc->file(), desc), + "extObject", JSExtensionsObjectName(options, desc), "class", GetPath(options, desc)); } @@ -1731,13 +1652,13 @@ void Generator::GenerateClassFieldToObject(const GeneratorOptions& options, printer->Print("jspb.Message.toObjectList(msg.get$getter$(),\n" " $type$.toObject, includeInstance)", "getter", JSGetterName(field), - "type", SubmessageTypeRef(options, field)); + "type", GetPath(options, field->message_type())); } } else { printer->Print("(f = msg.get$getter$()) && " "$type$.toObject(includeInstance, f)", "getter", JSGetterName(field), - "type", SubmessageTypeRef(options, field)); + "type", GetPath(options, field->message_type())); } } else { // Simple field (singular or repeated). @@ -1802,7 +1723,7 @@ void Generator::GenerateClassFieldFromObject( " }));\n", "name", JSObjectFieldName(field), "index", JSFieldIndex(field), - "fieldclass", SubmessageTypeRef(options, field)); + "fieldclass", GetPath(options, field->message_type())); } } else { printer->Print( @@ -1810,7 +1731,7 @@ void Generator::GenerateClassFieldFromObject( " msg, $index$, $fieldclass$.fromObject(obj.$name$));\n", "name", JSObjectFieldName(field), "index", JSFieldIndex(field), - "fieldclass", SubmessageTypeRef(options, field)); + "fieldclass", GetPath(options, field->message_type())); } } else { // Simple (primitive) field. @@ -1894,7 +1815,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* always_singular = */ false), "rpt", (field->is_repeated() ? "Repeated" : ""), "index", JSFieldIndex(field), - "wrapperclass", SubmessageTypeRef(options, field), + "wrapperclass", GetPath(options, field->message_type()), "required", (field->label() == FieldDescriptor::LABEL_REQUIRED ? ", 1" : "")); printer->Print( @@ -2122,7 +2043,7 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, " $class$.prototype.getExtension,\n" " $class$.prototype.setExtension);\n" " break;\n", - "extobj", JSExtensionsObjectName(options, desc->file(), desc), + "extobj", JSExtensionsObjectName(options, desc), "class", GetPath(options, desc)); } else { printer->Print( @@ -2152,7 +2073,7 @@ void Generator::GenerateClassDeserializeBinaryField( " var value = new $fieldclass$;\n" " reader.read$msgOrGroup$($grpfield$value," "$fieldclass$.deserializeBinaryFromReader);\n", - "fieldclass", SubmessageTypeRef(options, field), + "fieldclass", GetPath(options, field->message_type()), "msgOrGroup", (field->type() == FieldDescriptor::TYPE_GROUP) ? "Group" : "Message", "grpfield", (field->type() == FieldDescriptor::TYPE_GROUP) ? @@ -2228,7 +2149,7 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, printer->Print( " jspb.Message.serializeBinaryExtensions(this, writer, $extobj$,\n" " $class$.prototype.getExtension);\n", - "extobj", JSExtensionsObjectName(options, desc->file(), desc), + "extobj", JSExtensionsObjectName(options, desc), "class", GetPath(options, desc)); } @@ -2301,7 +2222,7 @@ void Generator::GenerateClassSerializeBinaryField( printer->Print( ",\n" " $submsg$.serializeBinaryToWriter\n", - "submsg", SubmessageTypeRef(options, field)); + "submsg", GetPath(options, field->message_type())); } else { printer->Print("\n"); } @@ -2369,9 +2290,9 @@ void Generator::GenerateExtension(const GeneratorOptions& options, "index", SimpleItoa(field->number()), "name", JSObjectFieldName(field), "ctor", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ? - SubmessageTypeRef(options, field) : string("null")), + GetPath(options, field->message_type()) : string("null")), "toObject", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ? - (SubmessageTypeRef(options, field) + ".toObject") : + (GetPath(options, field->message_type()) + ".toObject") : string("null")), "repeated", (field->is_repeated() ? "1" : "0")); @@ -2387,11 +2308,11 @@ void Generator::GenerateExtension(const GeneratorOptions& options, "binaryWriterFn", JSBinaryWriterMethodName(field), "binaryMessageSerializeFn", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ? - (SubmessageTypeRef(options, field) + + (GetPath(options, field->message_type()) + ".serializeBinaryToWriter") : "null", "binaryMessageDeserializeFn", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) ? - (SubmessageTypeRef(options, field) + + (GetPath(options, field->message_type()) + ".deserializeBinaryFromReader") : "null", "isPacked", (field->is_packed() ? "true" : "false")); } else { @@ -2403,8 +2324,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options, "// toObject() will function correctly.\n" "$extendName$[$index$] = $class$.$name$;\n" "\n", - "extendName", JSExtensionsObjectName(options, field->file(), - field->containing_type()), + "extendName", JSExtensionsObjectName(options, field->containing_type()), "index", SimpleItoa(field->number()), "class", extension_scope, "name", JSObjectFieldName(field)); @@ -2444,19 +2364,6 @@ bool GeneratorOptions::ParseFromOptions( namespace_prefix = options[i].second; } else if (options[i].first == "library") { library = options[i].second; - } else if (options[i].first == "import_style") { - if (options[i].second == "closure") { - import_style = IMPORT_CLOSURE; - } else if (options[i].second == "commonjs") { - import_style = IMPORT_COMMONJS; - } else if (options[i].second == "browser") { - import_style = IMPORT_BROWSER; - } else if (options[i].second == "es6") { - import_style = IMPORT_ES6; - } else { - *error = "Unknown import style " + options[i].second + ", expected " + - "one of: closure, commonjs, browser, es6."; - } } else { // Assume any other option is an output directory, as long as it is a bare // `key` rather than a `key=value` option. @@ -2468,11 +2375,6 @@ bool GeneratorOptions::ParseFromOptions( } } - if (!library.empty() && import_style != IMPORT_CLOSURE) { - *error = "The library option should only be used for " - "import_style=closure"; - } - return true; } @@ -2516,63 +2418,6 @@ void Generator::GenerateFileAndDeps( } } -void Generator::GenerateFile(const GeneratorOptions& options, - io::Printer* printer, - const FileDescriptor* file) const { - GenerateHeader(options, printer); - - // Generate "require" statements. - if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) { - printer->Print("var jspb = require('google-protobuf');\n"); - printer->Print("var goog = jspb;\n"); - printer->Print("var global = Function('return this')();\n\n"); - - for (int i = 0; i < file->dependency_count(); i++) { - const std::string& name = file->dependency(i)->name(); - printer->Print( - "var $alias$ = require('$file$');\n", - "alias", ModuleAlias(name), - "file", GetRootPath(file->name()) + GetJSFilename(name)); - } - } - - // We aren't using Closure's import system, but we use goog.exportSymbol() - // to construct the expected tree of objects, eg. - // - // goog.exportSymbol('foo.bar.Baz', null, this); - // - // // Later generated code expects foo.bar = {} to exist: - // foo.bar.Baz = function() { /* ... */ } - std::set<std::string> provided; - - // Cover the case where this file declares extensions but no messages. - // This will ensure that the file-level object will be declared to hold - // the extensions. - for (int i = 0; i < file->extension_count(); i++) { - provided.insert(file->extension(i)->full_name()); - } - - FindProvidesForFile(options, printer, file, &provided); - for (std::set<string>::iterator it = provided.begin(); - it != provided.end(); ++it) { - printer->Print("goog.exportSymbol('$name$', null, global);\n", - "name", *it); - } - - GenerateClassesAndEnums(options, printer, file); - - // Extensions nested inside messages are emitted inside - // GenerateClassesAndEnums(). - for (int i = 0; i < file->extension_count(); i++) { - GenerateExtension(options, printer, file->extension(i)); - } - - if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) { - printer->Print("goog.object.extend(exports, $package$);\n", - "package", GetPath(options, file)); - } -} - bool Generator::GenerateAll(const vector<const FileDescriptor*>& files, const string& parameter, GeneratorContext* context, @@ -2585,14 +2430,10 @@ bool Generator::GenerateAll(const vector<const FileDescriptor*>& files, } - // There are three schemes for where output files go: - // - // - import_style = IMPORT_CLOSURE, library non-empty: all output in one file - // - import_style = IMPORT_CLOSURE, library empty: one output file per type - // - import_style != IMPORT_CLOSURE: one output file per .proto file - if (options.import_style == GeneratorOptions::IMPORT_CLOSURE && - options.library != "") { - // All output should go in a single file. + // We're either generating a single library file with definitions for message + // and enum types in *all* FileDescriptor inputs, or we're generating a single + // file for each type. + if (options.library != "") { string filename = options.output_dir + "/" + options.library + ".js"; google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(context->Open(filename)); GOOGLE_CHECK(output.get()); @@ -2628,7 +2469,7 @@ bool Generator::GenerateAll(const vector<const FileDescriptor*>& files, if (printer.failed()) { return false; } - } else if (options.import_style == GeneratorOptions::IMPORT_CLOSURE) { + } else { // Collect all types, and print each type to a separate file. Pull out // free-floating extensions while we make this pass. map< string, vector<const FieldDescriptor*> > extensions_by_namespace; @@ -2770,24 +2611,6 @@ bool Generator::GenerateAll(const vector<const FileDescriptor*>& files, } } } - } else { - // Generate one output file per input (.proto) file. - - for (int i = 0; i < files.size(); i++) { - const google::protobuf::FileDescriptor* file = files[i]; - - string filename = options.output_dir + "/" + GetJSFilename(file->name()); - google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output( - context->Open(filename)); - GOOGLE_CHECK(output.get()); - io::Printer printer(output.get(), '$'); - - GenerateFile(options, &printer, file); - - if (printer.failed()) { - return false; - } - } } return true; diff --git a/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.h b/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.h index db9178d343..db2dceb34f 100755 --- a/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.h +++ b/third_party/protobuf/src/google/protobuf/compiler/js/js_generator.h @@ -67,13 +67,6 @@ struct GeneratorOptions { bool error_on_name_conflict; // Enable binary-format support? bool binary; - // What style of imports should be used. - enum ImportStyle { - IMPORT_CLOSURE, // goog.require() - IMPORT_COMMONJS, // require() - IMPORT_BROWSER, // no import statements - IMPORT_ES6, // import { member } from '' - } import_style; GeneratorOptions() : add_require_for_enums(false), @@ -82,8 +75,7 @@ struct GeneratorOptions { namespace_prefix(""), library(""), error_on_name_conflict(false), - binary(false), - import_style(IMPORT_CLOSURE) {} + binary(false) {} bool ParseFromOptions( const vector< pair< string, string > >& options, @@ -119,10 +111,6 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator { io::Printer* printer, const vector<const FileDescriptor*>& file, std::set<string>* provided) const; - void FindProvidesForFile(const GeneratorOptions& options, - io::Printer* printer, - const FileDescriptor* file, - std::set<string>* provided) const; void FindProvidesForMessage(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc, @@ -180,10 +168,6 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator { std::set<string>* required, std::set<string>* forwards) const; - void GenerateFile(const GeneratorOptions& options, - io::Printer* printer, - const FileDescriptor* file) const; - // Generate definitions for all message classes and enums in all files, // processing the files in dependence order. void GenerateFilesInDepOrder(const GeneratorOptions& options, diff --git a/third_party/protobuf/src/google/protobuf/compiler/main.cc b/third_party/protobuf/src/google/protobuf/compiler/main.cc index 66ad13b749..97df536e05 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/main.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/main.cc @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) { // Objective C google::protobuf::compiler::objectivec::ObjectiveCGenerator objc_generator; - cli.RegisterGenerator("--objc_out", "--objc_opt", &objc_generator, + cli.RegisterGenerator("--objc_out", &objc_generator, "Generate Objective C header and source."); // JavaScript diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc index 3f81dcb8b5..d6f01c60ac 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc @@ -80,12 +80,10 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) { if (HasPreservingUnknownEnumSemantics(descriptor_->file())) { // Include the unknown value. printer->Print( - "/// Value used if any message's field encounters a value that is not defined\n" - "/// by this enum. The message will also have C functions to get/set the rawValue\n" - "/// of the field.\n" "$name$_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,\n", "name", name_); } + for (int i = 0; i < all_values_.size(); i++) { SourceLocation location; if (all_values_[i]->GetSourceLocation(&location)) { @@ -109,8 +107,6 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) { "\n" "GPBEnumDescriptor *$name$_EnumDescriptor(void);\n" "\n" - "/// Checks to see if the given value is defined by the enum or was not known at\n" - "/// the time this source was generated.\n" "BOOL $name$_IsValidValue(int32_t value);\n" "\n", "name", name_); @@ -122,6 +118,16 @@ void EnumGenerator::GenerateSource(io::Printer* printer) { "\n", "name", name_); + printer->Print( + "GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n" + " static GPBEnumDescriptor *descriptor = NULL;\n" + " if (!descriptor) {\n" + " static GPBMessageEnumValueDescription values[] = {\n", + "name", name_); + printer->Indent(); + printer->Indent(); + printer->Indent(); + // Note: For the TextFormat decode info, we can't use the enum value as // the key because protocol buffer enums have 'allow_alias', which lets // a value be used more than once. Instead, the index into the list of @@ -129,66 +135,41 @@ void EnumGenerator::GenerateSource(io::Printer* printer) { // will be zero. TextFormatDecodeData text_format_decode_data; int enum_value_description_key = -1; - string text_blob; for (int i = 0; i < all_values_.size(); i++) { ++enum_value_description_key; string short_name(EnumValueShortName(all_values_[i])); - text_blob += short_name + '\0'; + printer->Print("{ .name = \"$short_name$\", .number = $name$ },\n", + "short_name", short_name, + "name", EnumValueName(all_values_[i])); if (UnCamelCaseEnumShortName(short_name) != all_values_[i]->name()) { text_format_decode_data.AddString(enum_value_description_key, short_name, all_values_[i]->name()); } } - - printer->Print( - "GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n" - " static GPBEnumDescriptor *descriptor = NULL;\n" - " if (!descriptor) {\n", - "name", name_); - - static const int kBytesPerLine = 40; // allow for escaping - printer->Print( - " static const char *valueNames ="); - for (int i = 0; i < text_blob.size(); i += kBytesPerLine) { - printer->Print( - "\n \"$data$\"", - "data", EscapeTrigraphs(CEscape(text_blob.substr(i, kBytesPerLine)))); - } - printer->Print( - ";\n" - " static const int32_t values[] = {\n"); - for (int i = 0; i < all_values_.size(); i++) { - printer->Print(" $name$,\n", "name", EnumValueName(all_values_[i])); - } + printer->Outdent(); + printer->Outdent(); + printer->Outdent(); printer->Print(" };\n"); - if (text_format_decode_data.num_entries() == 0) { printer->Print( - " GPBEnumDescriptor *worker =\n" - " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" - " valueNames:valueNames\n" - " values:values\n" - " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n" - " enumVerifier:$name$_IsValidValue];\n", + " descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" + " values:values\n" + " valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)\n" + " enumVerifier:$name$_IsValidValue];\n", "name", name_); } else { printer->Print( " static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n" - " GPBEnumDescriptor *worker =\n" - " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" - " valueNames:valueNames\n" - " values:values\n" - " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n" - " enumVerifier:$name$_IsValidValue\n" - " extraTextFormatInfo:extraTextFormatInfo];\n", + " descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n" + " values:values\n" + " valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription)\n" + " enumVerifier:$name$_IsValidValue\n" + " extraTextFormatInfo:extraTextFormatInfo];\n", "name", name_, "extraTextFormatInfo", CEscape(text_format_decode_data.Data())); } printer->Print( - " if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {\n" - " [worker release];\n" - " }\n" " }\n" " return descriptor;\n" "}\n\n"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc index b63bc0de63..30a13ddb90 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc @@ -44,7 +44,6 @@ namespace compiler { namespace objectivec { namespace { - void SetEnumVariables(const FieldDescriptor* descriptor, map<string, string>* variables) { string type = EnumName(descriptor->enum_type()); @@ -59,22 +58,25 @@ void SetEnumVariables(const FieldDescriptor* descriptor, (*variables)["enum_verifier"] = type + "_IsValidValue"; (*variables)["enum_desc_func"] = type + "_EnumDescriptor"; - (*variables)["dataTypeSpecific_name"] = "enumDescFunc"; - (*variables)["dataTypeSpecific_value"] = (*variables)["enum_desc_func"]; - const Descriptor* msg_descriptor = descriptor->containing_type(); (*variables)["owning_message_class"] = ClassName(msg_descriptor); } } // namespace -EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : SingleFieldGenerator(descriptor, options) { +EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor) + : SingleFieldGenerator(descriptor) { SetEnumVariables(descriptor, &variables_); } EnumFieldGenerator::~EnumFieldGenerator() {} +void EnumFieldGenerator::GenerateFieldDescriptionTypeSpecific( + io::Printer* printer) const { + printer->Print( + variables_, + " .dataTypeSpecific.enumDescFunc = $enum_desc_func$,\n"); +} + void EnumFieldGenerator::GenerateCFunctionDeclarations( io::Printer* printer) const { if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) { @@ -83,12 +85,7 @@ void EnumFieldGenerator::GenerateCFunctionDeclarations( printer->Print( variables_, - "/// Fetches the raw value of a @c $owning_message_class$'s @c $name$ property, even\n" - "/// if the value was not defined by the enum at the time the code was generated.\n" "int32_t $owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message);\n" - "/// Sets the raw value of an @c $owning_message_class$'s @c $name$ property, allowing\n" - "/// it to be set to a value that was not defined by the enum at the time the code\n" - "/// was generated.\n" "void Set$owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message, int32_t value);\n" "\n"); } @@ -115,7 +112,6 @@ void EnumFieldGenerator::GenerateCFunctionImplementations( void EnumFieldGenerator::DetermineForwardDeclarations( set<string>* 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 // before the message, so it will be declared before it is needed. @@ -127,18 +123,19 @@ void EnumFieldGenerator::DetermineForwardDeclarations( } RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : RepeatedFieldGenerator(descriptor, options) { + const FieldDescriptor* descriptor) + : RepeatedFieldGenerator(descriptor) { SetEnumVariables(descriptor, &variables_); variables_["array_storage_type"] = "GPBEnumArray"; } RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() {} -void RepeatedEnumFieldGenerator::FinishInitialization(void) { - RepeatedFieldGenerator::FinishInitialization(); - variables_["array_comment"] = - "// |" + variables_["name"] + "| contains |" + variables_["storage_type"] + "|\n"; +void RepeatedEnumFieldGenerator::GenerateFieldDescriptionTypeSpecific( + io::Printer* printer) const { + printer->Print( + variables_, + " .dataTypeSpecific.enumDescFunc = $enum_desc_func$,\n"); } } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h index 946faa819a..b629eae81a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h @@ -41,16 +41,16 @@ namespace compiler { namespace objectivec { class EnumFieldGenerator : public SingleFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); public: + virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const; virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; virtual void GenerateCFunctionImplementations(io::Printer* printer) const; virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; protected: - EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); + explicit EnumFieldGenerator(const FieldDescriptor* descriptor); virtual ~EnumFieldGenerator(); private: @@ -58,15 +58,13 @@ class EnumFieldGenerator : public SingleFieldGenerator { }; class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); public: - virtual void FinishInitialization(); + virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const; protected: - RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor); virtual ~RepeatedEnumFieldGenerator(); private: diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc index 3f7ab9d392..4e348393a3 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -114,14 +114,14 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization( printer->Print(vars, "{\n" - " .defaultValue.$default_name$ = $default$,\n" " .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n" + " .dataType = $extension_type$,\n" " .extendedClass = GPBStringifySymbol($extended_type$),\n" - " .messageOrGroupClassName = $type$,\n" - " .enumDescriptorFunc = $enum_desc_func_name$,\n" " .fieldNumber = $number$,\n" - " .dataType = $extension_type$,\n" + " .defaultValue.$default_name$ = $default$,\n" + " .messageOrGroupClassName = $type$,\n" " .options = $options$,\n" + " .enumDescriptorFunc = $enum_desc_func_name$,\n" "},\n"); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc index 7bb9837dc4..cf5d8cfb23 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -28,8 +28,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include <iostream> - #include <google/protobuf/compiler/objectivec/objectivec_field.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h> #include <google/protobuf/compiler/objectivec/objectivec_enum_field.h> @@ -47,7 +45,6 @@ namespace compiler { namespace objectivec { namespace { - void SetCommonFieldVariables(const FieldDescriptor* descriptor, map<string, string>* variables) { string camel_case_name = FieldName(descriptor); @@ -77,6 +74,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, (*variables)["field_number_name"] = classname + "_FieldNumber_" + capitalized_name; (*variables)["field_number"] = SimpleItoa(descriptor->number()); + (*variables)["has_index"] = SimpleItoa(descriptor->index()); (*variables)["field_type"] = GetCapitalizedType(descriptor); std::vector<string> field_flags; if (descriptor->is_repeated()) field_flags.push_back("GPBFieldRepeated"); @@ -100,9 +98,18 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, (*variables)["dataTypeSpecific_name"] = "className"; (*variables)["dataTypeSpecific_value"] = "NULL"; - (*variables)["storage_offset_value"] = - "(uint32_t)offsetof(" + classname + "__storage_, " + camel_case_name + ")"; - (*variables)["storage_offset_comment"] = ""; + string field_options = descriptor->options().SerializeAsString(); + // Must convert to a standard byte order for packing length into + // a cstring. + uint32 length = ghtonl(field_options.length()); + if (length > 0) { + string bytes((const char*)&length, sizeof(length)); + bytes.append(field_options); + string options_str = "\"" + CEscape(bytes) + "\""; + (*variables)["fieldoptions"] = "\"" + CEscape(bytes) + "\""; + } else { + (*variables)["fieldoptions"] = ""; + } // Clear some common things so they can be set just when needed. (*variables)["storage_attribute"] = ""; @@ -110,40 +117,39 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, } // namespace -FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options) { +FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field) { FieldGenerator* result = NULL; if (field->is_repeated()) { switch (GetObjectiveCType(field)) { case OBJECTIVECTYPE_MESSAGE: { if (field->is_map()) { - result = new MapFieldGenerator(field, options); + result = new MapFieldGenerator(field); } else { - result = new RepeatedMessageFieldGenerator(field, options); + result = new RepeatedMessageFieldGenerator(field); } break; } case OBJECTIVECTYPE_ENUM: - result = new RepeatedEnumFieldGenerator(field, options); + result = new RepeatedEnumFieldGenerator(field); break; default: - result = new RepeatedPrimitiveFieldGenerator(field, options); + result = new RepeatedPrimitiveFieldGenerator(field); break; } } else { switch (GetObjectiveCType(field)) { case OBJECTIVECTYPE_MESSAGE: { - result = new MessageFieldGenerator(field, options); + result = new MessageFieldGenerator(field); break; } case OBJECTIVECTYPE_ENUM: - result = new EnumFieldGenerator(field, options); + result = new EnumFieldGenerator(field); break; default: if (IsReferenceType(field)) { - result = new PrimitiveObjFieldGenerator(field, options); + result = new PrimitiveObjFieldGenerator(field); } else { - result = new PrimitiveFieldGenerator(field, options); + result = new PrimitiveFieldGenerator(field); } break; } @@ -152,8 +158,8 @@ FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, return result; } -FieldGenerator::FieldGenerator(const FieldDescriptor* descriptor, - const Options& options) + +FieldGenerator::FieldGenerator(const FieldDescriptor* descriptor) : descriptor_(descriptor) { SetCommonFieldVariables(descriptor, &variables_); } @@ -182,54 +188,52 @@ void FieldGenerator::DetermineForwardDeclarations( } void FieldGenerator::GenerateFieldDescription( - io::Printer* printer, bool include_default) const { - // Printed in the same order as the structure decl. - if (include_default) { - printer->Print( - variables_, - "{\n" - " .defaultValue.$default_name$ = $default$,\n" - " .core.name = \"$name$\",\n" - " .core.dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n" - " .core.number = $field_number_name$,\n" - " .core.hasIndex = $has_index$,\n" - " .core.offset = $storage_offset_value$,$storage_offset_comment$\n" - " .core.flags = $fieldflags$,\n" - " .core.dataType = GPBDataType$field_type$,\n" - "},\n"); + io::Printer* printer) const { + printer->Print( + variables_, + "{\n" + " .name = \"$name$\",\n" + " .number = $field_number_name$,\n" + " .hasIndex = $has_index$,\n" + " .flags = $fieldflags$,\n" + " .dataType = GPBDataType$field_type$,\n" + " .offset = offsetof($classname$__storage_, $name$),\n" + " .defaultValue.$default_name$ = $default$,\n"); + + // TODO(thomasvl): It might be useful to add a CPP wrapper to support + // compiling away the EnumDescriptors. To do that, we'd need a #if here + // to control setting the descriptor vs. the validator, and above in + // SetCommonFieldVariables() we'd want to wrap how we add + // GPBFieldHasDefaultValue to the flags. + + // " .dataTypeSpecific.value* = [something]," + GenerateFieldDescriptionTypeSpecific(printer); + + const string& field_options(variables_.find("fieldoptions")->second); + if (field_options.empty()) { + printer->Print(" .fieldOptions = NULL,\n"); } else { + // Can't use PrintRaw() here to get the #if/#else/#endif lines completely + // outdented because the need for indent captured on the previous + // printing of a \n and there is no way to get the current indent level + // to call the right number of Outdent()/Indents() to maintain state. printer->Print( variables_, - "{\n" - " .name = \"$name$\",\n" - " .dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n" - " .number = $field_number_name$,\n" - " .hasIndex = $has_index$,\n" - " .offset = $storage_offset_value$,$storage_offset_comment$\n" - " .flags = $fieldflags$,\n" - " .dataType = GPBDataType$field_type$,\n" - "},\n"); + "#if GPBOBJC_INCLUDE_FIELD_OPTIONS\n" + " .fieldOptions = $fieldoptions$,\n" + "#else\n" + " .fieldOptions = NULL,\n" + "#endif // GPBOBJC_INCLUDE_FIELD_OPTIONS\n"); } -} - -void FieldGenerator::SetRuntimeHasBit(int has_index) { - variables_["has_index"] = SimpleItoa(has_index); -} - -void FieldGenerator::SetNoHasBit(void) { - variables_["has_index"] = "GPBNoHasBit"; -} -int FieldGenerator::ExtraRuntimeHasBitsNeeded(void) const { - return 0; + printer->Print("},\n"); } -void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) { - // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some - // error cases, so it seems to be ok to use as a back door for errors. - cerr << "Error: should have overriden SetExtraRuntimeHasBitsBase()." << endl; - cerr.flush(); - abort(); +void FieldGenerator::GenerateFieldDescriptionTypeSpecific( + io::Printer* printer) const { + printer->Print( + variables_, + " .dataTypeSpecific.$dataTypeSpecific_name$ = $dataTypeSpecific_value$,\n"); } void FieldGenerator::SetOneofIndexBase(int index_base) { @@ -248,9 +252,9 @@ void FieldGenerator::FinishInitialization(void) { } } -SingleFieldGenerator::SingleFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : FieldGenerator(descriptor, options) { +SingleFieldGenerator::SingleFieldGenerator( + const FieldDescriptor* descriptor) + : FieldGenerator(descriptor) { // Nothing } @@ -264,15 +268,15 @@ void SingleFieldGenerator::GenerateFieldStorageDeclaration( void SingleFieldGenerator::GeneratePropertyDeclaration( io::Printer* printer) const { printer->Print(variables_, "$comments$"); - printer->Print( - variables_, - "@property(nonatomic, readwrite) $property_type$ $name$;\n" - "\n"); if (WantsHasProperty()) { printer->Print( variables_, "@property(nonatomic, readwrite) BOOL has$capitalized_name$;\n"); } + printer->Print( + variables_, + "@property(nonatomic, readwrite) $property_type$ $name$;\n" + "\n"); } void SingleFieldGenerator::GeneratePropertyImplementation( @@ -296,17 +300,9 @@ bool SingleFieldGenerator::WantsHasProperty(void) const { return false; } -bool SingleFieldGenerator::RuntimeUsesHasBit(void) const { - if (descriptor_->containing_oneof() != NULL) { - // The oneof tracks what is set instead. - return false; - } - return true; -} - -ObjCObjFieldGenerator::ObjCObjFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : SingleFieldGenerator(descriptor, options) { +ObjCObjFieldGenerator::ObjCObjFieldGenerator( + const FieldDescriptor* descriptor) + : SingleFieldGenerator(descriptor) { variables_["property_storage_attribute"] = "strong"; if (IsRetainedName(variables_["name"])) { variables_["storage_attribute"] = " NS_RETURNS_NOT_RETAINED"; @@ -328,15 +324,14 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration( // conventions (init*, new*, etc.) printer->Print(variables_, "$comments$"); - printer->Print( - variables_, - "@property(nonatomic, readwrite, $property_storage_attribute$, null_resettable) $property_type$ *$name$$storage_attribute$;\n"); if (WantsHasProperty()) { printer->Print( variables_, - "/// Test to see if @c $name$ has been set.\n" "@property(nonatomic, readwrite) BOOL has$capitalized_name$;\n"); } + printer->Print( + variables_, + "@property(nonatomic, readwrite, $property_storage_attribute$, null_resettable) $property_type$ *$name$$storage_attribute$;\n"); if (IsInitName(variables_.find("name")->second)) { // If property name starts with init we need to annotate it to get past ARC. // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 @@ -347,19 +342,18 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration( } RepeatedFieldGenerator::RepeatedFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : ObjCObjFieldGenerator(descriptor, options) { - // Default to no comment and let the cases needing it fill it in. - variables_["array_comment"] = ""; + const FieldDescriptor* descriptor) + : ObjCObjFieldGenerator(descriptor) { + // Repeated fields don't use the has index. + variables_["has_index"] = "GPBNoHasBit"; } RepeatedFieldGenerator::~RepeatedFieldGenerator() {} void RepeatedFieldGenerator::FinishInitialization(void) { FieldGenerator::FinishInitialization(); - if (variables_.find("array_property_type") == variables_.end()) { - variables_["array_property_type"] = variable("array_storage_type"); - } + variables_["array_comment"] = + "// |" + variables_["name"] + "| contains |" + variables_["storage_type"] + "|\n"; } void RepeatedFieldGenerator::GenerateFieldStorageDeclaration( @@ -385,14 +379,13 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration( variables_, "$comments$" "$array_comment$" - "@property(nonatomic, readwrite, strong, null_resettable) $array_property_type$ *$name$$storage_attribute$;\n" - "/// The number of items in @c $name$ without causing the array to be created.\n" + "@property(nonatomic, readwrite, strong, null_resettable) $array_storage_type$ *$name$$storage_attribute$;\n" "@property(nonatomic, readonly) NSUInteger $name$_Count;\n"); if (IsInitName(variables_.find("name")->second)) { // If property name starts with init we need to annotate it to get past ARC. // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 printer->Print(variables_, - "- ($array_property_type$ *)$name$ GPB_METHOD_FAMILY_NONE;\n"); + "- ($array_storage_type$ *)$name$ GPB_METHOD_FAMILY_NONE;\n"); } printer->Print("\n"); } @@ -402,12 +395,7 @@ bool RepeatedFieldGenerator::WantsHasProperty(void) const { return false; } -bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const { - return false; // The array having anything is what is used. -} - -FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, - const Options& options) +FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) : descriptor_(descriptor), field_generators_( new scoped_ptr<FieldGenerator>[descriptor->field_count()]), @@ -415,12 +403,10 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, new scoped_ptr<FieldGenerator>[descriptor->extension_count()]) { // Construct all the FieldGenerators. for (int i = 0; i < descriptor->field_count(); i++) { - field_generators_[i].reset( - FieldGenerator::Make(descriptor->field(i), options)); + field_generators_[i].reset(FieldGenerator::Make(descriptor->field(i))); } for (int i = 0; i < descriptor->extension_count(); i++) { - extension_generators_[i].reset( - FieldGenerator::Make(descriptor->extension(i), options)); + extension_generators_[i].reset(FieldGenerator::Make(descriptor->extension(i))); } } @@ -436,40 +422,12 @@ const FieldGenerator& FieldGeneratorMap::get_extension(int index) const { return *extension_generators_[index]; } -int FieldGeneratorMap::CalculateHasBits(void) { - int total_bits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - if (field_generators_[i]->RuntimeUsesHasBit()) { - field_generators_[i]->SetRuntimeHasBit(total_bits); - ++total_bits; - } else { - field_generators_[i]->SetNoHasBit(); - } - int extra_bits = field_generators_[i]->ExtraRuntimeHasBitsNeeded(); - if (extra_bits) { - field_generators_[i]->SetExtraRuntimeHasBitsBase(total_bits); - total_bits += extra_bits; - } - } - return total_bits; -} - void FieldGeneratorMap::SetOneofIndexBase(int index_base) { for (int i = 0; i < descriptor_->field_count(); i++) { field_generators_[i]->SetOneofIndexBase(index_base); } } -bool FieldGeneratorMap::DoesAnyFieldHaveNonZeroDefault(void) const { - for (int i = 0; i < descriptor_->field_count(); i++) { - if (HasNonZeroDefaultValue(descriptor_->field(i))) { - return true; - } - } - - return false; -} - } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h index a3a4b1b6e2..130a52dd76 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -49,37 +49,24 @@ namespace objectivec { class FieldGenerator { public: - static FieldGenerator* Make(const FieldDescriptor* field, - const Options& options); + static FieldGenerator* Make(const FieldDescriptor* field); virtual ~FieldGenerator(); - // Exposed for subclasses to fill in. virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0; virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0; + virtual void GeneratePropertyImplementation(io::Printer* printer) const = 0; - // Called by GenerateFieldDescription, exposed for classes that need custom - // generation. + virtual void GenerateFieldDescription(io::Printer* printer) const; + virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const; + virtual void GenerateFieldNumberConstant(io::Printer* printer) const; - // Exposed for subclasses to extend, base does nothing. virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; virtual void GenerateCFunctionImplementations(io::Printer* printer) const; - // Exposed for subclasses, should always call it on the parent class also. virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; - // Used during generation, not intended to be extended by subclasses. - void GenerateFieldDescription( - io::Printer* printer, bool include_default) const; - void GenerateFieldNumberConstant(io::Printer* printer) const; - - // Exposed to get and set the has bits information. - virtual bool RuntimeUsesHasBit(void) const = 0; - void SetRuntimeHasBit(int has_index); - void SetNoHasBit(void); - virtual int ExtraRuntimeHasBitsNeeded(void) const; - virtual void SetExtraRuntimeHasBitsBase(int index_base); void SetOneofIndexBase(int index_base); string variable(const char* key) const { @@ -94,7 +81,7 @@ class FieldGenerator { string raw_field_name() const { return variable("raw_field_name"); } protected: - FieldGenerator(const FieldDescriptor* descriptor, const Options& options); + explicit FieldGenerator(const FieldDescriptor* descriptor); virtual void FinishInitialization(void); virtual bool WantsHasProperty(void) const = 0; @@ -115,11 +102,8 @@ class SingleFieldGenerator : public FieldGenerator { virtual void GeneratePropertyImplementation(io::Printer* printer) const; - virtual bool RuntimeUsesHasBit(void) const; - protected: - SingleFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit SingleFieldGenerator(const FieldDescriptor* descriptor); virtual bool WantsHasProperty(void) const; private: @@ -135,8 +119,7 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator { virtual void GeneratePropertyDeclaration(io::Printer* printer) const; protected: - ObjCObjFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit ObjCObjFieldGenerator(const FieldDescriptor* descriptor); private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjCObjFieldGenerator); @@ -151,11 +134,8 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator { virtual void GeneratePropertyImplementation(io::Printer* printer) const; - virtual bool RuntimeUsesHasBit(void) const; - protected: - RepeatedFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit RepeatedFieldGenerator(const FieldDescriptor* descriptor); virtual void FinishInitialization(void); virtual bool WantsHasProperty(void) const; @@ -166,20 +146,14 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator { // Convenience class which constructs FieldGenerators for a Descriptor. class FieldGeneratorMap { public: - FieldGeneratorMap(const Descriptor* descriptor, const Options& options); + explicit FieldGeneratorMap(const Descriptor* descriptor); ~FieldGeneratorMap(); const FieldGenerator& get(const FieldDescriptor* field) const; const FieldGenerator& get_extension(int index) const; - // Assigns the has bits and returns the number of bits needed. - int CalculateHasBits(void); - void SetOneofIndexBase(int index_base); - // Check if any field of this message has a non zero default. - bool DoesAnyFieldHaveNonZeroDefault(void) const; - private: const Descriptor* descriptor_; scoped_array<scoped_ptr<FieldGenerator> > field_generators_; diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc index c58e753006..228c66f0b4 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -45,23 +45,22 @@ namespace protobuf { // This is also found in GPBBootstrap.h, and needs to be kept in sync. It // is the version check done to ensure generated code works with the current // runtime being used. -const int32 GOOGLE_PROTOBUF_OBJC_GEN_VERSION = 30001; +const int32 GOOGLE_PROTOBUF_OBJC_GEN_VERSION = 30000; namespace compiler { namespace objectivec { -FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options) +FileGenerator::FileGenerator(const FileDescriptor *file) : file_(file), root_class_name_(FileClassName(file)), - is_public_dep_(false), - options_(options) { + is_public_dep_(false) { for (int i = 0; i < file_->enum_type_count(); i++) { EnumGenerator *generator = new EnumGenerator(file_->enum_type(i)); enum_generators_.push_back(generator); } for (int i = 0; i < file_->message_type_count(); i++) { MessageGenerator *generator = - new MessageGenerator(root_class_name_, file_->message_type(i), options_); + new MessageGenerator(root_class_name_, file_->message_type(i)); message_generators_.push_back(generator); } for (int i = 0; i < file_->extension_count(); i++) { @@ -151,15 +150,13 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { printer->Print( "#pragma mark - $root_class_name$\n" "\n" - "/// Exposes the extension registry for this file.\n" - "///\n" - "/// The base class provides:\n" - "/// @code\n" - "/// + (GPBExtensionRegistry *)extensionRegistry;\n" - "/// @endcode\n" - "/// which is a @c GPBExtensionRegistry that includes all the extensions defined by\n" - "/// this file and all files that it depends on.\n" "@interface $root_class_name$ : GPBRootObject\n" + "\n" + "// The base class provides:\n" + "// + (GPBExtensionRegistry *)extensionRegistry;\n" + "// which is an GPBExtensionRegistry that includes all the extensions defined by\n" + "// this file and all files that it depends on.\n" + "\n" "@end\n" "\n", "root_class_name", root_class_name_); @@ -355,8 +352,7 @@ const vector<FileGenerator *> &FileGenerator::DependencyGenerators() { public_import_names.insert(file_->public_dependency(i)->name()); } for (int i = 0; i < file_->dependency_count(); i++) { - FileGenerator *generator = - new FileGenerator(file_->dependency(i), options_); + FileGenerator *generator = new FileGenerator(file_->dependency(i)); const string& name = file_->dependency(i)->name(); bool public_import = (public_import_names.count(name) != 0); generator->SetIsPublicDependency(public_import); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h index 4c0fcd3f41..1bb4f0ea41 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h @@ -55,7 +55,7 @@ class MessageGenerator; class FileGenerator { public: - FileGenerator(const FileDescriptor* file, const Options& options); + explicit FileGenerator(const FileDescriptor* file); ~FileGenerator(); void GenerateSource(io::Printer* printer); @@ -84,8 +84,6 @@ class FileGenerator { vector<ExtensionGenerator*> extension_generators_; bool is_public_dep_; - const Options options_; - const vector<FileGenerator*>& DependencyGenerators(); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc index 72e295de49..375b4e0f54 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc @@ -49,31 +49,21 @@ bool ObjectiveCGenerator::Generate(const FileDescriptor* file, const string& parameter, OutputDirectory* output_directory, string* error) const { - // ----------------------------------------------------------------- - // Parse generator options. - - Options generation_options; - + // ObjC doesn't have any options at the moment, error if passed one. vector<pair<string, string> > options; ParseGeneratorParameter(parameter, &options); for (int i = 0; i < options.size(); i++) { - if (options[i].first == "expected_prefixes_path") { - generation_options.expected_prefixes_path = options[i].second; - } else { - *error = "error: Unknown generator option: " + options[i].first; - return false; - } + *error = "error:: Unknown generator option: " + options[i].first; + return false; } - // ----------------------------------------------------------------- - // Validate the objc prefix/package pairing. - if (!ValidateObjCClassPrefix(file, generation_options, error)) { + if (!ValidateObjCClassPrefix(file, error)) { // *error will have been filled in. return false; } - FileGenerator file_generator(file, generation_options); + FileGenerator file_generator(file); string filepath = FilePath(file); // Generate header. diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index fda5180712..990aca248c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -58,14 +58,6 @@ namespace protobuf { namespace compiler { namespace objectivec { -Options::Options() { - // Default is the value of the env for the package prefixes. - const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); - if (file_path) { - expected_prefixes_path = file_path; - } -} - namespace { hash_set<string> MakeWordsMap(const char* const words[], size_t num_words) { @@ -124,14 +116,9 @@ string UnderscoresToCamelCase(const string& input, bool first_capitalized) { } values.push_back(current); - string result; - bool first_segment_forces_upper = false; for (vector<string>::iterator i = values.begin(); i != values.end(); ++i) { string value = *i; bool all_upper = (kUpperSegments.count(value) > 0); - if (all_upper && (result.length() == 0)) { - first_segment_forces_upper = true; - } for (int j = 0; j < value.length(); j++) { if (j == 0 || all_upper) { value[j] = ascii_toupper(value[j]); @@ -139,11 +126,13 @@ string UnderscoresToCamelCase(const string& input, bool first_capitalized) { // Nothing, already in lower. } } - result += value; + *i = value; } - if ((result.length() != 0) && - !first_capitalized && - !first_segment_forces_upper) { + string result; + for (vector<string>::iterator i = values.begin(); i != values.end(); ++i) { + result += *i; + } + if ((result.length() != 0) && !first_capitalized) { result[0] = ascii_tolower(result[0]); } return result; @@ -220,6 +209,11 @@ string NameFromFieldDescriptor(const FieldDescriptor* field) { } } +// Escape C++ trigraphs by escaping question marks to \? +string EscapeTrigraphs(const string& to_escape) { + return StringReplace(to_escape, "?", "\\?", true); +} + void PathSplit(const string& path, string* directory, string* basename) { string::size_type last_slash = path.rfind('/'); if (last_slash == string::npos) { @@ -259,11 +253,6 @@ bool IsSpecialName(const string& name, const string* special_names, } // namespace -// Escape C++ trigraphs by escaping question marks to \? -string EscapeTrigraphs(const string& to_escape) { - return StringReplace(to_escape, "?", "\\?", true); -} - string StripProto(const string& filename) { if (HasSuffixString(filename, ".protodevel")) { return StripSuffixString(filename, ".protodevel"); @@ -734,7 +723,7 @@ string DefaultValue(const FieldDescriptor* field) { uint32 length = ghtonl(default_string.length()); string bytes((const char*)&length, sizeof(length)); bytes.append(default_string); - return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\""; + return "(NSData*)\"" + CEscape(bytes) + "\""; } else { return "@\"" + EscapeTrigraphs(CEscape(default_string)) + "\""; } @@ -751,50 +740,6 @@ string DefaultValue(const FieldDescriptor* field) { return NULL; } -bool HasNonZeroDefaultValue(const FieldDescriptor* field) { - // Repeated fields don't have defaults. - if (field->is_repeated()) { - return false; - } - - if (!field->has_default_value()) { - // No custom default set in the proto file. - return false; - } - - // Some proto file set the default to the zero value, so make sure the value - // isn't the zero case. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: - return field->default_value_int32() != 0; - case FieldDescriptor::CPPTYPE_UINT32: - return field->default_value_uint32() != 0U; - case FieldDescriptor::CPPTYPE_INT64: - return field->default_value_int64() != 0LL; - case FieldDescriptor::CPPTYPE_UINT64: - return field->default_value_uint64() != 0ULL; - case FieldDescriptor::CPPTYPE_DOUBLE: - return field->default_value_double() != 0.0; - case FieldDescriptor::CPPTYPE_FLOAT: - return field->default_value_float() != 0.0f; - case FieldDescriptor::CPPTYPE_BOOL: - return field->default_value_bool(); - case FieldDescriptor::CPPTYPE_STRING: { - const string& default_string = field->default_value_string(); - return default_string.length() != 0; - } - case FieldDescriptor::CPPTYPE_ENUM: - return field->default_value_enum()->number() != 0; - case FieldDescriptor::CPPTYPE_MESSAGE: - return false; - } - - // Some compilers report reaching end of function even though all cases of - // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; - return false; -} - string BuildFlagsString(const vector<string>& strings) { if (strings.size() == 0) { return "0"; @@ -818,14 +763,16 @@ string BuildCommentsString(const SourceLocation& location) { while (!lines.empty() && lines.back().empty()) { lines.pop_back(); } - string prefix("///"); + string prefix("//"); string suffix("\n"); string final_comments; for (int i = 0; i < lines.size(); i++) { - // HeaderDoc uses '\' and '@' for markers; escape them. - const string line = StringReplace(lines[i], "\\", "\\\\", true); + // We use $ for delimiters, so replace comments with dollars with + // html escaped version. + // None of the other compilers handle this (as of this writing) but we + // ran into it once, so just to be safe. final_comments += - prefix + StringReplace(line, "@", "\\@", true) + suffix; + prefix + StringReplace(lines[i], "$", "$", true) + suffix; } return final_comments; } @@ -936,33 +883,33 @@ bool Parser::ParseLoop() { StringPiece prefix(line, offset + 1, line.length() - offset - 1); TrimWhitespace(&package); TrimWhitespace(&prefix); - // Don't really worry about error checking the package/prefix for + // Don't really worry about error checking the the package/prefix for // being valid. Assume the file is validated when it is created/edited. (*prefix_map_)[package.ToString()] = prefix.ToString(); } return true; } -bool LoadExpectedPackagePrefixes(const Options &generation_options, - map<string, string>* prefix_map, +bool LoadExpectedPackagePrefixes(map<string, string>* prefix_map, + string* out_expect_file_path, string* out_error) { - if (generation_options.expected_prefixes_path.empty()) { + const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); + if (file_path == NULL) { return true; } int fd; do { - fd = open(generation_options.expected_prefixes_path.c_str(), O_RDONLY); + fd = open(file_path, O_RDONLY); } while (fd < 0 && errno == EINTR); if (fd < 0) { *out_error = - string("error: Unable to open \"") + - generation_options.expected_prefixes_path + - "\", " + strerror(errno); + string(file_path) + ":0:0: error: Unable to open." + strerror(errno); return false; } io::FileInputStream file_stream(fd); file_stream.SetCloseOnDelete(true); + *out_expect_file_path = file_path; Parser parser(prefix_map); const void* buf; @@ -973,9 +920,8 @@ bool LoadExpectedPackagePrefixes(const Options &generation_options, } if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len))) { - *out_error = - string("error: ") + generation_options.expected_prefixes_path + - " Line " + SimpleItoa(parser.last_line()) + ", " + parser.error_str(); + *out_error = string(file_path) + ":" + SimpleItoa(parser.last_line()) + + ":0: error: " + parser.error_str(); return false; } } @@ -984,9 +930,7 @@ bool LoadExpectedPackagePrefixes(const Options &generation_options, } // namespace -bool ValidateObjCClassPrefix(const FileDescriptor* file, - const Options& generation_options, - string* out_error) { +bool ValidateObjCClassPrefix(const FileDescriptor* file, string* out_error) { const string prefix = file->options().objc_class_prefix(); const string package = file->package(); @@ -995,10 +939,11 @@ bool ValidateObjCClassPrefix(const FileDescriptor* file, // Load any expected package prefixes to validate against those. map<string, string> expected_package_prefixes; - if (!LoadExpectedPackagePrefixes(generation_options, - &expected_package_prefixes, - out_error)) { - return false; + string expect_file_path; + if (!LoadExpectedPackagePrefixes(&expected_package_prefixes, + &expect_file_path, out_error)) { + // Any error, clear the entries that were read. + expected_package_prefixes.clear(); } // Check: Error - See if there was an expected prefix for the package and @@ -1012,9 +957,8 @@ bool ValidateObjCClassPrefix(const FileDescriptor* file, return true; } else { // ...it didn't match! - *out_error = "error: Expected 'option objc_class_prefix = \"" + - package_match->second + "\";' for package '" + package + - "' in '" + file->name() + "'"; + *out_error = "protoc:0: error: Expected 'option objc_class_prefix = \"" + + package_match->second + "\";' in '" + file->name() + "'"; if (prefix.length()) { *out_error += "; but found '" + prefix + "' instead"; } @@ -1036,11 +980,11 @@ bool ValidateObjCClassPrefix(const FileDescriptor* file, i != expected_package_prefixes.end(); ++i) { if (i->second == prefix) { *out_error = - "error: Found 'option objc_class_prefix = \"" + prefix + + "protoc:0: error: Found 'option objc_class_prefix = \"" + prefix + "\";' in '" + file->name() + "'; that prefix is already used for 'package " + i->first + ";'. It can only be reused by listing it in the expected file (" + - generation_options.expected_prefixes_path + ")."; + expect_file_path + ")."; return false; // Only report first usage of the prefix. } } @@ -1073,7 +1017,7 @@ bool ValidateObjCClassPrefix(const FileDescriptor* file, << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" << " consider adding it to the expected prefixes file (" - << generation_options.expected_prefixes_path << ")." << endl; + << expect_file_path << ")." << endl; cerr.flush(); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 0db9de94f2..072a2e57c5 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -42,15 +42,6 @@ namespace protobuf { namespace compiler { namespace objectivec { -// Generator options (see objectivec_generator.cc for a description of each): -struct Options { - Options(); - string expected_prefixes_path; -}; - -// Escape C++ trigraphs by escaping question marks to "\?". -string EscapeTrigraphs(const string& to_escape); - // Strips ".proto" or ".protodevel" from the end of a filename. string StripProto(const string& filename); @@ -73,7 +64,7 @@ string FilePath(const FileDescriptor* file); // Gets the name of the root class we'll generate in the file. This class // is not meant for external consumption, but instead contains helpers that -// the rest of the classes need +// the rest of the the classes need string FileClassName(const FileDescriptor* file); // These return the fully-qualified class name corresponding to the given @@ -146,22 +137,18 @@ bool IsReferenceType(const FieldDescriptor* field); string GPBGenericValueFieldName(const FieldDescriptor* field); string DefaultValue(const FieldDescriptor* field); -bool HasNonZeroDefaultValue(const FieldDescriptor* field); string BuildFlagsString(const vector<string>& strings); -// Builds a HeaderDoc style comment out of the comments in the .proto file. string BuildCommentsString(const SourceLocation& location); // Checks the prefix for a given file and outputs any warnings needed, if // there are flat out errors, then out_error is filled in and the result is // false. -bool ValidateObjCClassPrefix(const FileDescriptor* file, - const Options& generation_options, - string* out_error); +bool ValidateObjCClassPrefix(const FileDescriptor* file, string *out_error); // Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform -// the input into the expected output. +// the input into the the expected output. class LIBPROTOC_EXPORT TextFormatDecodeData { public: TextFormatDecodeData() {} diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc index ac5d8aea21..2987f3db88 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc @@ -84,14 +84,13 @@ const char* MapEntryTypeName(const FieldDescriptor* descriptor, bool isKey) { } // namespace -MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : RepeatedFieldGenerator(descriptor, options) { +MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor) + : RepeatedFieldGenerator(descriptor) { const FieldDescriptor* key_descriptor = descriptor->message_type()->FindFieldByName("key"); const FieldDescriptor* value_descriptor = descriptor->message_type()->FindFieldByName("value"); - value_field_generator_.reset(FieldGenerator::Make(value_descriptor, options)); + value_field_generator_.reset(FieldGenerator::Make(value_descriptor)); // Pull over some variables_ from the value. variables_["field_type"] = value_field_generator_->variable("field_type"); @@ -118,62 +117,46 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, variables_["fieldflags"] = BuildFlagsString(field_flags); ObjectiveCType value_objc_type = GetObjectiveCType(value_descriptor); - const bool value_is_object_type = + if ((GetObjectiveCType(key_descriptor) == OBJECTIVECTYPE_STRING) && ((value_objc_type == OBJECTIVECTYPE_STRING) || (value_objc_type == OBJECTIVECTYPE_DATA) || - (value_objc_type == OBJECTIVECTYPE_MESSAGE)); - if ((GetObjectiveCType(key_descriptor) == OBJECTIVECTYPE_STRING) && - value_is_object_type) { + (value_objc_type == OBJECTIVECTYPE_MESSAGE))) { variables_["array_storage_type"] = "NSMutableDictionary"; - variables_["array_property_type"] = - "NSMutableDictionary<NSString*, " + - value_field_generator_->variable("storage_type") + "*>"; } else { - string class_name("GPB"); - class_name += MapEntryTypeName(key_descriptor, true); - class_name += MapEntryTypeName(value_descriptor, false); - class_name += "Dictionary"; - variables_["array_storage_type"] = class_name; - if (value_is_object_type) { - variables_["array_property_type"] = - class_name + "<" + - value_field_generator_->variable("storage_type") + "*>"; - } + string base_name = MapEntryTypeName(key_descriptor, true); + base_name += MapEntryTypeName(value_descriptor, false); + base_name += "Dictionary"; + variables_["array_storage_type"] = "GPB" + base_name; } - - variables_["dataTypeSpecific_name"] = - value_field_generator_->variable("dataTypeSpecific_name"); - variables_["dataTypeSpecific_value"] = - value_field_generator_->variable("dataTypeSpecific_value"); } MapFieldGenerator::~MapFieldGenerator() {} void MapFieldGenerator::FinishInitialization(void) { RepeatedFieldGenerator::FinishInitialization(); - // Use the array_comment support in RepeatedFieldGenerator to output what the + // Use the array_comment suport in RepeatedFieldGenerator to output what the // values in the map are. const FieldDescriptor* value_descriptor = descriptor_->message_type()->FindFieldByName("value"); - if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_ENUM) { + ObjectiveCType value_objc_type = GetObjectiveCType(value_descriptor); + if ((value_objc_type == OBJECTIVECTYPE_MESSAGE) || + (value_objc_type == OBJECTIVECTYPE_DATA) || + (value_objc_type == OBJECTIVECTYPE_STRING) || + (value_objc_type == OBJECTIVECTYPE_ENUM)) { variables_["array_comment"] = "// |" + variables_["name"] + "| values are |" + value_field_generator_->variable("storage_type") + "|\n"; + } else { + variables_["array_comment"] = ""; } } -void MapFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { - RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); - const FieldDescriptor* value_descriptor = - descriptor_->message_type()->FindFieldByName("value"); - if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_MESSAGE) { - const string& value_storage_type = - value_field_generator_->variable("storage_type"); - fwd_decls->insert("@class " + value_storage_type); - } +void MapFieldGenerator::GenerateFieldDescriptionTypeSpecific( + io::Printer* printer) const { + // Relay it to the value generator to provide enum validator, message + // class, etc. + value_field_generator_->GenerateFieldDescriptionTypeSpecific(printer); } - } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h index bc68a6829f..173541f207 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h @@ -41,21 +41,18 @@ namespace compiler { namespace objectivec { class MapFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); public: virtual void FinishInitialization(void); + virtual void GenerateFieldDescriptionTypeSpecific(io::Printer* printer) const; protected: - MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); + explicit MapFieldGenerator(const FieldDescriptor* descriptor); virtual ~MapFieldGenerator(); - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; - private: scoped_ptr<FieldGenerator> value_field_generator_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); }; diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc index 3ebeeade27..32671d4201 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc @@ -66,12 +66,11 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) { // The first item in the object structure is our uint32[] for has bits. // We then want to order things to make the instances as small as // possible. So we follow the has bits with: - // 1. Anything always 4 bytes - float, *32, enums - // 2. Anything that is always a pointer (they will be 8 bytes on 64 bit + // 1. Bools (1 byte) + // 2. Anything always 4 bytes - float, *32, enums + // 3. Anything that is always a pointer (they will be 8 bytes on 64 bit // builds and 4 bytes on 32bit builds. - // 3. Anything always 8 bytes - double, *64 - // - // NOTE: Bools aren't listed, they were stored in the has bits. + // 4. Anything always 8 bytes - double, *64 // // Why? Using 64bit builds as an example, this means worse case, we have // enough bools that we overflow 1 byte from 4 byte alignment, so 3 bytes @@ -116,9 +115,9 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) { case FieldDescriptor::TYPE_ENUM: return 2; - // 0 bytes. Stored in the has bits. + // 1 byte. case FieldDescriptor::TYPE_BOOL: - return 99; // End of the list (doesn't really matter). + return 1; } // Some compilers report reaching end of function even though all cases of @@ -175,11 +174,10 @@ const FieldDescriptor** SortFieldsByStorageSize(const Descriptor* descriptor) { } // namespace MessageGenerator::MessageGenerator(const string& root_classname, - const Descriptor* descriptor, - const Options& options) + const Descriptor* descriptor) : root_classname_(root_classname), descriptor_(descriptor), - field_generators_(descriptor, options), + field_generators_(descriptor), class_name_(ClassName(descriptor_)) { for (int i = 0; i < descriptor_->extension_count(); i++) { extension_generators_.push_back( @@ -198,9 +196,7 @@ MessageGenerator::MessageGenerator(const string& root_classname, for (int i = 0; i < descriptor_->nested_type_count(); i++) { MessageGenerator* generator = - new MessageGenerator(root_classname_, - descriptor_->nested_type(i), - options); + new MessageGenerator(root_classname_, descriptor_->nested_type(i)); nested_message_generators_.push_back(generator); } } @@ -234,6 +230,11 @@ void MessageGenerator::DetermineForwardDeclarations(set<string>* fwd_decls) { if (!IsMapEntryMessage(descriptor_)) { for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* fieldDescriptor = descriptor_->field(i); + // If it is a the field is repeated, the type will be and *Array, and we + // don't need any forward decl. + if (fieldDescriptor->is_repeated()) { + continue; + } field_generators_.get(fieldDescriptor) .DetermineForwardDeclarations(fwd_decls); } @@ -405,28 +406,32 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { sort(sorted_extensions.begin(), sorted_extensions.end(), ExtensionRangeOrdering()); - // Assign has bits: - // 1. FieldGeneratorMap::CalculateHasBits() loops through the fields seeing - // who needs has bits and assigning them. - // 2. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative - // index that groups all the elements in the oneof. - size_t num_has_bits = field_generators_.CalculateHasBits(); + // TODO(thomasvl): Finish optimizing has bit. The current behavior is as + // follows: + // 1. objectivec_field.cc's SetCommonFieldVariables() defaults the has_index + // to the field's index in the list of fields. + // 2. RepeatedFieldGenerator::RepeatedFieldGenerator() sets has_index to + // GPBNoHasBit because repeated fields & map<> fields don't use the has + // bit. + // 3. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative + // index that groups all the elements on of the oneof. + // So in has_storage, we need enough bits for the single fields that aren't + // in any oneof, and then one int32 for each oneof (to store the field + // number). So we could save a little space by not using the field's index + // and instead make a second pass only assigning indexes for the fields + // that would need it. The only savings would come when messages have over + // a multiple of 32 fields with some number being repeated or in oneofs to + // drop the count below that 32 multiple; so it hasn't seemed worth doing + // at the moment. + size_t num_has_bits = descriptor_->field_count(); size_t sizeof_has_storage = (num_has_bits + 31) / 32; - if (sizeof_has_storage == 0) { - // In the case where no field needs has bits, don't let the _has_storage_ - // end up as zero length (zero length arrays are sort of a grey area - // since it has to be at the start of the struct). This also ensures a - // field with only oneofs keeps the required negative indices they need. - sizeof_has_storage = 1; - } // Tell all the fields the oneof base. for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin(); iter != oneof_generators_.end(); ++iter) { (*iter)->SetOneofIndexBase(sizeof_has_storage); } field_generators_.SetOneofIndexBase(sizeof_has_storage); - // sizeof_has_storage needs enough bits for the single fields that aren't in - // any oneof, and then one int32 for each oneof (to store the field number). + // Add an int32 for each oneof to store which is set. sizeof_has_storage += descriptor_->oneof_decl_count(); printer->Print( @@ -453,26 +458,47 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " static GPBDescriptor *descriptor = nil;\n" " if (!descriptor) {\n"); + bool has_oneofs = oneof_generators_.size(); + if (has_oneofs) { + printer->Print( + " static GPBMessageOneofDescription oneofs[] = {\n"); + printer->Indent(); + printer->Indent(); + printer->Indent(); + for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin(); + iter != oneof_generators_.end(); ++iter) { + (*iter)->GenerateDescription(printer); + } + printer->Outdent(); + printer->Outdent(); + printer->Outdent(); + printer->Print( + " };\n"); + } + TextFormatDecodeData text_format_decode_data; bool has_fields = descriptor_->field_count() > 0; - bool need_defaults = field_generators_.DoesAnyFieldHaveNonZeroDefault(); - string field_description_type; - if (need_defaults) { - field_description_type = "GPBMessageFieldDescriptionWithDefault"; - } else { - field_description_type = "GPBMessageFieldDescription"; - } if (has_fields) { + // TODO(thomasvl): The plugin's FieldGenerator::GenerateFieldDescription() + // wraps the fieldOptions's value of this structure in an CPP gate so + // they can be compiled away; but that still results in a const char* in + // the structure for a NULL pointer for every message field. If the + // fieldOptions are moved to a separate payload like the TextFormat extra + // data is, then it would shrink that static data shrinking the binaries + // a little more. + // TODO(thomasvl): proto3 syntax doens't need a defaultValue in the + // structure because primitive types are always zero. If we add a second + // structure and a different initializer, we can avoid the wasted static + // storage for every field in a proto3 message. printer->Print( - " static $field_description_type$ fields[] = {\n", - "field_description_type", field_description_type); + " static GPBMessageFieldDescription fields[] = {\n"); printer->Indent(); printer->Indent(); printer->Indent(); for (int i = 0; i < descriptor_->field_count(); ++i) { const FieldGenerator& field_generator = field_generators_.get(sorted_fields[i]); - field_generator.GenerateFieldDescription(printer, need_defaults); + field_generator.GenerateFieldDescription(printer); if (field_generator.needs_textformat_name_support()) { text_format_decode_data.AddString(sorted_fields[i]->number(), field_generator.generated_objc_name(), @@ -486,89 +512,111 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " };\n"); } - map<string, string> vars; - vars["classname"] = class_name_; - vars["rootclassname"] = root_classname_; - vars["fields"] = has_fields ? "fields" : "NULL"; - if (has_fields) { - vars["fields_count"] = - "(uint32_t)(sizeof(fields) / sizeof(" + field_description_type + "))"; - } else { - vars["fields_count"] = "0"; - } - - std::vector<string> init_flags; - if (need_defaults) { - init_flags.push_back("GPBDescriptorInitializationFlag_FieldsWithDefault"); - } - if (descriptor_->options().message_set_wire_format()) { - init_flags.push_back("GPBDescriptorInitializationFlag_WireFormat"); - } - vars["init_flags"] = BuildFlagsString(init_flags); - - printer->Print( - vars, - " GPBDescriptor *localDescriptor =\n" - " [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n" - " rootClass:[$rootclassname$ class]\n" - " file:$rootclassname$_FileDescriptor()\n" - " fields:$fields$\n" - " fieldCount:$fields_count$\n" - " storageSize:sizeof($classname$__storage_)\n" - " flags:$init_flags$];\n"); - if (oneof_generators_.size() != 0) { + bool has_enums = enum_generators_.size(); + if (has_enums) { printer->Print( - " static const char *oneofs[] = {\n"); - for (vector<OneofGenerator*>::iterator iter = oneof_generators_.begin(); - iter != oneof_generators_.end(); ++iter) { - printer->Print( - " \"$name$\",\n", - "name", (*iter)->DescriptorName()); - } - printer->Print( - " };\n" - " [localDescriptor setupOneofs:oneofs\n" - " count:(uint32_t)(sizeof(oneofs) / sizeof(char*))\n" - " firstHasIndex:$first_has_index$];\n", - "first_has_index", oneof_generators_[0]->HasIndexAsString()); - } - if (text_format_decode_data.num_entries() != 0) { - const string text_format_data_str(text_format_decode_data.Data()); - printer->Print( - "#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n" - " static const char *extraTextFormatInfo ="); - static const int kBytesPerLine = 40; // allow for escaping - for (int i = 0; i < text_format_data_str.size(); i += kBytesPerLine) { - printer->Print( - "\n \"$data$\"", - "data", EscapeTrigraphs( - CEscape(text_format_data_str.substr(i, kBytesPerLine)))); + " static GPBMessageEnumDescription enums[] = {\n"); + printer->Indent(); + printer->Indent(); + printer->Indent(); + for (vector<EnumGenerator*>::iterator iter = enum_generators_.begin(); + iter != enum_generators_.end(); ++iter) { + printer->Print("{ .enumDescriptorFunc = $name$_EnumDescriptor },\n", + "name", (*iter)->name()); } + printer->Outdent(); + printer->Outdent(); + printer->Outdent(); printer->Print( - ";\n" - " [localDescriptor setupExtraTextInfo:extraTextFormatInfo];\n" - "#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"); + " };\n"); } - if (sorted_extensions.size() != 0) { + + bool has_extensions = sorted_extensions.size(); + if (has_extensions) { printer->Print( - " static const GPBExtensionRange ranges[] = {\n"); + " static GPBExtensionRange ranges[] = {\n"); + printer->Indent(); + printer->Indent(); + printer->Indent(); for (int i = 0; i < sorted_extensions.size(); i++) { - printer->Print(" { .start = $start$, .end = $end$ },\n", + printer->Print("{ .start = $start$, .end = $end$ },\n", "start", SimpleItoa(sorted_extensions[i]->start), "end", SimpleItoa(sorted_extensions[i]->end)); } + printer->Outdent(); + printer->Outdent(); + printer->Outdent(); printer->Print( - " };\n" - " [localDescriptor setupExtensionRanges:ranges\n" - " count:(uint32_t)(sizeof(ranges) / sizeof(GPBExtensionRange))];\n"); + " };\n"); } - printer->Print( - " NSAssert(descriptor == nil, @\"Startup recursed!\");\n" - " descriptor = localDescriptor;\n" - " }\n" - " return descriptor;\n" - "}\n\n" - "@end\n\n"); + + map<string, string> vars; + vars["classname"] = class_name_; + vars["rootclassname"] = root_classname_; + vars["fields"] = has_fields ? "fields" : "NULL"; + vars["fields_count"] = + has_fields ? "sizeof(fields) / sizeof(GPBMessageFieldDescription)" : "0"; + vars["oneofs"] = has_oneofs ? "oneofs" : "NULL"; + vars["oneof_count"] = + has_oneofs ? "sizeof(oneofs) / sizeof(GPBMessageOneofDescription)" : "0"; + vars["enums"] = has_enums ? "enums" : "NULL"; + vars["enum_count"] = + has_enums ? "sizeof(enums) / sizeof(GPBMessageEnumDescription)" : "0"; + vars["ranges"] = has_extensions ? "ranges" : "NULL"; + vars["range_count"] = + has_extensions ? "sizeof(ranges) / sizeof(GPBExtensionRange)" : "0"; + vars["wireformat"] = + descriptor_->options().message_set_wire_format() ? "YES" : "NO"; + + if (text_format_decode_data.num_entries() == 0) { + printer->Print( + vars, + " GPBDescriptor *localDescriptor =\n" + " [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n" + " rootClass:[$rootclassname$ class]\n" + " file:$rootclassname$_FileDescriptor()\n" + " fields:$fields$\n" + " fieldCount:$fields_count$\n" + " oneofs:$oneofs$\n" + " oneofCount:$oneof_count$\n" + " enums:$enums$\n" + " enumCount:$enum_count$\n" + " ranges:$ranges$\n" + " rangeCount:$range_count$\n" + " storageSize:sizeof($classname$__storage_)\n" + " wireFormat:$wireformat$];\n"); + } else { + vars["extraTextFormatInfo"] = CEscape(text_format_decode_data.Data()); + printer->Print( + vars, + "#if GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n" + " const char *extraTextFormatInfo = NULL;\n" + "#else\n" + " static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n" + "#endif // GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n" + " GPBDescriptor *localDescriptor =\n" + " [GPBDescriptor allocDescriptorForClass:[$classname$ class]\n" + " rootClass:[$rootclassname$ class]\n" + " file:$rootclassname$_FileDescriptor()\n" + " fields:$fields$\n" + " fieldCount:$fields_count$\n" + " oneofs:$oneofs$\n" + " oneofCount:$oneof_count$\n" + " enums:$enums$\n" + " enumCount:$enum_count$\n" + " ranges:$ranges$\n" + " rangeCount:$range_count$\n" + " storageSize:sizeof($classname$__storage_)\n" + " wireFormat:$wireformat$\n" + " extraTextFormatInfo:extraTextFormatInfo];\n"); + } + printer->Print( + " NSAssert(descriptor == nil, @\"Startup recursed!\");\n" + " descriptor = localDescriptor;\n" + " }\n" + " return descriptor;\n" + "}\n\n" + "@end\n\n"); for (int i = 0; i < descriptor_->field_count(); i++) { field_generators_.get(descriptor_->field(i)) diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h index 8565e76ff6..06b536ff83 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h @@ -54,9 +54,7 @@ class EnumGenerator; class MessageGenerator { public: - MessageGenerator(const string& root_classname, - const Descriptor* descriptor, - const Options& options); + MessageGenerator(const string& root_classname, const Descriptor* descriptor); ~MessageGenerator(); void GenerateStaticVariablesInitialization(io::Printer* printer); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc index d6ccd6d1e7..f2ce4e5b54 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc @@ -58,9 +58,8 @@ void SetMessageVariables(const FieldDescriptor* descriptor, } // namespace -MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : ObjCObjFieldGenerator(descriptor, options) { +MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor) + : ObjCObjFieldGenerator(descriptor) { SetMessageVariables(descriptor, &variables_); } @@ -68,7 +67,6 @@ MessageFieldGenerator::~MessageFieldGenerator() {} void MessageFieldGenerator::DetermineForwardDeclarations( set<string>* fwd_decls) const { - ObjCObjFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); } @@ -84,24 +82,14 @@ bool MessageFieldGenerator::WantsHasProperty(void) const { } RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : RepeatedFieldGenerator(descriptor, options) { + const FieldDescriptor* descriptor) + : RepeatedFieldGenerator(descriptor) { SetMessageVariables(descriptor, &variables_); variables_["array_storage_type"] = "NSMutableArray"; - variables_["array_property_type"] = - "NSMutableArray<" + variables_["storage_type"] + "*>"; } RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} -void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( - set<string>* fwd_decls) const { - RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); - // Class name is already in "storage_type". - fwd_decls->insert("@class " + variable("storage_type")); -} - - } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h index d2dba15334..708ea5668f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h @@ -41,12 +41,10 @@ namespace compiler { namespace objectivec { class MessageFieldGenerator : public ObjCObjFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); protected: - MessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit MessageFieldGenerator(const FieldDescriptor* descriptor); virtual ~MessageFieldGenerator(); virtual bool WantsHasProperty(void) const; @@ -58,17 +56,12 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { }; class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); protected: - RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor); virtual ~RepeatedMessageFieldGenerator(); - public: - virtual void DetermineForwardDeclarations(set<string>* fwd_decls) const; - private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc index 44bafd7f3c..3cb874828e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc @@ -104,7 +104,6 @@ void OneofGenerator::GeneratePublicCasePropertyDeclaration( void OneofGenerator::GenerateClearFunctionDeclaration(io::Printer* printer) { printer->Print( variables_, - "/// Clears whatever value was set for the oneof '$name$'.\n" "void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message);\n"); } @@ -120,16 +119,17 @@ void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) { "void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n" " GPBDescriptor *descriptor = [message descriptor];\n" " GPBOneofDescriptor *oneof = descriptor->oneofs_[$raw_index$];\n" - " GPBMaybeClearOneof(message, oneof, $index$, 0);\n" + " GPBMaybeClearOneof(message, oneof, 0);\n" "}\n"); } -string OneofGenerator::DescriptorName(void) const { - return variables_.find("name")->second; -} - -string OneofGenerator::HasIndexAsString(void) const { - return variables_.find("index")->second; +void OneofGenerator::GenerateDescription(io::Printer* printer) { + printer->Print( + variables_, + "{\n" + " .name = \"$name$\",\n" + " .index = $index$,\n" + "},\n"); } } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h index 3d9df4dbf4..bcba82da57 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h @@ -61,9 +61,7 @@ class OneofGenerator { void GeneratePropertyImplementation(io::Printer* printer); void GenerateClearFunctionImplementation(io::Printer* printer); - - string DescriptorName(void) const; - string HasIndexAsString(void) const; + void GenerateDescription(io::Printer* printer); private: const OneofDescriptor* descriptor_; diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc index d49350f4b7..c185b66dbe 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc @@ -74,7 +74,7 @@ const char* PrimitiveTypeName(const FieldDescriptor* descriptor) { case OBJECTIVECTYPE_ENUM: return "int32_t"; case OBJECTIVECTYPE_MESSAGE: - return NULL; // Messages go through objectivec_message_field.cc|h. + return NULL; } // Some compilers report reaching end of function even though all cases of @@ -107,8 +107,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { case OBJECTIVECTYPE_ENUM: return "Enum"; case OBJECTIVECTYPE_MESSAGE: - // Want NSArray (but goes through objectivec_message_field.cc|h). - return ""; + return ""; // Want NSArray } // Some compilers report reaching end of function even though all cases of @@ -127,42 +126,16 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, } // namespace PrimitiveFieldGenerator::PrimitiveFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : SingleFieldGenerator(descriptor, options) { + const FieldDescriptor* descriptor) + : SingleFieldGenerator(descriptor) { SetPrimitiveVariables(descriptor, &variables_); } PrimitiveFieldGenerator::~PrimitiveFieldGenerator() {} -void PrimitiveFieldGenerator::GenerateFieldStorageDeclaration( - io::Printer* printer) const { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Nothing, BOOLs are stored in the has bits. - } else { - SingleFieldGenerator::GenerateFieldStorageDeclaration(printer); - } -} - -int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Reserve a bit for the storage of the boolean. - return 1; - } - return 0; -} - -void PrimitiveFieldGenerator::SetExtraRuntimeHasBitsBase(int has_base) { - if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { - // Set into the offset the has bit to use for the actual value. - variables_["storage_offset_value"] = SimpleItoa(has_base); - variables_["storage_offset_comment"] = - " // Stored in _has_storage_ to save space."; - } -} - PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : ObjCObjFieldGenerator(descriptor, options) { + const FieldDescriptor* descriptor) + : ObjCObjFieldGenerator(descriptor) { SetPrimitiveVariables(descriptor, &variables_); variables_["property_storage_attribute"] = "copy"; } @@ -170,8 +143,8 @@ PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator( PrimitiveObjFieldGenerator::~PrimitiveObjFieldGenerator() {} RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : RepeatedFieldGenerator(descriptor, options) { + const FieldDescriptor* descriptor) + : RepeatedFieldGenerator(descriptor) { SetPrimitiveVariables(descriptor, &variables_); string base_name = PrimitiveArrayTypeName(descriptor); @@ -179,13 +152,19 @@ RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( variables_["array_storage_type"] = "GPB" + base_name + "Array"; } else { variables_["array_storage_type"] = "NSMutableArray"; - variables_["array_property_type"] = - "NSMutableArray<" + variables_["storage_type"] + "*>"; } } RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() {} +void RepeatedPrimitiveFieldGenerator::FinishInitialization(void) { + RepeatedFieldGenerator::FinishInitialization(); + if (IsPrimitiveType(descriptor_)) { + // No comment needed for primitive types. + variables_["array_comment"] = ""; + } +} + } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h index 69bb1fddc1..9bb793434c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h @@ -41,30 +41,21 @@ namespace compiler { namespace objectivec { class PrimitiveFieldGenerator : public SingleFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); protected: - PrimitiveFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor); virtual ~PrimitiveFieldGenerator(); - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - - virtual int ExtraRuntimeHasBitsNeeded(void) const; - virtual void SetExtraRuntimeHasBitsBase(int index_base); - private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); }; class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); protected: - PrimitiveObjFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit PrimitiveObjFieldGenerator(const FieldDescriptor* descriptor); virtual ~PrimitiveObjFieldGenerator(); private: @@ -72,13 +63,12 @@ class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { }; class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator { - friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field, - const Options& options); + friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field); protected: - RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, - const Options& options); + explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor); virtual ~RepeatedPrimitiveFieldGenerator(); + virtual void FinishInitialization(void); private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); diff --git a/third_party/protobuf/src/google/protobuf/compiler/parser.cc b/third_party/protobuf/src/google/protobuf/compiler/parser.cc index 90ded4de21..ea792a9d8c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/parser.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/parser.cc @@ -544,9 +544,9 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { // Store the syntax into the file. if (file != NULL) file->set_syntax(syntax_identifier_); } else if (!stop_after_syntax_identifier_) { - GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " - << file->name() << ". Please use 'syntax = \"proto2\";' " - << "or 'syntax = \"proto3\";' to specify a syntax " + GOOGLE_LOG(WARNING) << "No syntax specified for the proto file. " + << "Please use 'syntax = \"proto2\";' or " + << "'syntax = \"proto3\";' to specify a syntax " << "version. (Defaulted to proto2 syntax.)"; syntax_identifier_ = "proto2"; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc index 92c76fb036..9692f1bff5 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -75,10 +75,6 @@ std::string StripDotProto(const std::string& proto_file) { return proto_file.substr(0, lastindex); } -std::string GetOutputFilename(const std::string& proto_file) { - return StripDotProto(proto_file) + ".rb"; -} - std::string LabelForField(const google::protobuf::FieldDescriptor* field) { switch (field->label()) { case FieldDescriptor::LABEL_OPTIONAL: return "optional"; @@ -335,69 +331,8 @@ void EndPackageModules( } } -bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file, - string* error) { - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - field->message_type()->file() == file) || - (field->type() == FieldDescriptor::TYPE_ENUM && - field->enum_type()->file() == file)) { - *error = "proto3 message field " + field->full_name() + " in file " + - file->name() + " has a dependency on a type from proto2 file " + - file->name() + - ". Ruby doesn't support proto2 yet, so we must fail."; - return true; - } - } - - for (int i = 0; i < message->nested_type_count(); i++) { - if (UsesTypeFromFile(message->nested_type(i), file, error)) { - return true; - } - } - - return false; -} - -// Ruby doesn't currently support proto2. This causes a failure even for proto3 -// files that import proto2. But in some cases, the proto2 file is only being -// imported to extend another proto2 message. The prime example is declaring -// custom options by extending FileOptions/FieldOptions/etc. -// -// If the proto3 messages don't have any proto2 submessages, it is safe to omit -// the dependency completely. Users won't be able to use any proto2 extensions, -// but they already couldn't because proto2 messages aren't supported. -// -// If/when we add proto2 support, we should remove this. -bool MaybeEmitDependency(const FileDescriptor* import, - const FileDescriptor* from, - io::Printer* printer, - string* error) { - if (import->syntax() == FileDescriptor::SYNTAX_PROTO2) { - for (int i = 0; i < from->message_type_count(); i++) { - if (UsesTypeFromFile(from->message_type(i), import, error)) { - // Error text was already set by UsesTypeFromFile(). - return false; - } - } - - // Ok to omit this proto2 dependency -- so we won't print anything. - GOOGLE_LOG(WARNING) << "Omitting proto2 dependency '" << import->name() - << "' from proto3 output file '" - << GetOutputFilename(from->name()) - << "' because we don't support proto2 and no proto2 " - "types from that file are being used."; - return true; - } else { - printer->Print( - "require '$name$'\n", "name", StripDotProto(import->name())); - return true; - } -} - -bool GenerateFile(const FileDescriptor* file, io::Printer* printer, - string* error) { +void GenerateFile(const google::protobuf::FileDescriptor* file, + google::protobuf::io::Printer* printer) { printer->Print( "# Generated by the protocol buffer compiler. DO NOT EDIT!\n" "# source: $filename$\n" @@ -408,9 +343,9 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, "require 'google/protobuf'\n\n"); for (int i = 0; i < file->dependency_count(); i++) { - if (!MaybeEmitDependency(file->dependency(i), file, printer, error)) { - return false; - } + const std::string& name = file->dependency(i)->name(); + printer->Print( + "require '$name$'\n", "name", StripDotProto(name)); } printer->Print( @@ -434,7 +369,6 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, GenerateEnumAssignment("", file->enum_type(i), printer); } EndPackageModules(levels, printer); - return true; } bool Generator::Generate( @@ -450,11 +384,15 @@ bool Generator::Generate( return false; } + std::string filename = + StripDotProto(file->name()) + ".rb"; scoped_ptr<io::ZeroCopyOutputStream> output( - generator_context->Open(GetOutputFilename(file->name()))); + generator_context->Open(filename)); io::Printer printer(output.get(), '$'); - return GenerateFile(file, &printer, error); + GenerateFile(file, &printer); + + return true; } } // namespace ruby diff --git a/third_party/protobuf/src/google/protobuf/descriptor.h b/third_party/protobuf/src/google/protobuf/descriptor.h index 7e3a749662..e7e8c6af42 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.h +++ b/third_party/protobuf/src/google/protobuf/descriptor.h @@ -1645,7 +1645,7 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, reserved_range, const Descriptor::ReservedRange*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions); PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) @@ -1690,7 +1690,7 @@ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value, const EnumValueDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions); PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) @@ -1705,14 +1705,14 @@ PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions); PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions); PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, server_streaming, bool) @@ -1726,7 +1726,7 @@ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions) +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions); PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*) diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc index ff0cfcf8ce..eda6280f3f 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc @@ -93,12 +93,6 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* SourceCodeInfo_Location_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* SourceCodeInfo_Location_reflection_ = NULL; -const ::google::protobuf::Descriptor* GeneratedCodeInfo_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - GeneratedCodeInfo_reflection_ = NULL; -const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - GeneratedCodeInfo_Annotation_reflection_ = NULL; } // namespace @@ -527,39 +521,6 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { sizeof(SourceCodeInfo_Location), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _internal_metadata_), -1); - GeneratedCodeInfo_descriptor_ = file->message_type(18); - static const int GeneratedCodeInfo_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, annotation_), - }; - GeneratedCodeInfo_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - GeneratedCodeInfo_descriptor_, - GeneratedCodeInfo::default_instance_, - GeneratedCodeInfo_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _has_bits_[0]), - -1, - -1, - sizeof(GeneratedCodeInfo), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _internal_metadata_), - -1); - GeneratedCodeInfo_Annotation_descriptor_ = GeneratedCodeInfo_descriptor_->nested_type(0); - static const int GeneratedCodeInfo_Annotation_offsets_[4] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, path_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, source_file_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, begin_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_), - }; - GeneratedCodeInfo_Annotation_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - GeneratedCodeInfo_Annotation_descriptor_, - GeneratedCodeInfo_Annotation::default_instance_, - GeneratedCodeInfo_Annotation_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _has_bits_[0]), - -1, - -1, - sizeof(GeneratedCodeInfo_Annotation), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _internal_metadata_), - -1); } namespace { @@ -616,10 +577,6 @@ void protobuf_RegisterTypes(const ::std::string&) { SourceCodeInfo_descriptor_, &SourceCodeInfo::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( SourceCodeInfo_Location_descriptor_, &SourceCodeInfo_Location::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - GeneratedCodeInfo_descriptor_, &GeneratedCodeInfo::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - GeneratedCodeInfo_Annotation_descriptor_, &GeneratedCodeInfo_Annotation::default_instance()); } } // namespace @@ -669,10 +626,6 @@ void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto() { delete SourceCodeInfo_reflection_; delete SourceCodeInfo_Location::default_instance_; delete SourceCodeInfo_Location_reflection_; - delete GeneratedCodeInfo::default_instance_; - delete GeneratedCodeInfo_reflection_; - delete GeneratedCodeInfo_Annotation::default_instance_; - delete GeneratedCodeInfo_Annotation_reflection_; } void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { @@ -746,7 +699,7 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.pr" "otobuf.MethodOptions\022\037\n\020client_streaming" "\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(\010:" - "\005false\"\256\005\n\013FileOptions\022\024\n\014java_package\030\001" + "\005false\"\252\005\n\013FileOptions\022\024\n\014java_package\030\001" " \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023ja" "va_multiple_files\030\n \001(\010:\005false\022,\n\035java_g" "enerate_equals_and_hash\030\024 \001(\010:\005false\022%\n\026" @@ -758,60 +711,56 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "e\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022\031\n" "\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_ar" "enas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030$" - " \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022+\n\037javana" - "no_use_deprecated_package\030& \001(\010B\002\030\001\022C\n\024u" - "ninterpreted_option\030\347\007 \003(\0132$.google.prot" - "obuf.UninterpretedOption\":\n\014OptimizeMode" - "\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTI" - "ME\020\003*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027me" - "ssage_set_wire_format\030\001 \001(\010:\005false\022.\n\037no" - "_standard_descriptor_accessor\030\002 \001(\010:\005fal" - "se\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_ent" - "ry\030\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132" - "$.google.protobuf.UninterpretedOption*\t\010" - "\350\007\020\200\200\200\200\002\"\230\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\016" - "2#.google.protobuf.FieldOptions.CType:\006S" - "TRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$." - "google.protobuf.FieldOptions.JSType:\tJS_" - "NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndeprecate" - "d\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024u" - "ninterpreted_option\030\347\007 \003(\0132$.google.prot" - "obuf.UninterpretedOption\"/\n\005CType\022\n\n\006STR" - "ING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JST" - "ype\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\002\"\215\001\n\013EnumOptions\022\023\n\013a" - "llow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005fa" - "lse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo" - "gle.protobuf.UninterpretedOption*\t\010\350\007\020\200\200" - "\200\200\002\"}\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\ndeprecat" + " \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\'\n\037javana" + "no_use_deprecated_package\030& \001(\010\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005" + "SPEED\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\002\"\346\001\n\016MessageOptions\022&\n\027messag" + "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" + "ndard_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$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002\"\230\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.g" + "oogle.protobuf.FieldOptions.CType:\006STRIN" + "G\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.goog" + "le.protobuf.FieldOptions.JSType:\tJS_NORM" + "AL\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\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.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_NUMB" + "ER\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013allow" + "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" + "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google." + "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"" + "}\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.UninterpretedOption" + "*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndeprecat" "ed\030! \001(\010:\005false\022C\n\024uninterpreted_option\030" "\347\007 \003(\0132$.google.protobuf.UninterpretedOp" - "tion*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndepr" - "ecated\030! \001(\010:\005false\022C\n\024uninterpreted_opt" - "ion\030\347\007 \003(\0132$.google.protobuf.Uninterpret" - "edOption*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOpt" - "ion\022;\n\004name\030\002 \003(\0132-.google.protobuf.Unin" - "terpretedOption.NamePart\022\030\n\020identifier_v" - "alue\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_val" - "ue\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggreg" - "ate_value\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\016SourceC" - "odeInfo\022:\n\010location\030\001 \003(\0132(.google.proto" - "buf.SourceCodeInfo.Location\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\020" - "leading_comments\030\003 \001(\t\022\031\n\021trailing_comme" - "nts\030\004 \001(\t\022!\n\031leading_detached_comments\030\006" - " \003(\t\"\247\001\n\021GeneratedCodeInfo\022A\n\nannotation" - "\030\001 \003(\0132-.google.protobuf.GeneratedCodeIn" - "fo.Annotation\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\003end\030\004 \001(\005BX\n\023com.google.protobufB\020D" - "escriptorProtosH\001Z\ndescriptor\242\002\003GPB\252\002\032Go" - "ogle.Protobuf.Reflection", 5184); + "tion*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022" + ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp" + "retedOption.NamePart\022\030\n\020identifier_value" + "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne" + "gative_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\010NamePart\022\021\n\tname_part\030\001 \002" + "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI" + "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf." + "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004" + "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead" + "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030" + "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t" + "BX\n\023com.google.protobufB\020DescriptorProto" + "sH\001Z\ndescriptor\242\002\003GPB\252\002\032Google.Protobuf." + "Reflection", 5010); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); FileDescriptorSet::default_instance_ = new FileDescriptorSet(); @@ -836,8 +785,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { UninterpretedOption_NamePart::default_instance_ = new UninterpretedOption_NamePart(); SourceCodeInfo::default_instance_ = new SourceCodeInfo(); SourceCodeInfo_Location::default_instance_ = new SourceCodeInfo_Location(); - GeneratedCodeInfo::default_instance_ = new GeneratedCodeInfo(); - GeneratedCodeInfo_Annotation::default_instance_ = new GeneratedCodeInfo_Annotation(); FileDescriptorSet::default_instance_->InitAsDefaultInstance(); FileDescriptorProto::default_instance_->InitAsDefaultInstance(); DescriptorProto::default_instance_->InitAsDefaultInstance(); @@ -860,8 +807,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { UninterpretedOption_NamePart::default_instance_->InitAsDefaultInstance(); SourceCodeInfo::default_instance_->InitAsDefaultInstance(); SourceCodeInfo_Location::default_instance_->InitAsDefaultInstance(); - GeneratedCodeInfo::default_instance_->InitAsDefaultInstance(); - GeneratedCodeInfo_Annotation::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto); } @@ -8129,7 +8074,7 @@ bool FileOptions::MergePartialFromCodedStream( break; } - // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + // optional bool javanano_use_deprecated_package = 38; case 38: { if (tag == 304) { parse_javanano_use_deprecated_package: @@ -8287,7 +8232,7 @@ void FileOptions::SerializeWithCachedSizes( 37, this->csharp_namespace(), output); } - // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + // optional bool javanano_use_deprecated_package = 38; if (has_javanano_use_deprecated_package()) { ::google::protobuf::internal::WireFormatLite::WriteBool(38, this->javanano_use_deprecated_package(), output); } @@ -8413,7 +8358,7 @@ void FileOptions::SerializeWithCachedSizes( 37, this->csharp_namespace(), target); } - // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + // optional bool javanano_use_deprecated_package = 38; if (has_javanano_use_deprecated_package()) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(38, this->javanano_use_deprecated_package(), target); } @@ -8524,7 +8469,7 @@ int FileOptions::ByteSize() const { this->csharp_namespace()); } - // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + // optional bool javanano_use_deprecated_package = 38; if (has_javanano_use_deprecated_package()) { total_size += 2 + 1; } @@ -9165,7 +9110,7 @@ void FileOptions::clear_csharp_namespace() { // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } -// optional bool javanano_use_deprecated_package = 38 [deprecated = true]; +// optional bool javanano_use_deprecated_package = 38; bool FileOptions::has_javanano_use_deprecated_package() const { return (_has_bits_[0] & 0x00004000u) != 0; } @@ -14112,812 +14057,6 @@ SourceCodeInfo::location() const { #endif // PROTOBUF_INLINE_NOT_IN_HEADERS -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int GeneratedCodeInfo_Annotation::kPathFieldNumber; -const int GeneratedCodeInfo_Annotation::kSourceFileFieldNumber; -const int GeneratedCodeInfo_Annotation::kBeginFieldNumber; -const int GeneratedCodeInfo_Annotation::kEndFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo.Annotation) -} - -void GeneratedCodeInfo_Annotation::InitAsDefaultInstance() { -} - -GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) -} - -void GeneratedCodeInfo_Annotation::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - begin_ = 0; - end_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() { - // @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo.Annotation) - SharedDtor(); -} - -void GeneratedCodeInfo_Annotation::SharedDtor() { - source_file_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { - } -} - -void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation::descriptor() { - protobuf_AssignDescriptorsOnce(); - return GeneratedCodeInfo_Annotation_descriptor_; -} - -const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); - return *default_instance_; -} - -GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::default_instance_ = NULL; - -GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const { - GeneratedCodeInfo_Annotation* n = new GeneratedCodeInfo_Annotation; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void GeneratedCodeInfo_Annotation::Clear() { -#define ZR_HELPER_(f) reinterpret_cast<char*>(\ - &reinterpret_cast<GeneratedCodeInfo_Annotation*>(16)->f) - -#define ZR_(first, last) do {\ - ::memset(&first, 0,\ - ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ -} while (0) - - if (_has_bits_[0 / 32] & 14u) { - ZR_(begin_, end_); - if (has_source_file()) { - source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - } - -#undef ZR_HELPER_ -#undef ZR_ - - path_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - if (_internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->Clear(); - } -} - -bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo.Annotation) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int32 path = 1 [packed = true]; - case 1: { - if (tag == 10) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_path()))); - } else if (tag == 8) { - DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - 1, 10, input, this->mutable_path()))); - } else { - goto handle_unusual; - } - if (input->ExpectTag(18)) goto parse_source_file; - break; - } - - // optional string source_file = 2; - case 2: { - if (tag == 18) { - parse_source_file: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_source_file())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); - } else { - goto handle_unusual; - } - if (input->ExpectTag(24)) goto parse_begin; - break; - } - - // optional int32 begin = 3; - case 3: { - if (tag == 24) { - parse_begin: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &begin_))); - set_has_begin(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(32)) goto parse_end; - break; - } - - // optional int32 end = 4; - case 4: { - if (tag == 32) { - parse_end: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &end_))); - set_has_end(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo.Annotation) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo.Annotation) - return false; -#undef DO_ -} - -void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo.Annotation) - // 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_); - } - for (int i = 0; i < this->path_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( - this->path(i), output); - } - - // optional string source_file = 2; - if (has_source_file()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 2, this->source_file(), output); - } - - // optional int32 begin = 3; - if (has_begin()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->begin(), output); - } - - // optional int32 end = 4; - if (has_end()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->end(), output); - } - - if (_internal_metadata_.have_unknown_fields()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo.Annotation) -} - -::google::protobuf::uint8* GeneratedCodeInfo_Annotation::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation) - // repeated int32 path = 1 [packed = true]; - if (this->path_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _path_cached_byte_size_, target); - } - for (int i = 0; i < this->path_size(); i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32NoTagToArray(this->path(i), target); - } - - // optional string source_file = 2; - if (has_source_file()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->source_file().data(), this->source_file().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 2, this->source_file(), target); - } - - // optional int32 begin = 3; - if (has_begin()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->begin(), target); - } - - // optional int32 end = 4; - if (has_end()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->end(), target); - } - - if (_internal_metadata_.have_unknown_fields()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo.Annotation) - return target; -} - -int GeneratedCodeInfo_Annotation::ByteSize() const { - int total_size = 0; - - if (_has_bits_[1 / 32] & 14u) { - // optional string source_file = 2; - if (has_source_file()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->source_file()); - } - - // optional int32 begin = 3; - if (has_begin()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->begin()); - } - - // optional int32 end = 4; - if (has_end()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->end()); - } - - } - // repeated int32 path = 1 [packed = true]; - { - int data_size = 0; - for (int i = 0; i < this->path_size(); i++) { - data_size += ::google::protobuf::internal::WireFormatLite:: - Int32Size(this->path(i)); - } - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _path_cached_byte_size_ = data_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; - } - - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void GeneratedCodeInfo_Annotation::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const GeneratedCodeInfo_Annotation* source = - ::google::protobuf::internal::DynamicCastToGenerated<const GeneratedCodeInfo_Annotation>( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - path_.MergeFrom(from.path_); - if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { - if (from.has_source_file()) { - set_has_source_file(); - source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); - } - if (from.has_begin()) { - set_begin(from.begin()); - } - if (from.has_end()) { - set_end(from.end()); - } - } - if (from._internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); - } -} - -void GeneratedCodeInfo_Annotation::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void GeneratedCodeInfo_Annotation::CopyFrom(const GeneratedCodeInfo_Annotation& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool GeneratedCodeInfo_Annotation::IsInitialized() const { - - return true; -} - -void GeneratedCodeInfo_Annotation::Swap(GeneratedCodeInfo_Annotation* other) { - if (other == this) return; - InternalSwap(other); -} -void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) { - path_.UnsafeArenaSwap(&other->path_); - source_file_.Swap(&other->source_file_); - std::swap(begin_, other->begin_); - std::swap(end_, other->end_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - std::swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = GeneratedCodeInfo_Annotation_descriptor_; - metadata.reflection = GeneratedCodeInfo_Annotation_reflection_; - return metadata; -} - - -// ------------------------------------------------------------------- - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int GeneratedCodeInfo::kAnnotationFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -GeneratedCodeInfo::GeneratedCodeInfo() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo) -} - -void GeneratedCodeInfo::InitAsDefaultInstance() { -} - -GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from) - : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo) -} - -void GeneratedCodeInfo::SharedCtor() { - _cached_size_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -GeneratedCodeInfo::~GeneratedCodeInfo() { - // @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo) - SharedDtor(); -} - -void GeneratedCodeInfo::SharedDtor() { - if (this != default_instance_) { - } -} - -void GeneratedCodeInfo::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* GeneratedCodeInfo::descriptor() { - protobuf_AssignDescriptorsOnce(); - return GeneratedCodeInfo_descriptor_; -} - -const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); - return *default_instance_; -} - -GeneratedCodeInfo* GeneratedCodeInfo::default_instance_ = NULL; - -GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const { - GeneratedCodeInfo* n = new GeneratedCodeInfo; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void GeneratedCodeInfo::Clear() { - annotation_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - if (_internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->Clear(); - } -} - -bool GeneratedCodeInfo::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - case 1: { - if (tag == 10) { - DO_(input->IncrementRecursionDepth()); - parse_loop_annotation: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( - input, add_annotation())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(10)) goto parse_loop_annotation; - input->UnsafeDecrementRecursionDepth(); - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo) - return true; -failure: - // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo) - return false; -#undef DO_ -} - -void GeneratedCodeInfo::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo) - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->annotation(i), output); - } - - if (_internal_metadata_.have_unknown_fields()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo) -} - -::google::protobuf::uint8* GeneratedCodeInfo::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo) - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 1, this->annotation(i), target); - } - - if (_internal_metadata_.have_unknown_fields()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo) - return target; -} - -int GeneratedCodeInfo::ByteSize() const { - int total_size = 0; - - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - total_size += 1 * this->annotation_size(); - for (int i = 0; i < this->annotation_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->annotation(i)); - } - - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void GeneratedCodeInfo::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const GeneratedCodeInfo* source = - ::google::protobuf::internal::DynamicCastToGenerated<const GeneratedCodeInfo>( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void GeneratedCodeInfo::MergeFrom(const GeneratedCodeInfo& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - annotation_.MergeFrom(from.annotation_); - if (from._internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); - } -} - -void GeneratedCodeInfo::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void GeneratedCodeInfo::CopyFrom(const GeneratedCodeInfo& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool GeneratedCodeInfo::IsInitialized() const { - - return true; -} - -void GeneratedCodeInfo::Swap(GeneratedCodeInfo* other) { - if (other == this) return; - InternalSwap(other); -} -void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) { - annotation_.UnsafeArenaSwap(&other->annotation_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - std::swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = GeneratedCodeInfo_descriptor_; - metadata.reflection = GeneratedCodeInfo_reflection_; - return metadata; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// GeneratedCodeInfo_Annotation - -// repeated int32 path = 1 [packed = true]; -int GeneratedCodeInfo_Annotation::path_size() const { - return path_.size(); -} -void GeneratedCodeInfo_Annotation::clear_path() { - path_.Clear(); -} - ::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_.Get(index); -} - void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) { - path_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) -} - void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) { - path_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) -} - const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -GeneratedCodeInfo_Annotation::path() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_; -} - ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -GeneratedCodeInfo_Annotation::mutable_path() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return &path_; -} - -// optional string source_file = 2; -bool GeneratedCodeInfo_Annotation::has_source_file() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_source_file() { - _has_bits_[0] |= 0x00000002u; -} -void GeneratedCodeInfo_Annotation::clear_has_source_file() { - _has_bits_[0] &= ~0x00000002u; -} -void GeneratedCodeInfo_Annotation::clear_source_file() { - source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_source_file(); -} - const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { - set_has_source_file(); - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - ::std::string* GeneratedCodeInfo_Annotation::release_source_file() { - clear_has_source_file(); - return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { - if (source_file != NULL) { - set_has_source_file(); - } else { - clear_has_source_file(); - } - source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - -// optional int32 begin = 3; -bool GeneratedCodeInfo_Annotation::has_begin() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_begin() { - _has_bits_[0] |= 0x00000004u; -} -void GeneratedCodeInfo_Annotation::clear_has_begin() { - _has_bits_[0] &= ~0x00000004u; -} -void GeneratedCodeInfo_Annotation::clear_begin() { - begin_ = 0; - clear_has_begin(); -} - ::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) - return begin_; -} - void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) { - set_has_begin(); - begin_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) -} - -// optional int32 end = 4; -bool GeneratedCodeInfo_Annotation::has_end() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void GeneratedCodeInfo_Annotation::set_has_end() { - _has_bits_[0] |= 0x00000008u; -} -void GeneratedCodeInfo_Annotation::clear_has_end() { - _has_bits_[0] &= ~0x00000008u; -} -void GeneratedCodeInfo_Annotation::clear_end() { - end_ = 0; - clear_has_end(); -} - ::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) - return end_; -} - void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) { - set_has_end(); - end_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) -} - -// ------------------------------------------------------------------- - -// GeneratedCodeInfo - -// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; -int GeneratedCodeInfo::annotation_size() const { - return annotation_.size(); -} -void GeneratedCodeInfo::clear_annotation() { - annotation_.Clear(); -} -const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Get(index); -} -::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Mutable(index); -} -::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Add(); -} -::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* -GeneratedCodeInfo::mutable_annotation() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) - return &annotation_; -} -const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& -GeneratedCodeInfo::annotation() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - // @@protoc_insertion_point(namespace_scope) } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.h b/third_party/protobuf/src/google/protobuf/descriptor.pb.h index 3fe07bf5c6..6025516258 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.pb.h +++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.h @@ -50,8 +50,6 @@ class FieldOptions; class FileDescriptorProto; class FileDescriptorSet; class FileOptions; -class GeneratedCodeInfo; -class GeneratedCodeInfo_Annotation; class MessageOptions; class MethodDescriptorProto; class MethodOptions; @@ -2017,12 +2015,12 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { ::std::string* release_csharp_namespace(); void set_allocated_csharp_namespace(::std::string* csharp_namespace); - // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; - bool has_javanano_use_deprecated_package() const PROTOBUF_DEPRECATED; - void clear_javanano_use_deprecated_package() PROTOBUF_DEPRECATED; + // optional bool javanano_use_deprecated_package = 38; + bool has_javanano_use_deprecated_package() const; + void clear_javanano_use_deprecated_package(); static const int kJavananoUseDeprecatedPackageFieldNumber = 38; - bool javanano_use_deprecated_package() const PROTOBUF_DEPRECATED; - void set_javanano_use_deprecated_package(bool value) PROTOBUF_DEPRECATED; + bool javanano_use_deprecated_package() const; + void set_javanano_use_deprecated_package(bool value); // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -3392,228 +3390,6 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message { void InitAsDefaultInstance(); static SourceCodeInfo* default_instance_; }; -// ------------------------------------------------------------------- - -class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobuf::Message { - public: - GeneratedCodeInfo_Annotation(); - virtual ~GeneratedCodeInfo_Annotation(); - - GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from); - - inline GeneratedCodeInfo_Annotation& operator=(const GeneratedCodeInfo_Annotation& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const GeneratedCodeInfo_Annotation& default_instance(); - - void Swap(GeneratedCodeInfo_Annotation* other); - - // implements Message ---------------------------------------------- - - inline GeneratedCodeInfo_Annotation* New() const { return New(NULL); } - - GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const GeneratedCodeInfo_Annotation& from); - void MergeFrom(const GeneratedCodeInfo_Annotation& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(GeneratedCodeInfo_Annotation* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); - } - inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); - } - public: - - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated int32 path = 1 [packed = true]; - int path_size() const; - void clear_path(); - static const int kPathFieldNumber = 1; - ::google::protobuf::int32 path(int index) const; - void set_path(int index, ::google::protobuf::int32 value); - void add_path(::google::protobuf::int32 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& - path() const; - ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* - mutable_path(); - - // optional string source_file = 2; - bool has_source_file() const; - void clear_source_file(); - static const int kSourceFileFieldNumber = 2; - const ::std::string& source_file() const; - void set_source_file(const ::std::string& value); - void set_source_file(const char* value); - void set_source_file(const char* value, size_t size); - ::std::string* mutable_source_file(); - ::std::string* release_source_file(); - void set_allocated_source_file(::std::string* source_file); - - // optional int32 begin = 3; - bool has_begin() const; - void clear_begin(); - static const int kBeginFieldNumber = 3; - ::google::protobuf::int32 begin() const; - void set_begin(::google::protobuf::int32 value); - - // optional int32 end = 4; - bool has_end() const; - void clear_end(); - static const int kEndFieldNumber = 4; - ::google::protobuf::int32 end() const; - void set_end(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation) - private: - inline void set_has_source_file(); - inline void clear_has_source_file(); - inline void set_has_begin(); - inline void clear_has_begin(); - inline void set_has_end(); - inline void clear_has_end(); - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; - mutable int _path_cached_byte_size_; - ::google::protobuf::internal::ArenaStringPtr source_file_; - ::google::protobuf::int32 begin_; - ::google::protobuf::int32 end_; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); - friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); - friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); - - void InitAsDefaultInstance(); - static GeneratedCodeInfo_Annotation* default_instance_; -}; -// ------------------------------------------------------------------- - -class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message { - public: - GeneratedCodeInfo(); - virtual ~GeneratedCodeInfo(); - - GeneratedCodeInfo(const GeneratedCodeInfo& from); - - inline GeneratedCodeInfo& operator=(const GeneratedCodeInfo& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const GeneratedCodeInfo& default_instance(); - - void Swap(GeneratedCodeInfo* other); - - // implements Message ---------------------------------------------- - - inline GeneratedCodeInfo* New() const { return New(NULL); } - - GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const GeneratedCodeInfo& from); - void MergeFrom(const GeneratedCodeInfo& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(GeneratedCodeInfo* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); - } - inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); - } - public: - - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - typedef GeneratedCodeInfo_Annotation Annotation; - - // accessors ------------------------------------------------------- - - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - int annotation_size() const; - void clear_annotation(); - static const int kAnnotationFieldNumber = 1; - const ::google::protobuf::GeneratedCodeInfo_Annotation& annotation(int index) const; - ::google::protobuf::GeneratedCodeInfo_Annotation* mutable_annotation(int index); - ::google::protobuf::GeneratedCodeInfo_Annotation* add_annotation(); - ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* - mutable_annotation(); - const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& - annotation() const; - - // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo) - private: - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation > annotation_; - friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); - friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); - friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); - - void InitAsDefaultInstance(); - static GeneratedCodeInfo* default_instance_; -}; // =================================================================== @@ -6194,7 +5970,7 @@ inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_na // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } -// optional bool javanano_use_deprecated_package = 38 [deprecated = true]; +// optional bool javanano_use_deprecated_package = 38; inline bool FileOptions::has_javanano_use_deprecated_package() const { return (_has_bits_[0] & 0x00004000u) != 0; } @@ -7418,175 +7194,6 @@ SourceCodeInfo::location() const { return location_; } -// ------------------------------------------------------------------- - -// GeneratedCodeInfo_Annotation - -// repeated int32 path = 1 [packed = true]; -inline int GeneratedCodeInfo_Annotation::path_size() const { - return path_.size(); -} -inline void GeneratedCodeInfo_Annotation::clear_path() { - path_.Clear(); -} -inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_.Get(index); -} -inline void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) { - path_.Set(index, value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) -} -inline void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) { - path_.Add(value); - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) -} -inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& -GeneratedCodeInfo_Annotation::path() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return path_; -} -inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* -GeneratedCodeInfo_Annotation::mutable_path() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) - return &path_; -} - -// optional string source_file = 2; -inline bool GeneratedCodeInfo_Annotation::has_source_file() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void GeneratedCodeInfo_Annotation::set_has_source_file() { - _has_bits_[0] |= 0x00000002u; -} -inline void GeneratedCodeInfo_Annotation::clear_has_source_file() { - _has_bits_[0] &= ~0x00000002u; -} -inline void GeneratedCodeInfo_Annotation::clear_source_file() { - source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_source_file(); -} -inline const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { - set_has_source_file(); - source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast<const char*>(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} -inline ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { - set_has_source_file(); - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) - return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string* GeneratedCodeInfo_Annotation::release_source_file() { - clear_has_source_file(); - return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { - if (source_file != NULL) { - set_has_source_file(); - } else { - clear_has_source_file(); - } - source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) -} - -// optional int32 begin = 3; -inline bool GeneratedCodeInfo_Annotation::has_begin() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void GeneratedCodeInfo_Annotation::set_has_begin() { - _has_bits_[0] |= 0x00000004u; -} -inline void GeneratedCodeInfo_Annotation::clear_has_begin() { - _has_bits_[0] &= ~0x00000004u; -} -inline void GeneratedCodeInfo_Annotation::clear_begin() { - begin_ = 0; - clear_has_begin(); -} -inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) - return begin_; -} -inline void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) { - set_has_begin(); - begin_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) -} - -// optional int32 end = 4; -inline bool GeneratedCodeInfo_Annotation::has_end() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void GeneratedCodeInfo_Annotation::set_has_end() { - _has_bits_[0] |= 0x00000008u; -} -inline void GeneratedCodeInfo_Annotation::clear_has_end() { - _has_bits_[0] &= ~0x00000008u; -} -inline void GeneratedCodeInfo_Annotation::clear_end() { - end_ = 0; - clear_has_end(); -} -inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) - return end_; -} -inline void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) { - set_has_end(); - end_ = value; - // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) -} - -// ------------------------------------------------------------------- - -// GeneratedCodeInfo - -// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; -inline int GeneratedCodeInfo::annotation_size() const { - return annotation_.size(); -} -inline void GeneratedCodeInfo::clear_annotation() { - annotation_.Clear(); -} -inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { - // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Get(index); -} -inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { - // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Mutable(index); -} -inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { - // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* -GeneratedCodeInfo::mutable_annotation() { - // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) - return &annotation_; -} -inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& -GeneratedCodeInfo::annotation() const { - // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) - return annotation_; -} - #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- @@ -7630,10 +7237,6 @@ GeneratedCodeInfo::annotation() const { // ------------------------------------------------------------------- -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - // @@protoc_insertion_point(namespace_scope) diff --git a/third_party/protobuf/src/google/protobuf/descriptor.proto b/third_party/protobuf/src/google/protobuf/descriptor.proto index 3e664d59ea..c59a6022e7 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.proto +++ b/third_party/protobuf/src/google/protobuf/descriptor.proto @@ -379,7 +379,7 @@ message FileOptions { // Whether the nano proto compiler should generate in the deprecated non-nano // suffixed package. - optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + optional bool javanano_use_deprecated_package = 38; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -777,29 +777,3 @@ message SourceCodeInfo { repeated string leading_detached_comments = 6; } } - -// 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. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // 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]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // 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; - } -} diff --git a/third_party/protobuf/src/google/protobuf/dynamic_message.cc b/third_party/protobuf/src/google/protobuf/dynamic_message.cc index 8d689ac88b..bb4004769d 100644 --- a/third_party/protobuf/src/google/protobuf/dynamic_message.cc +++ b/third_party/protobuf/src/google/protobuf/dynamic_message.cc @@ -419,7 +419,7 @@ DynamicMessage::~DynamicMessage() { } // We need to manually run the destructors for repeated fields and strings, - // just as we ran their constructors in the DynamicMessage constructor. + // just as we ran their constructors in the the DynamicMessage constructor. // We also need to manually delete oneof fields if it is set and is string // or message. // Additionally, if any singular embedded messages have been allocated, we diff --git a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc index e3a34d0ac0..4bcd354fe6 100644 --- a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc +++ b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc @@ -629,24 +629,6 @@ CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output) had_error_ = false; } -CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* output, - bool do_eager_refresh) - : output_(output), - buffer_(NULL), - buffer_size_(0), - total_bytes_(0), - had_error_(false), - aliasing_enabled_(false) { - if (do_eager_refresh) { - // Eagerly Refresh() so buffer space is immediately available. - Refresh(); - // The Refresh() may have failed. If the client doesn't write any data, - // though, don't consider this an error. If the client does write data, then - // another Refresh() will be attempted and it will set the error once again. - had_error_ = false; - } -} - CodedOutputStream::~CodedOutputStream() { Trim(); } diff --git a/third_party/protobuf/src/google/protobuf/io/coded_stream.h b/third_party/protobuf/src/google/protobuf/io/coded_stream.h index e37710035a..2da096c5c8 100644 --- a/third_party/protobuf/src/google/protobuf/io/coded_stream.h +++ b/third_party/protobuf/src/google/protobuf/io/coded_stream.h @@ -117,7 +117,7 @@ #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) #define PROTOBUF_LITTLE_ENDIAN 1 #endif - #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) + #if _MSC_VER >= 1300 // If MSVC has "/RTCc" set, it will complain about truncating casts at // runtime. This file contains some intentional truncating casts. #pragma runtime_checks("c", off) @@ -666,7 +666,6 @@ class LIBPROTOBUF_EXPORT CodedOutputStream { public: // Create an CodedOutputStream that writes to the given ZeroCopyOutputStream. explicit CodedOutputStream(ZeroCopyOutputStream* output); - CodedOutputStream(ZeroCopyOutputStream* output, bool do_eager_refresh); // Destroy the CodedOutputStream and position the underlying // ZeroCopyOutputStream immediately after the last byte written. @@ -1286,9 +1285,9 @@ inline bool CodedInputStream::IsFlat() const { } // namespace protobuf -#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) +#if defined(_MSC_VER) && _MSC_VER >= 1300 #pragma runtime_checks("c", restore) -#endif // _MSC_VER && !defined(__INTEL_COMPILER) +#endif // _MSC_VER } // namespace google #endif // GOOGLE_PROTOBUF_IO_CODED_STREAM_H__ diff --git a/third_party/protobuf/src/google/protobuf/io/gzip_stream.cc b/third_party/protobuf/src/google/protobuf/io/gzip_stream.cc index 9c621b6a27..1be6c86359 100644 --- a/third_party/protobuf/src/google/protobuf/io/gzip_stream.cc +++ b/third_party/protobuf/src/google/protobuf/io/gzip_stream.cc @@ -241,7 +241,9 @@ void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream, GzipOutputStream::~GzipOutputStream() { Close(); - operator delete(input_buffer_); + if (input_buffer_ != NULL) { + operator delete(input_buffer_); + } } // private diff --git a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index 083beca43d..686e63f252 100644 --- a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -157,7 +157,6 @@ StringOutputStream::~StringOutputStream() { } bool StringOutputStream::Next(void** data, int* size) { - GOOGLE_CHECK_NE(NULL, target_); int old_size = target_->size(); // Grow the string. @@ -189,44 +188,14 @@ bool StringOutputStream::Next(void** data, int* size) { void StringOutputStream::BackUp(int count) { GOOGLE_CHECK_GE(count, 0); - GOOGLE_CHECK_NE(NULL, target_); GOOGLE_CHECK_LE(count, target_->size()); target_->resize(target_->size() - count); } int64 StringOutputStream::ByteCount() const { - GOOGLE_CHECK_NE(NULL, target_); return target_->size(); } -void StringOutputStream::SetString(string* target) { - target_ = target; -} - -// =================================================================== - -LazyStringOutputStream::LazyStringOutputStream( - ResultCallback<string*>* callback) - : StringOutputStream(NULL), - callback_(GOOGLE_CHECK_NOTNULL(callback)), - string_is_set_(false) { -} - -LazyStringOutputStream::~LazyStringOutputStream() { -} - -bool LazyStringOutputStream::Next(void** data, int* size) { - if (!string_is_set_) { - SetString(callback_->Run()); - string_is_set_ = true; - } - return StringOutputStream::Next(data, size); -} - -int64 LazyStringOutputStream::ByteCount() const { - return string_is_set_ ? StringOutputStream::ByteCount() : 0; -} - // =================================================================== CopyingInputStream::~CopyingInputStream() {} diff --git a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h index 1c397deae2..a598ef2e3d 100644 --- a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -148,9 +148,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream { void BackUp(int count); int64 ByteCount() const; - protected: - void SetString(string* target); - private: static const int kMinimumSize = 16; @@ -159,27 +156,6 @@ class LIBPROTOBUF_EXPORT StringOutputStream : public ZeroCopyOutputStream { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOutputStream); }; -// LazyStringOutputStream is a StringOutputStream with lazy acquisition of -// the output string from a callback. The string is owned externally, and not -// deleted in the stream destructor. -class LIBPROTOBUF_EXPORT LazyStringOutputStream : public StringOutputStream { - public: - // Callback should be permanent (non-self-deleting). Ownership is transferred - // to the LazyStringOutputStream. - explicit LazyStringOutputStream(ResultCallback<string*>* callback); - ~LazyStringOutputStream(); - - // implements ZeroCopyOutputStream, overriding StringOutputStream ----------- - bool Next(void** data, int* size); - int64 ByteCount() const; - - private: - const scoped_ptr<ResultCallback<string*> > callback_; - bool string_is_set_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyStringOutputStream); -}; - // Note: There is no StringInputStream. Instead, just create an // ArrayInputStream as follows: // ArrayInputStream input(str.data(), str.size()); diff --git a/third_party/protobuf/src/google/protobuf/map.h b/third_party/protobuf/src/google/protobuf/map.h index 83199380bf..dfc6242004 100644 --- a/third_party/protobuf/src/google/protobuf/map.h +++ b/third_party/protobuf/src/google/protobuf/map.h @@ -545,16 +545,10 @@ class Map { } #if __cplusplus >= 201103L && !defined(GOOGLE_PROTOBUF_OS_APPLE) && \ - !defined(GOOGLE_PROTOBUF_OS_NACL) && \ - !defined(GOOGLE_PROTOBUF_OS_ANDROID) && \ - !defined(GOOGLE_PROTOBUF_OS_EMSCRIPTEN) + !defined(GOOGLE_PROTOBUF_OS_NACL) && !defined(GOOGLE_PROTOBUF_OS_ANDROID) template<class NodeType, class... Args> void construct(NodeType* p, Args&&... args) { - // Clang 3.6 doesn't compile static casting to void* directly. (Issue #1266) - // According C++ standard 5.2.9/1: "The static_cast operator shall not cast - // away constness". So first the maybe const pointer is casted to const void* and - // after the const void* is const casted. - new (const_cast<void*>(static_cast<const void*>(p))) NodeType(std::forward<Args>(args)...); + new (static_cast<void*>(p)) NodeType(std::forward<Args>(args)...); } template<class NodeType> diff --git a/third_party/protobuf/src/google/protobuf/message.h b/third_party/protobuf/src/google/protobuf/message.h index a4d9277e69..7c27afd999 100644 --- a/third_party/protobuf/src/google/protobuf/message.h +++ b/third_party/protobuf/src/google/protobuf/message.h @@ -739,9 +739,9 @@ class LIBPROTOBUF_EXPORT Reflection { // specifyed by 'field' passing ownership to the message. // TODO(tmarek): Make virtual after all subclasses have been // updated. - virtual void AddAllocatedMessage(Message* /* message */, - const FieldDescriptor* /*field */, - Message* /* new_entry */) const {} + virtual void AddAllocatedMessage(Message* message, + const FieldDescriptor* field, + Message* new_entry) const {} // Get a RepeatedFieldRef object that can be used to read the underlying @@ -947,27 +947,27 @@ 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*/, - const FieldDescriptor* /* field */, - const MapKey& /* key */) const { + virtual bool ContainsMapKey(const Message& message, + const FieldDescriptor* field, + const MapKey& key) const { return false; } // If key is in map field: Saves the value pointer to val and returns // false. If key in not in map field: Insert the key into map, saves // value pointer to val and retuns true. - virtual bool InsertOrLookupMapValue(Message* /* message */, - const FieldDescriptor* /* field */, - const MapKey& /* key */, - MapValueRef* /* val */) const { + virtual bool InsertOrLookupMapValue(Message* message, + const FieldDescriptor* field, + const MapKey& key, + MapValueRef* val) const { return false; } // Delete and returns true if key is in the map field. Returns false // otherwise. - virtual bool DeleteMapValue(Message* /* mesage */, - const FieldDescriptor* /* field */, - const MapKey& /* key */) const { + virtual bool DeleteMapValue(Message* message, + const FieldDescriptor* field, + const MapKey& key) const { return false; } @@ -987,15 +987,15 @@ class LIBPROTOBUF_EXPORT Reflection { // Get the number of <key, value> pair of a map field. The result may be // different from FieldSize which can have duplicate keys. - virtual int MapSize(const Message& /* message */, - const FieldDescriptor* /* field */) const { + virtual int MapSize(const Message& message, + const FieldDescriptor* field) const { return 0; } // Help method for MapIterator. friend class MapIterator; virtual internal::MapFieldBase* MapData( - Message* /* message */, const FieldDescriptor* /* field */) const { + Message* message, const FieldDescriptor* field) const { return NULL; } diff --git a/third_party/protobuf/src/google/protobuf/repeated_field.h b/third_party/protobuf/src/google/protobuf/repeated_field.h index 5447fa42af..432236ce45 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field.h +++ b/third_party/protobuf/src/google/protobuf/repeated_field.h @@ -574,7 +574,7 @@ class GenericTypeHandler { template <typename GenericType> GenericType* GenericTypeHandler<GenericType>::NewFromPrototype( - const GenericType* /* prototype */, ::google::protobuf::Arena* arena) { + const GenericType* prototype, ::google::protobuf::Arena* arena) { return New(arena); } template <typename GenericType> @@ -627,7 +627,7 @@ void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from, // Message specialization bodies defined in message.cc. This split is necessary // to allow proto2-lite (which includes this header) to be independent of // Message. -DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message) +DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message); #undef DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES @@ -674,7 +674,7 @@ class LIBPROTOBUF_EXPORT StringTypeHandlerBase { static inline ::google::protobuf::Arena* GetArena(string*) { return NULL; } - static inline void* GetMaybeArenaPointer(string* /* value */) { + static inline void* GetMaybeArenaPointer(string* value) { return NULL; } static inline void Delete(string* value, Arena* arena) { @@ -692,7 +692,7 @@ class LIBPROTOBUF_EXPORT StringTypeHandlerBase { class StringTypeHandler : public StringTypeHandlerBase { public: static int SpaceUsed(const string& value) { - return static_cast<int>(sizeof(value)) + StringSpaceUsedExcludingSelf(value); + return sizeof(value) + StringSpaceUsedExcludingSelf(value); } }; diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops.h index 9b3d1e6b57..31e2b78235 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/atomicops.h +++ b/third_party/protobuf/src/google/protobuf/stubs/atomicops.h @@ -76,7 +76,7 @@ typedef int32 Atomic32; #ifdef GOOGLE_PROTOBUF_ARCH_64_BIT // We need to be able to go between Atomic64 and AtomicWord implicitly. This // means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) +#if defined(__ILP32__) || defined(GOOGLE_PROTOBUF_OS_NACL) || defined(GOOGLE_PROTOBUF_ARCH_SPARC) // NaCl's intptr_t is not actually 64-bits on 64-bit! // http://code.google.com/p/nativeclient/issues/detail?id=1162 // sparcv9's pointer type is 32bits @@ -214,8 +214,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); #include <google/protobuf/stubs/atomicops_internals_power.h> #elif defined(__native_client__) #include <google/protobuf/stubs/atomicops_internals_pnacl.h> -#elif defined(GOOGLE_PROTOBUF_ARCH_PPC) -#include <google/protobuf/stubs/atomicops_internals_ppc_gcc.h> #elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) #include <google/protobuf/stubs/atomicops_internals_generic_gcc.h> #elif defined(__clang__) diff --git a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h b/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h deleted file mode 100644 index 8231a578f3..0000000000 --- a/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h +++ /dev/null @@ -1,155 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: ogabbay@advaoptical.com (Oded Gabbay) -// Cleaned up by: bsilver16384@gmail.com (Brian Silverman) -// -// This file is an internal atomic implementation, use atomicops.h instead. - -#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_ -#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_ - -#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") - -namespace google { -namespace protobuf { -namespace internal { - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 prev; - - __asm__ __volatile__( - "0: \n\t" - "lwarx %[prev],0,%[ptr] \n\t" - "cmpw 0,%[prev],%[old_value] \n\t" - "bne- 1f \n\t" - "stwcx. %[new_value],0,%[ptr] \n\t" - "bne- 0b \n\t" - "1: \n\t" - : [prev] "=&r"(prev), "+m"(*ptr) - : [ptr] "r"(ptr), [old_value] "r"(old_value), [new_value] "r"(new_value) - : "cc", "memory"); - - return prev; -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr, - Atomic32 new_value) { - Atomic32 old; - - __asm__ __volatile__( - "0: \n\t" - "lwarx %[old],0,%[ptr] \n\t" - "stwcx. %[new_value],0,%[ptr] \n\t" - "bne- 0b \n\t" - : [old] "=&r"(old), "+m"(*ptr) - : [ptr] "r"(ptr), [new_value] "r"(new_value) - : "cc", "memory"); - - return old; -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, - Atomic32 increment) { - Atomic32 temp; - - __asm__ __volatile__( - "0: \n\t" - "lwarx %[temp],0,%[ptr] \n\t" - "add %[temp],%[increment],%[temp] \n\t" - "stwcx. %[temp],0,%[ptr] \n\t" - "bne- 0b \n\t" - : [temp] "=&r"(temp) - : [increment] "r"(increment), [ptr] "r"(ptr) - : "cc", "memory"); - - return temp; -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr, - Atomic32 increment) { - MemoryBarrier(); - Atomic32 res = NoBarrier_AtomicIncrement(ptr, increment); - MemoryBarrier(); - return res; -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr, - Atomic32 old_value, Atomic32 new_value) { - Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value); - MemoryBarrier(); - return res; -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr, - Atomic32 old_value, Atomic32 new_value) { - MemoryBarrier(); - Atomic32 res = NoBarrier_CompareAndSwap(ptr, old_value, new_value); - return res; -} - -inline void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value) { - *ptr = value; -} - -inline void MemoryBarrier() { __asm__ __volatile__("sync" : : : "memory"); } - -inline void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value) { - *ptr = value; - MemoryBarrier(); -} - -inline void Release_Store(volatile Atomic32 *ptr, Atomic32 value) { - MemoryBarrier(); - *ptr = value; -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr) { return *ptr; } - -inline Atomic32 Acquire_Load(volatile const Atomic32 *ptr) { - Atomic32 value = *ptr; - MemoryBarrier(); - return value; -} - -inline Atomic32 Release_Load(volatile const Atomic32 *ptr) { - MemoryBarrier(); - return *ptr; -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#undef ATOMICOPS_COMPILER_BARRIER - -#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PPC_GCC_H_ diff --git a/third_party/protobuf/src/google/protobuf/stubs/callback.h b/third_party/protobuf/src/google/protobuf/stubs/callback.h index 87271c5eb8..6da530d3e6 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/callback.h +++ b/third_party/protobuf/src/google/protobuf/stubs/callback.h @@ -78,18 +78,6 @@ class LIBPROTOBUF_EXPORT Closure { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Closure); }; -template<typename R> -class ResultCallback { - public: - ResultCallback() {} - virtual ~ResultCallback() {} - - virtual R Run() = 0; - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ResultCallback); -}; - template<typename R, typename A1> class LIBPROTOBUF_EXPORT ResultCallback1 { public: @@ -252,50 +240,6 @@ class MethodClosure2 : public Closure { Arg2 arg2_; }; -template<typename R> -class FunctionResultCallback_0_0 : public ResultCallback<R> { - public: - typedef R (*FunctionType)(); - - FunctionResultCallback_0_0(FunctionType function, bool self_deleting) - : function_(function), self_deleting_(self_deleting) {} - ~FunctionResultCallback_0_0() {} - - R Run() { - bool needs_delete = self_deleting_; // read in case callback deletes - R result = function_(); - if (needs_delete) delete this; - return result; - } - - private: - FunctionType function_; - bool self_deleting_; -}; - -template<typename R, typename P1> -class FunctionResultCallback_1_0 : public ResultCallback<R> { - public: - typedef R (*FunctionType)(P1); - - FunctionResultCallback_1_0(FunctionType function, bool self_deleting, - P1 p1) - : function_(function), self_deleting_(self_deleting), p1_(p1) {} - ~FunctionResultCallback_1_0() {} - - R Run() { - bool needs_delete = self_deleting_; // read in case callback deletes - R result = function_(p1_); - if (needs_delete) delete this; - return result; - } - - private: - FunctionType function_; - bool self_deleting_; - P1 p1_; -}; - template<typename R, typename Arg1> class FunctionResultCallback_0_1 : public ResultCallback1<R, Arg1> { public: @@ -464,33 +408,6 @@ inline Closure* NewPermanentCallback( object, method, false, arg1, arg2); } -// See ResultCallback -template<typename R> -inline ResultCallback<R>* NewCallback(R (*function)()) { - return new internal::FunctionResultCallback_0_0<R>(function, true); -} - -// See ResultCallback -template<typename R> -inline ResultCallback<R>* NewPermanentCallback(R (*function)()) { - return new internal::FunctionResultCallback_0_0<R>(function, false); -} - -// See ResultCallback -template<typename R, typename P1> -inline ResultCallback<R>* NewCallback(R (*function)(P1), P1 p1) { - return new internal::FunctionResultCallback_1_0<R, P1>( - function, true, p1); -} - -// See ResultCallback -template<typename R, typename P1> -inline ResultCallback<R>* NewPermanentCallback( - R (*function)(P1), P1 p1) { - return new internal::FunctionResultCallback_1_0<R, P1>( - function, false, p1); -} - // See ResultCallback1 template<typename R, typename A1> inline ResultCallback1<R, A1>* NewCallback(R (*function)(A1)) { diff --git a/third_party/protobuf/src/google/protobuf/stubs/platform_macros.h b/third_party/protobuf/src/google/protobuf/stubs/platform_macros.h index 4ba4b348c7..5cde8f4efe 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/platform_macros.h +++ b/third_party/protobuf/src/google/protobuf/stubs/platform_macros.h @@ -65,7 +65,7 @@ #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 #elif defined(sparc) #define GOOGLE_PROTOBUF_ARCH_SPARC 1 -#if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__) +#ifdef SOLARIS_64BIT_ENABLED #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 #else #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 @@ -73,9 +73,6 @@ #elif defined(_POWER) || defined(__powerpc64__) || defined(__PPC64__) #define GOOGLE_PROTOBUF_ARCH_POWER 1 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 -#elif defined(__PPC__) -#define GOOGLE_PROTOBUF_ARCH_PPC 1 -#define GOOGLE_PROTOBUF_ARCH_32_BIT 1 #elif defined(__GNUC__) # if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h diff --git a/third_party/protobuf/src/google/protobuf/stubs/port.h b/third_party/protobuf/src/google/protobuf/stubs/port.h index 1036dff16e..b35a3afec2 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/port.h +++ b/third_party/protobuf/src/google/protobuf/stubs/port.h @@ -53,7 +53,7 @@ #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) #define PROTOBUF_LITTLE_ENDIAN 1 #endif - #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) + #if defined(_MSC_VER) && _MSC_VER >= 1300 // If MSVC has "/RTCc" set, it will complain about truncating casts at // runtime. This file contains some intentional truncating casts. #pragma runtime_checks("c", off) diff --git a/third_party/protobuf/src/google/protobuf/stubs/statusor.h b/third_party/protobuf/src/google/protobuf/stubs/statusor.h index ad848701ba..a9d2b374bf 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/statusor.h +++ b/third_party/protobuf/src/google/protobuf/stubs/statusor.h @@ -224,14 +224,14 @@ inline StatusOr<T>& StatusOr<T>::operator=(const StatusOr<T>& other) { template<typename T> template<typename U> inline StatusOr<T>::StatusOr(const StatusOr<U>& other) - : status_(other.status_), value_(other.status_.ok() ? other.value_ : NULL) { + : status_(other.status_), value_(other.value_) { } template<typename T> template<typename U> inline StatusOr<T>& StatusOr<T>::operator=(const StatusOr<U>& other) { status_ = other.status_; - if (status_.ok()) value_ = other.value_; + value_ = other.value_; return *this; } diff --git a/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto b/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto index c90752440b..2cb7775ccf 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto @@ -39,8 +39,6 @@ message TestWellKnownTypes { google.protobuf.BoolValue bool_field = 16; google.protobuf.StringValue string_field = 17; google.protobuf.BytesValue bytes_field = 18; - // Part of struct, but useful to be able to test separately - google.protobuf.Value value_field = 19; } // A repeated field for each well-known type. diff --git a/third_party/protobuf/src/google/protobuf/util/field_mask_util.cc b/third_party/protobuf/src/google/protobuf/util/field_mask_util.cc index c59f43aa64..29ca9c1e99 100644 --- a/third_party/protobuf/src/google/protobuf/util/field_mask_util.cc +++ b/third_party/protobuf/src/google/protobuf/util/field_mask_util.cc @@ -103,7 +103,7 @@ class FieldMaskTree { // Add a field path into the tree. In a FieldMask, each field path matches // the specified field and also all its sub-fields. If the field path to // add is a sub-path of an existing field path in the tree (i.e., a leaf - // node), it means the tree already matches the given path so nothing will + // node), it means the tree already matchesthe the given path so nothing will // be added to the tree. If the path matches an existing non-leaf node in the // tree, that non-leaf node will be turned into a leaf node with all its // children removed because the path matches all the node's children. diff --git a/third_party/protobuf/src/google/protobuf/util/internal/testdata/maps.proto b/third_party/protobuf/src/google/protobuf/util/internal/testdata/maps.proto index 6475ecddc2..7fb42a2628 100644 --- a/third_party/protobuf/src/google/protobuf/util/internal/testdata/maps.proto +++ b/third_party/protobuf/src/google/protobuf/util/internal/testdata/maps.proto @@ -44,35 +44,6 @@ message MapOut { map<string, MapM> map1 = 1; map<string, MapOut> map2 = 2; map<int32, string> map3 = 3; - map<bool, string> map4 = 5; - string bar = 4; -} - -// A message with exactly the same wire representation as MapOut, but using -// repeated message fields instead of map fields. We use this message to test -// the wire-format compatibility of the JSON transcoder (e.g., whether it -// handles missing keys correctly). -message MapOutWireFormat { - message Map1Entry { - string key = 1; - MapM value = 2; - } - repeated Map1Entry map1 = 1; - message Map2Entry { - string key = 1; - MapOut value = 2; - } - repeated Map2Entry map2 = 2; - message Map3Entry { - int32 key = 1; - string value = 2; - } - repeated Map3Entry map3 = 3; - message Map4Entry { - bool key = 1; - string value = 2; - } - repeated Map4Entry map4 = 5; string bar = 4; } diff --git a/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h b/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h index 79493ca010..b1c477d1a9 100644 --- a/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h +++ b/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h @@ -412,12 +412,12 @@ inline bool WireFormatLite::ReadPackedPrimitive< \ CPPTYPE, WireFormatLite::DECLARED_TYPE>(input, values); \ } -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE); #undef READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE |