diff --git a/BUILD b/BUILD
index 7de87f884f25a..e592465ea0539 100644
--- a/BUILD
+++ b/BUILD
@@ -1203,22 +1203,24 @@ cc_binary(
],
)
-sh_test(
- name = "build_files_updated_unittest",
- srcs = [
- "build_files_updated_unittest.sh",
- ],
- data = [
- "BUILD",
- "cmake/extract_includes.bat.in",
- "cmake/libprotobuf.cmake",
- "cmake/libprotobuf-lite.cmake",
- "cmake/libprotoc.cmake",
- "cmake/tests.cmake",
- "src/Makefile.am",
- "update_file_lists.sh",
- ],
-)
+# TODO: re-enable this test if appropriate, or replace with something that
+# uses the new setup.
+# sh_test(
+# name = "build_files_updated_unittest",
+# srcs = [
+# "build_files_updated_unittest.sh",
+# ],
+# data = [
+# "BUILD",
+# "cmake/extract_includes.bat.in",
+# "cmake/libprotobuf.cmake",
+# "cmake/libprotobuf-lite.cmake",
+# "cmake/libprotoc.cmake",
+# "cmake/tests.cmake",
+# "src/Makefile.am",
+# "update_file_lists.sh",
+# ],
+# )
java_proto_library(
name = "test_messages_proto2_java_proto",
diff --git a/CHANGES.txt b/CHANGES.txt
index 6b7517a75d4e0..835281ff56fe2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,21 @@
+Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+ Python
+ * Removed Python 2.x support.
+ * Pure python descriptor_pool.AddSerializedFile() will always build the
+ file and return FileDescriptor which is same with python c++ extension
+ * type errors thrown by MergeFrom now report fully qualified class names
+ * Protobuf python generated code are simplified. Some platforms that uses
+ "is"("is not") to compare the enum or descriptor's label/type may fail,
+ should use "=="("!=") instead.
+
+ C++
+ * Generated code now uses the c++11 standard integer types int{32,64}_t and
+ uint{32,64}_t
+
+ Java
+ * Add @deprecated javadoc for set/get/has methods
+ * correctly decode \? escape sequence in text protos
+
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
C++
* Better Smaller ByteSizeLong
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index b9caa83578569..95b7f1fa765ba 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -5,6 +5,7 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
@@ -32,29 +33,54 @@ set(libprotobuf_lite_files
)
set(libprotobuf_lite_includes
+ ${protobuf_source_dir}/src/google/protobuf/any.h
${protobuf_source_dir}/src/google/protobuf/arena.h
+ ${protobuf_source_dir}/src/google/protobuf/arena_impl.h
${protobuf_source_dir}/src/google/protobuf/arenastring.h
${protobuf_source_dir}/src/google/protobuf/extension_set.h
+ ${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
+ ${protobuf_source_dir}/src/google/protobuf/has_bits.h
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
+ ${protobuf_source_dir}/src/google/protobuf/inlined_string_field.h
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
+ ${protobuf_source_dir}/src/google/protobuf/io/io_win32.h
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/map.h
+ ${protobuf_source_dir}/src/google/protobuf/map_entry_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/map_field_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/map_type_handler.h
${protobuf_source_dir}/src/google/protobuf/message_lite.h
+ ${protobuf_source_dir}/src/google/protobuf/metadata_lite.h
${protobuf_source_dir}/src/google/protobuf/parse_context.h
+ ${protobuf_source_dir}/src/google/protobuf/port.h
${protobuf_source_dir}/src/google/protobuf/repeated_field.h
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/callback.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/casts.h
${protobuf_source_dir}/src/google/protobuf/stubs/common.h
- ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/hash.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/logging.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/macros.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/map_util.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/mutex.h
${protobuf_source_dir}/src/google/protobuf/stubs/once.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/platform_macros.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/port.h
${protobuf_source_dir}/src/google/protobuf/stubs/status.h
- ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/stl_util.h
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h
- ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h
- ${protobuf_source_dir}/src/google/protobuf/stubs/time.h
+ ${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index d394467332ff8..e4b810c66a4f9 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -15,11 +15,13 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
+ ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.cc
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
${protobuf_source_dir}/src/google/protobuf/map_field.cc
${protobuf_source_dir}/src/google/protobuf/message.cc
+ ${protobuf_source_dir}/src/google/protobuf/reflection_internal.h
${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc
${protobuf_source_dir}/src/google/protobuf/service.cc
${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc
@@ -44,7 +46,6 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc
${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
@@ -55,7 +56,6 @@ set(libprotobuf_files
)
set(libprotobuf_includes
- ${protobuf_source_dir}/src/google/protobuf/any.h
${protobuf_source_dir}/src/google/protobuf/any.pb.h
${protobuf_source_dir}/src/google/protobuf/api.pb.h
${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
@@ -68,18 +68,22 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/empty.pb.h
${protobuf_source_dir}/src/google/protobuf/field_access_listener.h
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h
+ ${protobuf_source_dir}/src/google/protobuf/generated_enum_reflection.h
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
${protobuf_source_dir}/src/google/protobuf/io/printer.h
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h
+ ${protobuf_source_dir}/src/google/protobuf/map_entry.h
${protobuf_source_dir}/src/google/protobuf/map_field.h
+ ${protobuf_source_dir}/src/google/protobuf/map_field_inl.h
${protobuf_source_dir}/src/google/protobuf/message.h
+ ${protobuf_source_dir}/src/google/protobuf/metadata.h
+ ${protobuf_source_dir}/src/google/protobuf/reflection.h
${protobuf_source_dir}/src/google/protobuf/reflection_ops.h
${protobuf_source_dir}/src/google/protobuf/service.h
${protobuf_source_dir}/src/google/protobuf/source_context.pb.h
${protobuf_source_dir}/src/google/protobuf/struct.pb.h
- ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h
${protobuf_source_dir}/src/google/protobuf/text_format.h
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h
${protobuf_source_dir}/src/google/protobuf/type.pb.h
@@ -87,23 +91,10 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h
- ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h
${protobuf_source_dir}/src/google/protobuf/util/json_util.h
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h
${protobuf_source_dir}/src/google/protobuf/util/time_util.h
+ ${protobuf_source_dir}/src/google/protobuf/util/type_resolver.h
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h
${protobuf_source_dir}/src/google/protobuf/wire_format.h
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index a6f791934b27a..505e469d07f0a 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -36,6 +36,7 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc
@@ -64,17 +65,28 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
@@ -82,85 +94,30 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)
set(libprotoc_headers
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/scc.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@@ -183,4 +140,3 @@ set_target_properties(libprotoc PROPERTIES
OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotoc ALIAS libprotoc)
-
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 801c994fd2b83..9ede4f328caeb 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -111,27 +111,28 @@ foreach(proto_file ${tests_protos})
${protobuf_source_dir}/src/${pb_file})
endforeach(proto_file)
-set(common_test_files
+set(common_lite_test_files
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
+ ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
+ ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
+)
+
+set(common_test_files
+ ${common_lite_test_files}
+ ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
${protobuf_source_dir}/src/google/protobuf/test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/test_util.inc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
)
-set(common_lite_test_files
- ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
-)
-
set(tests_files
${protobuf_source_dir}/src/google/protobuf/any_test.cc
${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.h
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
@@ -144,7 +145,6 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc
diff --git a/conformance/Makefile.am b/conformance/Makefile.am
index b281f9cfaa084..ac6f9e1b2beb7 100644
--- a/conformance/Makefile.am
+++ b/conformance/Makefile.am
@@ -359,24 +359,10 @@ test_php_c: protoc_middleman conformance-test-runner conformance-php-c $(other_l
# These depend on library paths being properly set up. The easiest way to
# run them is to just use "tox" from the python dir.
test_python: protoc_middleman conformance-test-runner
- VERSION="$(shell python --version 2>&1)"; \
- if [[ "$$VERSION" == "Python 2.7"* ]]; then \
- echo "Using Python 2.7 failure list."; \
- ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python_2.7.txt ./conformance_python.py; \
- else \
- echo "Using Python >2.7 failure list."; \
- ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python.txt ./conformance_python.py; \
- fi
+ ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python.txt ./conformance_python.py
test_python_cpp: protoc_middleman conformance-test-runner
- VERSION="$(shell python --version 2>&1)"; \
- if [[ "$$VERSION" == "Python 2.7"* ]]; then \
- echo "Using Python 2.7 failure list."; \
- ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp_2.7.txt ./conformance_python.py; \
- else \
- echo "Using Python >2.7 failure list."; \
- ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp.txt ./conformance_python.py; \
- fi
+ ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp.txt ./conformance_python.py
test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js
diff --git a/conformance/conformance.proto b/conformance/conformance.proto
index 49608b38f4c4d..7248e98961f34 100644
--- a/conformance/conformance.proto
+++ b/conformance/conformance.proto
@@ -95,7 +95,7 @@ message ConformanceRequest {
//
// TODO(haberman): if/when we expand the conformance tests to support proto2,
// we will want to include a field that lets the payload/response be a
- // protobuf_test_messages.proto2.TestAllTypes message instead.
+ // protobuf_test_messages.google.protobuf.TestAllTypes message instead.
oneof payload {
bytes protobuf_payload = 1;
string json_payload = 2;
@@ -109,7 +109,7 @@ message ConformanceRequest {
// The full name for the test message to use; for the moment, either:
// protobuf_test_messages.proto3.TestAllTypesProto3 or
- // protobuf_test_messages.proto2.TestAllTypesProto2.
+ // protobuf_test_messages.google.protobuf.TestAllTypesProto2.
string message_type = 4;
// Each test is given a specific test category. Some category may need
diff --git a/conformance/text_format_failure_list_java.txt b/conformance/text_format_failure_list_java.txt
index 71e32429ec689..793aae1281abe 100644
--- a/conformance/text_format_failure_list_java.txt
+++ b/conformance/text_format_failure_list_java.txt
@@ -7,7 +7,3 @@ Required.Proto3.TextFormatInput.AnyField.TextFormatOutput
Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex
Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
diff --git a/conformance/text_format_failure_list_python_2.7.txt b/conformance/text_format_failure_list_python_2.7.txt
deleted file mode 100644
index cada2bc03b2e3..0000000000000
--- a/conformance/text_format_failure_list_python_2.7.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# This is the list of text format conformance tests that are known to fail right
-# now.
-# TODO: These should be fixed.
-Required.Proto3.TextFormatInput.FloatFieldMaxValue.ProtobufOutput
-Required.Proto3.TextFormatInput.FloatFieldMaxValue.TextFormatOutput
-
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString
diff --git a/conformance/text_format_failure_list_python_cpp_2.7.txt b/conformance/text_format_failure_list_python_cpp_2.7.txt
deleted file mode 100644
index ba2089bcaad39..0000000000000
--- a/conformance/text_format_failure_list_python_cpp_2.7.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString
diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
index fb053b2576c4d..0a3d5c604eaa7 100644
--- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
@@ -427,7 +427,7 @@ public string TextPayload {
///
/// The full name for the test message to use; for the moment, either:
/// protobuf_test_messages.proto3.TestAllTypesProto3 or
- /// protobuf_test_messages.proto2.TestAllTypesProto2.
+ /// protobuf_test_messages.google.protobuf.TestAllTypesProto2.
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
index caf51644e74e6..da79db8ec462f 100644
Binary files a/csharp/src/Google.Protobuf.Test/testprotos.pb and b/csharp/src/Google.Protobuf.Test/testprotos.pb differ
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index b32b76c0a50f3..123d80ac93368 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -261,8 +261,8 @@ public void MergeFrom(pb::CodedInputStream input) {
///
/// `Value` represents a dynamically typed value which can be either
/// null, a number, a string, a boolean, a recursive struct value, or a
- /// list of values. A producer of value is expected to set one of that
- /// variants, absence of any variant indicates an error.
+ /// list of values. A producer of value is expected to set one of these
+ /// variants. Absence of any variant indicates an error.
///
/// The JSON representation for `Value` is JSON value.
///
diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java
index 9617f770cc21e..e698f681dbddd 100644
--- a/java/core/src/main/java/com/google/protobuf/ByteString.java
+++ b/java/core/src/main/java/com/google/protobuf/ByteString.java
@@ -480,7 +480,8 @@ public static ByteString copyFromUtf8(String text) {
* @param streamToDrain The source stream, which is read completely but not closed.
* @return A new {@code ByteString} which is made up of chunks of various sizes, depending on the
* behavior of the underlying stream.
- * @throws IOException IOException is thrown if there is a problem reading the underlying stream.
+ * @throws IOException if there is a problem reading the underlying stream
+ * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
*/
public static ByteString readFrom(InputStream streamToDrain) throws IOException {
return readFrom(streamToDrain, MIN_READ_FROM_CHUNK_SIZE, MAX_READ_FROM_CHUNK_SIZE);
@@ -500,13 +501,23 @@ public static ByteString readFrom(InputStream streamToDrain) throws IOException
* @param streamToDrain The source stream, which is read completely but not closed.
* @param chunkSize The size of the chunks in which to read the stream.
* @return A new {@code ByteString} which is made up of chunks of the given size.
- * @throws IOException IOException is thrown if there is a problem reading the underlying stream.
+ * @throws IOException if there is a problem reading the underlying stream
+ * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
*/
public static ByteString readFrom(InputStream streamToDrain, int chunkSize) throws IOException {
return readFrom(streamToDrain, chunkSize, chunkSize);
}
- // Helper method that takes the chunk size range as a parameter.
+ /**
+ * Helper method that takes the chunk size range as a parameter.
+ *
+ * @param streamToDrain the source stream, which is read completely but not closed
+ * @param minChunkSize the minimum size of the chunks in which to read the stream
+ * @param maxChunkSize the maximum size of the chunks in which to read the stream
+ * @return a new {@code ByteString} which is made up of chunks within the given size range
+ * @throws IOException if there is a problem reading the underlying stream
+ * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
+ */
public static ByteString readFrom(InputStream streamToDrain, int minChunkSize, int maxChunkSize)
throws IOException {
Collection results = new ArrayList();
@@ -565,6 +576,8 @@ private static ByteString readChunk(InputStream in, final int chunkSize) throws
*
* @param other string to concatenate
* @return a new {@code ByteString} instance
+ * @throws IllegalArgumentException if the combined size of the two byte strings exceeds
+ * Integer.MAX_VALUE
*/
public final ByteString concat(ByteString other) {
if (Integer.MAX_VALUE - size() < other.size()) {
@@ -585,6 +598,8 @@ public final ByteString concat(ByteString other) {
*
* @param byteStrings strings to be concatenated
* @return new {@code ByteString}
+ * @throws IllegalArgumentException if the combined size of the byte strings exceeds
+ * Integer.MAX_VALUE
*/
public static ByteString copyFrom(Iterable byteStrings) {
// Determine the size;
diff --git a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
index 168eb5ac07cf2..cd639686c2ccc 100644
--- a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -2013,20 +2013,20 @@ private int bufferPos(long pos) {
private ByteBuffer slice(long begin, long end) throws IOException {
int prevPos = buffer.position();
int prevLimit = buffer.limit();
+ // View ByteBuffer as Buffer to avoid cross-Java version issues.
+ // See https://issues.apache.org/jira/browse/MRESOLVER-85
+ Buffer asBuffer = buffer;
try {
- // Casts to Buffer here are required for Java 8 compatibility
- // no matter what tricorder tells you. see
- // https://issues.apache.org/jira/browse/MRESOLVER-85
- ((Buffer) buffer).position(bufferPos(begin));
- ((Buffer) buffer).limit(bufferPos(end));
+ asBuffer.position(bufferPos(begin));
+ asBuffer.limit(bufferPos(end));
return buffer.slice();
} catch (IllegalArgumentException e) {
InvalidProtocolBufferException ex = InvalidProtocolBufferException.truncatedMessage();
ex.initCause(e);
throw ex;
} finally {
- ((Buffer) buffer).position(prevPos);
- ((Buffer) buffer).limit(prevLimit);
+ asBuffer.position(prevPos);
+ asBuffer.limit(prevLimit);
}
}
}
@@ -3963,18 +3963,18 @@ private long currentRemaining() {
private ByteBuffer slice(int begin, int end) throws IOException {
int prevPos = currentByteBuffer.position();
int prevLimit = currentByteBuffer.limit();
+ // View ByteBuffer as Buffer to avoid cross-Java version issues.
+ // See https://issues.apache.org/jira/browse/MRESOLVER-85
+ Buffer asBuffer = currentByteBuffer;
try {
- // casts to Buffer here are required for Java 8 compatibility
- // no matter what tricorder tells you. see
- // https://issues.apache.org/jira/browse/MRESOLVER-85
- ((Buffer) currentByteBuffer).position(begin);
- ((Buffer) currentByteBuffer).limit(end);
+ asBuffer.position(begin);
+ asBuffer.limit(end);
return currentByteBuffer.slice();
} catch (IllegalArgumentException e) {
throw InvalidProtocolBufferException.truncatedMessage();
} finally {
- ((Buffer) currentByteBuffer).position(prevPos);
- ((Buffer) currentByteBuffer).limit(prevLimit);
+ asBuffer.position(prevPos);
+ asBuffer.limit(prevLimit);
}
}
}
diff --git a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
index 399a6eb928359..e79543ac55d74 100644
--- a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
+++ b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
@@ -693,7 +693,7 @@ public static int computeRawMessageSetExtensionSize(
}
/**
- * Compute the number of bytes that would be needed to encode an lazily parsed MessageSet
+ * Compute the number of bytes that would be needed to encode a lazily parsed MessageSet
* extension field to the stream. For historical reasons, the wire format differs from normal
* fields.
*/
diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
index cba889ff2922a..184838b80a9c8 100644
--- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
+++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
@@ -41,14 +41,14 @@
import com.google.protobuf.Internal.FloatList;
import com.google.protobuf.Internal.IntList;
import com.google.protobuf.Internal.LongList;
-// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3V3 and
-// in the future may have GeneratedMessageV3V4 etc. This allows us to change some aspects of this
+// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3 and
+// in the future may have GeneratedMessageV4 etc. This allows us to change some aspects of this
// class without breaking binary compatibility with old generated code that still subclasses
-// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV3V? classes to
-// interoperate (e.g., a GeneratedMessageV3V3 object has a message extension field whose class
-// type is GeneratedMessageV3V4), these classes still share a common parent class AbstractMessage
+// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV? classes to
+// interoperate (e.g., a GeneratedMessageV3 object has a message extension field whose class
+// type is GeneratedMessageV4), these classes still share a common parent class AbstractMessage
// and are using the same GeneratedMessage.GeneratedExtension class for extension definitions.
-// Since this class becomes GeneratedMessageV3V? in opensource, we have to add an import here
+// Since this class becomes GeneratedMessageV? in opensource, we have to add an import here
// to be able to use GeneratedMessage.GeneratedExtension. The GeneratedExtension definition in
// this file is also excluded from opensource to avoid conflict.
import com.google.protobuf.GeneratedMessage.GeneratedExtension;
diff --git a/java/core/src/main/java/com/google/protobuf/MapFieldLite.java b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
index 66ff592101c5e..66f5f46566ed1 100644
--- a/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
+++ b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
@@ -63,7 +63,7 @@ private MapFieldLite(Map mapData) {
EMPTY_MAP_FIELD.makeImmutable();
}
- /** Returns an singleton immutable empty MapFieldLite instance. */
+ /** Returns a singleton immutable empty MapFieldLite instance. */
@SuppressWarnings({"unchecked", "cast"})
public static MapFieldLite emptyMapField() {
return (MapFieldLite) EMPTY_MAP_FIELD;
diff --git a/java/core/src/main/java/com/google/protobuf/MessageLite.java b/java/core/src/main/java/com/google/protobuf/MessageLite.java
index 7d2ef33a17f0e..bbf30364b2353 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageLite.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageLite.java
@@ -73,6 +73,9 @@ public interface MessageLite extends MessageLiteOrBuilder {
/**
* Get the number of bytes required to encode this message. The result is only computed on the
* first call and memoized after that.
+ *
+ * If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will
+ * be smaller than the actual number of bytes required and might be negative.
*/
int getSerializedSize();
@@ -85,12 +88,18 @@ public interface MessageLite extends MessageLiteOrBuilder {
/**
* Serializes the message to a {@code ByteString} and returns it. This is just a trivial wrapper
* around {@link #writeTo(CodedOutputStream)}.
+ *
+ * If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
+ * unpredictable. It may throw a runtime exception or truncate or slice the data.
*/
ByteString toByteString();
/**
* Serializes the message to a {@code byte} array and returns it. This is just a trivial wrapper
* around {@link #writeTo(CodedOutputStream)}.
+ *
+ * If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
+ * unpredictable. It may throw a runtime exception or truncate or slice the data.
*/
byte[] toByteArray();
diff --git a/java/core/src/main/java/com/google/protobuf/SchemaUtil.java b/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
index 4c8bb06f041c5..a798599c8606e 100644
--- a/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
+++ b/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
@@ -63,7 +63,7 @@ public static void requireGeneratedMessage(Class> messageType) {
&& GENERATED_MESSAGE_CLASS != null
&& !GENERATED_MESSAGE_CLASS.isAssignableFrom(messageType)) {
throw new IllegalArgumentException(
- "Message classes must extend GeneratedMessage or GeneratedMessageLite");
+ "Message classes must extend GeneratedMessageV3 or GeneratedMessageLite");
}
}
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java
index e781df333d10f..21f1ff09d4699 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -445,9 +445,7 @@ private void printField(
}
/**
- * An adapter class that can take a MapEntry or a MutableMapEntry and returns its key and entry.
- * This class is created solely for the purpose of sorting map entries by its key and prevent
- * duplicated logic by having a separate comparator for MapEntry and MutableMapEntry.
+ * An adapter class that can take a {@link MapEntry} and returns its key and entry.
*/
private static class MapEntryAdapter implements Comparable {
private Object entry;
@@ -2360,6 +2358,9 @@ public static ByteString unescapeBytes(final CharSequence charString)
case '"':
result[pos++] = '\"';
break;
+ case '?':
+ result[pos++] = '?';
+ break;
case 'x':
// hex escape
diff --git a/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java b/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
index 18d90fe9d81d1..bb95e2a21146f 100644
--- a/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
+++ b/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
@@ -184,7 +184,7 @@ private void assertIsUnmodifiable(List> list) {
}
private RepeatedFieldBuilderV3
- newRepeatedFieldBuilderV3(GeneratedMessage.BuilderParent parent) {
+ newRepeatedFieldBuilderV3(AbstractMessage.BuilderParent parent) {
return new RepeatedFieldBuilderV3(
Collections.emptyList(), false, parent, false);
}
diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java
index 27d7e692fdac9..b4092687d919b 100644
--- a/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -3815,8 +3815,7 @@ public static ByteString readBytesFromFile(String filename) {
private static ByteString readBytesFromResource(String name) {
try {
- return ByteString.copyFrom(
- com.google.common.io.ByteStreams.toByteArray(TestUtil.class.getResourceAsStream(name)));
+ return ByteString.readFrom(TestUtil.class.getResourceAsStream(name));
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 69568e1df5e2a..e755111f0f9e8 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -34,6 +34,7 @@
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED;
import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED;
+import static org.junit.Assert.assertThrows;
import com.google.protobuf.DescriptorProtos.DescriptorProto;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
@@ -41,6 +42,7 @@
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.FileDescriptor;
+import com.google.protobuf.TextFormat.InvalidEscapeSequenceException;
import com.google.protobuf.TextFormat.Parser.SingularOverwritePolicy;
import com.google.protobuf.testing.proto.TestProto3Optional;
import com.google.protobuf.testing.proto.TestProto3Optional.NestedEnum;
@@ -61,6 +63,7 @@
import java.util.List;
import java.util.logging.Logger;
import org.junit.Test;
+import org.junit.function.ThrowingRunnable;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -596,9 +599,7 @@ private static Descriptor createDescriptorForAny(FieldDescriptorProto... fields)
.setPackage("google.protobuf")
.setSyntax("proto3")
.addMessageType(
- DescriptorProto.newBuilder()
- .setName("Any")
- .addAllField(Arrays.asList(fields)))
+ DescriptorProto.newBuilder().setName("Any").addAllField(Arrays.asList(fields)))
.build(),
new FileDescriptor[0]);
return fileDescriptor.getMessageTypes().get(0);
@@ -874,6 +875,11 @@ public void testParseErrors() throws Exception {
}
// =================================================================
+ @Test
+ public void testEscapeQuestionMark() throws InvalidEscapeSequenceException {
+ assertThat(TextFormat.unescapeText("?")).isEqualTo("?");
+ assertThat(TextFormat.unescapeText("\\?")).isEqualTo("?");
+ }
@Test
public void testEscape() throws Exception {
@@ -1231,6 +1237,36 @@ private void assertPrintFieldValue(String expect, Object value, String fieldName
assertThat(sb.toString()).isEqualTo(expect);
}
+ @Test
+ public void testPrintFieldValueThrows() throws Exception {
+ assertPrintFieldThrowsClassCastException(5, "repeated_string");
+ assertPrintFieldThrowsClassCastException(5L, "repeated_string");
+ assertPrintFieldThrowsClassCastException(ByteString.EMPTY, "repeated_string");
+ assertPrintFieldThrowsClassCastException(5, "repeated_float");
+ assertPrintFieldThrowsClassCastException(5D, "repeated_float");
+ assertPrintFieldThrowsClassCastException("text", "repeated_float");
+ assertPrintFieldThrowsClassCastException(5, "repeated_double");
+ assertPrintFieldThrowsClassCastException(5F, "repeated_double");
+ assertPrintFieldThrowsClassCastException("text", "repeated_double");
+ assertPrintFieldThrowsClassCastException(123L, "repeated_int32");
+ assertPrintFieldThrowsClassCastException(123, "repeated_int64");
+ assertPrintFieldThrowsClassCastException(1, "repeated_bytes");
+ }
+
+ private void assertPrintFieldThrowsClassCastException(final Object value, String fieldName)
+ throws Exception {
+ final StringBuilder stringBuilder = new StringBuilder();
+ final FieldDescriptor fieldDescriptor = TestAllTypes.getDescriptor().findFieldByName(fieldName);
+ assertThrows(
+ ClassCastException.class,
+ new ThrowingRunnable() {
+ @Override
+ public void run() throws Throwable {
+ TextFormat.printer().printFieldValue(fieldDescriptor, value, stringBuilder);
+ }
+ });
+ }
+
@Test
public void testShortDebugString() {
assertThat(
diff --git a/kokoro/linux/bazel/build.sh b/kokoro/linux/bazel/build.sh
index 1b4fb8d10a381..5ec92ce7e5b48 100755
--- a/kokoro/linux/bazel/build.sh
+++ b/kokoro/linux/bazel/build.sh
@@ -22,9 +22,11 @@ cd $(dirname $0)/../../..
git submodule update --init --recursive
+# Disabled for now, re-enable if appropriate.
+# //:build_files_updated_unittest \
+
trap print_test_logs EXIT
bazel test -k --copt=-Werror --host_copt=-Werror \
- //:build_files_updated_unittest \
//java:tests \
//:protoc \
//:protobuf \
diff --git a/kokoro/linux/dockerfile/test/python27/Dockerfile b/kokoro/linux/dockerfile/test/python27/Dockerfile
deleted file mode 100644
index 6b0eaf72c8626..0000000000000
--- a/kokoro/linux/dockerfile/test/python27/Dockerfile
+++ /dev/null
@@ -1,31 +0,0 @@
-FROM python:2.7-buster
-
-# Install dependencies. We start with the basic ones require to build protoc
-# and the C++ build
-RUN apt-get update && apt-get install -y \
- autoconf \
- autotools-dev \
- build-essential \
- bzip2 \
- ccache \
- curl \
- gcc \
- git \
- libc6 \
- libc6-dbg \
- libc6-dev \
- libgtest-dev \
- libtool \
- make \
- parallel \
- time \
- wget \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
-
-# Install Python libraries.
-RUN python -m pip install --no-cache-dir --upgrade \
- pip \
- setuptools \
- tox \
- wheel
diff --git a/objectivec/GPBStruct.pbobjc.h b/objectivec/GPBStruct.pbobjc.h
index e36df3f1a3a1e..abdd6c82be379 100644
--- a/objectivec/GPBStruct.pbobjc.h
+++ b/objectivec/GPBStruct.pbobjc.h
@@ -128,8 +128,8 @@ typedef GPB_ENUM(GPBValue_Kind_OneOfCase) {
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
- * list of values. A producer of value is expected to set one of that
- * variants, absence of any variant indicates an error.
+ * list of values. A producer of value is expected to set one of these
+ * variants. Absence of any variant indicates an error.
*
* The JSON representation for `Value` is JSON value.
**/
diff --git a/php/src/Google/Protobuf/Value.php b/php/src/Google/Protobuf/Value.php
index 7bebb998843bf..dcc0bdf7c4297 100644
--- a/php/src/Google/Protobuf/Value.php
+++ b/php/src/Google/Protobuf/Value.php
@@ -11,8 +11,8 @@
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
- * list of values. A producer of value is expected to set one of that
- * variants, absence of any variant indicates an error.
+ * list of values. A producer of value is expected to set one of these
+ * variants. Absence of any variant indicates an error.
* The JSON representation for `Value` is JSON value.
*
* Generated from protobuf message google.protobuf.Value
diff --git a/python/README.md b/python/README.md
index 31e649c7150c4..f0c9ce4f44d36 100644
--- a/python/README.md
+++ b/python/README.md
@@ -26,7 +26,7 @@ use python c++ implementation.
Installation
============
-1) Make sure you have Python 2.7 or newer. If in doubt, run:
+1) Make sure you have Python 3.5 or newer. If in doubt, run:
$ python -V
diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py
index 70fdae16ff4d1..0f7bd1744328f 100644
--- a/python/google/protobuf/descriptor.py
+++ b/python/google/protobuf/descriptor.py
@@ -36,7 +36,6 @@
import threading
import warnings
-import six
from google.protobuf.internal import api_implementation
@@ -111,7 +110,7 @@ def _Deprecated(name):
_internal_create_key = object()
-class DescriptorBase(six.with_metaclass(DescriptorMetaclass)):
+class DescriptorBase(metaclass=DescriptorMetaclass):
"""Descriptors base class.
diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py
index de9100b09ca59..a6955ce81e855 100644
--- a/python/google/protobuf/descriptor_pool.py
+++ b/python/google/protobuf/descriptor_pool.py
@@ -207,13 +207,18 @@ def AddSerializedFile(self, serialized_file_desc_proto):
Args:
serialized_file_desc_proto (bytes): A bytes string, serialization of the
:class:`FileDescriptorProto` to add.
+
+ Returns:
+ FileDescriptor: Descriptor for the added file.
"""
# pylint: disable=g-import-not-at-top
from google.protobuf import descriptor_pb2
file_desc_proto = descriptor_pb2.FileDescriptorProto.FromString(
serialized_file_desc_proto)
- self.Add(file_desc_proto)
+ file_desc = self._ConvertFileProtoToFileDescriptor(file_desc_proto)
+ file_desc.serialized_pb = serialized_file_desc_proto
+ return file_desc
# Add Descriptor to descriptor pool is dreprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@@ -808,7 +813,6 @@ def _ConvertFileProtoToFileDescriptor(self, file_proto):
self._MakeServiceDescriptor(service_proto, index, scope,
file_proto.package, file_descriptor))
- self.Add(file_proto)
self._file_descriptors[file_proto.name] = file_descriptor
# Add extensions to the pool
@@ -865,11 +869,17 @@ def _ConvertMessageDescriptor(self, desc_proto, package=None, file_desc=None,
for index, extension in enumerate(desc_proto.extension)]
oneofs = [
# pylint: disable=g-complex-comprehension
- descriptor.OneofDescriptor(desc.name, '.'.join((desc_name, desc.name)),
- index, None, [], desc.options,
- # pylint: disable=protected-access
- create_key=descriptor._internal_create_key)
- for index, desc in enumerate(desc_proto.oneof_decl)]
+ descriptor.OneofDescriptor(
+ desc.name,
+ '.'.join((desc_name, desc.name)),
+ index,
+ None,
+ [],
+ _OptionsOrNone(desc),
+ # pylint: disable=protected-access
+ create_key=descriptor._internal_create_key)
+ for index, desc in enumerate(desc_proto.oneof_decl)
+ ]
extension_ranges = [(r.start, r.end) for r in desc_proto.extension_range]
if extension_ranges:
is_extendable = True
@@ -987,6 +997,11 @@ def _MakeFieldDescriptor(self, field_proto, message_name, index,
else:
full_name = field_proto.name
+ if field_proto.json_name:
+ json_name = field_proto.json_name
+ else:
+ json_name = None
+
return descriptor.FieldDescriptor(
name=field_proto.name,
full_name=full_name,
@@ -1003,6 +1018,7 @@ def _MakeFieldDescriptor(self, field_proto, message_name, index,
is_extension=is_extension,
extension_scope=None,
options=_OptionsOrNone(field_proto),
+ json_name=json_name,
file=file_desc,
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
@@ -1107,6 +1123,8 @@ def _SetFieldType(self, field_proto, field_desc, package, scope):
field_desc.default_value = b''
elif field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE:
field_desc.default_value = None
+ elif field_proto.type == descriptor.FieldDescriptor.TYPE_GROUP:
+ field_desc.default_value = None
else:
# All other types are of the "int" type.
field_desc.default_value = 0
diff --git a/python/google/protobuf/internal/__init__.py b/python/google/protobuf/internal/__init__.py
index 7d2e571a143a5..e69de29bb2d1d 100644
--- a/python/google/protobuf/internal/__init__.py
+++ b/python/google/protobuf/internal/__init__.py
@@ -1,30 +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.
-
diff --git a/python/google/protobuf/internal/_parameterized.py b/python/google/protobuf/internal/_parameterized.py
index 4cba1d479d740..287ba689bf2dc 100755
--- a/python/google/protobuf/internal/_parameterized.py
+++ b/python/google/protobuf/internal/_parameterized.py
@@ -154,8 +154,6 @@ def testIsNegative(self, arg):
import unittest
import uuid
-import six
-
try:
# Since python 3
import collections.abc as collections_abc
@@ -181,7 +179,7 @@ def _StrClass(cls):
def _NonStringIterable(obj):
return (isinstance(obj, collections_abc.Iterable) and not
- isinstance(obj, six.string_types))
+ isinstance(obj, str))
def _FormatParameterList(testcase_params):
diff --git a/python/google/protobuf/internal/decoder.py b/python/google/protobuf/internal/decoder.py
index 6804986b6ebe2..bc1b7b785cf0f 100644
--- a/python/google/protobuf/internal/decoder.py
+++ b/python/google/protobuf/internal/decoder.py
@@ -80,16 +80,8 @@
__author__ = 'kenton@google.com (Kenton Varda)'
+import math
import struct
-import sys
-import six
-
-_UCS2_MAXUNICODE = 65535
-if six.PY3:
- long = int
-else:
- import re # pylint: disable=g-import-not-at-top
- _SURROGATE_PATTERN = re.compile(six.u(r'[\ud800-\udfff]'))
from google.protobuf.internal import containers
from google.protobuf.internal import encoder
@@ -97,13 +89,6 @@
from google.protobuf import message
-# This will overflow and thus become IEEE-754 "infinity". We would use
-# "float('inf')" but it doesn't work on Windows pre-Python-2.6.
-_POS_INF = 1e10000
-_NEG_INF = -_POS_INF
-_NAN = _POS_INF * 0
-
-
# This is not for optimization, but rather to avoid conflicts with local
# variables named "message".
_DecodeError = message.DecodeError
@@ -123,7 +108,7 @@ def DecodeVarint(buffer, pos):
result = 0
shift = 0
while 1:
- b = six.indexbytes(buffer, pos)
+ b = buffer[pos]
result |= ((b & 0x7f) << shift)
pos += 1
if not (b & 0x80):
@@ -146,7 +131,7 @@ def DecodeVarint(buffer, pos):
result = 0
shift = 0
while 1:
- b = six.indexbytes(buffer, pos)
+ b = buffer[pos]
result |= ((b & 0x7f) << shift)
pos += 1
if not (b & 0x80):
@@ -159,12 +144,9 @@ def DecodeVarint(buffer, pos):
raise _DecodeError('Too many bytes when decoding varint.')
return DecodeVarint
-# We force 32-bit values to int and 64-bit values to long to make
-# alternate implementations where the distinction is more significant
-# (e.g. the C++ implementation) simpler.
-
-_DecodeVarint = _VarintDecoder((1 << 64) - 1, long)
-_DecodeSignedVarint = _SignedVarintDecoder(64, long)
+# All 32-bit and 64-bit values are represented as int.
+_DecodeVarint = _VarintDecoder((1 << 64) - 1, int)
+_DecodeSignedVarint = _SignedVarintDecoder(64, int)
# Use these versions for values which must be limited to 32 bits.
_DecodeVarint32 = _VarintDecoder((1 << 32) - 1, int)
@@ -189,7 +171,7 @@ def ReadTag(buffer, pos):
Tuple[bytes, int] of the tag data and new position.
"""
start = pos
- while six.indexbytes(buffer, pos) & 0x80:
+ while buffer[pos] & 0x80:
pos += 1
pos += 1
@@ -333,11 +315,11 @@ def InnerDecode(buffer, pos):
if (float_bytes[3:4] in b'\x7F\xFF' and float_bytes[2:3] >= b'\x80'):
# If at least one significand bit is set...
if float_bytes[0:3] != b'\x00\x00\x80':
- return (_NAN, new_pos)
+ return (math.nan, new_pos)
# If sign bit is set...
if float_bytes[3:4] == b'\xFF':
- return (_NEG_INF, new_pos)
- return (_POS_INF, new_pos)
+ return (-math.inf, new_pos)
+ return (math.inf, new_pos)
# Note that we expect someone up-stack to catch struct.error and convert
# it to _DecodeError -- this way we don't have to set up exception-
@@ -377,7 +359,7 @@ def InnerDecode(buffer, pos):
if ((double_bytes[7:8] in b'\x7F\xFF')
and (double_bytes[6:7] >= b'\xF0')
and (double_bytes[0:7] != b'\x00\x00\x00\x00\x00\x00\xF0')):
- return (_NAN, new_pos)
+ return (math.nan, new_pos)
# Note that we expect someone up-stack to catch struct.error and convert
# it to _DecodeError -- this way we don't have to set up exception-
@@ -559,31 +541,21 @@ def DecodeField(buffer, pos, end, message, field_dict):
def StringDecoder(field_number, is_repeated, is_packed, key, new_default,
- is_strict_utf8=False, clear_if_default=False):
+ clear_if_default=False):
"""Returns a decoder for a string field."""
local_DecodeVarint = _DecodeVarint
- local_unicode = six.text_type
def _ConvertToUnicode(memview):
"""Convert byte to unicode."""
byte_str = memview.tobytes()
try:
- value = local_unicode(byte_str, 'utf-8')
+ value = str(byte_str, 'utf-8')
except UnicodeDecodeError as e:
# add more information to the error message and re-raise it.
e.reason = '%s in field: %s' % (e, key.full_name)
raise
- if is_strict_utf8 and six.PY2 and sys.maxunicode > _UCS2_MAXUNICODE:
- # Only do the check for python2 ucs4 when is_strict_utf8 enabled
- if _SURROGATE_PATTERN.search(value):
- reason = ('String field %s contains invalid UTF-8 data when parsing'
- 'a protocol buffer: surrogates not allowed. Use'
- 'the bytes type if you intend to send raw bytes.') % (
- key.full_name)
- raise message.DecodeError(reason)
-
return value
assert not is_packed
diff --git a/python/google/protobuf/internal/descriptor_database_test.py b/python/google/protobuf/internal/descriptor_database_test.py
old mode 100755
new mode 100644
index 619779a5dd43b..ad3ca645f929f
--- a/python/google/protobuf/internal/descriptor_database_test.py
+++ b/python/google/protobuf/internal/descriptor_database_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -34,10 +32,7 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
import warnings
from google.protobuf import unittest_pb2
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
old mode 100755
new mode 100644
index fed82bfc7ab79..e59cf9b97e123
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -36,13 +34,9 @@
import copy
import os
+import unittest
import warnings
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
-
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_import_public_pb2
from google.protobuf import unittest_pb2
@@ -407,9 +401,19 @@ def testAddSerializedFile(self):
# TODO(jieluo): Fix python and cpp extension diff.
return
self.pool = descriptor_pool.DescriptorPool()
- self.pool.AddSerializedFile(self.factory_test1_fd.SerializeToString())
- self.pool.AddSerializedFile(self.factory_test2_fd.SerializeToString())
+ file1 = self.pool.AddSerializedFile(
+ self.factory_test1_fd.SerializeToString())
+ file2 = self.pool.AddSerializedFile(
+ self.factory_test2_fd.SerializeToString())
+ self.assertEqual(file1.name,
+ 'google/protobuf/internal/factory_test1.proto')
+ self.assertEqual(file2.name,
+ 'google/protobuf/internal/factory_test2.proto')
self.testFindMessageTypeByName()
+ file_json = self.pool.AddSerializedFile(
+ more_messages_pb2.DESCRIPTOR.serialized_pb)
+ field = file_json.message_types_by_name['class'].fields_by_name['int_field']
+ self.assertEqual(field.json_name, 'json_int')
def testEnumDefaultValue(self):
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
old mode 100755
new mode 100644
index 4fc80492b8fca..88d7136bc86ab
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -34,14 +32,9 @@
__author__ = 'robinson@google.com (Will Robinson)'
-import sys
+import unittest
import warnings
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
-
from google.protobuf import unittest_custom_options_pb2
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
@@ -582,10 +575,7 @@ def CheckDescriptorMapping(self, mapping):
self.assertEqual(mapping, mapping)
self.assertGreater(len(mapping), 0) # Sized
self.assertEqual(len(mapping), len(excepted_dict)) # Iterable
- if sys.version_info >= (3,):
- key, item = next(iter(mapping.items()))
- else:
- key, item = mapping.items()[0]
+ key, item = next(iter(mapping.items()))
self.assertIn(key, mapping) # Container
self.assertEqual(mapping.get(key), item)
with self.assertRaises(TypeError):
@@ -598,13 +588,6 @@ def CheckDescriptorMapping(self, mapping):
# keys(), iterkeys() &co
item = (next(iter(mapping.keys())), next(iter(mapping.values())))
self.assertEqual(item, next(iter(mapping.items())))
- if sys.version_info < (3,):
- def CheckItems(seq, iterator):
- self.assertEqual(next(iterator), seq[0])
- self.assertEqual(list(iterator), seq[1:])
- CheckItems(mapping.keys(), mapping.iterkeys())
- CheckItems(mapping.values(), mapping.itervalues())
- CheckItems(mapping.items(), mapping.iteritems())
excepted_dict[key] = 'change value'
self.assertNotEqual(mapping, excepted_dict)
del excepted_dict[key]
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index 0c016f3cfafd2..4b4f652f2516e 100644
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -68,8 +68,6 @@
import struct
-import six
-
from google.protobuf.internal import wire_format
@@ -372,7 +370,8 @@ def FieldSize(map_value):
def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
- local_int2byte = six.int2byte
+ local_int2byte = struct.Struct('>B').pack
+
def EncodeVarint(write, value, unused_deterministic=None):
bits = value & 0x7f
value >>= 7
@@ -389,7 +388,8 @@ def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
- local_int2byte = six.int2byte
+ local_int2byte = struct.Struct('>B').pack
+
def EncodeSignedVarint(write, value, unused_deterministic=None):
if value < 0:
value += (1 << 64)
@@ -420,8 +420,7 @@ def _VarintBytes(value):
def TagBytes(field_number, wire_type):
"""Encode the given tag and return the bytes. Only called at startup."""
- return six.binary_type(
- _VarintBytes(wire_format.PackTag(field_number, wire_type)))
+ return bytes(_VarintBytes(wire_format.PackTag(field_number, wire_type)))
# --------------------------------------------------------------------
# As with sizers (see above), we have a number of common encoder
diff --git a/python/google/protobuf/internal/enum_type_wrapper.py b/python/google/protobuf/internal/enum_type_wrapper.py
index 9ae0066584990..9a53999a43088 100644
--- a/python/google/protobuf/internal/enum_type_wrapper.py
+++ b/python/google/protobuf/internal/enum_type_wrapper.py
@@ -37,8 +37,6 @@
__author__ = 'rabsatt@google.com (Kevin Rabsatt)'
-import six
-
class EnumTypeWrapper(object):
"""A utility for finding the names of enum values."""
@@ -57,7 +55,7 @@ def Name(self, number): # pylint: disable=invalid-name
except KeyError:
pass # fall out to break exception chaining
- if not isinstance(number, six.integer_types):
+ if not isinstance(number, int):
raise TypeError(
'Enum value for {} must be an int, but got {} {!r}.'.format(
self._enum_type.name, type(number), number))
diff --git a/python/google/protobuf/internal/generator_test.py b/python/google/protobuf/internal/generator_test.py
old mode 100755
new mode 100644
index ab16d175d2495..0c4299a3d1108
--- a/python/google/protobuf/internal/generator_test.py
+++ b/python/google/protobuf/internal/generator_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
old mode 100755
new mode 100644
index 0f2727e9caaa3..af3713fcb5a2d
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -37,12 +35,8 @@
import json
import math
import struct
-import sys
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import any_pb2
from google.protobuf import duration_pb2
@@ -296,11 +290,8 @@ def testExtensionSerializationJsonMatchesProto3Spec(self):
def testJsonEscapeString(self):
message = json_format_proto3_pb2.TestMessage()
- if sys.version_info[0] < 3:
- message.string_value = '&\n<\"\r>\b\t\f\\\001/\xe2\x80\xa8\xe2\x80\xa9'
- else:
- message.string_value = '&\n<\"\r>\b\t\f\\\001/'
- message.string_value += (b'\xe2\x80\xa8\xe2\x80\xa9').decode('utf-8')
+ message.string_value = '&\n<\"\r>\b\t\f\\\001/'
+ message.string_value += (b'\xe2\x80\xa8\xe2\x80\xa9').decode('utf-8')
self.assertEqual(
json_format.MessageToJson(message),
'{\n "stringValue": '
@@ -1039,8 +1030,6 @@ def testInvalidMap(self):
json_format.ParseError,
'Failed to parse boolMap field: Expected "true" or "false", not null.',
json_format.Parse, text, message)
- if sys.version_info < (2, 7):
- return
text = r'{"stringMap": {"a": 3, "\u0061": 2}}'
self.assertRaisesRegexp(
json_format.ParseError,
diff --git a/python/google/protobuf/internal/keywords_test.py b/python/google/protobuf/internal/keywords_test.py
old mode 100755
new mode 100644
index 87449280a7f3c..4182cf6be2286
--- a/python/google/protobuf/internal/keywords_test.py
+++ b/python/google/protobuf/internal/keywords_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/message_factory_test.py b/python/google/protobuf/internal/message_factory_test.py
old mode 100755
new mode 100644
index 42f91b2365bf9..97ef3aab52ab1
--- a/python/google/protobuf/internal/message_factory_test.py
+++ b/python/google/protobuf/internal/message_factory_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -34,10 +32,7 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import descriptor_pb2
from google.protobuf.internal import api_implementation
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
old mode 100755
new mode 100644
index 77122a2875f98..6ed1f20ef5f4d
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
# -*- coding: utf-8 -*-
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -44,31 +42,17 @@
__author__ = 'gps@google.com (Gregory P. Smith)'
-
+import collections
import copy
import math
import operator
import pickle
import pydoc
-import six
import sys
+import unittest
import warnings
-try:
- # Since python 3
- import collections.abc as collections_abc
-except ImportError:
- # Won't work after python 3.8
- import collections as collections_abc
-
-try:
- import unittest2 as unittest # PY26
-except ImportError:
- import unittest
-try:
- cmp # Python 2
-except NameError:
- cmp = lambda x, y: (x > y) - (x < y) # Python 3
+cmp = lambda x, y: (x > y) - (x < y)
from google.protobuf import map_proto2_unittest_pb2
from google.protobuf import map_unittest_pb2
@@ -89,22 +73,6 @@
from google.protobuf.internal import _parameterized
UCS2_MAXUNICODE = 65535
-if six.PY3:
- long = int
-
-
-# Python pre-2.6 does not have isinf() or isnan() functions, so we have
-# to provide our own.
-def isnan(val):
- # NaN is never equal to itself.
- return val != val
-def isinf(val):
- # Infinity times zero equals NaN.
- return not isnan(val) and isnan(val * 0)
-def IsPosInf(val):
- return isinf(val) and (val > 0)
-def IsNegInf(val):
- return isinf(val) and (val < 0)
warnings.simplefilter('error', DeprecationWarning)
@@ -243,10 +211,10 @@ def testPositiveInfinity(self, message_module):
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(IsPosInf(golden_message.optional_float))
- self.assertTrue(IsPosInf(golden_message.optional_double))
- self.assertTrue(IsPosInf(golden_message.repeated_float[0]))
- self.assertTrue(IsPosInf(golden_message.repeated_double[0]))
+ self.assertEqual(golden_message.optional_float, math.inf)
+ self.assertEqual(golden_message.optional_double, math.inf)
+ self.assertEqual(golden_message.repeated_float[0], math.inf)
+ self.assertEqual(golden_message.repeated_double[0], math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNegativeInfinity(self, message_module):
@@ -263,10 +231,10 @@ def testNegativeInfinity(self, message_module):
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(IsNegInf(golden_message.optional_float))
- self.assertTrue(IsNegInf(golden_message.optional_double))
- self.assertTrue(IsNegInf(golden_message.repeated_float[0]))
- self.assertTrue(IsNegInf(golden_message.repeated_double[0]))
+ self.assertEqual(golden_message.optional_float, -math.inf)
+ self.assertEqual(golden_message.optional_double, -math.inf)
+ self.assertEqual(golden_message.repeated_float[0], -math.inf)
+ self.assertEqual(golden_message.repeated_double[0], -math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNotANumber(self, message_module):
@@ -276,10 +244,10 @@ def testNotANumber(self, message_module):
b'\xD1\x02\x00\x00\x00\x00\x00\x00\xF8\x7F')
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(isnan(golden_message.optional_float))
- self.assertTrue(isnan(golden_message.optional_double))
- self.assertTrue(isnan(golden_message.repeated_float[0]))
- self.assertTrue(isnan(golden_message.repeated_double[0]))
+ self.assertTrue(math.isnan(golden_message.optional_float))
+ self.assertTrue(math.isnan(golden_message.optional_double))
+ self.assertTrue(math.isnan(golden_message.repeated_float[0]))
+ self.assertTrue(math.isnan(golden_message.repeated_double[0]))
# The protocol buffer may serialize to any one of multiple different
# representations of a NaN. Rather than verify a specific representation,
@@ -288,18 +256,18 @@ def testNotANumber(self, message_module):
serialized = golden_message.SerializeToString()
message = message_module.TestAllTypes()
message.ParseFromString(serialized)
- self.assertTrue(isnan(message.optional_float))
- self.assertTrue(isnan(message.optional_double))
- self.assertTrue(isnan(message.repeated_float[0]))
- self.assertTrue(isnan(message.repeated_double[0]))
+ self.assertTrue(math.isnan(message.optional_float))
+ self.assertTrue(math.isnan(message.optional_double))
+ self.assertTrue(math.isnan(message.repeated_float[0]))
+ self.assertTrue(math.isnan(message.repeated_double[0]))
def testPositiveInfinityPacked(self, message_module):
golden_data = (b'\xA2\x06\x04\x00\x00\x80\x7F'
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(IsPosInf(golden_message.packed_float[0]))
- self.assertTrue(IsPosInf(golden_message.packed_double[0]))
+ self.assertEqual(golden_message.packed_float[0], math.inf)
+ self.assertEqual(golden_message.packed_double[0], math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNegativeInfinityPacked(self, message_module):
@@ -307,8 +275,8 @@ def testNegativeInfinityPacked(self, message_module):
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(IsNegInf(golden_message.packed_float[0]))
- self.assertTrue(IsNegInf(golden_message.packed_double[0]))
+ self.assertEqual(golden_message.packed_float[0], -math.inf)
+ self.assertEqual(golden_message.packed_double[0], -math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNotANumberPacked(self, message_module):
@@ -316,14 +284,14 @@ def testNotANumberPacked(self, message_module):
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF8\x7F')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
- self.assertTrue(isnan(golden_message.packed_float[0]))
- self.assertTrue(isnan(golden_message.packed_double[0]))
+ self.assertTrue(math.isnan(golden_message.packed_float[0]))
+ self.assertTrue(math.isnan(golden_message.packed_double[0]))
serialized = golden_message.SerializeToString()
message = message_module.TestPackedTypes()
message.ParseFromString(serialized)
- self.assertTrue(isnan(message.packed_float[0]))
- self.assertTrue(isnan(message.packed_double[0]))
+ self.assertTrue(math.isnan(message.packed_float[0]))
+ self.assertTrue(math.isnan(message.packed_double[0]))
def testExtremeFloatValues(self, message_module):
message = message_module.TestAllTypes()
@@ -451,10 +419,7 @@ def testHighPrecisionFloatPrinting(self, message_module):
def testHighPrecisionDoublePrinting(self, message_module):
msg = message_module.TestAllTypes()
msg.optional_double = 0.12345678912345678
- if sys.version_info >= (3,):
- self.assertEqual(str(msg), 'optional_double: 0.12345678912345678\n')
- else:
- self.assertEqual(str(msg), 'optional_double: 0.123456789123\n')
+ self.assertEqual(str(msg), 'optional_double: 0.12345678912345678\n')
def testUnknownFieldPrinting(self, message_module):
populated = message_module.TestAllTypes()
@@ -694,7 +659,6 @@ def testRepeatedCompositeFieldSortArguments(self, message_module):
message = message_module.TestAllTypes()
get_bb = operator.attrgetter('bb')
- cmp_bb = lambda a, b: cmp(a.bb, b.bb)
message.repeated_nested_message.add().bb = 1
message.repeated_nested_message.add().bb = 3
message.repeated_nested_message.add().bb = 2
@@ -707,13 +671,6 @@ def testRepeatedCompositeFieldSortArguments(self, message_module):
message.repeated_nested_message.sort(key=get_bb, reverse=True)
self.assertEqual([k.bb for k in message.repeated_nested_message],
[6, 5, 4, 3, 2, 1])
- if sys.version_info >= (3,): return # No cmp sorting in PY3.
- message.repeated_nested_message.sort(sort_function=cmp_bb)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [1, 2, 3, 4, 5, 6])
- message.repeated_nested_message.sort(cmp=cmp_bb, reverse=True)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [6, 5, 4, 3, 2, 1])
def testRepeatedScalarFieldSortArguments(self, message_module):
"""Check sorting a scalar field using list.sort() arguments."""
@@ -726,12 +683,6 @@ def testRepeatedScalarFieldSortArguments(self, message_module):
self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
message.repeated_int32.sort(key=abs, reverse=True)
self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
- if sys.version_info < (3,): # No cmp sorting in PY3.
- abs_cmp = lambda a, b: cmp(abs(a), abs(b))
- message.repeated_int32.sort(sort_function=abs_cmp)
- self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
- message.repeated_int32.sort(cmp=abs_cmp, reverse=True)
- self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
message.repeated_string.append('aaa')
message.repeated_string.append('bb')
@@ -740,12 +691,6 @@ def testRepeatedScalarFieldSortArguments(self, message_module):
self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
message.repeated_string.sort(key=len, reverse=True)
self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
- if sys.version_info < (3,): # No cmp sorting in PY3.
- len_cmp = lambda a, b: cmp(len(a), len(b))
- message.repeated_string.sort(sort_function=len_cmp)
- self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
- message.repeated_string.sort(cmp=len_cmp, reverse=True)
- self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
def testRepeatedFieldsComparable(self, message_module):
m1 = message_module.TestAllTypes()
@@ -763,30 +708,11 @@ def testRepeatedFieldsComparable(self, message_module):
m2.repeated_nested_message.add().bb = 2
m2.repeated_nested_message.add().bb = 3
- if sys.version_info >= (3,): return # No cmp() in PY3.
-
- # These comparisons should not raise errors.
- _ = m1 < m2
- _ = m1.repeated_nested_message < m2.repeated_nested_message
-
- # Make sure cmp always works. If it wasn't defined, these would be
- # id() comparisons and would all fail.
- self.assertEqual(cmp(m1, m2), 0)
- self.assertEqual(cmp(m1.repeated_int32, m2.repeated_int32), 0)
- self.assertEqual(cmp(m1.repeated_int32, [0, 1, 2]), 0)
- self.assertEqual(cmp(m1.repeated_nested_message,
- m2.repeated_nested_message), 0)
- with self.assertRaises(TypeError):
- # Can't compare repeated composite containers to lists.
- cmp(m1.repeated_nested_message, m2.repeated_nested_message[:])
-
- # TODO(anuraag): Implement extensiondict comparison in C++ and then add test
-
def testRepeatedFieldsAreSequences(self, message_module):
m = message_module.TestAllTypes()
- self.assertIsInstance(m.repeated_int32, collections_abc.MutableSequence)
+ self.assertIsInstance(m.repeated_int32, collections.abc.MutableSequence)
self.assertIsInstance(m.repeated_nested_message,
- collections_abc.MutableSequence)
+ collections.abc.MutableSequence)
def testRepeatedFieldsNotHashable(self, message_module):
m = message_module.TestAllTypes()
@@ -860,8 +786,8 @@ def testMergeFromStringUsingMemoryView(self, message_module):
# that a sub-sliced memoryview is not being used.
self.assertIsInstance(m1.optional_bytes, bytes)
self.assertIsInstance(m1.repeated_bytes[0], bytes)
- self.assertIsInstance(m1.optional_string, six.text_type)
- self.assertIsInstance(m1.repeated_string[0], six.text_type)
+ self.assertIsInstance(m1.optional_string, str)
+ self.assertIsInstance(m1.repeated_string[0], str)
def testMergeFromEmpty(self, message_module):
m1 = message_module.TestAllTypes()
@@ -1049,10 +975,10 @@ def testAssignByteStringToUnicodeField(self, message_module):
in the value being converted to a Unicode string."""
m = message_module.TestAllTypes()
m.optional_string = str('')
- self.assertIsInstance(m.optional_string, six.text_type)
+ self.assertIsInstance(m.optional_string, str)
def testLongValuedSlice(self, message_module):
- """It should be possible to use long-valued indices in slices.
+ """It should be possible to use int-valued indices in slices.
This didn't used to work in the v2 C++ implementation.
"""
@@ -1060,12 +986,12 @@ def testLongValuedSlice(self, message_module):
# Repeated scalar
m.repeated_int32.append(1)
- sl = m.repeated_int32[long(0):long(len(m.repeated_int32))]
+ sl = m.repeated_int32[int(0):int(len(m.repeated_int32))]
self.assertEqual(len(m.repeated_int32), len(sl))
# Repeated composite
m.repeated_nested_message.add().bb = 3
- sl = m.repeated_nested_message[long(0):long(len(m.repeated_nested_message))]
+ sl = m.repeated_nested_message[int(0):int(len(m.repeated_nested_message))]
self.assertEqual(len(m.repeated_nested_message), len(sl))
def testExtendShouldNotSwallowExceptions(self, message_module):
@@ -1794,7 +1720,7 @@ def testScalarMapDefaults(self):
self.assertTrue(111 in msg.map_int32_bytes)
self.assertTrue(888 in msg.map_int32_enum)
- self.assertIsInstance(msg.map_string_string['abc'], six.text_type)
+ self.assertIsInstance(msg.map_string_string['abc'], str)
# Accessing an unset key still throws TypeError if the type of the key
# is incorrect.
@@ -1909,8 +1835,8 @@ def testStringUnicodeConversionInMap(self):
self.assertEqual(key, unicode_obj)
self.assertEqual(value, unicode_obj)
- self.assertIsInstance(key, six.text_type)
- self.assertIsInstance(value, six.text_type)
+ self.assertIsInstance(key, str)
+ self.assertIsInstance(value, str)
def testMessageMap(self):
msg = map_unittest_pb2.TestMap()
@@ -2110,7 +2036,7 @@ def testMergeFromBadType(self):
with self.assertRaisesRegexp(
TypeError,
r'Parameter to MergeFrom\(\) must be instance of same class: expected '
- r'.*TestMap got int\.'):
+ r'.+TestMap got int\.'):
msg.MergeFrom(1)
def testCopyFromBadType(self):
@@ -2118,15 +2044,15 @@ def testCopyFromBadType(self):
with self.assertRaisesRegexp(
TypeError,
r'Parameter to [A-Za-z]*From\(\) must be instance of same class: '
- r'expected .*TestMap got int\.'):
+ r'expected .+TestMap got int\.'):
msg.CopyFrom(1)
def testIntegerMapWithLongs(self):
msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[long(-123)] = long(-456)
- msg.map_int64_int64[long(-2**33)] = long(-2**34)
- msg.map_uint32_uint32[long(123)] = long(456)
- msg.map_uint64_uint64[long(2**33)] = long(2**34)
+ msg.map_int32_int32[int(-123)] = int(-456)
+ msg.map_int64_int64[int(-2**33)] = int(-2**34)
+ msg.map_uint32_uint32[int(123)] = int(456)
+ msg.map_uint64_uint64[int(2**33)] = int(2**34)
serialized = msg.SerializeToString()
msg2 = map_unittest_pb2.TestMap()
@@ -2238,54 +2164,6 @@ def testMapIteration(self):
matching_dict = {2: 4, 3: 6, 4: 8}
self.assertMapIterEquals(msg.map_int32_int32.items(), matching_dict)
- def testPython2Map(self):
- if sys.version_info < (3,):
- msg = map_unittest_pb2.TestMap()
- msg.map_int32_int32[2] = 4
- msg.map_int32_int32[3] = 6
- msg.map_int32_int32[4] = 8
- msg.map_int32_int32[5] = 10
- map_int32 = msg.map_int32_int32
- self.assertEqual(4, len(map_int32))
- msg2 = map_unittest_pb2.TestMap()
- msg2.ParseFromString(msg.SerializeToString())
-
- def CheckItems(seq, iterator):
- self.assertEqual(next(iterator), seq[0])
- self.assertEqual(list(iterator), seq[1:])
-
- CheckItems(map_int32.items(), map_int32.iteritems())
- CheckItems(map_int32.keys(), map_int32.iterkeys())
- CheckItems(map_int32.values(), map_int32.itervalues())
-
- self.assertEqual(6, map_int32.get(3))
- self.assertEqual(None, map_int32.get(999))
- self.assertEqual(6, map_int32.pop(3))
- self.assertEqual(0, map_int32.pop(3))
- self.assertEqual(3, len(map_int32))
- key, value = map_int32.popitem()
- self.assertEqual(2 * key, value)
- self.assertEqual(2, len(map_int32))
- map_int32.clear()
- self.assertEqual(0, len(map_int32))
-
- with self.assertRaises(KeyError):
- map_int32.popitem()
-
- self.assertEqual(0, map_int32.setdefault(2))
- self.assertEqual(1, len(map_int32))
-
- map_int32.update(msg2.map_int32_int32)
- self.assertEqual(4, len(map_int32))
-
- with self.assertRaises(TypeError):
- map_int32.update(msg2.map_int32_int32,
- msg2.map_int32_int32)
- with self.assertRaises(TypeError):
- map_int32.update(0)
- with self.assertRaises(TypeError):
- map_int32.update(value=12)
-
def testMapItems(self):
# Map items used to have strange behaviors when use c extension. Because
# [] may reorder the map and invalidate any exsting iterators.
@@ -2457,11 +2335,12 @@ def testMapDelete(self):
def testMapsAreMapping(self):
msg = map_unittest_pb2.TestMap()
- self.assertIsInstance(msg.map_int32_int32, collections_abc.Mapping)
- self.assertIsInstance(msg.map_int32_int32, collections_abc.MutableMapping)
- self.assertIsInstance(msg.map_int32_foreign_message, collections_abc.Mapping)
+ self.assertIsInstance(msg.map_int32_int32, collections.abc.Mapping)
+ self.assertIsInstance(msg.map_int32_int32, collections.abc.MutableMapping)
+ self.assertIsInstance(msg.map_int32_foreign_message,
+ collections.abc.Mapping)
self.assertIsInstance(msg.map_int32_foreign_message,
- collections_abc.MutableMapping)
+ collections.abc.MutableMapping)
def testMapsCompare(self):
msg = map_unittest_pb2.TestMap()
@@ -2501,19 +2380,7 @@ def testStrictUtf8Check(self):
optional_string=u'\ud001')
self.assertEqual(msg.optional_string, u'\ud001')
- @unittest.skipIf(six.PY2, 'Surrogates are acceptable in python2')
def testSurrogatesInPython3(self):
- # Surrogates like U+D83D is an invalid unicode character, it is
- # supported by Python2 only because in some builds, unicode strings
- # use 2-bytes code units. Since Python 3.3, we don't have this problem.
- #
- # Surrogates are utf16 code units, in a unicode string they are invalid
- # characters even when they appear in pairs like u'\ud801\udc01'. Protobuf
- # Python3 reject such cases at setters and parsers. Python2 accpect it
- # to keep same features with the language itself. 'Unpaired pairs'
- # like u'\ud801' are rejected at parsers when strict utf8 check is enabled
- # in proto3 to keep same behavior with c extension.
-
# Surrogates are rejected at setters in Python3.
with self.assertRaises(ValueError):
unittest_proto3_arena_pb2.TestAllTypes(
@@ -2528,33 +2395,6 @@ def testSurrogatesInPython3(self):
unittest_proto3_arena_pb2.TestAllTypes(
optional_string=u'\ud801\ud801')
- @unittest.skipIf(six.PY3 or sys.maxunicode == UCS2_MAXUNICODE,
- 'Surrogates are rejected at setters in Python3')
- def testSurrogatesInPython2(self):
- # Test optional_string=u'\ud801\udc01'.
- # surrogate pair is acceptable in python2.
- msg = unittest_proto3_arena_pb2.TestAllTypes(
- optional_string=u'\ud801\udc01')
- # TODO(jieluo): Change pure python to have same behavior with c extension.
- # Some build in python2 consider u'\ud801\udc01' and u'\U00010401' are
- # equal, some are not equal.
- if api_implementation.Type() == 'python':
- self.assertEqual(msg.optional_string, u'\ud801\udc01')
- else:
- self.assertEqual(msg.optional_string, u'\U00010401')
- serialized = msg.SerializeToString()
- msg2 = unittest_proto3_arena_pb2.TestAllTypes()
- msg2.MergeFromString(serialized)
- self.assertEqual(msg2.optional_string, u'\U00010401')
-
- # Python2 does not reject surrogates at setters.
- msg = unittest_proto3_arena_pb2.TestAllTypes(
- optional_string=b'\xed\xa0\x81')
- unittest_proto3_arena_pb2.TestAllTypes(
- optional_string=u'\ud801')
- unittest_proto3_arena_pb2.TestAllTypes(
- optional_string=u'\ud801\ud801')
-
@testing_refleaks.TestCase
class ValidTypeNamesTest(unittest.TestCase):
@@ -2636,9 +2476,8 @@ def testUnpackedFields(self):
self.assertEqual(golden_data, message.SerializeToString())
-@unittest.skipIf(api_implementation.Type() != 'cpp' or
- sys.version_info < (2, 7),
- 'explicit tests of the C++ implementation for PY27 and above')
+@unittest.skipIf(api_implementation.Type() != 'cpp',
+ 'explicit tests of the C++ implementation')
@testing_refleaks.TestCase
class OversizeProtosTest(unittest.TestCase):
diff --git a/python/google/protobuf/internal/more_messages.proto b/python/google/protobuf/internal/more_messages.proto
index c5889c481ff95..524dc701a9597 100644
--- a/python/google/protobuf/internal/more_messages.proto
+++ b/python/google/protobuf/internal/more_messages.proto
@@ -40,44 +40,44 @@ package google.protobuf.internal;
// canonicalization of serialized output, which should always be in tag order.
// We also mix in some extensions for extra fun.
message OutOfOrderFields {
- optional sint32 optional_sint32 = 5;
+ optional sint32 optional_sint32 = 5;
extensions 4 to 4;
- optional uint32 optional_uint32 = 3;
+ optional uint32 optional_uint32 = 3;
extensions 2 to 2;
- optional int32 optional_int32 = 1;
-};
-
+ optional int32 optional_int32 = 1;
+}
extend OutOfOrderFields {
- optional uint64 optional_uint64 = 4;
- optional int64 optional_int64 = 2;
+ optional uint64 optional_uint64 = 4;
+ optional int64 optional_int64 = 2;
}
-enum is { // top level enum keyword
+enum is { // top level enum keyword
default = 0;
- else = 1; // top level enum value keyword
+ else = 1; // top level enum value keyword
}
-message class { // message keyword
- optional int32 int_field = 1;
- optional int32 if = 2; // field keyword
- optional is as = 3; // enum field keyword
+message class { // message keyword
+ optional int32 int_field = 1 [json_name = "json_int"];
+ optional int32 if = 2; // field keyword
+ optional is as = 3; // enum field keyword
optional is enum_field = 4;
enum for { // nested enum keyword
default = 0;
- True = 1; // nested enum value keyword
+ True = 1; // nested enum value keyword
}
optional for nested_enum_field = 5;
message try {
optional int32 field = 1;
extensions 999 to 9999;
}
- optional try nested_message = 6;
+ optional try
+ nested_message = 6;
extensions 999 to 9999;
}
extend class {
- optional int32 continue = 1001; // top level extension keyword
+ optional int32 continue = 1001; // top level extension keyword
}
extend class.try {
@@ -86,7 +86,7 @@ extend class.try {
message ExtendClass {
extend class {
- optional int32 return = 1002; // nested extension keyword
+ optional int32 return = 1002; // nested extension keyword
}
}
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
old mode 100755
new mode 100644
index d7d63c8501245..8e2afaf98cf31
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/python_message.py b/python/google/protobuf/internal/python_message.py
index 99d2f078de26d..2921d5cb6ef19 100644
--- a/python/google/protobuf/internal/python_message.py
+++ b/python/google/protobuf/internal/python_message.py
@@ -55,9 +55,6 @@
import sys
import weakref
-import six
-from six.moves import range
-
# We use "as" to avoid name collisions with variables.
from google.protobuf.internal import api_implementation
from google.protobuf.internal import containers
@@ -284,13 +281,6 @@ def _IsMessageMapField(field):
return value_type.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE
-def _IsStrictUtf8Check(field):
- if field.containing_type.syntax != 'proto3':
- return False
- enforce_utf8 = True
- return enforce_utf8
-
-
def _AttachFieldHelpers(cls, field_descriptor):
is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED)
is_packable = (is_repeated and
@@ -348,11 +338,10 @@ def AddDecoder(wiretype, is_packed):
field_descriptor, _GetInitializeDefaultForMap(field_descriptor),
is_message_map)
elif decode_type == _FieldDescriptor.TYPE_STRING:
- is_strict_utf8_check = _IsStrictUtf8Check(field_descriptor)
field_decoder = decoder.StringDecoder(
field_descriptor.number, is_repeated, is_packed,
field_descriptor, field_descriptor._default_constructor,
- is_strict_utf8_check, clear_if_default)
+ clear_if_default)
elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
field_decoder = type_checkers.TYPE_TO_DECODER[decode_type](
field_descriptor.number, is_repeated, is_packed,
@@ -485,7 +474,7 @@ def _ReraiseTypeErrorWithFieldName(message_name, field_name):
exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name))
# re-raise possibly-amended exception with original traceback:
- six.reraise(type(exc), exc, sys.exc_info()[2])
+ raise exc.with_traceback(sys.exc_info()[2])
def _AddInitMethod(message_descriptor, cls):
@@ -498,7 +487,7 @@ def _GetIntegerEnumValue(enum_type, value):
enum_type with the same name. If the value is not a string, it's
returned as-is. (No conversion or bounds-checking is done.)
"""
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
try:
return enum_type.values_by_name[value].number
except KeyError:
@@ -1305,6 +1294,14 @@ def FindInitializationErrors(self):
cls.FindInitializationErrors = FindInitializationErrors
+def _FullyQualifiedClassName(klass):
+ module = klass.__module__
+ name = getattr(klass, '__qualname__', klass.__name__)
+ if module in (None, 'builtins', '__builtin__'):
+ return name
+ return module + '.' + name
+
+
def _AddMergeFromMethod(cls):
LABEL_REPEATED = _FieldDescriptor.LABEL_REPEATED
CPPTYPE_MESSAGE = _FieldDescriptor.CPPTYPE_MESSAGE
@@ -1313,7 +1310,8 @@ def MergeFrom(self, msg):
if not isinstance(msg, cls):
raise TypeError(
'Parameter to MergeFrom() must be instance of same class: '
- 'expected %s got %s.' % (cls.__name__, msg.__class__.__name__))
+ 'expected %s got %s.' % (_FullyQualifiedClassName(cls),
+ _FullyQualifiedClassName(msg.__class__)))
assert msg is not self
self._Modified()
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
old mode 100755
new mode 100644
index 2b9ed1cb5a44c..9343389ed5018
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
# -*- coding: utf-8 -*-
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -38,14 +36,9 @@
import copy
import gc
import operator
-import six
import struct
import warnings
-
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_mset_pb2
@@ -67,10 +60,6 @@
from google.protobuf.internal import _parameterized
-if six.PY3:
- long = int # pylint: disable=redefined-builtin,invalid-name
-
-
warnings.simplefilter('error', DeprecationWarning)
@@ -411,7 +400,7 @@ def TestGetAndDeserialize(field_name, value, expected_type):
TestGetAndDeserialize('optional_int32', 1, int)
TestGetAndDeserialize('optional_int32', 1 << 30, int)
TestGetAndDeserialize('optional_uint32', 1 << 30, int)
- integer_64 = long
+ integer_64 = int
if struct.calcsize('L') == 4:
# Python only has signed ints, so 32-bit python can't fit an uint32
# in an int.
@@ -852,14 +841,14 @@ def testStringUTF8Encoding(self, message_module):
setattr, proto, 'optional_bytes', u'unicode object')
# Check that the default value is of python's 'unicode' type.
- self.assertEqual(type(proto.optional_string), six.text_type)
+ self.assertEqual(type(proto.optional_string), str)
- proto.optional_string = six.text_type('Testing')
+ proto.optional_string = str('Testing')
self.assertEqual(proto.optional_string, str('Testing'))
# Assign a value of type 'str' which can be encoded in UTF-8.
proto.optional_string = str('Testing')
- self.assertEqual(proto.optional_string, six.text_type('Testing'))
+ self.assertEqual(proto.optional_string, str('Testing'))
# Try to assign a 'bytes' object which contains non-UTF-8.
self.assertRaises(ValueError,
@@ -874,8 +863,7 @@ def testStringUTF8Encoding(self, message_module):
def testBytesInTextFormat(self, message_module):
proto = message_module.TestAllTypes(optional_bytes=b'\x00\x7f\x80\xff')
- self.assertEqual(u'optional_bytes: "\\000\\177\\200\\377"\n',
- six.text_type(proto))
+ self.assertEqual(u'optional_bytes: "\\000\\177\\200\\377"\n', str(proto))
def testEmptyNestedMessage(self, message_module):
proto = message_module.TestAllTypes()
@@ -1508,7 +1496,9 @@ def testHandWrittenReflection(self):
options=descriptor_pb2.MessageOptions(),
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
- class MyProtoClass(six.with_metaclass(reflection.GeneratedProtocolMessageType, message.Message)):
+
+ class MyProtoClass(
+ message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = mydescriptor
myproto_instance = MyProtoClass()
self.assertEqual(0, myproto_instance.foo_field)
@@ -1556,8 +1546,8 @@ def AddDescriptorField(proto, field_name, field_type):
self.assertTrue('price' in desc.fields_by_name)
self.assertTrue('owners' in desc.fields_by_name)
- class CarMessage(six.with_metaclass(reflection.GeneratedProtocolMessageType,
- message.Message)):
+ class CarMessage(
+ message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = desc
prius = CarMessage()
@@ -2094,7 +2084,7 @@ def testStringUTF8Serialization(self):
bytes_read = message2.MergeFromString(raw.item[0].message)
self.assertEqual(len(raw.item[0].message), bytes_read)
- self.assertEqual(type(message2.str), six.text_type)
+ self.assertEqual(type(message2.str), str)
self.assertEqual(message2.str, test_utf8)
# The pure Python API throws an exception on MergeFromString(),
@@ -3340,7 +3330,8 @@ def testParsingFlatClassWithExplicitClassDeclaration(self):
msg_descriptor = descriptor.MakeDescriptor(
file_descriptor.message_type[0])
- class MessageClass(six.with_metaclass(reflection.GeneratedProtocolMessageType, message.Message)):
+ class MessageClass(
+ message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = msg_descriptor
msg = MessageClass()
msg_str = (
diff --git a/python/google/protobuf/internal/service_reflection_test.py b/python/google/protobuf/internal/service_reflection_test.py
old mode 100755
new mode 100644
index 77239f4462621..8e72213b5e635
--- a/python/google/protobuf/internal/service_reflection_test.py
+++ b/python/google/protobuf/internal/service_reflection_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -35,10 +33,7 @@
__author__ = 'petar@google.com (Petar Petrov)'
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import unittest_pb2
from google.protobuf import service_reflection
diff --git a/python/google/protobuf/internal/symbol_database_test.py b/python/google/protobuf/internal/symbol_database_test.py
old mode 100755
new mode 100644
index af42681ae2bfa..4fdc4ee9c9b04
--- a/python/google/protobuf/internal/symbol_database_test.py
+++ b/python/google/protobuf/internal/symbol_database_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -32,10 +30,7 @@
"""Tests for google.protobuf.symbol_database."""
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import unittest_pb2
from google.protobuf import descriptor
diff --git a/python/google/protobuf/internal/testing_refleaks.py b/python/google/protobuf/internal/testing_refleaks.py
index e448fceef454a..abe88ed5784fe 100644
--- a/python/google/protobuf/internal/testing_refleaks.py
+++ b/python/google/protobuf/internal/testing_refleaks.py
@@ -38,18 +38,10 @@
the Py_DEBUG option), then this module is a no-op and tests will run normally.
"""
+import copyreg
import gc
import sys
-
-try:
- import copy_reg as copyreg #PY26
-except ImportError:
- import copyreg
-
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
class LocalTestResult(unittest.TestResult):
diff --git a/python/google/protobuf/internal/text_encoding_test.py b/python/google/protobuf/internal/text_encoding_test.py
old mode 100755
new mode 100644
index c7d182c444a80..f36a2cc5b4db6
--- a/python/google/protobuf/internal/text_encoding_test.py
+++ b/python/google/protobuf/internal/text_encoding_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -32,10 +30,7 @@
"""Tests for google.protobuf.text_encoding."""
-try:
- import unittest2 as unittest #PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import text_encoding
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py
old mode 100755
new mode 100644
index 6f75251dbec37..82b98c1816524
--- a/python/google/protobuf/internal/text_format_test.py
+++ b/python/google/protobuf/internal/text_format_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
# -*- coding: utf-8 -*-
-#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@@ -39,13 +37,7 @@
import string
import textwrap
-import six
-
-# pylint: disable=g-import-not-at-top
-try:
- import unittest2 as unittest # PY26
-except ImportError:
- import unittest
+import unittest
from google.protobuf import any_pb2
from google.protobuf import any_test_pb2
@@ -207,14 +199,10 @@ def testPrintFloatPrecision(self, message_module):
'repeated_double: 1.23456789\n'
'repeated_double: 1.234567898\n'
'repeated_double: 1.2345678987\n'
- 'repeated_double: 1.23456789876\n' +
- ('repeated_double: 1.23456789876\n'
- 'repeated_double: 1.23456789877\n'
- 'repeated_double: 1.23456789877\n'
- if six.PY2 else
- 'repeated_double: 1.234567898765\n'
- 'repeated_double: 1.2345678987654\n'
- 'repeated_double: 1.23456789876543\n') +
+ 'repeated_double: 1.23456789876\n'
+ 'repeated_double: 1.234567898765\n'
+ 'repeated_double: 1.2345678987654\n'
+ 'repeated_double: 1.23456789876543\n'
'repeated_double: 1.2e+100\n'
'repeated_double: 1.23e+100\n'
'repeated_double: 1.234e+100\n'
@@ -225,18 +213,14 @@ def testPrintFloatPrecision(self, message_module):
'repeated_double: 1.23456789e+100\n'
'repeated_double: 1.234567898e+100\n'
'repeated_double: 1.2345678987e+100\n'
- 'repeated_double: 1.23456789876e+100\n' +
- ('repeated_double: 1.23456789877e+100\n'
- 'repeated_double: 1.23456789877e+100\n'
- 'repeated_double: 1.23456789877e+100\n'
- if six.PY2 else
- 'repeated_double: 1.234567898765e+100\n'
- 'repeated_double: 1.2345678987654e+100\n'
- 'repeated_double: 1.23456789876543e+100\n'))
+ 'repeated_double: 1.23456789876e+100\n'
+ 'repeated_double: 1.234567898765e+100\n'
+ 'repeated_double: 1.2345678987654e+100\n'
+ 'repeated_double: 1.23456789876543e+100\n')
def testPrintExoticUnicodeSubclass(self, message_module):
- class UnicodeSub(six.text_type):
+ class UnicodeSub(str):
pass
message = message_module.TestAllTypes()
@@ -364,7 +348,7 @@ def testPrintRawUtf8String(self, message_module):
message.repeated_string.append(u'\u00fc\t\ua71f')
text = text_format.MessageToString(message, as_utf8=True)
golden_unicode = u'repeated_string: "\u00fc\\t\ua71f"\n'
- golden_text = golden_unicode if six.PY3 else golden_unicode.encode('utf-8')
+ golden_text = golden_unicode
# MessageToString always returns a native str.
self.CompareToGoldenText(text, golden_text)
parsed_message = message_module.TestAllTypes()
@@ -777,16 +761,18 @@ def testParseInvalidUtf8(self, message_module):
def testParseSingleWord(self, message_module):
message = message_module.TestAllTypes()
text = 'foo'
- six.assertRaisesRegex(self, text_format.ParseError, (
- r'1:1 : Message type "\w+.TestAllTypes" has no field named '
- r'"foo".'), text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ (r'1:1 : Message type "\w+.TestAllTypes" has no field named '
+ r'"foo".'), text_format.Parse, text, message)
def testParseUnknownField(self, message_module):
message = message_module.TestAllTypes()
text = 'unknown_field: 8\n'
- six.assertRaisesRegex(self, text_format.ParseError, (
- r'1:1 : Message type "\w+.TestAllTypes" has no field named '
- r'"unknown_field".'), text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ (r'1:1 : Message type "\w+.TestAllTypes" has no field named '
+ r'"unknown_field".'), text_format.Parse, text, message)
text = ('optional_int32: 123\n'
'unknown_field: 8\n'
'optional_nested_message { bb: 45 }')
@@ -797,19 +783,19 @@ def testParseUnknownField(self, message_module):
def testParseBadEnumValue(self, message_module):
message = message_module.TestAllTypes()
text = 'optional_nested_enum: BARR'
- six.assertRaisesRegex(self, text_format.ParseError,
- (r'1:23 : \'optional_nested_enum: BARR\': '
- r'Enum type "\w+.TestAllTypes.NestedEnum" '
- r'has no value named BARR.'), text_format.Parse,
- text, message)
+ self.assertRaisesRegex(text_format.ParseError,
+ (r'1:23 : \'optional_nested_enum: BARR\': '
+ r'Enum type "\w+.TestAllTypes.NestedEnum" '
+ r'has no value named BARR.'), text_format.Parse,
+ text, message)
def testParseBadIntValue(self, message_module):
message = message_module.TestAllTypes()
text = 'optional_int32: bork'
- six.assertRaisesRegex(self, text_format.ParseError,
- ('1:17 : \'optional_int32: bork\': '
- 'Couldn\'t parse integer: bork'),
- text_format.Parse, text, message)
+ self.assertRaisesRegex(text_format.ParseError,
+ ('1:17 : \'optional_int32: bork\': '
+ 'Couldn\'t parse integer: bork'), text_format.Parse,
+ text, message)
def testParseStringFieldUnescape(self, message_module):
message = message_module.TestAllTypes()
@@ -842,8 +828,8 @@ def testParseOneof(self, message_module):
def testParseMultipleOneof(self, message_module):
m_string = '\n'.join(['oneof_uint32: 11', 'oneof_string: "foo"'])
m2 = message_module.TestAllTypes()
- with six.assertRaisesRegex(self, text_format.ParseError,
- ' is specified along with field '):
+ with self.assertRaisesRegex(text_format.ParseError,
+ ' is specified along with field '):
text_format.Parse(m_string, m2)
# This example contains non-ASCII codepoint unicode data as literals
@@ -922,27 +908,28 @@ def testParseDuplicateMessages(self, message_module):
message = message_module.TestAllTypes()
text = ('optional_nested_message { bb: 1 } '
'optional_nested_message { bb: 2 }')
- six.assertRaisesRegex(self, text_format.ParseError, (
- r'1:59 : Message type "\w+.TestAllTypes" '
- r'should not have multiple "optional_nested_message" fields.'),
- text_format.Parse, text,
- message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ (r'1:59 : Message type "\w+.TestAllTypes" '
+ r'should not have multiple "optional_nested_message" fields.'),
+ text_format.Parse, text, message)
def testParseDuplicateScalars(self, message_module):
message = message_module.TestAllTypes()
text = ('optional_int32: 42 ' 'optional_int32: 67')
- six.assertRaisesRegex(self, text_format.ParseError, (
- r'1:36 : Message type "\w+.TestAllTypes" should not '
- r'have multiple "optional_int32" fields.'), text_format.Parse, text,
- message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ (r'1:36 : Message type "\w+.TestAllTypes" should not '
+ r'have multiple "optional_int32" fields.'), text_format.Parse, text,
+ message)
def testParseExistingScalarInMessage(self, message_module):
message = message_module.TestAllTypes(optional_int32=42)
text = 'optional_int32: 67'
- six.assertRaisesRegex(self, text_format.ParseError,
- (r'Message type "\w+.TestAllTypes" should not '
- r'have multiple "optional_int32" fields.'),
- text_format.Parse, text, message)
+ self.assertRaisesRegex(text_format.ParseError,
+ (r'Message type "\w+.TestAllTypes" should not '
+ r'have multiple "optional_int32" fields.'),
+ text_format.Parse, text, message)
@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2)
@@ -1398,14 +1385,14 @@ def testParseMessageByFieldNumber(self):
# Can't parse field number without set allow_field_number=True.
message = unittest_pb2.TestAllTypes()
text = '34:1\n'
- six.assertRaisesRegex(self, text_format.ParseError, (
- r'1:1 : Message type "\w+.TestAllTypes" has no field named '
- r'"34".'), text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ (r'1:1 : Message type "\w+.TestAllTypes" has no field named '
+ r'"34".'), text_format.Parse, text, message)
# Can't parse if field number is not found.
text = '1234:1\n'
- six.assertRaisesRegex(
- self,
+ self.assertRaisesRegex(
text_format.ParseError,
(r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"1234".'),
@@ -1492,13 +1479,13 @@ def testParseAllowedUnknownExtension(self):
' i:\n' # Missing value.
' }\n'
'}\n')
- six.assertRaisesRegex(self,
- text_format.ParseError,
- 'Invalid field value: }',
- text_format.Parse,
- malformed,
- message,
- allow_unknown_extension=True)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ 'Invalid field value: }',
+ text_format.Parse,
+ malformed,
+ message,
+ allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@@ -1506,13 +1493,13 @@ def testParseAllowedUnknownExtension(self):
' str: "malformed string\n' # Missing closing quote.
' }\n'
'}\n')
- six.assertRaisesRegex(self,
- text_format.ParseError,
- 'Invalid field value: "',
- text_format.Parse,
- malformed,
- message,
- allow_unknown_extension=True)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ 'Invalid field value: "',
+ text_format.Parse,
+ malformed,
+ message,
+ allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@@ -1520,13 +1507,13 @@ def testParseAllowedUnknownExtension(self):
' str: "malformed\n multiline\n string\n'
' }\n'
'}\n')
- six.assertRaisesRegex(self,
- text_format.ParseError,
- 'Invalid field value: "',
- text_format.Parse,
- malformed,
- message,
- allow_unknown_extension=True)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ 'Invalid field value: "',
+ text_format.Parse,
+ malformed,
+ message,
+ allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@@ -1534,28 +1521,28 @@ def testParseAllowedUnknownExtension(self):
' i: -5\n'
' \n' # Missing '>' here.
'}\n')
- six.assertRaisesRegex(self,
- text_format.ParseError,
- '5:1 : \'}\': Expected ">".',
- text_format.Parse,
- malformed,
- message,
- allow_unknown_extension=True)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ '5:1 : \'}\': Expected ">".',
+ text_format.Parse,
+ malformed,
+ message,
+ allow_unknown_extension=True)
# Don't allow unknown fields with allow_unknown_extension=True.
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
' unknown_field: true\n'
'}\n')
- six.assertRaisesRegex(self,
- text_format.ParseError,
- ('2:3 : Message type '
- '"proto2_wireformat_unittest.TestMessageSet" has no'
- ' field named "unknown_field".'),
- text_format.Parse,
- malformed,
- message,
- allow_unknown_extension=True)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ ('2:3 : Message type '
+ '"proto2_wireformat_unittest.TestMessageSet" has no'
+ ' field named "unknown_field".'),
+ text_format.Parse,
+ malformed,
+ message,
+ allow_unknown_extension=True)
# Parse known extension correctly.
message = unittest_mset_pb2.TestMessageSetContainer()
@@ -1585,22 +1572,24 @@ def testParseBadIdentifier(self):
def testParseBadExtension(self):
message = unittest_pb2.TestAllExtensions()
text = '[unknown_extension]: 8\n'
- six.assertRaisesRegex(self, text_format.ParseError,
- '1:2 : Extension "unknown_extension" not registered.',
- text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ '1:2 : Extension "unknown_extension" not registered.',
+ text_format.Parse, text, message)
message = unittest_pb2.TestAllTypes()
- six.assertRaisesRegex(self, text_format.ParseError, (
- '1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
- 'extensions.'), text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ ('1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
+ 'extensions.'), text_format.Parse, text, message)
def testParseNumericUnknownEnum(self):
message = unittest_pb2.TestAllTypes()
text = 'optional_nested_enum: 100'
- six.assertRaisesRegex(self, text_format.ParseError,
- (r'1:23 : \'optional_nested_enum: 100\': '
- r'Enum type "\w+.TestAllTypes.NestedEnum" '
- r'has no value with number 100.'), text_format.Parse,
- text, message)
+ self.assertRaisesRegex(text_format.ParseError,
+ (r'1:23 : \'optional_nested_enum: 100\': '
+ r'Enum type "\w+.TestAllTypes.NestedEnum" '
+ r'has no value with number 100.'),
+ text_format.Parse, text, message)
def testMergeDuplicateExtensionScalars(self):
message = unittest_pb2.TestAllExtensions()
@@ -1614,30 +1603,32 @@ def testParseDuplicateExtensionScalars(self):
message = unittest_pb2.TestAllExtensions()
text = ('[protobuf_unittest.optional_int32_extension]: 42 '
'[protobuf_unittest.optional_int32_extension]: 67')
- six.assertRaisesRegex(self, text_format.ParseError, (
- '1:96 : Message type "protobuf_unittest.TestAllExtensions" '
- 'should not have multiple '
- '"protobuf_unittest.optional_int32_extension" extensions.'),
- text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ ('1:96 : Message type "protobuf_unittest.TestAllExtensions" '
+ 'should not have multiple '
+ '"protobuf_unittest.optional_int32_extension" extensions.'),
+ text_format.Parse, text, message)
def testParseDuplicateExtensionMessages(self):
message = unittest_pb2.TestAllExtensions()
text = ('[protobuf_unittest.optional_nested_message_extension]: {} '
'[protobuf_unittest.optional_nested_message_extension]: {}')
- six.assertRaisesRegex(self, text_format.ParseError, (
- '1:114 : Message type "protobuf_unittest.TestAllExtensions" '
- 'should not have multiple '
- '"protobuf_unittest.optional_nested_message_extension" extensions.'),
- text_format.Parse, text, message)
+ self.assertRaisesRegex(
+ text_format.ParseError,
+ ('1:114 : Message type "protobuf_unittest.TestAllExtensions" '
+ 'should not have multiple '
+ '"protobuf_unittest.optional_nested_message_extension" extensions.'),
+ text_format.Parse, text, message)
def testParseGroupNotClosed(self):
message = unittest_pb2.TestAllTypes()
text = 'RepeatedGroup: <'
- six.assertRaisesRegex(self, text_format.ParseError, '1:16 : Expected ">".',
- text_format.Parse, text, message)
+ self.assertRaisesRegex(text_format.ParseError, '1:16 : Expected ">".',
+ text_format.Parse, text, message)
text = 'RepeatedGroup: {'
- six.assertRaisesRegex(self, text_format.ParseError, '1:16 : Expected "}".',
- text_format.Parse, text, message)
+ self.assertRaisesRegex(text_format.ParseError, '1:16 : Expected "}".',
+ text_format.Parse, text, message)
def testParseEmptyGroup(self):
message = unittest_pb2.TestAllTypes()
diff --git a/python/google/protobuf/internal/type_checkers.py b/python/google/protobuf/internal/type_checkers.py
index eb66f9f6fbaee..9b9b859e1ef26 100644
--- a/python/google/protobuf/internal/type_checkers.py
+++ b/python/google/protobuf/internal/type_checkers.py
@@ -45,16 +45,8 @@
__author__ = 'robinson@google.com (Will Robinson)'
-try:
- import ctypes
-except Exception: # pylint: disable=broad-except
- ctypes = None
- import struct
+import ctypes
import numbers
-import six
-
-if six.PY3:
- long = int
from google.protobuf.internal import api_implementation
from google.protobuf.internal import decoder
@@ -66,10 +58,7 @@
def TruncateToFourByteFloat(original):
- if ctypes:
- return ctypes.c_float(original).value
- else:
- return struct.unpack('=1.9']
+ install_requires = []
setup(
name='protobuf',
diff --git a/python/tox.ini b/python/tox.ini
index eab095c0d06bc..88dd842e82198 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
- py{33,34,35,36,37,38,39}-{cpp,python}
+ py{35,36,37,38,39}-{cpp,python}
[testenv]
usedevelop=true
@@ -14,11 +14,8 @@ setenv =
commands =
python setup.py -q build_py
python: python setup.py -q build
- py{33,34,35,36,37,38,39}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
+ py{35,36,37,38,39}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
python: python setup.py -q test -q
cpp: python setup.py -q test -q --cpp_implementation
python: python setup.py -q test_conformance
cpp: python setup.py -q test_conformance --cpp_implementation
-deps =
- # Keep this list of dependencies in sync with setup.py.
- six>=1.9
diff --git a/src/Makefile.am b/src/Makefile.am
index fbd0a41e24041..b1cdd5a1d3306 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,15 +73,19 @@ nobase_include_HEADERS = \
google/protobuf/arenastring.h \
google/protobuf/compiler/code_generator.h \
google/protobuf/compiler/command_line_interface.h \
+ google/protobuf/compiler/cpp/cpp_file.h \
google/protobuf/compiler/cpp/cpp_generator.h \
+ google/protobuf/compiler/cpp/cpp_helpers.h \
+ google/protobuf/compiler/cpp/cpp_names.h \
+ google/protobuf/compiler/csharp/csharp_doc_comment.h \
google/protobuf/compiler/csharp/csharp_generator.h \
google/protobuf/compiler/csharp/csharp_names.h \
+ google/protobuf/compiler/csharp/csharp_options.h \
google/protobuf/compiler/importer.h \
google/protobuf/compiler/java/java_generator.h \
google/protobuf/compiler/java/java_kotlin_generator.h \
google/protobuf/compiler/java/java_names.h \
google/protobuf/compiler/js/js_generator.h \
- google/protobuf/compiler/js/well_known_types_embed.h \
google/protobuf/compiler/objectivec/objectivec_generator.h \
google/protobuf/compiler/objectivec/objectivec_helpers.h \
google/protobuf/compiler/parser.h \
@@ -105,6 +109,7 @@ nobase_include_HEADERS = \
google/protobuf/generated_message_bases.h \
google/protobuf/generated_message_reflection.h \
google/protobuf/generated_message_table_driven.h \
+ google/protobuf/generated_message_table_driven_lite.h \
google/protobuf/generated_message_tctable_decl.h \
google/protobuf/generated_message_tctable_impl.h \
google/protobuf/generated_message_tctable_impl.inc \
@@ -133,15 +138,14 @@ nobase_include_HEADERS = \
google/protobuf/metadata.h \
google/protobuf/metadata_lite.h \
google/protobuf/parse_context.h \
+ google/protobuf/port.h \
google/protobuf/port_def.inc \
google/protobuf/port_undef.inc \
- google/protobuf/port.h \
google/protobuf/reflection.h \
google/protobuf/reflection_ops.h \
google/protobuf/repeated_field.h \
google/protobuf/service.h \
google/protobuf/source_context.pb.h \
- google/protobuf/string_member_robber.h \
google/protobuf/struct.pb.h \
google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/callback.h \
@@ -191,7 +195,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/extension_set.cc \
google/protobuf/generated_enum_util.cc \
google/protobuf/generated_message_table_driven_lite.cc \
- google/protobuf/generated_message_table_driven_lite.h \
+ google/protobuf/generated_message_tctable_lite.cc \
google/protobuf/generated_message_util.cc \
google/protobuf/implicit_weak_message.cc \
google/protobuf/inlined_string_field.cc \
@@ -205,21 +209,17 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/message_lite.cc \
google/protobuf/parse_context.cc \
google/protobuf/repeated_field.cc \
+ google/protobuf/string_member_robber.h \
google/protobuf/stubs/bytestream.cc \
- google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/common.cc \
- google/protobuf/stubs/hash.h \
google/protobuf/stubs/int128.cc \
google/protobuf/stubs/int128.h \
- google/protobuf/stubs/map_util.h \
google/protobuf/stubs/mathutil.h \
- google/protobuf/stubs/status_macros.h \
google/protobuf/stubs/status.cc \
- google/protobuf/stubs/status.h \
+ google/protobuf/stubs/status_macros.h \
google/protobuf/stubs/statusor.cc \
google/protobuf/stubs/statusor.h \
google/protobuf/stubs/stringpiece.cc \
- google/protobuf/stubs/stringpiece.h \
google/protobuf/stubs/stringprintf.cc \
google/protobuf/stubs/stringprintf.h \
google/protobuf/stubs/structurally_valid.cc \
@@ -252,7 +252,7 @@ libprotobuf_la_SOURCES = \
google/protobuf/generated_message_bases.cc \
google/protobuf/generated_message_reflection.cc \
google/protobuf/generated_message_table_driven.cc \
- google/protobuf/generated_message_table_driven_lite.h \
+ google/protobuf/generated_message_tctable_full.cc \
google/protobuf/io/gzip_stream.cc \
google/protobuf/io/printer.cc \
google/protobuf/io/tokenizer.cc \
@@ -303,7 +303,6 @@ libprotobuf_la_SOURCES = \
google/protobuf/util/internal/structured_objectwriter.h \
google/protobuf/util/internal/type_info.cc \
google/protobuf/util/internal/type_info.h \
- google/protobuf/util/internal/type_info_test_helper.cc \
google/protobuf/util/internal/type_info_test_helper.h \
google/protobuf/util/internal/utility.cc \
google/protobuf/util/internal/utility.h \
@@ -334,10 +333,8 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_field.cc \
google/protobuf/compiler/cpp/cpp_field.h \
google/protobuf/compiler/cpp/cpp_file.cc \
- google/protobuf/compiler/cpp/cpp_file.h \
google/protobuf/compiler/cpp/cpp_generator.cc \
google/protobuf/compiler/cpp/cpp_helpers.cc \
- google/protobuf/compiler/cpp/cpp_helpers.h \
google/protobuf/compiler/cpp/cpp_map_field.cc \
google/protobuf/compiler/cpp/cpp_map_field.h \
google/protobuf/compiler/cpp/cpp_message.cc \
@@ -345,7 +342,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_message_field.cc \
google/protobuf/compiler/cpp/cpp_message_field.h \
google/protobuf/compiler/cpp/cpp_message_layout_helper.h \
- google/protobuf/compiler/cpp/cpp_names.h \
google/protobuf/compiler/cpp/cpp_options.h \
google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \
google/protobuf/compiler/cpp/cpp_padding_optimizer.h \
@@ -358,7 +354,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_string_field.cc \
google/protobuf/compiler/cpp/cpp_string_field.h \
google/protobuf/compiler/csharp/csharp_doc_comment.cc \
- google/protobuf/compiler/csharp/csharp_doc_comment.h \
google/protobuf/compiler/csharp/csharp_enum.cc \
google/protobuf/compiler/csharp/csharp_enum.h \
google/protobuf/compiler/csharp/csharp_enum_field.cc \
@@ -374,11 +369,10 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_message.h \
google/protobuf/compiler/csharp/csharp_message_field.cc \
google/protobuf/compiler/csharp/csharp_message_field.h \
- google/protobuf/compiler/csharp/csharp_options.h \
google/protobuf/compiler/csharp/csharp_primitive_field.cc \
google/protobuf/compiler/csharp/csharp_primitive_field.h \
- google/protobuf/compiler/csharp/csharp_reflection_class.cc \
- google/protobuf/compiler/csharp/csharp_reflection_class.h \
+ google/protobuf/compiler/csharp/csharp_reflection_class.cc \
+ google/protobuf/compiler/csharp/csharp_reflection_class.h \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \
google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \
@@ -448,6 +442,7 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/java/java_string_field_lite.h \
google/protobuf/compiler/js/js_generator.cc \
google/protobuf/compiler/js/well_known_types_embed.cc \
+ google/protobuf/compiler/js/well_known_types_embed.h \
google/protobuf/compiler/objectivec/objectivec_enum.cc \
google/protobuf/compiler/objectivec/objectivec_enum.h \
google/protobuf/compiler/objectivec/objectivec_enum_field.cc \
@@ -460,7 +455,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/objectivec/objectivec_file.h \
google/protobuf/compiler/objectivec/objectivec_generator.cc \
google/protobuf/compiler/objectivec/objectivec_helpers.cc \
- google/protobuf/compiler/objectivec/objectivec_helpers.h \
google/protobuf/compiler/objectivec/objectivec_map_field.cc \
google/protobuf/compiler/objectivec/objectivec_map_field.h \
google/protobuf/compiler/objectivec/objectivec_message.cc \
@@ -542,18 +536,18 @@ protoc_inputs = \
EXTRA_DIST = \
$(protoc_inputs) \
- solaris/libstdc++.la \
+ README.md \
google/protobuf/compiler/package_info.h \
google/protobuf/compiler/ruby/ruby_generated_code.proto \
google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \
- google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \
- google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \
- google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \
+ google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \
+ google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \
+ google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \
- google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \
- google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \
- google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \
+ google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \
+ google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \
+ google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \
google/protobuf/compiler/zip_output_unittest.sh \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/gzip_stream_unittest.sh \
@@ -569,16 +563,16 @@ EXTRA_DIST = \
google/protobuf/testdata/golden_packed_fields_message \
google/protobuf/testdata/map_test_data.txt \
google/protobuf/testdata/text_format_unittest_data.txt \
- google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \
- google/protobuf/testdata/text_format_unittest_data_pointy.txt \
- google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \
- google/protobuf/testdata/text_format_unittest_extensions_data.txt \
- google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \
+ google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \
+ google/protobuf/testdata/text_format_unittest_data_pointy.txt \
+ google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \
+ google/protobuf/testdata/text_format_unittest_extensions_data.txt \
+ google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \
google/protobuf/util/package_info.h \
libprotobuf-lite.map \
libprotobuf.map \
libprotoc.map \
- README.md
+ solaris/libstdc++.la
protoc_lite_outputs = \
google/protobuf/map_lite_unittest.pb.cc \
@@ -703,11 +697,10 @@ endif
$(protoc_outputs): unittest_proto_middleman
COMMON_TEST_SOURCES = \
- google/protobuf/arena_test_util.cc \
- google/protobuf/arena_test_util.h \
+ $(COMMON_LITE_TEST_SOURCES) \
+ google/protobuf/compiler/cpp/cpp_unittest.h \
google/protobuf/map_test_util.h \
google/protobuf/map_test_util.inc \
- google/protobuf/map_test_util_impl.h \
google/protobuf/reflection_tester.cc \
google/protobuf/reflection_tester.h \
google/protobuf/test_util.cc \
@@ -737,6 +730,7 @@ protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \
# See configure.ac for more info.
protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
protobuf_test_SOURCES = \
+ $(COMMON_TEST_SOURCES) \
google/protobuf/any_test.cc \
google/protobuf/arena_unittest.cc \
google/protobuf/arenastring_unittest.cc \
@@ -747,7 +741,6 @@ protobuf_test_SOURCES = \
google/protobuf/compiler/cpp/cpp_move_unittest.cc \
google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \
google/protobuf/compiler/cpp/cpp_unittest.cc \
- google/protobuf/compiler/cpp/cpp_unittest.h \
google/protobuf/compiler/cpp/cpp_unittest.inc \
google/protobuf/compiler/cpp/metadata_test.cc \
google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \
@@ -815,8 +808,7 @@ protobuf_test_SOURCES = \
google/protobuf/util/type_resolver_util_test.cc \
google/protobuf/well_known_types_unittest.cc \
google/protobuf/wire_format_unittest.cc \
- google/protobuf/wire_format_unittest.inc \
- $(COMMON_TEST_SOURCES)
+ google/protobuf/wire_format_unittest.inc
nodist_protobuf_test_SOURCES = $(protoc_outputs)
$(am_protobuf_test_OBJECTS): unittest_proto_middleman
@@ -842,6 +834,7 @@ COMMON_LITE_TEST_SOURCES = \
google/protobuf/arena_test_util.h \
google/protobuf/map_lite_test_util.cc \
google/protobuf/map_lite_test_util.h \
+ google/protobuf/map_test_util_impl.h \
google/protobuf/test_util_lite.cc \
google/protobuf/test_util_lite.h
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index d3b1b4c226c2e..52c6ccca2f243 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -36,7 +36,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_),
~0u, // no _extensions_
@@ -112,11 +112,17 @@ Any::Any(const Any& from)
_any_metadata_(&type_url_, &value_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
GetArenaForAllocation());
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
GetArenaForAllocation());
@@ -126,7 +132,13 @@ Any::Any(const Any& from)
inline void Any::SharedCtor() {
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Any::~Any() {
@@ -154,7 +166,7 @@ void Any::SetCachedSize(int size) const {
void Any::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -166,12 +178,12 @@ void Any::Clear() {
const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string type_url = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url"));
@@ -181,7 +193,7 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// bytes value = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
@@ -211,10 +223,10 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* Any::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Any::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string type_url = 1;
@@ -245,7 +257,7 @@ size_t Any::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -282,7 +294,7 @@ void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Any::MergeFrom(const Any& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_type_url().empty()) {
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index b1b70f5079304..f6019139641f8 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
- static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+ static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
PROTOBUF_NAMESPACE_OPEN
@@ -191,8 +191,8 @@ class PROTOBUF_EXPORT Any final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -320,6 +320,11 @@ inline void Any::set_allocated_type_url(std::string* type_url) {
}
type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
}
@@ -366,6 +371,11 @@ inline void Any::set_allocated_value(std::string* value) {
}
value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
}
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index d3fb1dd52ddf8..72cc72e03c023 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -73,7 +73,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_),
~0u, // no _extensions_
@@ -200,11 +200,17 @@ Api::Api(const Api& from)
mixins_(from.mixins_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_version().empty()) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(),
GetArenaForAllocation());
@@ -220,7 +226,13 @@ Api::Api(const Api& from)
inline void Api::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&source_context_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&syntax_) -
@@ -253,7 +265,7 @@ void Api::SetCachedSize(int size) const {
void Api::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Api)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -273,12 +285,12 @@ void Api::Clear() {
const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name"));
@@ -288,7 +300,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Method methods = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@@ -301,7 +313,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Option options = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@@ -314,7 +326,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// string version = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
auto str = _internal_mutable_version();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version"));
@@ -324,7 +336,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// .google.protobuf.SourceContext source_context = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
CHK_(ptr);
} else
@@ -332,7 +344,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Mixin mixins = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@@ -345,8 +357,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// .google.protobuf.Syntax syntax = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@@ -375,10 +387,10 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Api::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@@ -452,7 +464,7 @@ size_t Api::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -523,7 +535,7 @@ void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Api::MergeFrom(const Api& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
methods_.MergeFrom(from.methods_);
@@ -611,16 +623,25 @@ Method::Method(const Method& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_request_type_url().empty()) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(),
GetArenaForAllocation());
}
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_response_type_url().empty()) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(),
GetArenaForAllocation());
@@ -633,8 +654,17 @@ Method::Method(const Method& from)
inline void Method::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&request_streaming_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&syntax_) -
@@ -667,7 +697,7 @@ void Method::SetCachedSize(int size) const {
void Method::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Method)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -684,12 +714,12 @@ void Method::Clear() {
const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name"));
@@ -699,7 +729,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// string request_type_url = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_request_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url"));
@@ -709,7 +739,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// bool request_streaming = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@@ -717,7 +747,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// string response_type_url = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
auto str = _internal_mutable_response_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url"));
@@ -727,7 +757,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// bool response_streaming = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) {
response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@@ -735,7 +765,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// repeated .google.protobuf.Option options = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@@ -748,8 +778,8 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// .google.protobuf.Syntax syntax = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@@ -778,10 +808,10 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Method::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@@ -853,7 +883,7 @@ size_t Method::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -920,7 +950,7 @@ void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Method::MergeFrom(const Method& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
options_.MergeFrom(from.options_);
@@ -1010,11 +1040,17 @@ Mixin::Mixin(const Mixin& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_root().empty()) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(),
GetArenaForAllocation());
@@ -1024,7 +1060,13 @@ Mixin::Mixin(const Mixin& from)
inline void Mixin::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Mixin::~Mixin() {
@@ -1052,7 +1094,7 @@ void Mixin::SetCachedSize(int size) const {
void Mixin::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1064,12 +1106,12 @@ void Mixin::Clear() {
const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name"));
@@ -1079,7 +1121,7 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string root = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_root();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root"));
@@ -1110,10 +1152,10 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Mixin::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@@ -1148,7 +1190,7 @@ size_t Mixin::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1185,7 +1227,7 @@ void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Mixin::MergeFrom(const Mixin& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_name().empty()) {
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 01c670b2b78b0..4ed460e68ffef 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
- static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+ static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
PROTOBUF_NAMESPACE_OPEN
@@ -168,8 +168,8 @@ class PROTOBUF_EXPORT Api final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -428,8 +428,8 @@ class PROTOBUF_EXPORT Method final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -666,8 +666,8 @@ class PROTOBUF_EXPORT Mixin final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -794,6 +794,11 @@ inline void Api::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
}
@@ -917,6 +922,11 @@ inline void Api::set_allocated_version(std::string* version) {
}
version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
}
@@ -1113,6 +1123,11 @@ inline void Method::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
}
@@ -1159,6 +1174,11 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url
}
request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (request_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
}
@@ -1225,6 +1245,11 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u
}
response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (response_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
}
@@ -1352,6 +1377,11 @@ inline void Mixin::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
}
@@ -1398,6 +1428,11 @@ inline void Mixin::set_allocated_root(std::string* root) {
}
root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (root_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
}
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 8b1a6b577673a..f6d873be62331 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -414,6 +414,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
p, std::is_convertible());
}
+ // Creates message-owned arena.
+ static Arena* CreateMessageOwnedArena() {
+ return new Arena(internal::MessageOwned{});
+ }
+
+ // Checks whether the given arena is message-owned.
+ static bool IsMessageOwnedArena(Arena* arena) {
+ return arena->IsMessageOwned();
+ }
+
private:
static Arena* GetArenaForAllocationInternal(
const T* p, std::true_type /*is_derived_from*/) {
@@ -521,6 +531,14 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template
struct has_get_arena : InternalHelper::has_get_arena {};
+ // Constructor solely used by message-owned arena.
+ inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {}
+
+ // Checks whether this arena is message-owned.
+ PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
+ return impl_.IsMessageOwned();
+ }
+
template
PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena,
Args&&... args) {
diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h
index b47bad78c7686..d7e69c117b1e6 100644
--- a/src/google/protobuf/arena_impl.h
+++ b/src/google/protobuf/arena_impl.h
@@ -255,6 +255,13 @@ class PROTOBUF_EXPORT SerialArena {
static constexpr size_t kCleanupSize = AlignUpTo8(sizeof(CleanupNode));
};
+// Tag type used to invoke the constructor of message-owned arena.
+// Only message-owned arenas use this constructor for creation.
+// Such constructors are internal implementation details of the library.
+struct MessageOwned {
+ explicit MessageOwned() = default;
+};
+
// This class provides the core Arena memory allocation library. Different
// implementations only need to implement the public interface below.
// Arena is not a template type as that would only be useful if all protos
@@ -265,6 +272,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
public:
ThreadSafeArena() { Init(false); }
+ // Constructor solely used by message-owned arena.
+ ThreadSafeArena(internal::MessageOwned) : alloc_policy_(kMessageOwnedArena) {
+ Init(false);
+ }
+
ThreadSafeArena(char* mem, size_t size) { InitializeFrom(mem, size); }
explicit ThreadSafeArena(void* mem, size_t size,
@@ -320,6 +332,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
// Add object pointer and cleanup function pointer to the list.
void AddCleanup(void* elem, void (*cleanup)(void*));
+ // Checks whether this arena is message-owned.
+ PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
+ return alloc_policy_ & kMessageOwnedArena;
+ }
+
private:
// Unique for each arena. Changes on Reset().
uint64_t tag_and_id_;
@@ -328,7 +345,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
intptr_t alloc_policy_ = 0; // Tagged pointer to AllocPolicy.
// The LSB of alloc_policy_ indicates if the user owns the initial block.
- enum { kUserOwnedInitialBlock = 1 };
+ // The second LSB of alloc_policy_ indicates if the arena is message-owned.
+ enum {
+ kUserOwnedInitialBlock = 1,
+ kMessageOwnedArena = 2,
+ };
// Pointer to a linked list of SerialArena.
std::atomic threads_;
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index ba00fbdb6d293..76d9126ac3900 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -759,6 +759,7 @@ TEST(ArenaTest, AddAllocatedWithReflection) {
}
TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) {
+#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
{
RepeatedPtrField repeated_field;
EXPECT_TRUE(repeated_field.empty());
@@ -769,6 +770,7 @@ TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) {
EXPECT_TRUE(repeated_field.empty());
EXPECT_EQ(0, repeated_field.size());
}
+#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES
{
RepeatedPtrField repeated_field;
EXPECT_TRUE(repeated_field.empty());
diff --git a/src/google/protobuf/compiler/annotation_test_util.h b/src/google/protobuf/compiler/annotation_test_util.h
index fa87c6cc88e41..551f2244c5dbe 100644
--- a/src/google/protobuf/compiler/annotation_test_util.h
+++ b/src/google/protobuf/compiler/annotation_test_util.h
@@ -78,7 +78,7 @@ bool RunProtoCompiler(const std::string& filename,
bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info);
// Finds all of the Annotations for a given source file and path.
-// See Location.path in http://google3/net/proto2/proto/descriptor.proto for
+// See Location.path in https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for
// explanation of what path vector is.
void FindAnnotationsOnPath(
const GeneratedCodeInfo& info, const std::string& source_file,
@@ -88,7 +88,7 @@ void FindAnnotationsOnPath(
// Finds the Annotation for a given source file and path (or returns null if it
// couldn't). If there are several annotations for given path, returns the first
// one. See Location.path in
-// http://google3/net/proto2/proto/descriptor.proto for explanation of what path
+// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for explanation of what path
// vector is.
const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
const GeneratedCodeInfo& info, const std::string& source_file,
diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.cc b/src/google/protobuf/compiler/cpp/cpp_extension.cc
index 670c37f5bb4e5..647528552abfb 100644
--- a/src/google/protobuf/compiler/cpp/cpp_extension.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_extension.cc
@@ -44,18 +44,6 @@ namespace protobuf {
namespace compiler {
namespace cpp {
-namespace {
-
-// Returns the fully-qualified class name of the message that this field
-// extends. This function is used in the Google-internal code to handle some
-// legacy cases.
-std::string ExtendeeClassName(const FieldDescriptor* descriptor) {
- const Descriptor* extendee = descriptor->containing_type();
- return ClassName(extendee, true);
-}
-
-} // anonymous namespace
-
ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
const Options& options,
MessageSCCAnalyzer* scc_analyzer)
@@ -88,7 +76,8 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
break;
}
SetCommonVars(options, &variables_);
- variables_["extendee"] = ExtendeeClassName(descriptor_);
+ variables_["extendee"] =
+ QualifiedClassName(descriptor_->containing_type(), options_);
variables_["type_traits"] = type_traits_;
std::string name = descriptor_->name();
variables_["name"] = ResolveKeyword(name);
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 3de72941fd8da..878ff78f75d73 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -1178,7 +1178,8 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) {
IncludeFile("net/proto2/io/public/coded_stream.h", printer);
IncludeFile("net/proto2/public/arena.h", printer);
IncludeFile("net/proto2/public/arenastring.h", printer);
- if (options_.force_inline_string || options_.profile_driven_inline_string) {
+ if ((options_.force_inline_string || options_.profile_driven_inline_string) &&
+ !options_.opensource_runtime) {
IncludeFile("net/proto2/public/inlined_string_field.h", printer);
}
if (HasSimpleBaseClasses(file_, options_)) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index d4d6a589c6d6a..4459e50123cc6 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -58,6 +58,7 @@
#include
#include
+// Must be last.
#include
namespace google {
@@ -170,11 +171,7 @@ static std::unordered_set* MakeKeywordsMap() {
static std::unordered_set& kKeywords = *MakeKeywordsMap();
std::string IntTypeName(const Options& options, const std::string& type) {
- if (options.opensource_runtime) {
- return "::PROTOBUF_NAMESPACE_ID::" + type;
- } else {
- return "::" + type;
- }
+ return type + "_t";
}
void SetIntVar(const Options& options, const std::string& type,
@@ -456,6 +453,19 @@ std::string FieldName(const FieldDescriptor* field) {
return result;
}
+std::string OneofCaseConstantName(const FieldDescriptor* field) {
+ GOOGLE_DCHECK(field->containing_oneof());
+ std::string field_name = UnderscoresToCamelCase(field->name(), true);
+ return "k" + field_name;
+}
+
+std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) {
+ GOOGLE_DCHECK(field->containing_oneof());
+ const std::string qualification =
+ QualifiedClassName(field->containing_type());
+ return StrCat(qualification, "::", OneofCaseConstantName(field));
+}
+
std::string EnumValueName(const EnumValueDescriptor* enum_value) {
std::string result = enum_value->name();
if (kKeywords.count(result) > 0) {
@@ -522,13 +532,13 @@ std::string StripProto(const std::string& filename) {
const char* PrimitiveTypeName(FieldDescriptor::CppType type) {
switch (type) {
case FieldDescriptor::CPPTYPE_INT32:
- return "::google::protobuf::int32";
+ return "int32_t";
case FieldDescriptor::CPPTYPE_INT64:
- return "::google::protobuf::int64";
+ return "int64_t";
case FieldDescriptor::CPPTYPE_UINT32:
- return "::google::protobuf::uint32";
+ return "uint32_t";
case FieldDescriptor::CPPTYPE_UINT64:
- return "::google::protobuf::uint64";
+ return "uint64_t";
case FieldDescriptor::CPPTYPE_DOUBLE:
return "double";
case FieldDescriptor::CPPTYPE_FLOAT:
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index d4c020b4ac207..7dc7e89afaf6e 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -1437,7 +1437,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (EnableMessageOwnedArena(descriptor_)) {
format(
"inline $classname$() : $classname$("
- "new ::$proto_ns$::Arena(), true) {}\n");
+ "::$proto_ns$::Arena::InternalHelper<$classname$>::\n"
+ " CreateMessageOwnedArena(), true) {}\n");
} else {
format("inline $classname$() : $classname$(nullptr) {}\n");
}
@@ -1530,10 +1531,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true));
format.Indent();
for (auto field : FieldRange(oneof)) {
- std::string oneof_enum_case_field_name =
- UnderscoresToCamelCase(field->name(), true);
- format("k$1$ = $2$,\n", oneof_enum_case_field_name, // 1
- field->number()); // 2
+ format("$1$ = $2$,\n", OneofCaseConstantName(field), // 1
+ field->number()); // 2
}
format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name()));
format.Outdent();
diff --git a/src/google/protobuf/compiler/cpp/cpp_names.h b/src/google/protobuf/compiler/cpp/cpp_names.h
index cbc69a7cb7b51..6bcbff0616813 100644
--- a/src/google/protobuf/compiler/cpp/cpp_names.h
+++ b/src/google/protobuf/compiler/cpp/cpp_names.h
@@ -73,6 +73,12 @@ std::string QualifiedExtensionName(const FieldDescriptor* d);
// anyway, so normally this just returns field->name().
std::string FieldName(const FieldDescriptor* field);
+// Requires that this field is in a oneof. Returns the (unqualified) case
+// constant for this field.
+std::string OneofCaseConstantName(const FieldDescriptor* field);
+// Returns the quafilied case constant for this field.
+std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field);
+
// Get the (unqualified) name that should be used for this enum value in C++
// code.
std::string EnumValueName(const EnumValueDescriptor* enum_value);
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index be19310df663a..93aff5d7e1b0b 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -292,6 +292,14 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
format(
" return $name$_.ReleaseNonDefault($init_value$, "
"GetArenaForAllocation());\n");
+ if (descriptor_->default_value_string().empty()) {
+ format(
+ "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+ " if ($name$_.IsDefault($init_value$)) {\n"
+ " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+ " }\n"
+ "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+ }
} else {
format(
" return $name$_.Release(nullptr, GetArenaForAllocation(), "
@@ -314,6 +322,14 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
format(
" $name$_.SetAllocated($init_value$, $name$,\n"
" GetArenaForAllocation());\n");
+ if (descriptor_->default_value_string().empty()) {
+ format(
+ "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+ " if ($name$_.IsDefault($init_value$)) {\n"
+ " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+ " }\n"
+ "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+ }
} else {
// Currently, string fields with default value can't be inlined.
format(
@@ -422,6 +438,13 @@ void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
}
GOOGLE_DCHECK(!inlined_);
format("$name$_.UnsafeSetDefault($init_value$);\n");
+ if (IsString(descriptor_, options_) &&
+ descriptor_->default_value_string().empty()) {
+ format(
+ "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+ " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+ "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+ }
}
void StringFieldGenerator::GenerateCopyConstructorCode(
diff --git a/src/google/protobuf/compiler/java/java_doc_comment.cc b/src/google/protobuf/compiler/java/java_doc_comment.cc
index 2376488f02e33..80b79025dfd7d 100644
--- a/src/google/protobuf/compiler/java/java_doc_comment.cc
+++ b/src/google/protobuf/compiler/java/java_doc_comment.cc
@@ -36,6 +36,7 @@
#include
+#include
#include
#include
@@ -186,6 +187,21 @@ void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) {
printer->Print(" */\n");
}
+void WriteDeprecatedJavadoc(io::Printer* printer, const FieldDescriptor* field,
+ const FieldAccessorType type) {
+ if (!field->options().deprecated()) {
+ return;
+ }
+
+ // Lite codegen does not annotate set & clear methods with @Deprecated.
+ if (field->file()->options().optimize_for() == FileOptions::LITE_RUNTIME &&
+ (type == SETTER || type == CLEARER)) {
+ return;
+ }
+
+ printer->Print(" * @deprecated\n");
+}
+
void WriteFieldAccessorDocComment(io::Printer* printer,
const FieldDescriptor* field,
const FieldAccessorType type,
@@ -194,6 +210,7 @@ void WriteFieldAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * $def$
\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
+ WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
printer->Print(" * @return Whether the $name$ field is set.\n", "name",
@@ -252,6 +269,7 @@ void WriteFieldEnumValueAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * $def$
\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
+ WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
// Should never happen
@@ -321,6 +339,7 @@ void WriteFieldStringBytesAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * $def$
\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
+ WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
// Should never happen
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index f4c1a1f8b7093..c4849ad0f7ebc 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -83,7 +83,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr;
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_),
~0u, // no _extensions_
@@ -248,6 +248,9 @@ Version::Version(const Version& from)
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_suffix()) {
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(),
GetArenaForAllocation());
@@ -260,6 +263,9 @@ Version::Version(const Version& from)
inline void Version::SharedCtor() {
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&major_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&patch_) -
@@ -290,7 +296,7 @@ void Version::SetCachedSize(int size) const {
void Version::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -311,12 +317,12 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional int32 major = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_major(&has_bits);
major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -325,7 +331,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional int32 minor = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_minor(&has_bits);
minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -334,7 +340,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional int32 patch = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
_Internal::set_has_patch(&has_bits);
patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -343,7 +349,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional string suffix = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
auto str = _internal_mutable_suffix();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -377,10 +383,10 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* Version::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Version::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -424,7 +430,7 @@ size_t Version::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -472,7 +478,7 @@ void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Version::MergeFrom(const Version& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -569,6 +575,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
proto_file_(from.proto_file_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_parameter()) {
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(),
GetArenaForAllocation());
@@ -583,6 +592,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
inline void CodeGeneratorRequest::SharedCtor() {
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
compiler_version_ = nullptr;
}
@@ -611,7 +623,7 @@ void CodeGeneratorRequest::SetCachedSize(int size) const {
void CodeGeneratorRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -635,12 +647,12 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated string file_to_generate = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@@ -657,7 +669,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string parameter = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_parameter();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -669,7 +681,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.compiler.Version compiler_version = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr);
CHK_(ptr);
} else
@@ -677,7 +689,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
case 15:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) {
ptr -= 1;
do {
ptr += 1;
@@ -712,10 +724,10 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorRequest::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated string file_to_generate = 1;
@@ -767,7 +779,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -822,7 +834,7 @@ void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
file_to_generate_.MergeFrom(from.file_to_generate_);
@@ -915,16 +927,25 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_insertion_point()) {
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(),
GetArenaForAllocation());
}
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_content()) {
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(),
GetArenaForAllocation());
@@ -939,8 +960,17 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
inline void CodeGeneratorResponse_File::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
generated_code_info_ = nullptr;
}
@@ -971,7 +1001,7 @@ void CodeGeneratorResponse_File::SetCachedSize(int size) const {
void CodeGeneratorResponse_File::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -999,12 +1029,12 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1016,7 +1046,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional string insertion_point = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_insertion_point();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1028,7 +1058,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional string content = 15;
case 15:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) {
auto str = _internal_mutable_content();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1040,7 +1070,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
case 16:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 130)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 130)) {
ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr);
CHK_(ptr);
} else
@@ -1070,10 +1100,10 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorResponse_File::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -1127,7 +1157,7 @@ size_t CodeGeneratorResponse_File::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1181,7 +1211,7 @@ void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -1272,6 +1302,9 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
file_(from.file_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_error()) {
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(),
GetArenaForAllocation());
@@ -1282,6 +1315,9 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
inline void CodeGeneratorResponse::SharedCtor() {
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
supported_features_ = uint64_t{0u};
}
@@ -1309,7 +1345,7 @@ void CodeGeneratorResponse::SetCachedSize(int size) const {
void CodeGeneratorResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1327,12 +1363,12 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string error = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_error();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1344,7 +1380,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional uint64 supported_features = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_supported_features(&has_bits);
supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -1353,7 +1389,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
case 15:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) {
ptr -= 1;
do {
ptr += 1;
@@ -1388,10 +1424,10 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorResponse::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -1431,7 +1467,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1476,7 +1512,7 @@ void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
file_.MergeFrom(from.file_);
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 39c4884080955..5ed6e55e006da 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -58,7 +58,7 @@ struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
- static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+ static const uint32_t offsets[];
};
PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
PROTOBUF_NAMESPACE_OPEN
@@ -211,8 +211,8 @@ class PROTOC_EXPORT Version final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -271,11 +271,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_major() const;
public:
void clear_major();
- ::PROTOBUF_NAMESPACE_ID::int32 major() const;
- void set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t major() const;
+ void set_major(int32_t value);
private:
- ::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const;
- void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t _internal_major() const;
+ void _internal_set_major(int32_t value);
public:
// optional int32 minor = 2;
@@ -284,11 +284,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_minor() const;
public:
void clear_minor();
- ::PROTOBUF_NAMESPACE_ID::int32 minor() const;
- void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t minor() const;
+ void set_minor(int32_t value);
private:
- ::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const;
- void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t _internal_minor() const;
+ void _internal_set_minor(int32_t value);
public:
// optional int32 patch = 3;
@@ -297,11 +297,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_patch() const;
public:
void clear_patch();
- ::PROTOBUF_NAMESPACE_ID::int32 patch() const;
- void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t patch() const;
+ void set_patch(int32_t value);
private:
- ::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const;
- void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
+ int32_t _internal_patch() const;
+ void _internal_set_patch(int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version)
@@ -314,9 +314,9 @@ class PROTOC_EXPORT Version final :
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_;
- ::PROTOBUF_NAMESPACE_ID::int32 major_;
- ::PROTOBUF_NAMESPACE_ID::int32 minor_;
- ::PROTOBUF_NAMESPACE_ID::int32 patch_;
+ int32_t major_;
+ int32_t minor_;
+ int32_t patch_;
friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
};
// -------------------------------------------------------------------
@@ -421,8 +421,8 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -652,8 +652,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -877,8 +877,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@@ -986,11 +986,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
bool _internal_has_supported_features() const;
public:
void clear_supported_features();
- ::PROTOBUF_NAMESPACE_ID::uint64 supported_features() const;
- void set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
+ uint64_t supported_features() const;
+ void set_supported_features(uint64_t value);
private:
- ::PROTOBUF_NAMESPACE_ID::uint64 _internal_supported_features() const;
- void _internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
+ uint64_t _internal_supported_features() const;
+ void _internal_set_supported_features(uint64_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
@@ -1004,7 +1004,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_;
- ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_;
+ uint64_t supported_features_;
friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
};
// ===================================================================
@@ -1030,18 +1030,18 @@ inline void Version::clear_major() {
major_ = 0;
_has_bits_[0] &= ~0x00000002u;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const {
+inline int32_t Version::_internal_major() const {
return major_;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const {
+inline int32_t Version::major() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major)
return _internal_major();
}
-inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_major(int32_t value) {
_has_bits_[0] |= 0x00000002u;
major_ = value;
}
-inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_major(int32_t value) {
_internal_set_major(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major)
}
@@ -1058,18 +1058,18 @@ inline void Version::clear_minor() {
minor_ = 0;
_has_bits_[0] &= ~0x00000004u;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const {
+inline int32_t Version::_internal_minor() const {
return minor_;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const {
+inline int32_t Version::minor() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor)
return _internal_minor();
}
-inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_minor(int32_t value) {
_has_bits_[0] |= 0x00000004u;
minor_ = value;
}
-inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_minor(int32_t value) {
_internal_set_minor(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor)
}
@@ -1086,18 +1086,18 @@ inline void Version::clear_patch() {
patch_ = 0;
_has_bits_[0] &= ~0x00000008u;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const {
+inline int32_t Version::_internal_patch() const {
return patch_;
}
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const {
+inline int32_t Version::patch() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch)
return _internal_patch();
}
-inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_patch(int32_t value) {
_has_bits_[0] |= 0x00000008u;
patch_ = value;
}
-inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_patch(int32_t value) {
_internal_set_patch(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch)
}
@@ -1148,6 +1148,11 @@ inline std::string* Version::release_suffix() {
}
_has_bits_[0] &= ~0x00000001u;
return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void Version::set_allocated_suffix(std::string* suffix) {
if (suffix != nullptr) {
@@ -1157,6 +1162,11 @@ inline void Version::set_allocated_suffix(std::string* suffix) {
}
suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
}
@@ -1285,6 +1295,11 @@ inline std::string* CodeGeneratorRequest::release_parameter() {
}
_has_bits_[0] &= ~0x00000001u;
return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) {
if (parameter != nullptr) {
@@ -1294,6 +1309,11 @@ inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter
}
parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
@@ -1474,6 +1494,11 @@ inline std::string* CodeGeneratorResponse_File::release_name() {
}
_has_bits_[0] &= ~0x00000001u;
return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1483,6 +1508,11 @@ inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
@@ -1532,6 +1562,11 @@ inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
}
_has_bits_[0] &= ~0x00000002u;
return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* insertion_point) {
if (insertion_point != nullptr) {
@@ -1541,6 +1576,11 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::strin
}
insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
@@ -1590,6 +1630,11 @@ inline std::string* CodeGeneratorResponse_File::release_content() {
}
_has_bits_[0] &= ~0x00000004u;
return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) {
if (content != nullptr) {
@@ -1599,6 +1644,11 @@ inline void CodeGeneratorResponse_File::set_allocated_content(std::string* conte
}
content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
@@ -1740,6 +1790,11 @@ inline std::string* CodeGeneratorResponse::release_error() {
}
_has_bits_[0] &= ~0x00000001u;
return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
if (error != nullptr) {
@@ -1749,6 +1804,11 @@ inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
}
error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error,
GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+ error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
}
@@ -1764,18 +1824,18 @@ inline void CodeGeneratorResponse::clear_supported_features() {
supported_features_ = uint64_t{0u};
_has_bits_[0] &= ~0x00000002u;
}
-inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::_internal_supported_features() const {
+inline uint64_t CodeGeneratorResponse::_internal_supported_features() const {
return supported_features_;
}
-inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::supported_features() const {
+inline uint64_t CodeGeneratorResponse::supported_features() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
return _internal_supported_features();
}
-inline void CodeGeneratorResponse::_internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void CodeGeneratorResponse::_internal_set_supported_features(uint64_t value) {
_has_bits_[0] |= 0x00000002u;
supported_features_ = value;
}
-inline void CodeGeneratorResponse::set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void CodeGeneratorResponse::set_supported_features(uint64_t value) {
_internal_set_supported_features(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
}
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index 95de716f923ee..ebe7d72097064 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -180,6 +180,8 @@ void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file,
}
printer->Print(
"from google.protobuf import descriptor as _descriptor\n"
+ "from google.protobuf import descriptor_pool as "
+ "_descriptor_pool\n"
"from google.protobuf import message as _message\n"
"from google.protobuf import reflection as _reflection\n"
"from google.protobuf import symbol_database as "
@@ -350,12 +352,32 @@ bool Generator::Generate(const FileDescriptor* file,
PrintTopLevelEnums();
PrintTopLevelExtensions();
if (pure_python_workable_) {
- PrintAllNestedEnumsInFile();
- PrintMessageDescriptors();
- FixForeignFieldsInDescriptors();
+ if (GeneratingDescriptorProto()) {
+ printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+ printer_->Indent();
+ // Create enums before message descriptors
+ PrintAllNestedEnumsInFile(StripPrintDescriptor::kCreate);
+ PrintMessageDescriptors(StripPrintDescriptor::kCreate);
+ FixForeignFieldsInDescriptors();
+ printer_->Outdent();
+ printer_->Print("else:\n");
+ printer_->Indent();
+ }
+ // Find the message descriptors first and then use the message
+ // descriptor to find enums.
+ PrintMessageDescriptors(StripPrintDescriptor::kFind);
+ PrintAllNestedEnumsInFile(StripPrintDescriptor::kFind);
+ if (GeneratingDescriptorProto()) {
+ printer_->Outdent();
+ }
}
PrintMessages();
if (pure_python_workable_) {
+ PrintServiceDescriptors();
+
+ printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+ printer_->Indent();
+
// We have to fix up the extensions after the message classes themselves,
// since they need to call static RegisterExtension() methods on these
// classes.
@@ -366,7 +388,11 @@ bool Generator::Generate(const FileDescriptor* file,
// custom options that may be unknown when we define the descriptors.
// This does not apply to services because they are not used by extensions.
FixAllDescriptorOptions();
- PrintServiceDescriptors();
+
+ // Set serialized_start and serialized_end.
+ SetSerializedPbInterval();
+
+ printer_->Outdent();
}
if (HasGenericServices(file)) {
PrintServices();
@@ -428,46 +454,65 @@ void Generator::PrintFileDescriptor() const {
m["package"] = file_->package();
m["syntax"] = StringifySyntax(file_->syntax());
m["options"] = OptionsValue(file_->options().SerializeAsString());
- const char file_descriptor_template[] =
- "$descriptor_name$ = _descriptor.FileDescriptor(\n"
- " name='$name$',\n"
- " package='$package$',\n"
- " syntax='$syntax$',\n"
- " serialized_options=$options$,\n"
- " create_key=_descriptor._internal_create_key,\n";
- printer_->Print(m, file_descriptor_template);
- printer_->Indent();
- if (pure_python_workable_) {
- printer_->Print("serialized_pb=b'$value$'\n", "value",
- strings::CHexEscape(file_descriptor_serialized_));
- if (file_->dependency_count() != 0) {
- printer_->Print(",\ndependencies=[");
- for (int i = 0; i < file_->dependency_count(); ++i) {
- std::string module_alias = ModuleAlias(file_->dependency(i)->name());
- printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
- module_alias);
+ m["serialized_descriptor"] = strings::CHexEscape(file_descriptor_serialized_);
+ if (GeneratingDescriptorProto()) {
+ printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+ printer_->Indent();
+ // Pure python's AddSerializedFile() depend on the generated
+ // descriptor_pb2.py thus we can not use AddSerializedFile() when
+ // generated descriptor.proto for pure python.
+ const char file_descriptor_template[] =
+ "$descriptor_name$ = _descriptor.FileDescriptor(\n"
+ " name='$name$',\n"
+ " package='$package$',\n"
+ " syntax='$syntax$',\n"
+ " serialized_options=$options$,\n"
+ " create_key=_descriptor._internal_create_key,\n";
+ printer_->Print(m, file_descriptor_template);
+ printer_->Indent();
+ if (pure_python_workable_) {
+ printer_->Print("serialized_pb=b'$value$'\n", "value",
+ strings::CHexEscape(file_descriptor_serialized_));
+ if (file_->dependency_count() != 0) {
+ printer_->Print(",\ndependencies=[");
+ for (int i = 0; i < file_->dependency_count(); ++i) {
+ std::string module_alias = ModuleAlias(file_->dependency(i)->name());
+ printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
+ module_alias);
+ }
+ printer_->Print("]");
}
- printer_->Print("]");
- }
- if (file_->public_dependency_count() > 0) {
- printer_->Print(",\npublic_dependencies=[");
- for (int i = 0; i < file_->public_dependency_count(); ++i) {
- std::string module_alias =
- ModuleAlias(file_->public_dependency(i)->name());
- printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
- module_alias);
+ if (file_->public_dependency_count() > 0) {
+ printer_->Print(",\npublic_dependencies=[");
+ for (int i = 0; i < file_->public_dependency_count(); ++i) {
+ std::string module_alias =
+ ModuleAlias(file_->public_dependency(i)->name());
+ printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
+ module_alias);
+ }
+ printer_->Print("]");
}
- printer_->Print("]");
+ } else {
+ printer_->Print("serialized_pb=''\n");
}
- } else {
- printer_->Print("serialized_pb=''\n");
- }
- // TODO(falk): Also print options and fix the message_type, enum_type,
- // service and extension later in the generation.
+ // TODO(falk): Also print options and fix the message_type, enum_type,
+ // service and extension later in the generation.
- printer_->Outdent();
- printer_->Print(")\n");
+ printer_->Outdent();
+ printer_->Print(")\n");
+
+ printer_->Outdent();
+ printer_->Print("else:\n");
+ printer_->Indent();
+ }
+ printer_->Print(m,
+ "$descriptor_name$ = "
+ "_descriptor_pool.Default().AddSerializedFile(b'$serialized_"
+ "descriptor$')\n");
+ if (GeneratingDescriptorProto()) {
+ printer_->Outdent();
+ }
printer_->Print("\n");
}
@@ -477,7 +522,7 @@ void Generator::PrintTopLevelEnums() const {
std::vector > top_level_enum_values;
for (int i = 0; i < file_->enum_type_count(); ++i) {
const EnumDescriptor& enum_descriptor = *file_->enum_type(i);
- PrintEnum(enum_descriptor);
+ PrintFindEnum(enum_descriptor);
printer_->Print(
"$name$ = "
"enum_type_wrapper.EnumTypeWrapper($descriptor_name$)",
@@ -501,16 +546,17 @@ void Generator::PrintTopLevelEnums() const {
}
// Prints all enums contained in all message types in |file|.
-void Generator::PrintAllNestedEnumsInFile() const {
+void Generator::PrintAllNestedEnumsInFile(
+ StripPrintDescriptor print_mode) const {
for (int i = 0; i < file_->message_type_count(); ++i) {
- PrintNestedEnums(*file_->message_type(i));
+ PrintNestedEnums(*file_->message_type(i), print_mode);
}
}
// Prints a Python statement assigning the appropriate module-level
// enum name to a Python EnumDescriptor object equivalent to
// enum_descriptor.
-void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
+void Generator::PrintCreateEnum(const EnumDescriptor& enum_descriptor) const {
std::map m;
std::string module_level_descriptor_name =
ModuleLevelDescriptorName(enum_descriptor);
@@ -545,7 +591,6 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
printer_->Print("serialized_options=$options_value$,\n", "options_value",
OptionsValue(options_string));
EnumDescriptorProto edp;
- PrintSerializedPbInterval(enum_descriptor, edp);
printer_->Outdent();
printer_->Print(")\n");
if (pure_python_workable_) {
@@ -555,20 +600,41 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
printer_->Print("\n");
}
+void Generator::PrintFindEnum(const EnumDescriptor& enum_descriptor) const {
+ std::map m;
+ m["descriptor_name"] = ModuleLevelDescriptorName(enum_descriptor);
+ m["name"] = enum_descriptor.name();
+ m["file"] = kDescriptorKey;
+ if (enum_descriptor.containing_type()) {
+ m["containing_type"] =
+ ModuleLevelDescriptorName(*enum_descriptor.containing_type());
+ printer_->Print(m,
+ "$descriptor_name$ = "
+ "$containing_type$.enum_types_by_name['$name$']\n");
+ } else {
+ printer_->Print(
+ m, "$descriptor_name$ = $file$.enum_types_by_name['$name$']\n");
+ }
+}
+
// Recursively prints enums in nested types within descriptor, then
// prints enums contained at the top level in descriptor.
-void Generator::PrintNestedEnums(const Descriptor& descriptor) const {
+void Generator::PrintNestedEnums(const Descriptor& descriptor,
+ StripPrintDescriptor print_mode) const {
for (int i = 0; i < descriptor.nested_type_count(); ++i) {
- PrintNestedEnums(*descriptor.nested_type(i));
+ PrintNestedEnums(*descriptor.nested_type(i), print_mode);
}
for (int i = 0; i < descriptor.enum_type_count(); ++i) {
- PrintEnum(*descriptor.enum_type(i));
+ if (print_mode == StripPrintDescriptor::kCreate) {
+ PrintCreateEnum(*descriptor.enum_type(i));
+ } else {
+ PrintFindEnum(*descriptor.enum_type(i));
+ }
}
}
void Generator::PrintTopLevelExtensions() const {
- const bool is_extension = true;
for (int i = 0; i < file_->extension_count(); ++i) {
const FieldDescriptor& extension_field = *file_->extension(i);
std::string constant_name = extension_field.name() + "_FIELD_NUMBER";
@@ -576,27 +642,32 @@ void Generator::PrintTopLevelExtensions() const {
printer_->Print("$constant_name$ = $number$\n", "constant_name",
constant_name, "number",
StrCat(extension_field.number()));
- printer_->Print("$name$ = ", "name",
- ResolveKeyword(extension_field.name()));
- PrintFieldDescriptor(extension_field, is_extension);
- printer_->Print("\n");
+ printer_->Print(
+ "$resolved_name$ = "
+ "$file$.extensions_by_name['$name$']\n",
+ "resolved_name", ResolveKeyword(extension_field.name()), "file",
+ kDescriptorKey, "name", extension_field.name());
}
printer_->Print("\n");
}
// Prints Python equivalents of all Descriptors in |file|.
-void Generator::PrintMessageDescriptors() const {
- for (int i = 0; i < file_->message_type_count(); ++i) {
- PrintDescriptor(*file_->message_type(i));
- printer_->Print("\n");
+void Generator::PrintMessageDescriptors(StripPrintDescriptor print_mode) const {
+ if (print_mode == StripPrintDescriptor::kCreate) {
+ for (int i = 0; i < file_->message_type_count(); ++i) {
+ PrintCreateDescriptor(*file_->message_type(i));
+ printer_->Print("\n");
+ }
+ } else {
+ for (int i = 0; i < file_->message_type_count(); ++i) {
+ PrintFindDescriptor(*file_->message_type(i));
+ }
}
}
void Generator::PrintServiceDescriptors() const {
for (int i = 0; i < file_->service_count(); ++i) {
PrintServiceDescriptor(*file_->service(i));
- AddServiceToFileDescriptor(*file_->service(i));
- printer_->Print("\n");
}
}
@@ -610,65 +681,11 @@ void Generator::PrintServices() const {
void Generator::PrintServiceDescriptor(
const ServiceDescriptor& descriptor) const {
- printer_->Print("\n");
- std::string service_name = ModuleLevelServiceDescriptorName(descriptor);
- std::string options_string;
- descriptor.options().SerializeToString(&options_string);
-
- printer_->Print("$service_name$ = _descriptor.ServiceDescriptor(\n",
- "service_name", service_name);
- printer_->Indent();
std::map m;
+ m["service_name"] = ModuleLevelServiceDescriptorName(descriptor);
m["name"] = descriptor.name();
- m["full_name"] = descriptor.full_name();
m["file"] = kDescriptorKey;
- m["index"] = StrCat(descriptor.index());
- m["options_value"] = OptionsValue(options_string);
- const char required_function_arguments[] =
- "name='$name$',\n"
- "full_name='$full_name$',\n"
- "file=$file$,\n"
- "index=$index$,\n"
- "serialized_options=$options_value$,\n"
- "create_key=_descriptor._internal_create_key,\n";
- printer_->Print(m, required_function_arguments);
-
- ServiceDescriptorProto sdp;
- PrintSerializedPbInterval(descriptor, sdp);
-
- printer_->Print("methods=[\n");
- for (int i = 0; i < descriptor.method_count(); ++i) {
- const MethodDescriptor* method = descriptor.method(i);
- method->options().SerializeToString(&options_string);
-
- m.clear();
- m["name"] = method->name();
- m["full_name"] = method->full_name();
- m["index"] = StrCat(method->index());
- m["serialized_options"] = CEscape(options_string);
- m["input_type"] = ModuleLevelDescriptorName(*(method->input_type()));
- m["output_type"] = ModuleLevelDescriptorName(*(method->output_type()));
- m["options_value"] = OptionsValue(options_string);
- printer_->Print("_descriptor.MethodDescriptor(\n");
- printer_->Indent();
- printer_->Print(m,
- "name='$name$',\n"
- "full_name='$full_name$',\n"
- "index=$index$,\n"
- "containing_service=None,\n"
- "input_type=$input_type$,\n"
- "output_type=$output_type$,\n"
- "serialized_options=$options_value$,\n"
- "create_key=_descriptor._internal_create_key,\n");
- printer_->Outdent();
- printer_->Print("),\n");
- }
-
- printer_->Outdent();
- printer_->Print("])\n");
- printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name",
- service_name);
- printer_->Print("\n");
+ printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n");
}
void Generator::PrintDescriptorKeyAndModuleName(
@@ -713,18 +730,20 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const {
// to a Python Descriptor object for message_descriptor.
//
// Mutually recursive with PrintNestedDescriptors().
-void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
- PrintNestedDescriptors(message_descriptor);
+void Generator::PrintCreateDescriptor(
+ const Descriptor& message_descriptor) const {
+ std::map m;
+ m["name"] = message_descriptor.name();
+ m["full_name"] = message_descriptor.full_name();
+ m["file"] = kDescriptorKey;
+
+ PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kCreate);
printer_->Print("\n");
printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n",
"descriptor_name",
ModuleLevelDescriptorName(message_descriptor));
printer_->Indent();
- std::map m;
- m["name"] = message_descriptor.name();
- m["full_name"] = message_descriptor.full_name();
- m["file"] = kDescriptorKey;
const char required_function_arguments[] =
"name='$name$',\n"
"full_name='$full_name$',\n"
@@ -800,22 +819,46 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
}
printer_->Outdent();
printer_->Print("],\n");
- // Serialization of proto
- DescriptorProto edp;
- PrintSerializedPbInterval(message_descriptor, edp);
printer_->Outdent();
printer_->Print(")\n");
}
+void Generator::PrintFindDescriptor(
+ const Descriptor& message_descriptor) const {
+ std::map m;
+ m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor);
+ m["name"] = message_descriptor.name();
+
+ if (message_descriptor.containing_type()) {
+ m["containing_type"] =
+ ModuleLevelDescriptorName(*message_descriptor.containing_type());
+ printer_->Print(m,
+ "$descriptor_name$ = "
+ "$containing_type$.nested_types_by_name['$name$']\n");
+ } else {
+ m["file"] = kDescriptorKey;
+ printer_->Print(
+ m, "$descriptor_name$ = $file$.message_types_by_name['$name$']\n");
+ }
+
+ PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kFind);
+}
+
// Prints Python Descriptor objects for all nested types contained in
// message_descriptor.
//
// Mutually recursive with PrintDescriptor().
-void Generator::PrintNestedDescriptors(
- const Descriptor& containing_descriptor) const {
- for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
- PrintDescriptor(*containing_descriptor.nested_type(i));
+void Generator::PrintNestedDescriptors(const Descriptor& containing_descriptor,
+ StripPrintDescriptor print_mode) const {
+ if (print_mode == StripPrintDescriptor::kCreate) {
+ for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
+ PrintCreateDescriptor(*containing_descriptor.nested_type(i));
+ }
+ } else {
+ for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
+ PrintFindDescriptor(*containing_descriptor.nested_type(i));
+ }
}
}
@@ -1098,10 +1141,6 @@ void Generator::FixForeignFieldsInExtensions() const {
void Generator::FixForeignFieldsInExtension(
const FieldDescriptor& extension_field) const {
GOOGLE_CHECK(extension_field.is_extension());
- // extension_scope() will be NULL for top-level extensions, which is
- // exactly what FixForeignFieldsInField() wants.
- FixForeignFieldsInField(extension_field.extension_scope(), extension_field,
- "extensions_by_name");
std::map m;
// Confusingly, for FieldDescriptors that happen to be extensions,
@@ -1300,7 +1339,8 @@ std::string Generator::ModuleLevelServiceDescriptorName(
//
template
void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
- DescriptorProtoT& proto) const {
+ DescriptorProtoT& proto,
+ const std::string& name) const {
descriptor.CopyTo(&proto);
std::string sp;
proto.SerializeToString(&sp);
@@ -1308,9 +1348,9 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
GOOGLE_CHECK_GE(offset, 0);
printer_->Print(
- "serialized_start=$serialized_start$,\n"
- "serialized_end=$serialized_end$,\n",
- "serialized_start", StrCat(offset), "serialized_end",
+ "$name$._serialized_start=$serialized_start$\n"
+ "$name$._serialized_end=$serialized_end$\n",
+ "name", name, "serialized_start", StrCat(offset), "serialized_end",
StrCat(offset + sp.size()));
}
@@ -1320,16 +1360,62 @@ void PrintDescriptorOptionsFixingCode(const std::string& descriptor,
io::Printer* printer) {
// Reset the _options to None thus DescriptorBase.GetOptions() can
// parse _options again after extensions are registered.
- printer->Print("$descriptor$._options = None\n", "descriptor", descriptor);
+ printer->Print(
+ "$descriptor$._options = None\n"
+ "$descriptor$._serialized_options = $serialized_value$\n",
+ "descriptor", descriptor, "serialized_value", options);
}
} // namespace
+void Generator::SetSerializedPbInterval() const {
+ // Top level enums.
+ for (int i = 0; i < file_->enum_type_count(); ++i) {
+ EnumDescriptorProto proto;
+ const EnumDescriptor& descriptor = *file_->enum_type(i);
+ PrintSerializedPbInterval(descriptor, proto,
+ ModuleLevelDescriptorName(descriptor));
+ }
+
+ // Messages.
+ for (int i = 0; i < file_->message_type_count(); ++i) {
+ SetMessagePbInterval(*file_->message_type(i));
+ }
+
+ // Services.
+ for (int i = 0; i < file_->service_count(); ++i) {
+ ServiceDescriptorProto proto;
+ const ServiceDescriptor& service = *file_->service(i);
+ PrintSerializedPbInterval(service, proto,
+ ModuleLevelServiceDescriptorName(service));
+ }
+}
+
+void Generator::SetMessagePbInterval(const Descriptor& descriptor) const {
+ DescriptorProto message_proto;
+ PrintSerializedPbInterval(descriptor, message_proto,
+ ModuleLevelDescriptorName(descriptor));
+
+ // Nested messages.
+ for (int i = 0; i < descriptor.nested_type_count(); ++i) {
+ SetMessagePbInterval(*descriptor.nested_type(i));
+ }
+
+ for (int i = 0; i < descriptor.enum_type_count(); ++i) {
+ EnumDescriptorProto proto;
+ const EnumDescriptor& enum_des = *descriptor.enum_type(i);
+ PrintSerializedPbInterval(enum_des, proto,
+ ModuleLevelDescriptorName(enum_des));
+ }
+}
+
// Prints expressions that set the options field of all descriptors.
void Generator::FixAllDescriptorOptions() const {
// Prints an expression that sets the file descriptor's options.
std::string file_options = OptionsValue(file_->options().SerializeAsString());
if (file_options != "None") {
PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_);
+ } else {
+ printer_->Print("DESCRIPTOR._options = None\n");
}
// Prints expressions that set the options for all top level enums.
for (int i = 0; i < file_->enum_type_count(); ++i) {
@@ -1346,6 +1432,10 @@ void Generator::FixAllDescriptorOptions() const {
for (int i = 0; i < file_->message_type_count(); ++i) {
FixOptionsForMessage(*file_->message_type(i));
}
+
+ for (int i = 0; i < file_->service_count(); ++i) {
+ FixOptionsForService(*file_->service(i));
+ }
}
void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const {
@@ -1380,6 +1470,31 @@ void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const {
}
}
+// Prints expressions that set the options for an service descriptor and its
+// value descriptors.
+void Generator::FixOptionsForService(
+ const ServiceDescriptor& service_descriptor) const {
+ std::string descriptor_name =
+ ModuleLevelServiceDescriptorName(service_descriptor);
+ std::string service_options =
+ OptionsValue(service_descriptor.options().SerializeAsString());
+ if (service_options != "None") {
+ PrintDescriptorOptionsFixingCode(descriptor_name, service_options,
+ printer_);
+ }
+
+ for (int i = 0; i < service_descriptor.method_count(); ++i) {
+ const MethodDescriptor* method = service_descriptor.method(i);
+ std::string method_options =
+ OptionsValue(method->options().SerializeAsString());
+ if (method_options != "None") {
+ std::string method_name =
+ descriptor_name + ".methods_by_name['" + method->name() + "']";
+ PrintDescriptorOptionsFixingCode(method_name, method_options, printer_);
+ }
+ }
+}
+
// Prints expressions that set the options for field descriptors (including
// extensions).
void Generator::FixOptionsForField(const FieldDescriptor& field) const {
diff --git a/src/google/protobuf/compiler/python/python_generator.h b/src/google/protobuf/compiler/python/python_generator.h
index ed1c99504ca65..3b4c1323bdd2f 100644
--- a/src/google/protobuf/compiler/python/python_generator.h
+++ b/src/google/protobuf/compiler/python/python_generator.h
@@ -59,6 +59,8 @@ class Printer;
namespace compiler {
namespace python {
+enum class StripPrintDescriptor { kCreate, kFind };
+
// CodeGenerator implementation for generated Python protocol buffer classes.
// If you create your own protocol compiler binary and you want it to support
// Python output, you can do so by registering an instance of this
@@ -79,9 +81,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
void PrintImports() const;
void PrintFileDescriptor() const;
void PrintTopLevelEnums() const;
- void PrintAllNestedEnumsInFile() const;
- void PrintNestedEnums(const Descriptor& descriptor) const;
- void PrintEnum(const EnumDescriptor& enum_descriptor) const;
+ void PrintAllNestedEnumsInFile(StripPrintDescriptor print_mode) const;
+ void PrintNestedEnums(const Descriptor& descriptor,
+ StripPrintDescriptor print_mode) const;
+ void PrintCreateEnum(const EnumDescriptor& enum_descriptor) const;
+ void PrintFindEnum(const EnumDescriptor& enum_descriptor) const;
void PrintTopLevelExtensions() const;
@@ -93,9 +97,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const;
void PrintFieldsInDescriptor(const Descriptor& message_descriptor) const;
void PrintExtensionsInDescriptor(const Descriptor& message_descriptor) const;
- void PrintMessageDescriptors() const;
- void PrintDescriptor(const Descriptor& message_descriptor) const;
- void PrintNestedDescriptors(const Descriptor& containing_descriptor) const;
+ void PrintMessageDescriptors(StripPrintDescriptor print_mode) const;
+ void PrintCreateDescriptor(const Descriptor& message_descriptor) const;
+ void PrintFindDescriptor(const Descriptor& message_descriptor) const;
+ void PrintNestedDescriptors(const Descriptor& containing_descriptor,
+ StripPrintDescriptor print_mode) const;
void PrintMessages() const;
void PrintMessage(const Descriptor& message_descriptor,
@@ -150,14 +156,19 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
template
void PrintSerializedPbInterval(const DescriptorT& descriptor,
- DescriptorProtoT& proto) const;
+ DescriptorProtoT& proto,
+ const std::string& name) const;
void FixAllDescriptorOptions() const;
void FixOptionsForField(const FieldDescriptor& field) const;
void FixOptionsForOneof(const OneofDescriptor& oneof) const;
void FixOptionsForEnum(const EnumDescriptor& descriptor) const;
+ void FixOptionsForService(const ServiceDescriptor& descriptor) const;
void FixOptionsForMessage(const Descriptor& descriptor) const;
+ void SetSerializedPbInterval() const;
+ void SetMessagePbInterval(const Descriptor& descriptor) const;
+
void CopyPublicDependenciesAliases(const std::string& copy_from,
const FileDescriptor* file) const;
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index 0b057cd8624bb..2f7f95192efdf 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -453,7 +453,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto = nullptr;
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _internal_metadata_),
~0u, // no _extensions_
@@ -1308,7 +1308,7 @@ void FileDescriptorSet::SetCachedSize(int size) const {
void FileDescriptorSet::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1319,12 +1319,12 @@ void FileDescriptorSet::Clear() {
const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.FileDescriptorProto file = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@@ -1358,10 +1358,10 @@ const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorSet::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileDescriptorSet::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.FileDescriptorProto file = 1;
@@ -1384,7 +1384,7 @@ size_t FileDescriptorSet::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1414,7 +1414,7 @@ void FileDescriptorSet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FileDescriptorSet::MergeFrom(const FileDescriptorSet& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorSet)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
file_.MergeFrom(from.file_);
@@ -1505,16 +1505,25 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
weak_dependency_(from.weak_dependency_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_package()) {
package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package(),
GetArenaForAllocation());
}
syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_syntax()) {
syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_syntax(),
GetArenaForAllocation());
@@ -1534,8 +1543,17 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
inline void FileDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&options_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&source_code_info_) -
@@ -1570,7 +1588,7 @@ void FileDescriptorProto::SetCachedSize(int size) const {
void FileDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -1609,12 +1627,12 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1626,7 +1644,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional string package = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_package();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1638,7 +1656,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated string dependency = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@@ -1655,7 +1673,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.DescriptorProto message_type = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
ptr -= 1;
do {
ptr += 1;
@@ -1668,7 +1686,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) {
ptr -= 1;
do {
ptr += 1;
@@ -1681,7 +1699,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@@ -1694,7 +1712,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 1;
do {
ptr += 1;
@@ -1707,7 +1725,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional .google.protobuf.FileOptions options = 8;
case 8:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -1715,7 +1733,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
case 9:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) {
ptr = ctx->ParseMessage(_internal_mutable_source_code_info(), ptr);
CHK_(ptr);
} else
@@ -1723,7 +1741,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated int32 public_dependency = 10;
case 10:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) {
ptr -= 1;
do {
ptr += 1;
@@ -1731,7 +1749,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr));
- } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) {
+ } else if (static_cast(tag) == 82) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_public_dependency(), ptr, ctx);
CHK_(ptr);
} else
@@ -1739,7 +1757,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated int32 weak_dependency = 11;
case 11:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 88)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 88)) {
ptr -= 1;
do {
ptr += 1;
@@ -1747,7 +1765,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<88>(ptr));
- } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) {
+ } else if (static_cast(tag) == 90) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_weak_dependency(), ptr, ctx);
CHK_(ptr);
} else
@@ -1755,7 +1773,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional string syntax = 12;
case 12:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 98)) {
auto str = _internal_mutable_syntax();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -1789,10 +1807,10 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -1908,7 +1926,7 @@ size_t FileDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2023,7 +2041,7 @@ void FileDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
dependency_.MergeFrom(from.dependency_);
@@ -2190,7 +2208,7 @@ void DescriptorProto_ExtensionRange::SetCachedSize(int size) const {
void DescriptorProto_ExtensionRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2212,12 +2230,12 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional int32 start = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_start(&has_bits);
start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -2226,7 +2244,7 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR
continue;
// optional int32 end = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_end(&has_bits);
end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -2235,7 +2253,7 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR
continue;
// optional .google.protobuf.ExtensionRangeOptions options = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -2265,10 +2283,10 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ExtensionRange::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto_ExtensionRange::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -2304,7 +2322,7 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2347,7 +2365,7 @@ void DescriptorProto_ExtensionRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*
void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRange& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -2460,7 +2478,7 @@ void DescriptorProto_ReservedRange::SetCachedSize(int size) const {
void DescriptorProto_ReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2478,12 +2496,12 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional int32 start = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_start(&has_bits);
start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -2492,7 +2510,7 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO
continue;
// optional int32 end = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_end(&has_bits);
end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -2523,10 +2541,10 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ReservedRange::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto_ReservedRange::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -2554,7 +2572,7 @@ size_t DescriptorProto_ReservedRange::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2590,7 +2608,7 @@ void DescriptorProto_ReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*
void DescriptorProto_ReservedRange::MergeFrom(const DescriptorProto_ReservedRange& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ReservedRange)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -2683,6 +2701,9 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
reserved_name_(from.reserved_name_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@@ -2697,6 +2718,9 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
inline void DescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -2725,7 +2749,7 @@ void DescriptorProto::SetCachedSize(int size) const {
void DescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -2755,12 +2779,12 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -2772,7 +2796,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.FieldDescriptorProto field = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@@ -2785,7 +2809,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.DescriptorProto nested_type = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@@ -2798,7 +2822,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
ptr -= 1;
do {
ptr += 1;
@@ -2811,7 +2835,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) {
ptr -= 1;
do {
ptr += 1;
@@ -2824,7 +2848,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@@ -2837,7 +2861,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// optional .google.protobuf.MessageOptions options = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -2845,7 +2869,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
case 8:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
ptr -= 1;
do {
ptr += 1;
@@ -2858,7 +2882,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
case 9:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) {
ptr -= 1;
do {
ptr += 1;
@@ -2871,7 +2895,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
continue;
// repeated string reserved_name = 10;
case 10:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) {
ptr -= 1;
do {
ptr += 1;
@@ -2910,10 +2934,10 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -3013,7 +3037,7 @@ size_t DescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -3110,7 +3134,7 @@ void DescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void DescriptorProto::MergeFrom(const DescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
field_.MergeFrom(from.field_);
@@ -3232,7 +3256,7 @@ void ExtensionRangeOptions::SetCachedSize(int size) const {
void ExtensionRangeOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -3244,12 +3268,12 @@ void ExtensionRangeOptions::Clear() {
const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -3288,10 +3312,10 @@ const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NA
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* ExtensionRangeOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ExtensionRangeOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
@@ -3320,7 +3344,7 @@ size_t ExtensionRangeOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -3350,7 +3374,7 @@ void ExtensionRangeOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void ExtensionRangeOptions::MergeFrom(const ExtensionRangeOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ExtensionRangeOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -3446,26 +3470,41 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_extendee()) {
extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_extendee(),
GetArenaForAllocation());
}
type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_type_name()) {
type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_name(),
GetArenaForAllocation());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_default_value()) {
default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
GetArenaForAllocation());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_json_name()) {
json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
GetArenaForAllocation());
@@ -3483,10 +3522,25 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
inline void FieldDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&options_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&proto3_optional_) -
@@ -3524,7 +3578,7 @@ void FieldDescriptorProto::SetCachedSize(int size) const {
void FieldDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -3568,12 +3622,12 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -3585,7 +3639,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string extendee = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_extendee();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -3597,7 +3651,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional int32 number = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
_Internal::set_has_number(&has_bits);
number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -3606,8 +3660,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(val))) {
_internal_set_label(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>(val));
@@ -3619,8 +3673,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(val))) {
_internal_set_type(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>(val));
@@ -3632,7 +3686,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string type_name = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
auto str = _internal_mutable_type_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -3644,7 +3698,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string default_value = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
auto str = _internal_mutable_default_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -3656,7 +3710,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.FieldOptions options = 8;
case 8:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -3664,7 +3718,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional int32 oneof_index = 9;
case 9:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) {
_Internal::set_has_oneof_index(&has_bits);
oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -3673,7 +3727,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string json_name = 10;
case 10:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) {
auto str = _internal_mutable_json_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -3685,7 +3739,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional bool proto3_optional = 17;
case 17:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 136)) {
_Internal::set_has_proto3_optional(&has_bits);
proto3_optional_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -3716,10 +3770,10 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* FieldDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FieldDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -3825,7 +3879,7 @@ size_t FieldDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -3922,7 +3976,7 @@ void FieldDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -4061,6 +4115,9 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@@ -4075,6 +4132,9 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
inline void OneofDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -4103,7 +4163,7 @@ void OneofDescriptorProto::SetCachedSize(int size) const {
void OneofDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4125,12 +4185,12 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -4142,7 +4202,7 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.OneofOptions options = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -4172,10 +4232,10 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* OneofDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* OneofDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -4209,7 +4269,7 @@ size_t OneofDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4249,7 +4309,7 @@ void OneofDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -4360,7 +4420,7 @@ void EnumDescriptorProto_EnumReservedRange::SetCachedSize(int size) const {
void EnumDescriptorProto_EnumReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4378,12 +4438,12 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional int32 start = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_start(&has_bits);
start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -4392,7 +4452,7 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt
continue;
// optional int32 end = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_end(&has_bits);
end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -4423,10 +4483,10 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto_EnumReservedRange::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumDescriptorProto_EnumReservedRange::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -4454,7 +4514,7 @@ size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4490,7 +4550,7 @@ void EnumDescriptorProto_EnumReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::M
void EnumDescriptorProto_EnumReservedRange::MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -4573,6 +4633,9 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
reserved_name_(from.reserved_name_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@@ -4587,6 +4650,9 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
inline void EnumDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -4615,7 +4681,7 @@ void EnumDescriptorProto::SetCachedSize(int size) const {
void EnumDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4640,12 +4706,12 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -4657,7 +4723,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@@ -4670,7 +4736,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional .google.protobuf.EnumOptions options = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -4678,7 +4744,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
ptr -= 1;
do {
ptr += 1;
@@ -4691,7 +4757,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// repeated string reserved_name = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) {
ptr -= 1;
do {
ptr += 1;
@@ -4730,10 +4796,10 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -4793,7 +4859,7 @@ size_t EnumDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -4855,7 +4921,7 @@ void EnumDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
value_.MergeFrom(from.value_);
@@ -4946,6 +5012,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@@ -4961,6 +5030,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
inline void EnumValueDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&options_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&number_) -
@@ -4992,7 +5064,7 @@ void EnumValueDescriptorProto::SetCachedSize(int size) const {
void EnumValueDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5015,12 +5087,12 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -5032,7 +5104,7 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF
continue;
// optional int32 number = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_number(&has_bits);
number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@@ -5041,7 +5113,7 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF
continue;
// optional .google.protobuf.EnumValueOptions options = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -5071,10 +5143,10 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* EnumValueDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumValueDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -5114,7 +5186,7 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5159,7 +5231,7 @@ void EnumValueDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -5251,6 +5323,9 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro
method_(from.method_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@@ -5265,6 +5340,9 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro
inline void ServiceDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
options_ = nullptr;
}
@@ -5293,7 +5371,7 @@ void ServiceDescriptorProto::SetCachedSize(int size) const {
void ServiceDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5316,12 +5394,12 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -5333,7 +5411,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N
continue;
// repeated .google.protobuf.MethodDescriptorProto method = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@@ -5346,7 +5424,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N
continue;
// optional .google.protobuf.ServiceOptions options = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -5376,10 +5454,10 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* ServiceDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ServiceDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -5421,7 +5499,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5468,7 +5546,7 @@ void ServiceDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
method_.MergeFrom(from.method_);
@@ -5564,16 +5642,25 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_input_type()) {
input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_input_type(),
GetArenaForAllocation());
}
output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_output_type()) {
output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_output_type(),
GetArenaForAllocation());
@@ -5591,8 +5678,17 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
inline void MethodDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&options_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&server_streaming_) -
@@ -5626,7 +5722,7 @@ void MethodDescriptorProto::SetCachedSize(int size) const {
void MethodDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5657,12 +5753,12 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -5674,7 +5770,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional string input_type = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
auto str = _internal_mutable_input_type();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -5686,7 +5782,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional string output_type = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
auto str = _internal_mutable_output_type();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -5698,7 +5794,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional .google.protobuf.MethodOptions options = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
CHK_(ptr);
} else
@@ -5706,7 +5802,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional bool client_streaming = 5 [default = false];
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) {
_Internal::set_has_client_streaming(&has_bits);
client_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -5715,7 +5811,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional bool server_streaming = 6 [default = false];
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) {
_Internal::set_has_server_streaming(&has_bits);
server_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -5746,10 +5842,10 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* MethodDescriptorProto::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MethodDescriptorProto::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -5815,7 +5911,7 @@ size_t MethodDescriptorProto::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -5879,7 +5975,7 @@ void MethodDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodDescriptorProto)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -6041,51 +6137,81 @@ FileOptions::FileOptions(const FileOptions& from)
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_package()) {
java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_package(),
GetArenaForAllocation());
}
java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_java_outer_classname()) {
java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_outer_classname(),
GetArenaForAllocation());
}
go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_go_package()) {
go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_go_package(),
GetArenaForAllocation());
}
objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_objc_class_prefix()) {
objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_objc_class_prefix(),
GetArenaForAllocation());
}
csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_csharp_namespace()) {
csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_csharp_namespace(),
GetArenaForAllocation());
}
swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_swift_prefix()) {
swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_swift_prefix(),
GetArenaForAllocation());
}
php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_class_prefix()) {
php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_class_prefix(),
GetArenaForAllocation());
}
php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_namespace()) {
php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_namespace(),
GetArenaForAllocation());
}
php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_php_metadata_namespace()) {
php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_metadata_namespace(),
GetArenaForAllocation());
}
ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_ruby_package()) {
ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_ruby_package(),
GetArenaForAllocation());
@@ -6098,15 +6224,45 @@ FileOptions::FileOptions(const FileOptions& from)
inline void FileOptions::SharedCtor() {
java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&java_multiple_files_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&deprecated_) -
@@ -6148,7 +6304,7 @@ void FileOptions::SetCachedSize(int size) const {
void FileOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -6209,12 +6365,12 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string java_package = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_java_package();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6226,7 +6382,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string java_outer_classname = 8;
case 8:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
auto str = _internal_mutable_java_outer_classname();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6238,8 +6394,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
case 9:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(val))) {
_internal_set_optimize_for(static_cast<::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>(val));
@@ -6251,7 +6407,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool java_multiple_files = 10 [default = false];
case 10:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) {
_Internal::set_has_java_multiple_files(&has_bits);
java_multiple_files_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6260,7 +6416,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string go_package = 11;
case 11:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 90)) {
auto str = _internal_mutable_go_package();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6272,7 +6428,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool cc_generic_services = 16 [default = false];
case 16:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 128)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 128)) {
_Internal::set_has_cc_generic_services(&has_bits);
cc_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6281,7 +6437,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool java_generic_services = 17 [default = false];
case 17:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 136)) {
_Internal::set_has_java_generic_services(&has_bits);
java_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6290,7 +6446,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool py_generic_services = 18 [default = false];
case 18:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 144)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 144)) {
_Internal::set_has_py_generic_services(&has_bits);
py_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6299,7 +6455,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
case 20:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 160)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 160)) {
_Internal::set_has_java_generate_equals_and_hash(&has_bits);
java_generate_equals_and_hash_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6308,7 +6464,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool deprecated = 23 [default = false];
case 23:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 184)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 184)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6317,7 +6473,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool java_string_check_utf8 = 27 [default = false];
case 27:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 216)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 216)) {
_Internal::set_has_java_string_check_utf8(&has_bits);
java_string_check_utf8_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6326,7 +6482,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool cc_enable_arenas = 31 [default = true];
case 31:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 248)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 248)) {
_Internal::set_has_cc_enable_arenas(&has_bits);
cc_enable_arenas_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6335,7 +6491,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string objc_class_prefix = 36;
case 36:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
auto str = _internal_mutable_objc_class_prefix();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6347,7 +6503,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string csharp_namespace = 37;
case 37:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) {
auto str = _internal_mutable_csharp_namespace();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6359,7 +6515,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string swift_prefix = 39;
case 39:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
auto str = _internal_mutable_swift_prefix();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6371,7 +6527,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string php_class_prefix = 40;
case 40:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
auto str = _internal_mutable_php_class_prefix();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6383,7 +6539,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string php_namespace = 41;
case 41:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) {
auto str = _internal_mutable_php_namespace();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6395,7 +6551,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool php_generic_services = 42 [default = false];
case 42:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) {
_Internal::set_has_php_generic_services(&has_bits);
php_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -6404,7 +6560,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string php_metadata_namespace = 44;
case 44:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 98)) {
auto str = _internal_mutable_php_metadata_namespace();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6416,7 +6572,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional string ruby_package = 45;
case 45:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 106)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 106)) {
auto str = _internal_mutable_ruby_package();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -6428,7 +6584,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -6468,10 +6624,10 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* FileOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -6662,7 +6818,7 @@ size_t FileOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -6820,7 +6976,7 @@ void FileOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FileOptions::MergeFrom(const FileOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -7059,7 +7215,7 @@ void MessageOptions::SetCachedSize(int size) const {
void MessageOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7076,12 +7232,12 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional bool message_set_wire_format = 1 [default = false];
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_message_set_wire_format(&has_bits);
message_set_wire_format_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7090,7 +7246,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
continue;
// optional bool no_standard_descriptor_accessor = 2 [default = false];
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_no_standard_descriptor_accessor(&has_bits);
no_standard_descriptor_accessor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7099,7 +7255,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
continue;
// optional bool deprecated = 3 [default = false];
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7108,7 +7264,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
continue;
// optional bool map_entry = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) {
_Internal::set_has_map_entry(&has_bits);
map_entry_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7117,7 +7273,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -7157,10 +7313,10 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* MessageOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MessageOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -7214,7 +7370,7 @@ size_t MessageOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7267,7 +7423,7 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void MessageOptions::MergeFrom(const MessageOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MessageOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -7405,7 +7561,7 @@ void FieldOptions::SetCachedSize(int size) const {
void FieldOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7425,13 +7581,13 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(val))) {
_internal_set_ctype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_CType>(val));
@@ -7443,7 +7599,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// optional bool packed = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_packed(&has_bits);
packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7452,7 +7608,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// optional bool deprecated = 3 [default = false];
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7461,7 +7617,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// optional bool lazy = 5 [default = false];
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) {
_Internal::set_has_lazy(&has_bits);
lazy_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7470,8 +7626,8 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(val))) {
_internal_set_jstype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>(val));
@@ -7483,7 +7639,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// optional bool weak = 10 [default = false];
case 10:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) {
_Internal::set_has_weak(&has_bits);
weak_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -7492,7 +7648,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -7532,10 +7688,10 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* FieldOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FieldOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -7603,7 +7759,7 @@ size_t FieldOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7668,7 +7824,7 @@ void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FieldOptions::MergeFrom(const FieldOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -7785,7 +7941,7 @@ void OneofOptions::SetCachedSize(int size) const {
void OneofOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7797,12 +7953,12 @@ void OneofOptions::Clear() {
const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -7841,10 +7997,10 @@ const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* OneofOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* OneofOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
@@ -7873,7 +8029,7 @@ size_t OneofOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -7903,7 +8059,7 @@ void OneofOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void OneofOptions::MergeFrom(const OneofOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8006,7 +8162,7 @@ void EnumOptions::SetCachedSize(int size) const {
void EnumOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8023,12 +8179,12 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional bool allow_alias = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_allow_alias(&has_bits);
allow_alias_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -8037,7 +8193,7 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// optional bool deprecated = 3 [default = false];
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -8046,7 +8202,7 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -8086,10 +8242,10 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* EnumOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -8131,7 +8287,7 @@ size_t EnumOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8174,7 +8330,7 @@ void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void EnumOptions::MergeFrom(const EnumOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8286,7 +8442,7 @@ void EnumValueOptions::SetCachedSize(int size) const {
void EnumValueOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8301,12 +8457,12 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional bool deprecated = 1 [default = false];
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -8315,7 +8471,7 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -8355,10 +8511,10 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* EnumValueOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumValueOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -8394,7 +8550,7 @@ size_t EnumValueOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8430,7 +8586,7 @@ void EnumValueOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void EnumValueOptions::MergeFrom(const EnumValueOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8530,7 +8686,7 @@ void ServiceOptions::SetCachedSize(int size) const {
void ServiceOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8545,12 +8701,12 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional bool deprecated = 33 [default = false];
case 33:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -8559,7 +8715,7 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -8599,10 +8755,10 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* ServiceOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ServiceOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -8638,7 +8794,7 @@ size_t ServiceOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8674,7 +8830,7 @@ void ServiceOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void ServiceOptions::MergeFrom(const ServiceOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8782,7 +8938,7 @@ void MethodOptions::SetCachedSize(int size) const {
void MethodOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8802,12 +8958,12 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional bool deprecated = 33 [default = false];
case 33:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) {
_Internal::set_has_deprecated(&has_bits);
deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -8816,8 +8972,8 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_
continue;
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
case 34:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
- ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
+ uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(val))) {
_internal_set_idempotency_level(static_cast<::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>(val));
@@ -8829,7 +8985,7 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
ptr -= 2;
do {
ptr += 2;
@@ -8869,10 +9025,10 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* MethodOptions::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MethodOptions::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -8915,7 +9071,7 @@ size_t MethodOptions::ByteSizeLong() const {
total_size += _extensions_.ByteSize();
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -8959,7 +9115,7 @@ void MethodOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void MethodOptions::MergeFrom(const MethodOptions& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodOptions)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -9043,6 +9199,9 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name_part()) {
name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name_part(),
GetArenaForAllocation());
@@ -9053,6 +9212,9 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp
inline void UninterpretedOption_NamePart::SharedCtor() {
name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
is_extension_ = false;
}
@@ -9080,7 +9242,7 @@ void UninterpretedOption_NamePart::SetCachedSize(int size) const {
void UninterpretedOption_NamePart::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9097,12 +9259,12 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// required string name_part = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
auto str = _internal_mutable_name_part();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -9114,7 +9276,7 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT
continue;
// required bool is_extension = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) {
_Internal::set_has_is_extension(&has_bits);
is_extension_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -9145,10 +9307,10 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption_NamePart::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UninterpretedOption_NamePart::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@@ -9210,7 +9372,7 @@ size_t UninterpretedOption_NamePart::ByteSizeLong() const {
} else {
total_size += RequiredFieldsByteSizeFallback();
}
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9233,7 +9395,7 @@ void UninterpretedOption_NamePart::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* t
void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption.NamePart)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@@ -9322,16 +9484,25 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
name_(from.name_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_identifier_value()) {
identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_identifier_value(),
GetArenaForAllocation());
}
string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_string_value()) {
string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_string_value(),
GetArenaForAllocation());
}
aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_aggregate_value()) {
aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aggregate_value(),
GetArenaForAllocation());
@@ -9344,8 +9515,17 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
inline void UninterpretedOption::SharedCtor() {
identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast(
reinterpret_cast(&positive_int_value_) - reinterpret_cast(this)),
0, static_cast(reinterpret_cast(&double_value_) -
@@ -9378,7 +9558,7 @@ void UninterpretedOption::SetCachedSize(int size) const {
void UninterpretedOption::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9408,12 +9588,12 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@@ -9426,7 +9606,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional string identifier_value = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
auto str = _internal_mutable_identifier_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -9438,7 +9618,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional uint64 positive_int_value = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) {
_Internal::set_has_positive_int_value(&has_bits);
positive_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -9447,7 +9627,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional int64 negative_int_value = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) {
_Internal::set_has_negative_int_value(&has_bits);
negative_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@@ -9456,7 +9636,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional double double_value = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 49)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 49)) {
_Internal::set_has_double_value(&has_bits);
double_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr);
ptr += sizeof(double);
@@ -9465,7 +9645,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional bytes string_value = 7;
case 7:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) {
auto str = _internal_mutable_string_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
@@ -9474,7 +9654,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
continue;
// optional string aggregate_value = 8;
case 8:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) {
auto str = _internal_mutable_aggregate_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -9508,10 +9688,10 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UninterpretedOption::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
@@ -9579,7 +9759,7 @@ size_t UninterpretedOption::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9648,7 +9828,7 @@ void UninterpretedOption::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void UninterpretedOption::MergeFrom(const UninterpretedOption& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
name_.MergeFrom(from.name_);
@@ -9758,11 +9938,17 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location&
leading_detached_comments_(from.leading_detached_comments_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_leading_comments()) {
leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_leading_comments(),
GetArenaForAllocation());
}
trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_trailing_comments()) {
trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_trailing_comments(),
GetArenaForAllocation());
@@ -9772,7 +9958,13 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location&
inline void SourceCodeInfo_Location::SharedCtor() {
leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
SourceCodeInfo_Location::~SourceCodeInfo_Location() {
@@ -9800,7 +9992,7 @@ void SourceCodeInfo_Location::SetCachedSize(int size) const {
void SourceCodeInfo_Location::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9824,15 +10016,15 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated int32 path = 1 [packed = true];
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx);
CHK_(ptr);
- } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) {
+ } else if (static_cast(tag) == 8) {
_internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
CHK_(ptr);
} else
@@ -9840,10 +10032,10 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
continue;
// repeated int32 span = 2 [packed = true];
case 2:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_span(), ptr, ctx);
CHK_(ptr);
- } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) {
+ } else if (static_cast(tag) == 16) {
_internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
CHK_(ptr);
} else
@@ -9851,7 +10043,7 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
continue;
// optional string leading_comments = 3;
case 3:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) {
auto str = _internal_mutable_leading_comments();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -9863,7 +10055,7 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
continue;
// optional string trailing_comments = 4;
case 4:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) {
auto str = _internal_mutable_trailing_comments();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@@ -9875,7 +10067,7 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
continue;
// repeated string leading_detached_comments = 6;
case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@@ -9914,10 +10106,10 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo_Location::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* SourceCodeInfo_Location::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 path = 1 [packed = true];
@@ -9981,7 +10173,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -9992,7 +10184,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
if (data_size > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
- static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
+ static_cast(data_size));
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
_path_cached_byte_size_.store(cached_size,
@@ -10007,7 +10199,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const {
if (data_size > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
- static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
+ static_cast(data_size));
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
_span_cached_byte_size_.store(cached_size,
@@ -10059,7 +10251,7 @@ void SourceCodeInfo_Location::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo.Location)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
path_.MergeFrom(from.path_);
@@ -10164,7 +10356,7 @@ void SourceCodeInfo::SetCachedSize(int size) const {
void SourceCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -10175,12 +10367,12 @@ void SourceCodeInfo::Clear() {
const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+ if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@@ -10214,10 +10406,10 @@ const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE
#undef CHK_
}
-::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* SourceCodeInfo::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
@@ -10240,7 +10432,7 @@ size_t SourceCodeInfo::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo)
size_t total_size = 0;
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@@ -10270,7 +10462,7 @@ void SourceCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void SourceCodeInfo::MergeFrom(const SourceCodeInfo& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo)
GOOGLE_DCHECK_NE(&from, this);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ uint32_t cached_has_bits = 0;
(void) cached_has_bits;
location_.MergeFrom(from.location_);
@@ -10332,6 +10524,9 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
path_(from.path_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_source_file()) {
source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_source_file(),
GetArenaForAllocation());
@@ -10344,6 +10539,9 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
inline void GeneratedCodeInfo_Annotation::SharedCtor() {
source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast(this) + static_cast