Merge remote-tracking branch 'origin/main' into alignas-fix

pull/11248/head
Kent Ross 2 years ago
commit 496af774f8
  1. 9
      build_defs/arch_tests.bzl
  2. 11
      build_defs/internal_shell.bzl
  3. 24
      conformance/conformance_test_runner.cc
  4. 5
      docs/options.md
  5. 201
      docs/third_party.md
  6. 1
      java/core/BUILD.bazel
  7. 11
      java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
  8. 95
      java/core/src/main/java/com/google/protobuf/ProtobufLists.java
  9. 2
      java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java
  10. 1
      java/lite/pom.xml
  11. 18
      kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh
  12. 36
      kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
  13. 21
      kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
  14. 44
      kokoro/linux/aarch64/python_crosscompile_aarch64.sh
  15. 28
      kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
  16. 14
      kokoro/linux/aarch64/test_cpp_aarch64.sh
  17. 32
      kokoro/linux/aarch64/test_java_aarch64.sh
  18. 26
      kokoro/linux/aarch64/test_python_aarch64.sh
  19. 4
      kokoro/linux/cpp_aarch64/common.cfg
  20. 4
      kokoro/linux/java_aarch64/common.cfg
  21. 13
      kokoro/linux/python_aarch64/build.sh
  22. 21
      kokoro/linux/python_aarch64/common.cfg
  23. 8
      kokoro/release/collect_all_artifacts.sh
  24. 2
      php/ext/google/protobuf/convert.c
  25. 606
      php/ext/google/protobuf/php-upb.c
  26. 1534
      php/ext/google/protobuf/php-upb.h
  27. 4
      protobuf_deps.bzl
  28. 17
      python/BUILD.bazel
  29. 0
      python/google/protobuf/__init__.py
  30. 26
      python/google/protobuf/internal/_parameterized.py
  31. 4
      python/google/protobuf/pyext/descriptor.cc
  32. 15
      python/google/protobuf/pyext/descriptor_database.cc
  33. 1
      python/google/protobuf/pyext/extension_dict.cc
  34. 27
      python/google/protobuf/pyext/map_container.cc
  35. 43
      python/google/protobuf/pyext/message.cc
  36. 56
      python/google/protobuf/pyext/message.h
  37. 40
      python/google/protobuf/pyext/proto2_api_test.proto
  38. 1
      python/google/protobuf/pyext/repeated_composite_container.cc
  39. 33
      python/google/protobuf/pyext/repeated_scalar_container.cc
  40. 2
      python/google/protobuf/pyext/safe_numerics.h
  41. 38
      python/google/protobuf/text_format.py
  42. 371
      ruby/ext/google/protobuf_c/ruby-upb.c
  43. 1534
      ruby/ext/google/protobuf_c/ruby-upb.h
  44. 6
      src/file_lists.cmake
  45. 8
      src/google/protobuf/BUILD.bazel
  46. 49
      src/google/protobuf/arena.cc
  47. 41
      src/google/protobuf/arena.h
  48. 108
      src/google/protobuf/arena_align.h
  49. 22
      src/google/protobuf/arena_align_test.cc
  50. 9
      src/google/protobuf/arena_cleanup.h
  51. 2
      src/google/protobuf/arena_test_util.cc
  52. 6
      src/google/protobuf/arena_test_util.h
  53. 4
      src/google/protobuf/arena_unittest.cc
  54. 6
      src/google/protobuf/arenastring.cc
  55. 8
      src/google/protobuf/arenastring.h
  56. 2
      src/google/protobuf/arenastring_unittest.cc
  57. 4
      src/google/protobuf/arenaz_sampler_test.cc
  58. 7
      src/google/protobuf/compiler/annotation_test_util.cc
  59. 6
      src/google/protobuf/compiler/code_generator.cc
  60. 25
      src/google/protobuf/compiler/command_line_interface.cc
  61. 39
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  62. 59
      src/google/protobuf/compiler/cpp/enum.cc
  63. 6
      src/google/protobuf/compiler/cpp/file.cc
  64. 23
      src/google/protobuf/compiler/cpp/message.cc
  65. 5
      src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
  66. 6
      src/google/protobuf/compiler/csharp/csharp_enum.cc
  67. 9
      src/google/protobuf/compiler/csharp/csharp_field_base.cc
  68. 7
      src/google/protobuf/compiler/csharp/csharp_helpers.cc
  69. 4
      src/google/protobuf/compiler/csharp/csharp_message.cc
  70. 11
      src/google/protobuf/compiler/importer_unittest.cc
  71. 13
      src/google/protobuf/compiler/mock_code_generator.cc
  72. 6
      src/google/protobuf/compiler/objectivec/field.cc
  73. 13
      src/google/protobuf/compiler/objectivec/helpers.cc
  74. 3
      src/google/protobuf/compiler/objectivec/import_writer.cc
  75. 3
      src/google/protobuf/compiler/objectivec/map_field.cc
  76. 3
      src/google/protobuf/compiler/objectivec/message.cc
  77. 5
      src/google/protobuf/compiler/objectivec/primitive_field.cc
  78. 25
      src/google/protobuf/compiler/parser.cc
  79. 5
      src/google/protobuf/compiler/parser_unittest.cc
  80. 5
      src/google/protobuf/compiler/php/php_generator.cc
  81. 1
      src/google/protobuf/compiler/plugin.cc
  82. 18
      src/google/protobuf/compiler/python/generator.cc
  83. 1
      src/google/protobuf/compiler/python/helpers.cc
  84. 31
      src/google/protobuf/compiler/python/plugin_unittest.cc
  85. 6
      src/google/protobuf/compiler/python/pyi_generator.cc
  86. 15
      src/google/protobuf/compiler/ruby/ruby_generator.cc
  87. 36
      src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
  88. 8
      src/google/protobuf/compiler/scc.h
  89. 57
      src/google/protobuf/compiler/subprocess.cc
  90. 139
      src/google/protobuf/descriptor.cc
  91. 13
      src/google/protobuf/descriptor.h
  92. 255
      src/google/protobuf/descriptor.pb.cc
  93. 74
      src/google/protobuf/descriptor.pb.h
  94. 20
      src/google/protobuf/descriptor.proto
  95. 64
      src/google/protobuf/descriptor_database.cc
  96. 2
      src/google/protobuf/descriptor_database.h
  97. 1
      src/google/protobuf/descriptor_database_unittest.cc
  98. 19
      src/google/protobuf/descriptor_unittest.cc
  99. 4
      src/google/protobuf/dynamic_message.cc
  100. 8
      src/google/protobuf/dynamic_message.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -24,13 +24,12 @@ def _arch_test_impl(
name = name,
tools = bazel_binaries,
cmd = """
for binary in "$(rootpaths %s) %s"; do
for binary in "%s"; do
(file -L $$binary | grep -q "%s") \
|| (echo "Test binary is not an %s binary: "; file -L $$binary; exit 1)
done
""" % (
" ".join(bazel_binaries),
" ".join(system_binaries),
" ".join(["$(rootpaths %s)" % b for b in bazel_binaries] + system_binaries),
file_platform,
platform,
),
@ -44,13 +43,13 @@ def _arch_test_impl(
def aarch64_test(**kwargs):
_arch_test_impl(
platform = "aarch64",
file_platform = "ELF 64-bit LSB executable, ARM aarch64",
file_platform = "ELF 64-bit LSB.* ARM aarch64",
**kwargs
)
def x86_64_test(**kwargs):
_arch_test_impl(
platform = "x86_64",
file_platform = "ELF 64-bit LSB executable, ARM x86_64",
file_platform = "ELF 64-bit LSB.*, ARM x86_64",
**kwargs
)

@ -9,7 +9,6 @@ def inline_sh_binary(
tools = [],
deps = [],
cmd = "",
testonly = None,
**kwargs):
"""Bazel rule to wrap up an inline bash script in a binary.
@ -28,8 +27,6 @@ def inline_sh_binary(
deps: a list of dependency labels that are required to run this binary.
cmd: the inline sh command to run.
**kwargs: other keyword arguments that are passed to sh_binary.
testonly: common rule attribute (see:
https://bazel.build/reference/be/common-definitions#common-attributes)
"""
native.genrule(
@ -38,15 +35,16 @@ def inline_sh_binary(
exec_tools = tools,
outs = [name + ".sh"],
cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd,
testonly = testonly,
visibility = ["//visibility:private"],
tags = kwargs["tags"] if "tags" in kwargs else None,
target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None,
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
)
native.sh_binary(
name = name,
srcs = [name + "_genrule"],
data = srcs + tools + deps,
testonly = testonly,
**kwargs
)
@ -83,6 +81,9 @@ def inline_sh_test(
outs = [name + ".sh"],
cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd,
visibility = ["//visibility:private"],
tags = kwargs["tags"] if "tags" in kwargs else None,
target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None,
testonly = kwargs["testonly"] if "testonly" in kwargs else None,
)
native.sh_test(

@ -77,7 +77,7 @@ using std::vector;
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define GOOGLE_CHECK_SYSCALL(call) \
#define CHECK_SYSCALL(call) \
if (call < 0) { \
perror(#call " " __FILE__ ":" TOSTRING(__LINE__)); \
exit(1); \
@ -289,22 +289,22 @@ void ForkPipeRunner::SpawnTestProgram() {
if (pid) {
// Parent.
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
CHECK_SYSCALL(close(toproc_pipe_fd[0]));
CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
write_fd_ = toproc_pipe_fd[1];
read_fd_ = fromproc_pipe_fd[0];
child_pid_ = pid;
} else {
// Child.
GOOGLE_CHECK_SYSCALL(close(STDIN_FILENO));
GOOGLE_CHECK_SYSCALL(close(STDOUT_FILENO));
GOOGLE_CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO));
GOOGLE_CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO));
CHECK_SYSCALL(close(STDIN_FILENO));
CHECK_SYSCALL(close(STDOUT_FILENO));
CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO));
CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO));
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[1]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
CHECK_SYSCALL(close(toproc_pipe_fd[0]));
CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
CHECK_SYSCALL(close(toproc_pipe_fd[1]));
CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
std::unique_ptr<char[]> executable(new char[executable_.size() + 1]);
memcpy(executable.get(), executable_.c_str(), executable_.size());
@ -319,7 +319,7 @@ void ForkPipeRunner::SpawnTestProgram() {
}
argv.push_back(nullptr);
// Never returns.
GOOGLE_CHECK_SYSCALL(execv(executable.get(), const_cast<char **>(argv.data())));
CHECK_SYSCALL(execv(executable.get(), const_cast<char **>(argv.data())));
}
}

@ -451,3 +451,8 @@ with info about your project (name and website) so we can add an entry for you.
* Website: http://connect.build/
* Extension: 1167-1176
1. protocel
* Website: https://github.com/Neakxs/protocel
* Extension: 1177-1178

@ -7,110 +7,103 @@ If you have a project that should be listed here, please
## Programming Languages
These are projects we know about implementing Protocol Buffers for other programming languages:
* Action Script: https://code.google.com/p/protobuf-actionscript3/
* Action Script: https://code.google.com/p/protoc-gen-as3/
* Action Script: https://github.com/matrix3d/JProtoc
* Action Script: https://github.com/zhongfq/protobuf-as3/
* Ada: https://github.com/reznikmm/protobuf
* C: https://github.com/protobuf-c/protobuf-c
* C: https://koti.kapsi.fi/jpa/nanopb/
* C: https://github.com/cloudwu/pbc/
* C: https://github.com/haberman/upb/wiki
* C: https://github.com/squidfunk/protobluff
* C: https://github.com/eerimoq/pbtools
* C++: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* C++: https://EmbeddedProto.com
* C/C++: http://spbc.sf.net/
* C#: https://code.google.com/p/protobuf-csharp-port
* C#: https://silentorbit.com/protobuf/
* C#/.NET/WCF/VB: https://code.google.com/p/protobuf-net/
* Clojure: http://github.com/ninjudd/clojure-protobuf
* Clojure: https://github.com/clojusc/protobuf
* Clojure: https://protojure.readthedocs.io
* Common Lisp: http://github.com/brown/protobuf
* Common Lisp: http://github.com/qitab/cl-protobuf
* D: https://github.com/dcarp/protobuf-d
* D: https://github.com/msoucy/dproto
* D: https://github.com/opticron/ProtocolBuffer
* Dart: https://github.com/dart-lang/dart-protobuf (runtime) https://github.com/dart-lang/dart-protoc-plugin (code generator)
* Delphi: http://sourceforge.net/projects/protobuf-delphi/
* Delphi: http://fundementals.sourceforge.net/dl.html
* Elixir: https://github.com/jeremyong/exprotoc
* Elixir: https://github.com/tony612/protobuf-elixir
* Elixir: https://github.com/ahamez/protox
* Elm: https://github.com/tiziano88/elm-protobuf
* Erlang: https://github.com/tomas-abrahamsson/gpb
* Erlang: http://piqi.org/
* Erlang: https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb instead)
* Hacklang/HHVM: https://github.com/y3llowcake/proto-hack
* GDScript: https://github.com/oniksan/godobuf (Godot v3 engine plugin)
* Go: https://github.com/golang/protobuf (Google-official implementation)
* Go: https://github.com/akunspy/gopbuf
* Go: https://github.com/gogo/protobuf
* GopherJS: https://github.com/johanbrandhorst/protobuf
* Haskell: https://hackage.haskell.org/package/hprotoc
* Haskell: https://github.com/google/proto-lens (Google-unofficial implementation)
* Haskell: https://github.com/awakesecurity/proto3-suite (code generator) https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer)
* Haxe: https://github.com/Atry/protoc-gen-haxe
* Java: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* Java/Android: https://github.com/square/wire
* Java: https://github.com/HebiRobotics/QuickBuffers/
* Java ME: https://code.google.com/p/protobuf-javame/
* Java ME: http://swingme.sourceforge.net/encode.shtml
* Javascript: https://code.google.com/p/protobuf-js/
* Javascript: http://github.com/sirikata/protojs
* Javascript: https://github.com/dcodeIO/ProtoBuf.js
* Javascript: https://code.google.com/p/protobuf-for-node/
* Javascript: https://code.google.com/p/protostuff/
* Javascript: https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h)
* Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port of the Google-official implementation)
* Javascript: https://github.com/ButterCam/sisyphus-js
* Julia: https://github.com/tanmaykm/ProtoBuf.jl
* Kotlin: https://github.com/marcoferrer/kroto-plus
* Kotlin: https://github.com/Kotlin/kotlinx.serialization
* Kotlin: https://github.com/ButterCam/sisyphus
* Kotlin: https://github.com/open-toast/protokt
* Kotlin Multiplatform: https://github.com/streem/pbandk
* Lua: https://code.google.com/p/protoc-gen-lua/
* Lua: http://github.com/indygreg/lua-protobuf
* Lua: https://github.com/Neopallium/lua-pb
* Matlab: https://code.google.com/p/protobuf-matlab/
* Mercury: https://code.google.com/p/protobuf-mercury/
* Objective C: https://code.google.com/p/protobuf-objc/
* Objective C: https://github.com/alexeyxo/protobuf-objc
* OCaml: http://piqi.org/
* Perl: http://groups.google.com/group/protobuf-perl
* Perl: https://metacpan.org/pod/Google::ProtocolBuffers
* Perl: https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic
* Perl/XS: https://code.google.com/p/protobuf-perlxs/
* PHP: https://code.google.com/p/pb4php/
* PHP: https://github.com/allegro/php-protobuf/
* PHP: https://github.com/chobie/php-protocolbuffers
* Prolog: http://www.swi-prolog.org/pldoc/package/protobufs.html
* Purescript: https://github.com/xc-jp/purescript-protobuf
* Python: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* Python: https://github.com/eigenein/protobuf
* Python: https://github.com/danielgtaylor/python-betterproto
* R: http://cran.r-project.org/package=RProtoBuf
* Ruby: https://code.google.com/p/ruby-protobuf/
* Ruby: http://github.com/mozy/ruby-protocol-buffers
* Ruby: https://github.com/bmizerany/beefcake/tree/master/lib/beefcake
* Ruby: https://github.com/localshred/protobuf
* Rust: https://github.com/tokio-rs/prost
* Rust: https://github.com/stepancheg/rust-protobuf/
* Rust: https://github.com/tafia/quick-protobuf
* Scala: http://github.com/jeffplaisance/scala-protobuf
* Scala: https://code.google.com/p/protobuf-scala
* Scala: https://github.com/SandroGrzicic/ScalaBuff
* Scala: https://scalapb.github.io
* Solidity: https://github.com/celer-network/pb3-gen-sol
* Swift: https://github.com/alexeyxo/protobuf-swift
* Swift: https://github.com/apple/swift-protobuf/
* Typescript: https://github.com/thesayyn/protoc-gen-ts
* Typescript: https://github.com/pbkit/pbkit
* Vala: https://launchpad.net/protobuf-vala
* Visual Basic: https://code.google.com/p/protobuf-net/
These are projects we know about implementing Protocol Buffers for other
programming languages: * Action Script:
https://code.google.com/p/protobuf-actionscript3/ * Action Script:
https://code.google.com/p/protoc-gen-as3/ * Action Script:
https://github.com/matrix3d/JProtoc * Action Script:
https://github.com/zhongfq/protobuf-as3/ * Ada:
https://github.com/reznikmm/protobuf * C:
https://github.com/protobuf-c/protobuf-c * C: https://koti.kapsi.fi/jpa/nanopb/
* C: https://github.com/cloudwu/pbc/ * C: https://github.com/haberman/upb/wiki *
C: https://github.com/squidfunk/protobluff * C:
https://github.com/eerimoq/pbtools * C++:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
C++: https://github.com/yksten/struct2x * C++: https://EmbeddedProto.com *
C/C++: http://spbc.sf.net/ * C#: https://code.google.com/p/protobuf-csharp-port
* C#: https://silentorbit.com/protobuf/ * C#/.NET/WCF/VB:
https://code.google.com/p/protobuf-net/ * Clojure:
http://github.com/ninjudd/clojure-protobuf * Clojure:
https://github.com/clojusc/protobuf * Clojure: https://protojure.readthedocs.io
* Common Lisp: http://github.com/brown/protobuf * Common Lisp:
http://github.com/qitab/cl-protobuf * D: https://github.com/dcarp/protobuf-d *
D: https://github.com/msoucy/dproto * D:
https://github.com/opticron/ProtocolBuffer * Dart:
https://github.com/dart-lang/dart-protobuf (runtime)
https://github.com/dart-lang/dart-protoc-plugin (code generator) * Delphi:
http://sourceforge.net/projects/protobuf-delphi/ * Delphi:
http://fundementals.sourceforge.net/dl.html * Elixir:
https://github.com/jeremyong/exprotoc * Elixir:
https://github.com/tony612/protobuf-elixir * Elixir:
https://github.com/ahamez/protox * Elm:
https://github.com/tiziano88/elm-protobuf * Erlang:
https://github.com/tomas-abrahamsson/gpb * Erlang: http://piqi.org/ * Erlang:
https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb
instead) * Hacklang/HHVM: https://github.com/y3llowcake/proto-hack * GDScript:
https://github.com/oniksan/godobuf (Godot v3 engine plugin) * Go:
https://github.com/golang/protobuf (Google-official implementation) * Go:
https://github.com/akunspy/gopbuf * Go: https://github.com/gogo/protobuf *
GopherJS: https://github.com/johanbrandhorst/protobuf * Haskell:
https://hackage.haskell.org/package/hprotoc * Haskell:
https://github.com/google/proto-lens (Google-unofficial implementation) *
Haskell: https://github.com/awakesecurity/proto3-suite (code generator)
https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer) *
Haxe: https://github.com/Atry/protoc-gen-haxe * Java:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
Java/Android: https://github.com/square/wire * Java:
https://github.com/HebiRobotics/QuickBuffers/ * Java ME:
https://code.google.com/p/protobuf-javame/ * Java ME:
http://swingme.sourceforge.net/encode.shtml * Javascript:
https://code.google.com/p/protobuf-js/ * Javascript:
http://github.com/sirikata/protojs * Javascript:
https://github.com/dcodeIO/ProtoBuf.js * Javascript:
https://code.google.com/p/protobuf-for-node/ * Javascript:
https://code.google.com/p/protostuff/ * Javascript:
https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h) *
Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port
of the Google-official implementation) * Javascript:
https://github.com/ButterCam/sisyphus-js * Julia:
https://github.com/tanmaykm/ProtoBuf.jl * Kotlin:
https://github.com/marcoferrer/kroto-plus * Kotlin:
https://github.com/Kotlin/kotlinx.serialization * Kotlin:
https://github.com/ButterCam/sisyphus * Kotlin:
https://github.com/open-toast/protokt * Kotlin Multiplatform:
https://github.com/streem/pbandk * Lua:
https://code.google.com/p/protoc-gen-lua/ * Lua:
http://github.com/indygreg/lua-protobuf * Lua:
https://github.com/Neopallium/lua-pb * Matlab:
https://code.google.com/p/protobuf-matlab/ * Mercury:
https://code.google.com/p/protobuf-mercury/ * Objective C:
https://code.google.com/p/protobuf-objc/ * Objective C:
https://github.com/alexeyxo/protobuf-objc * OCaml: http://piqi.org/ * Perl:
http://groups.google.com/group/protobuf-perl * Perl:
https://metacpan.org/pod/Google::ProtocolBuffers * Perl:
https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic * Perl/XS:
https://code.google.com/p/protobuf-perlxs/ * PHP:
https://code.google.com/p/pb4php/ * PHP:
https://github.com/allegro/php-protobuf/ * PHP:
https://github.com/chobie/php-protocolbuffers * Prolog:
http://www.swi-prolog.org/pldoc/package/protobufs.html * Purescript:
https://github.com/xc-jp/purescript-protobuf * Python:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
Python: https://github.com/eigenein/protobuf * Python:
https://github.com/danielgtaylor/python-betterproto * R:
http://cran.r-project.org/package=RProtoBuf * Ruby:
https://code.google.com/p/ruby-protobuf/ * Ruby:
http://github.com/mozy/ruby-protocol-buffers * Ruby:
https://github.com/bmizerany/beefcake/tree/master/lib/beefcake * Ruby:
https://github.com/localshred/protobuf * Rust: https://github.com/tokio-rs/prost
* Rust: https://github.com/stepancheg/rust-protobuf/ * Rust:
https://github.com/tafia/quick-protobuf * Scala:
http://github.com/jeffplaisance/scala-protobuf * Scala:
https://code.google.com/p/protobuf-scala * Scala:
https://github.com/SandroGrzicic/ScalaBuff * Scala: https://scalapb.github.io *
Solidity: https://github.com/celer-network/pb3-gen-sol * Swift:
https://github.com/alexeyxo/protobuf-swift * Swift:
https://github.com/apple/swift-protobuf/ * Typescript:
https://github.com/thesayyn/protoc-gen-ts * Typescript:
https://github.com/pbkit/pbkit * Vala: https://launchpad.net/protobuf-vala *
Visual Basic: https://code.google.com/p/protobuf-net/
## RPC Implementations

@ -80,7 +80,6 @@ LITE_SRCS = [
"src/main/java/com/google/protobuf/ProtoSyntax.java",
"src/main/java/com/google/protobuf/Protobuf.java",
"src/main/java/com/google/protobuf/ProtobufArrayList.java",
"src/main/java/com/google/protobuf/ProtobufLists.java",
"src/main/java/com/google/protobuf/ProtocolStringList.java",
"src/main/java/com/google/protobuf/RawMessageInfo.java",
"src/main/java/com/google/protobuf/Reader.java",

@ -67,12 +67,17 @@ public class LazyStringArrayList extends AbstractProtobufList<String>
EMPTY_LIST.makeImmutable();
}
static LazyStringArrayList emptyList() {
/** Returns an empty immutable {@code LazyStringArrayList} instance */
public static LazyStringArrayList emptyList() {
return EMPTY_LIST;
}
// For compatibility with older runtimes.
public static final LazyStringList EMPTY = EMPTY_LIST;
/**
* For compatibility with older runtimes.
*
* @deprecated use {@link emptyList()} instead
*/
@Deprecated public static final LazyStringList EMPTY = EMPTY_LIST;
private final List<Object> list;

@ -1,95 +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.
package com.google.protobuf;
import com.google.protobuf.Internal.BooleanList;
import com.google.protobuf.Internal.DoubleList;
import com.google.protobuf.Internal.FloatList;
import com.google.protobuf.Internal.IntList;
import com.google.protobuf.Internal.LongList;
import com.google.protobuf.Internal.ProtobufList;
/** Utility class for construction of lists that extend {@link ProtobufList}. */
@ExperimentalApi
@CheckReturnValue
final class ProtobufLists {
private ProtobufLists() {}
public static <E> ProtobufList<E> emptyProtobufList() {
return ProtobufArrayList.emptyList();
}
public static <E> ProtobufList<E> mutableCopy(ProtobufList<E> list) {
int size = list.size();
return list.mutableCopyWithCapacity(
size == 0 ? AbstractProtobufList.DEFAULT_CAPACITY : size * 2);
}
public static BooleanList emptyBooleanList() {
return BooleanArrayList.emptyList();
}
public static BooleanList newBooleanList() {
return new BooleanArrayList();
}
public static IntList emptyIntList() {
return IntArrayList.emptyList();
}
public static IntList newIntList() {
return new IntArrayList();
}
public static LongList emptyLongList() {
return LongArrayList.emptyList();
}
public static LongList newLongList() {
return new LongArrayList();
}
public static FloatList emptyFloatList() {
return FloatArrayList.emptyList();
}
public static FloatList newFloatList() {
return new FloatArrayList();
}
public static DoubleList emptyDoubleList() {
return DoubleArrayList.emptyList();
}
public static DoubleList newDoubleList() {
return new DoubleArrayList();
}
}

@ -43,7 +43,9 @@ import java.util.RandomAccess;
* it cannot be modified via the wrapper.
*
* @author jonp@google.com (Jon Perlow)
* @deprecated use {@link LazyStringArrayList#makeImmutable} instead.
*/
@Deprecated
public class UnmodifiableLazyStringList extends AbstractList<String>
implements LazyStringList, RandomAccess {

@ -156,7 +156,6 @@
<include>ProtoSyntax.java</include>
<include>Protobuf.java</include>
<include>ProtobufArrayList.java</include>
<include>ProtobufLists.java</include>
<include>ProtocolStringList.java</include>
<include>RawMessageInfo.java</include>
<include>Reader.java</include>

@ -1,18 +0,0 @@
#!/bin/bash
#
# Builds protobuf C++ with aarch64 crosscompiler and runs a basic set of tests under an emulator.
# NOTE: This script is expected to run under the dockcross/linux-arm64 docker image.
set -ex
# the build commands are expected to run under dockcross docker image
# where the CC, CXX and other toolchain variables already point to the crosscompiler
cmake .
make -j8
# check that the resulting test binary is indeed an aarch64 ELF
(file ./tests | grep -q "ELF 64-bit LSB executable, ARM aarch64") || (echo "Test binary in not an aarch64 binary"; exit 1)
# run the basic set of C++ tests under QEMU
# there are other tests we could run (e.g. ./lite-test), but this is sufficient as a smoketest
qemu-aarch64 ./tests

@ -1,36 +0,0 @@
#!/bin/bash
set -e
# go to the repo root
cd $(dirname $0)/../../../..
if [[ -t 0 ]]; then
DOCKER_TTY_ARGS="-it"
else
# The input device on kokoro is not a TTY, so -it does not work.
DOCKER_TTY_ARGS=
fi
# Pin the dockcross image since newer versions of the image break the build
PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/linux-arm64:20210625-795dd4d
# running dockcross image without any arguments generates a wrapper
# scripts that can be used to run commands under the dockcross image
# easily.
# See https://github.com/dockcross/dockcross#usage for details
docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-linux-arm64.sh
chmod +x dockcross-linux-arm64.sh
# the wrapper script has CRLF line endings and bash doesn't like that
# so we change CRLF line endings into LF.
sed -i 's/\r//g' dockcross-linux-arm64.sh
# The dockcross wrapper script runs arbitrary commands under the selected dockcross
# image with the following properties which make its use very convenient:
# * the current working directory is mounted under /work so the container can easily
# access the current workspace
# * the processes in the container run under the same UID and GID as the host process so unlike
# vanilla "docker run" invocations, the workspace doesn't get polluted with files
# owned by root.
./dockcross-linux-arm64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@"

@ -1,9 +1,10 @@
#!/bin/bash
set -e
set -ex
# go to the repo root
cd $(dirname $0)/../../../..
GIT_REPO_ROOT=`pwd`
if [[ -t 0 ]]; then
DOCKER_TTY_ARGS="-it"
@ -17,24 +18,10 @@ fi
# before https://github.com/dockcross/dockcross/pull/449
# Thanks to that, wheel build with this image aren't actually
# compliant with manylinux2014, but only with manylinux_2_24
PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20200929-608e6ac
PINNED_DOCKCROSS_IMAGE_VERSION=quay.io/pypa/manylinux_2_24_aarch64
# running dockcross image without any arguments generates a wrapper
# scripts that can be used to run commands under the dockcross image
# easily.
# See https://github.com/dockcross/dockcross#usage for details
docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-manylinux2014-aarch64.sh
chmod +x dockcross-manylinux2014-aarch64.sh
# the wrapper script has CRLF line endings and bash doesn't like that
# so we change CRLF line endings into LF.
sed -i 's/\r//g' dockcross-manylinux2014-aarch64.sh
# The dockcross wrapper script runs arbitrary commands under the selected dockcross
# image with the following properties which make its use very convenient:
# * the current working directory is mounted under /work so the container can easily
# access the current workspace
# * the processes in the container run under the same UID and GID as the host process so unlike
# vanilla "docker run" invocations, the workspace doesn't get polluted with files
# owned by root.
./dockcross-manylinux2014-aarch64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@"
docker run -v $GIT_REPO_ROOT:/workspace --rm $PINNED_DOCKCROSS_IMAGE_VERSION /bin/bash -c "cd /workspace; git config --global --add safe.directory '*'; $@"

@ -1,44 +0,0 @@
#!/bin/bash
#
# Builds protobuf python including the C++ extension with aarch64 crosscompiler.
# The outputs of this script are laid out so that we can later test them under an aarch64 emulator.
# NOTE: This script is expected to run under the dockcross/manylinux2014-aarch64 docker image.
set -ex
PYTHON="/opt/python/cp38-cp38/bin/python"
# Initialize any submodules.
git submodule update --init --recursive
# Build protoc and libprotobuf
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 -Dprotobuf_BUILD_TESTS=OFF .
make -j8
# create a simple shell wrapper that runs crosscompiled protoc under qemu
echo '#!/bin/bash' >protoc_qemu_wrapper.sh
echo 'exec qemu-aarch64 "../protoc" "$@"' >>protoc_qemu_wrapper.sh
chmod ugo+x protoc_qemu_wrapper.sh
# PROTOC variable is by build_py step that runs under ./python directory
export PROTOC=../protoc_qemu_wrapper.sh
pushd python
# NOTE: this step will use protoc_qemu_wrapper.sh to generate protobuf files.
${PYTHON} setup.py build_py
# when crosscompiling for aarch64, --plat-name needs to be set explicitly
# to end up with correctly named wheel file
# the value should be manylinuxABC_ARCH and dockcross docker image
# conveniently provides the value in the AUDITWHEEL_PLAT env
plat_name_flag="--plat-name=$AUDITWHEEL_PLAT"
# override the value of EXT_SUFFIX to make sure the crosscompiled .so files in the wheel have the correct filename suffix
export PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX="$(${PYTHON} -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX").replace("-x86_64-linux-gnu.so", "-aarch64-linux-gnu.so"))')"
# Build the python extension inplace to be able to python unittests later
${PYTHON} setup.py build_ext --cpp_implementation --compile_static_extension --inplace
# Build the binary wheel (to check it with auditwheel)
${PYTHON} setup.py bdist_wheel --cpp_implementation --compile_static_extension $plat_name_flag

@ -1,28 +0,0 @@
#!/bin/bash
set -ex
# go to the repo root
cd $(dirname $0)/../../..
cd python
PYTHON="/opt/python/cp38-cp38/bin/python"
${PYTHON} -m pip install --user pytest auditwheel numpy
# check that we are really using aarch64 python
(${PYTHON} -c 'import sysconfig; print(sysconfig.get_platform())' | grep -q "linux-aarch64") || (echo "Wrong python platform, needs to be aarch64 python."; exit 1)
# step 1: run all python unittests
# we've built the python extension previously with --inplace option
# so we can just discover all the unittests and run them directly under
# the python/ directory.
LD_LIBRARY_PATH=. PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -m pytest google/protobuf
# step 2: run auditwheel show to check that the wheel is manylinux2014 compatible.
# auditwheel needs to run on wheel's target platform (or under an emulator)
${PYTHON} -m auditwheel show dist/protobuf-*-manylinux2014_aarch64.whl
# step 3: smoketest that the wheel can be installed and run a smokecheck
${PYTHON} -m pip install dist/protobuf-*-manylinux2014_aarch64.whl
# when python cpp extension is on, simply importing a message type will trigger loading the cpp extension
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -c 'import google.protobuf.timestamp_pb2; print("Successfully loaded the python cpp extension!")'

@ -1,14 +0,0 @@
#!/bin/bash
#
# Crosscompiles protobuf C++ under dockcross docker image and runs the tests under an emulator.
set -e
# go to the repo root
cd $(dirname $0)/../../..
# Initialize any submodules.
git submodule update --init --recursive
# run the C++ build and test script under dockcross/linux-arm64 image
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh

@ -1,32 +0,0 @@
#!/bin/bash
set -ex
# go to the repo root
cd $(dirname $0)/../../..
if [[ -t 0 ]]; then
DOCKER_TTY_ARGS="-it"
else
# The input device on kokoro is not a TTY, so -it does not work.
DOCKER_TTY_ARGS=
fi
# crosscompile protoc as we will later need it for the java build.
# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible
# with a wide range of linux distros (including any docker images we will use later to build and test java)
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
# the command that will be used to build and test java under an emulator
# * IsValidUtf8Test and DecodeUtf8Test tests are skipped because they take very long under an emulator.
TEST_JAVA_COMMAND="mvn --batch-mode -DskipTests install && mvn --batch-mode -Dtest='**/*Test, !**/*IsValidUtf8Test, !**/*DecodeUtf8Test' -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false surefire:test"
# use an actual aarch64 docker image (with a real aarch64 java and maven) to run build & test protobuf java under an emulator
# * mount the protobuf root as /work to be able to access the crosscompiled files
# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
# we just run map the user's home to a throwaway temporary directory
# * the JAVA_OPTS and MAVEN_CONFIG variables are being set mostly to silence warnings about non-existent home directory
# and to avoid polluting the workspace.
docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "JAVA_OPTS=-Duser.home=/home/fake-user" -e "MAVEN_CONFIG=/home/fake-user/.m2" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/maven:3.8-openjdk-11 bash -c "cd java && $TEST_JAVA_COMMAND"

@ -1,26 +0,0 @@
#!/bin/bash
set -e
# go to the repo root
cd $(dirname $0)/../../..
if [[ -t 0 ]]; then
DOCKER_TTY_ARGS="-it"
else
# The input device on kokoro is not a TTY, so -it does not work.
DOCKER_TTY_ARGS=
fi
# crosscompile python extension and the binary wheel under dockcross/manylinux2014-aarch64 image
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/python_crosscompile_aarch64.sh
# once crosscompilation is done, use an actual aarch64 docker image (with a real aarch64 python) to run all the tests under an emulator
# * mount the protobuf root as /work to be able to access the crosscompiled files
# * intentionally use a different image than manylinux2014 so that we don't build and test on the same linux distribution
# (manylinux_2_24 is debian-based while manylinux2014 is centos-based)
# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
# we just run map the user's home to a throwaway temporary directory
docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work quay.io/pypa/manylinux_2_24_aarch64 kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh

@ -6,12 +6,12 @@ timeout_mins: 120
env_vars {
key: "CONTAINER_IMAGE"
value: "gcr.io/protobuf-build/emulation/linux:aarch64-4e847d7a01c1792471b6dd985ab0bf2677332e6f"
value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb"
}
env_vars {
key: "BAZEL_TARGETS"
value: "//src/..."
value: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test"
}
action {

@ -6,12 +6,12 @@ timeout_mins: 120
env_vars {
key: "CONTAINER_IMAGE"
value: "gcr.io/protobuf-build/emulation/linux:aarch64-4e847d7a01c1792471b6dd985ab0bf2677332e6f"
value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb"
}
env_vars {
key: "BAZEL_TARGETS"
value: "//java/..."
value: "//java/... //src/google/protobuf/compiler:protoc_aarch64_test"
}
action {

@ -1,13 +0,0 @@
#!/bin/bash
#
# This is the top-level script we give to Kokoro as the entry point for
# running the "continuous" and "presubmit" jobs.
set -ex
# Change to repo root
cd $(dirname $0)/../../..
kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
kokoro/linux/aarch64/test_python_aarch64.sh

@ -1,11 +1,28 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_aarch64/build.sh"
build_file: "protobuf/kokoro/linux/bazel.sh"
timeout_mins: 120
env_vars {
key: "CONTAINER_IMAGE"
value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb"
}
env_vars {
key: "BAZEL_TARGETS"
value: "//python/... //python:aarch64_test"
}
env_vars {
key: "BAZEL_EXTRA_FLAGS"
value: "--define=use_fast_cpp_protos=true "
# TODO(b/262628111) Enable this once conformance tests are fixed.
"--test_tag_filters=-conformance"
}
action {
define_artifacts {
regex: "**/sponge_log.xml"
regex: "**/sponge_log.*"
}
}

@ -6,6 +6,7 @@ set -ex
cd $(dirname $0)/../..
# Initialize any submodules.
git config --global --add safe.directory '*'
git submodule update --init --recursive
# The directory with all resulting artifacts
@ -48,11 +49,10 @@ cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc
# Install nuget (will also install mono)
# TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install
sudo apt update
sudo apt install -y gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
# NVidia has stopped publishing Cuda packages for Ubuntu 16.04, so we need to
# delete this file to allow the apt update to run successfully.
sudo rm -f /etc/apt/sources.list.d/cuda.list
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt-get install -y nuget

@ -510,7 +510,7 @@ bool Convert_PhpToUpbAutoWrap(zval *val, upb_MessageValue *upb_val, TypeInfo typ
const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(subm, 1);
upb_MessageValue msgval;
if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(val_f), arena)) return false;
upb_Message_Set(wrapper, val_f, msgval, arena);
upb_Message_SetFieldByDef(wrapper, val_f, msgval, arena);
upb_val->msg_val = wrapper;
return true;
} else {

@ -147,6 +147,12 @@
#if defined(__GNUC__) || defined(__clang__)
#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
#elif defined(_MSC_VER)
#define UPB_UNREACHABLE() \
do { \
assert(0); \
__assume(0); \
} while (0)
#else
#define UPB_UNREACHABLE() do { assert(0); } while(0)
#endif
@ -972,18 +978,19 @@ static const upb_MiniTableSub google_protobuf_MessageOptions_submsgs[1] = {
{.submsg = &google_protobuf_UninterpretedOption_msg_init},
};
static const upb_MiniTableField google_protobuf_MessageOptions__fields[5] = {
static const upb_MiniTableField google_protobuf_MessageOptions__fields[6] = {
{1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_protobuf_MessageOptions_msg_init = {
&google_protobuf_MessageOptions_submsgs[0],
&google_protobuf_MessageOptions__fields[0],
16, 5, kUpb_ExtMode_Extendable, 3, 255, 0,
16, 6, kUpb_ExtMode_Extendable, 3, 255, 0,
};
static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[3] = {
@ -1027,16 +1034,17 @@ static const upb_MiniTableSub google_protobuf_EnumOptions_submsgs[1] = {
{.submsg = &google_protobuf_UninterpretedOption_msg_init},
};
static const upb_MiniTableField google_protobuf_EnumOptions__fields[3] = {
static const upb_MiniTableField google_protobuf_EnumOptions__fields[4] = {
{2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_protobuf_EnumOptions_msg_init = {
&google_protobuf_EnumOptions_submsgs[0],
&google_protobuf_EnumOptions__fields[0],
UPB_SIZE(8, 16), 3, kUpb_ExtMode_Extendable, 0, 255, 0,
UPB_SIZE(8, 16), 4, kUpb_ExtMode_Extendable, 0, 255, 0,
};
static const upb_MiniTableSub google_protobuf_EnumValueOptions_submsgs[1] = {
@ -1299,7 +1307,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = {
* regenerated. */
static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p',
static const char descriptor[7996] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p',
't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u',
'f', '\"', 'M', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n',
'\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't',
@ -1489,7 +1497,7 @@ static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '
'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', ':', '\n', '\014', 'O', 'p', 't', 'i', 'm', 'i', 'z', 'e', 'M',
'o', 'd', 'e', '\022', '\t', '\n', '\005', 'S', 'P', 'E', 'E', 'D', '\020', '\001', '\022', '\r', '\n', '\t', 'C', 'O', 'D', 'E', '_', 'S', 'I',
'Z', 'E', '\020', '\002', '\022', '\020', '\n', '\014', 'L', 'I', 'T', 'E', '_', 'R', 'U', 'N', 'T', 'I', 'M', 'E', '\020', '\003', '*', '\t', '\010',
'\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '&', '\020', '\'', '\"', '\343', '\002', '\n', '\016', 'M', 'e', 's', 's', 'a', 'g',
'\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '&', '\020', '\'', '\"', '\273', '\003', '\n', '\016', 'M', 'e', 's', 's', 'a', 'g',
'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '<', '\n', '\027', 'm', 'e', 's', 's', 'a', 'g', 'e', '_', 's', 'e', 't', '_', 'w',
'i', 'r', 'e', '_', 'f', 'o', 'r', 'm', 'a', 't', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\024',
'm', 'e', 's', 's', 'a', 'g', 'e', 'S', 'e', 't', 'W', 'i', 'r', 'e', 'F', 'o', 'r', 'm', 'a', 't', '\022', 'L', '\n', '\037', 'n',
@ -1498,120 +1506,127 @@ static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '
'n', 'd', 'a', 'r', 'd', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'A', 'c', 'c', 'e', 's', 's', 'o', 'r', '\022', '%',
'\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e',
'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', '\033', '\n', '\t', 'm', 'a', 'p', '_', 'e', 'n', 't', 'r', 'y',
'\030', '\007', ' ', '\001', '(', '\010', 'R', '\010', 'm', 'a', 'p', 'E', 'n', 't', 'r', 'y', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't',
'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.',
'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r',
'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd',
'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', 'J', '\004',
'\010', '\005', '\020', '\006', 'J', '\004', '\010', '\006', '\020', '\007', 'J', '\004', '\010', '\010', '\020', '\t', 'J', '\004', '\010', '\t', '\020', '\n', '\"', '\222', '\004',
'\n', '\014', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'A', '\n', '\005', 'c', 't', 'y', 'p', 'e', '\030', '\001',
' ', '\001', '(', '\016', '2', '#', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i',
'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'C', 'T', 'y', 'p', 'e', ':', '\006', 'S', 'T', 'R', 'I', 'N', 'G', 'R',
'\005', 'c', 't', 'y', 'p', 'e', '\022', '\026', '\n', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\006', 'p',
'a', 'c', 'k', 'e', 'd', '\022', 'G', '\n', '\006', 'j', 's', 't', 'y', 'p', 'e', '\030', '\006', ' ', '\001', '(', '\016', '2', '$', '.', 'g',
'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o',
'n', 's', '.', 'J', 'S', 'T', 'y', 'p', 'e', ':', '\t', 'J', 'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', 'R', '\006', 'j', 's', 't',
'y', 'p', 'e', '\022', '\031', '\n', '\004', 'l', 'a', 'z', 'y', '\030', '\005', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R',
'\004', 'l', 'a', 'z', 'y', '\022', '.', '\n', '\017', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', '_', 'l', 'a', 'z', 'y', '\030',
'\017', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\016', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', 'L',
'a', 'z', 'y', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005',
'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', '\031', '\n', '\004', 'w', 'e', 'a', 'k',
'\030', '\n', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\004', 'w', 'e', 'a', 'k', '\022', 'X', '\n', '\024', 'u', 'n',
'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013',
'2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e',
'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e',
't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', '/', '\n', '\005', 'C', 'T', 'y', 'p', 'e', '\022', '\n', '\n', '\006', 'S', 'T', 'R',
'I', 'N', 'G', '\020', '\000', '\022', '\010', '\n', '\004', 'C', 'O', 'R', 'D', '\020', '\001', '\022', '\020', '\n', '\014', 'S', 'T', 'R', 'I', 'N', 'G',
'_', 'P', 'I', 'E', 'C', 'E', '\020', '\002', '\"', '5', '\n', '\006', 'J', 'S', 'T', 'y', 'p', 'e', '\022', '\r', '\n', '\t', 'J', 'S', '_',
'N', 'O', 'R', 'M', 'A', 'L', '\020', '\000', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\001', '\022', '\r',
'\n', '\t', 'J', 'S', '_', 'N', 'U', 'M', 'B', 'E', 'R', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J',
'\004', '\010', '\004', '\020', '\005', '\"', 's', '\n', '\014', 'O', 'n', 'e', 'o', 'f', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'X', '\n', '\024',
'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003',
'(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n',
't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p',
'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\300', '\001',
'\n', '\013', 'E', 'n', 'u', 'm', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '\037', '\n', '\013', 'a', 'l', 'l', 'o', 'w', '_', 'a', 'l',
'i', 'a', 's', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\n', 'a', 'l', 'l', 'o', 'w', 'A', 'l', 'i', 'a', 's', '\022', '%', '\n', '\n',
'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n',
'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't',
'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e',
'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p',
't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n',
'*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\005', '\020', '\006', '\"', '\236', '\001', '\n', '\020', 'E', 'n', 'u',
'm', 'V', 'a', 'l', 'u', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't',
'e', 'd', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't',
'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o',
'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u',
'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n',
'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200',
'\200', '\200', '\002', '\"', '\234', '\001', '\n', '\016', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n',
'\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R',
'\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e',
'\030', '\007', ' ', '\001', '(', '\010', 'R', '\010', 'm', 'a', 'p', 'E', 'n', 't', 'r', 'y', '\022', 'V', '\n', '&', 'd', 'e', 'p', 'r', 'e',
'c', 'a', 't', 'e', 'd', '_', 'l', 'e', 'g', 'a', 'c', 'y', '_', 'j', 's', 'o', 'n', '_', 'f', 'i', 'e', 'l', 'd', '_', 'c',
'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\030', '\013', ' ', '\001', '(', '\010', 'B', '\002', '\030', '\001', 'R', '\"', 'd', 'e', 'p', 'r', 'e',
'c', 'a', 't', 'e', 'd', 'L', 'e', 'g', 'a', 'c', 'y', 'J', 's', 'o', 'n', 'F', 'i', 'e', 'l', 'd', 'C', 'o', 'n', 'f', 'l',
'i', 'c', 't', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't',
'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o',
'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023',
'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020',
'\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', 'J', '\004', '\010', '\005', '\020', '\006', 'J', '\004', '\010', '\006', '\020', '\007', 'J', '\004',
'\010', '\010', '\020', '\t', 'J', '\004', '\010', '\t', '\020', '\n', '\"', '\222', '\004', '\n', '\014', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o',
'n', 's', '\022', 'A', '\n', '\005', 'c', 't', 'y', 'p', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', '#', '.', 'g', 'o', 'o', 'g', 'l',
'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'C',
'T', 'y', 'p', 'e', ':', '\006', 'S', 'T', 'R', 'I', 'N', 'G', 'R', '\005', 'c', 't', 'y', 'p', 'e', '\022', '\026', '\n', '\006', 'p', 'a',
'c', 'k', 'e', 'd', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\022', 'G', '\n', '\006', 'j', 's', 't',
'y', 'p', 'e', '\030', '\006', ' ', '\001', '(', '\016', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b',
'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'J', 'S', 'T', 'y', 'p', 'e', ':', '\t', 'J',
'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', 'R', '\006', 'j', 's', 't', 'y', 'p', 'e', '\022', '\031', '\n', '\004', 'l', 'a', 'z', 'y', '\030',
'\005', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\004', 'l', 'a', 'z', 'y', '\022', '.', '\n', '\017', 'u', 'n', 'v',
'e', 'r', 'i', 'f', 'i', 'e', 'd', '_', 'l', 'a', 'z', 'y', '\030', '\017', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e',
'R', '\016', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', 'L', 'a', 'z', 'y', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e',
'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e',
'c', 'a', 't', 'e', 'd', '\022', '\031', '\n', '\004', 'w', 'e', 'a', 'k', '\030', '\n', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's',
'e', 'R', '\004', 'w', 'e', 'a', 'k', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_',
'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r',
'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o',
'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', '/', '\n',
'\005', 'C', 'T', 'y', 'p', 'e', '\022', '\n', '\n', '\006', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\000', '\022', '\010', '\n', '\004', 'C', 'O', 'R',
'D', '\020', '\001', '\022', '\020', '\n', '\014', 'S', 'T', 'R', 'I', 'N', 'G', '_', 'P', 'I', 'E', 'C', 'E', '\020', '\002', '\"', '5', '\n', '\006',
'J', 'S', 'T', 'y', 'p', 'e', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', '\020', '\000', '\022', '\r', '\n', '\t',
'J', 'S', '_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\001', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'N', 'U', 'M', 'B', 'E', 'R', '\020',
'\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', '\"', 's', '\n', '\014', 'O', 'n', 'e',
'o', 'f', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e',
'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.',
'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't',
'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*',
'\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\230', '\002', '\n', '\013', 'E', 'n', 'u', 'm', 'O', 'p', 't', 'i', 'o', 'n',
's', '\022', '\037', '\n', '\013', 'a', 'l', 'l', 'o', 'w', '_', 'a', 'l', 'i', 'a', 's', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\n', 'a',
'l', 'l', 'o', 'w', 'A', 'l', 'i', 'a', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003',
' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'V',
'\n', '&', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '_', 'l', 'e', 'g', 'a', 'c', 'y', '_', 'j', 's', 'o', 'n', '_',
'f', 'i', 'e', 'l', 'd', '_', 'c', 'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\030', '\006', ' ', '\001', '(', '\010', 'B', '\002', '\030', '\001',
'R', '\"', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', 'L', 'e', 'g', 'a', 'c', 'y', 'J', 's', 'o', 'n', 'F', 'i', 'e',
'l', 'd', 'C', 'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e',
't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l',
'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O',
'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o',
'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\340', '\002', '\n', '\r', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p',
't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010',
':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'q', '\n', '\021', 'i', 'd',
'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', '_', 'l', 'e', 'v', 'e', 'l', '\030', '\"', ' ', '\001', '(', '\016', '2', '/', '.', 'g',
'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p', 't', 'i',
'o', 'n', 's', '.', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', ':', '\023', 'I', 'D', 'E',
'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', 'R', '\020', 'i', 'd', 'e', 'm', 'p', 'o', 't',
'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e',
'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.',
'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't',
'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"',
'P', '\n', '\020', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', '\027', '\n', '\023', 'I', 'D',
'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'N', 'O',
'_', 'S', 'I', 'D', 'E', '_', 'E', 'F', 'F', 'E', 'C', 'T', 'S', '\020', '\001', '\022', '\016', '\n', '\n', 'I', 'D', 'E', 'M', 'P', 'O',
'T', 'E', 'N', 'T', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\232', '\003', '\n', '\023', 'U', 'n', 'i',
'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\004', 'n', 'a', 'm', 'e', '\030',
'\002', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U',
'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '.', 'N', 'a', 'm', 'e', 'P', 'a',
'r', 't', 'R', '\004', 'n', 'a', 'm', 'e', '\022', ')', '\n', '\020', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '_', 'v', 'a',
'l', 'u', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 'V', 'a', 'l', 'u',
'e', '\022', ',', '\n', '\022', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\004',
' ', '\001', '(', '\004', 'R', '\020', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', ',', '\n',
'\022', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\005', ' ', '\001', '(', '\003',
'R', '\020', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 'd', 'o', 'u',
'b', 'l', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\006', ' ', '\001', '(', '\001', 'R', '\013', 'd', 'o', 'u', 'b', 'l', 'e', 'V', 'a',
'l', 'u', 'e', '\022', '!', '\n', '\014', 's', 't', 'r', 'i', 'n', 'g', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\007', ' ', '\001', '(', '\014',
'R', '\013', 's', 't', 'r', 'i', 'n', 'g', 'V', 'a', 'l', 'u', 'e', '\022', '\'', '\n', '\017', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't',
'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\010', ' ', '\001', '(', '\t', 'R', '\016', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', 'V',
'a', 'l', 'u', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e', '_',
'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014', 'i',
's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't', 'e',
'n', 's', 'i', 'o', 'n', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022',
'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l',
'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o',
'.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L',
'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001',
'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R',
'\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's',
'\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+',
'\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t',
'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a',
'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ',
'\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e',
'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o',
'\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o',
'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o',
'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a',
't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a',
't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u',
'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l',
'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020',
'\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n',
't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b',
'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o',
't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c',
'\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n',
'\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.',
'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't',
'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g',
'.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r',
'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e',
'.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n',
'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\005', '\020', '\006', '\"', '\236', '\001', '\n', '\020', 'E', 'n',
'u', 'm', 'V', 'a', 'l', 'u', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a',
't', 'e', 'd', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a',
't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i',
'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b',
'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u',
'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200',
'\200', '\200', '\200', '\002', '\"', '\234', '\001', '\n', '\016', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%',
'\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e',
'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r',
'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g',
'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd',
'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i',
'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\340', '\002', '\n', '\r', 'M', 'e', 't', 'h', 'o', 'd', 'O',
'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(',
'\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'q', '\n', '\021', 'i',
'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', '_', 'l', 'e', 'v', 'e', 'l', '\030', '\"', ' ', '\001', '(', '\016', '2', '/', '.',
'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p', 't',
'i', 'o', 'n', 's', '.', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', ':', '\023', 'I', 'D',
'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', 'R', '\020', 'i', 'd', 'e', 'm', 'p', 'o',
't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't',
'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e',
'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p',
't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n',
'\"', 'P', '\n', '\020', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', '\027', '\n', '\023', 'I',
'D', 'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'N',
'O', '_', 'S', 'I', 'D', 'E', '_', 'E', 'F', 'F', 'E', 'C', 'T', 'S', '\020', '\001', '\022', '\016', '\n', '\n', 'I', 'D', 'E', 'M', 'P',
'O', 'T', 'E', 'N', 'T', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\232', '\003', '\n', '\023', 'U', 'n',
'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\004', 'n', 'a', 'm', 'e',
'\030', '\002', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.',
'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '.', 'N', 'a', 'm', 'e', 'P',
'a', 'r', 't', 'R', '\004', 'n', 'a', 'm', 'e', '\022', ')', '\n', '\020', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '_', 'v',
'a', 'l', 'u', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 'V', 'a', 'l',
'u', 'e', '\022', ',', '\n', '\022', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030',
'\004', ' ', '\001', '(', '\004', 'R', '\020', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', ',',
'\n', '\022', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\005', ' ', '\001', '(',
'\003', 'R', '\020', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 'd', 'o',
'u', 'b', 'l', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\006', ' ', '\001', '(', '\001', 'R', '\013', 'd', 'o', 'u', 'b', 'l', 'e', 'V',
'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 's', 't', 'r', 'i', 'n', 'g', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\007', ' ', '\001', '(',
'\014', 'R', '\013', 's', 't', 'r', 'i', 'n', 'g', 'V', 'a', 'l', 'u', 'e', '\022', '\'', '\n', '\017', 'a', 'g', 'g', 'r', 'e', 'g', 'a',
't', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\010', ' ', '\001', '(', '\t', 'R', '\016', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e',
'V', 'a', 'l', 'u', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e',
'_', 'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014',
'i', 's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't',
'e', 'n', 's', 'i', 'o', 'n', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o',
'\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g',
'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f',
'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010',
'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020',
'\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001',
'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't',
's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022',
'+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(',
'\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e',
'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006',
' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm',
'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f',
'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g',
'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C',
'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't',
'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p',
'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o',
'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i',
'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022',
'\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a',
'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o',
'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n',
'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i',
'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007',
'\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', 'B', '~', '\n', '\023', 'c', 'o', 'm',
'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p',
't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n',
'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c',
'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l',
'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n',
};
static _upb_DefPool_Init *deps[1] = {
@ -1622,7 +1637,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = {
deps,
&google_protobuf_descriptor_proto_upb_file_layout,
"google/protobuf/descriptor.proto",
UPB_STRINGVIEW_INIT(descriptor, 7820)
UPB_STRINGVIEW_INIT(descriptor, 7996)
};
/*
@ -5508,6 +5523,11 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray(
if (ret.status == kUpb_UnknownToMessage_Ok) {
upb_MessageValue value;
value.msg_val = ret.message;
// Allocate array on demand before append.
if (!repeated_messages) {
upb_MiniTable_ResizeArray(msg, field, 0, arena);
repeated_messages = upb_MiniTable_GetMutableArray(msg, field);
}
if (!upb_Array_Append(repeated_messages, value, arena)) {
return kUpb_UnknownToMessage_OutOfMemory;
}
@ -5650,20 +5670,6 @@ const upb_Message_Extension* _upb_Message_Getext(
return NULL;
}
void _upb_Message_Clearext(upb_Message* msg,
const upb_MiniTableExtension* ext_l) {
upb_Message_Internal* in = upb_Message_Getinternal(msg);
if (!in->internal) return;
const upb_Message_Extension* base =
UPB_PTR_AT(in->internal, in->internal->ext_begin, void);
upb_Message_Extension* ext =
(upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
if (ext) {
*ext = *base;
in->internal->ext_begin += sizeof(upb_Message_Extension);
}
}
upb_Message_Extension* _upb_Message_GetOrCreateExtension(
upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* arena) {
upb_Message_Extension* ext =
@ -6391,6 +6397,21 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data,
}
upb_MtDecoder_ParseMessage(d, data, len);
if (UPB_UNLIKELY(d->table->field_count != 2)) {
upb_MtDecoder_ErrorFormat(d, "%hu fields in map", d->table->field_count);
UPB_UNREACHABLE();
}
if (UPB_UNLIKELY(d->table->fields[0].number != 1)) {
upb_MtDecoder_ErrorFormat(d, "field %d in map key",
d->table->fields[0].number);
UPB_UNREACHABLE();
}
if (UPB_UNLIKELY(d->table->fields[1].number != 2)) {
upb_MtDecoder_ErrorFormat(d, "field %d in map val",
d->table->fields[1].number);
UPB_UNREACHABLE();
}
upb_MtDecoder_AssignHasbits(d->table);
// Map entries have a pre-determined layout, regardless of types.
@ -8079,7 +8100,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]);
const int32_t end =
google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]);
const int32_t max = kUpb_MaxFieldNumber + 1;
// A full validation would also check that each range is disjoint, and that
// none of the fields overlap with the extension ranges, but we are just
@ -8087,7 +8107,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
// Note: Not a typo! Unlike extension ranges and message reserved ranges,
// the end value of an enum reserved range is *inclusive*!
if (start < 1 || end < start || end > max) {
if (end < start) {
_upb_DefBuilder_Errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n",
(int)start, (int)end, upb_EnumDef_FullName(e));
}
@ -9482,7 +9502,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx,
bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f) {
UPB_ASSERT(upb_FieldDef_HasPresence(f));
return _upb_MiniTable_HasField(msg, upb_FieldDef_MiniTable(f));
return upb_Message_HasField(msg, upb_FieldDef_MiniTable(f));
}
const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
@ -9504,7 +9524,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
const upb_FieldDef* f) {
upb_MessageValue default_val = upb_FieldDef_Default(f);
upb_MessageValue ret;
_upb_MiniTable_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret);
_upb_Message_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret);
return ret;
}
@ -9549,11 +9569,11 @@ make:
bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
upb_MessageValue val, upb_Arena* a) {
return _upb_MiniTable_SetField(msg, upb_FieldDef_MiniTable(f), &val, a);
return _upb_Message_SetField(msg, upb_FieldDef_MiniTable(f), &val, a);
}
void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) {
_upb_MiniTable_ClearField(msg, upb_FieldDef_MiniTable(f));
upb_Message_ClearField(msg, upb_FieldDef_MiniTable(f));
}
void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) {
@ -10788,6 +10808,7 @@ const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status) {
UPB_LONGJMP(d->err, status);
return NULL;
}
static void _upb_Decoder_VerifyUtf8(upb_Decoder* d, const char* buf, int len) {
if (!_upb_Decoder_VerifyUtf8Inline(buf, len)) {
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8);
@ -10863,7 +10884,8 @@ static const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr,
uint32_t* size) {
uint64_t size64;
ptr = _upb_Decoder_DecodeVarint(d, ptr, &size64);
if (size64 >= INT32_MAX || ptr - d->end + (int)size64 > d->limit) {
if (size64 >= INT32_MAX ||
!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, (int)size64)) {
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
}
*size = size64;
@ -10910,15 +10932,6 @@ static upb_Message* _upb_Decoder_NewSubMessage(
return msg;
}
UPB_NOINLINE
const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr,
int overrun) {
int status;
ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status);
if (ptr == NULL) _upb_Decoder_ErrorJmp(d, status);
return ptr;
}
static const char* _upb_Decoder_ReadString(upb_Decoder* d, const char* ptr,
int size, upb_StringView* str) {
if (d->options & kUpb_DecodeOption_AliasString) {
@ -10954,11 +10967,11 @@ UPB_FORCEINLINE
static const char* _upb_Decoder_DecodeSubMessage(
upb_Decoder* d, const char* ptr, upb_Message* submsg,
const upb_MiniTableSub* subs, const upb_MiniTableField* field, int size) {
int saved_delta = _upb_Decoder_PushLimit(d, ptr, size);
int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size);
const upb_MiniTable* subl = subs[field->submsg_index].submsg;
UPB_ASSERT(subl);
ptr = _upb_Decoder_RecurseSubMessage(d, ptr, submsg, subl, DECODE_NOGROUP);
_upb_Decoder_PopLimit(d, ptr, saved_delta);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_delta);
return ptr;
}
@ -11105,7 +11118,7 @@ static const char* _upb_Decoder_DecodeVarintPacked(
upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val,
const upb_MiniTableField* field, int lg2) {
int scale = 1 << lg2;
int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size);
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size);
char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size << lg2, void);
while (!_upb_Decoder_IsDone(d, &ptr)) {
wireval elem;
@ -11118,7 +11131,7 @@ static const char* _upb_Decoder_DecodeVarintPacked(
memcpy(out, &elem, scale);
out += scale;
}
_upb_Decoder_PopLimit(d, ptr, saved_limit);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit);
return ptr;
}
@ -11128,7 +11141,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
const upb_MiniTableSub* subs, const upb_MiniTableField* field,
wireval* val) {
const upb_MiniTableEnum* e = subs[field->submsg_index].subenum;
int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size);
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size);
char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size * 4, void);
while (!_upb_Decoder_IsDone(d, &ptr)) {
wireval elem;
@ -11144,7 +11157,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
memcpy(out, &elem, 4);
out += 4;
}
_upb_Decoder_PopLimit(d, ptr, saved_limit);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit);
return ptr;
}
@ -11892,7 +11905,7 @@ static const char* _upb_Decoder_DecodeMessage(upb_Decoder* d, const char* ptr,
d->debug_tagstart = ptr;
#endif
UPB_ASSERT(ptr < d->limit_ptr);
UPB_ASSERT(ptr < d->input.limit_ptr);
ptr = _upb_Decoder_DecodeTag(d, ptr, &tag);
field_number = tag >> 3;
wire_type = tag & 7;
@ -11950,6 +11963,13 @@ static upb_DecodeStatus _upb_Decoder_DecodeTop(struct upb_Decoder* d,
return kUpb_DecodeStatus_Ok;
}
UPB_NOINLINE
const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
const char* ptr, int overrun) {
return _upb_EpsCopyInputStream_IsDoneFallbackInline(
e, ptr, overrun, _upb_Decoder_BufferFlipCallback);
}
upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg,
const upb_MiniTable* l,
const upb_ExtensionRegistry* extreg, int options,
@ -11957,20 +11977,11 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg,
upb_Decoder state;
unsigned depth = (unsigned)options >> 16;
if (size <= 16) {
memset(&state.patch, 0, 32);
if (size) memcpy(&state.patch, buf, size);
buf = state.patch;
state.end = buf + size;
state.limit = 0;
if (upb_EpsCopyInputStream_Init(&state.input, &buf, size)) {
options &= ~kUpb_DecodeOption_AliasString; // Can't alias patch buf.
} else {
state.end = buf + size - 16;
state.limit = 16;
}
state.extreg = extreg;
state.limit_ptr = state.end;
state.unknown = NULL;
state.depth = depth ? depth : 64;
state.end_group = DECODE_NOGROUP;
@ -12035,28 +12046,27 @@ typedef enum {
UPB_NOINLINE
static const char* fastdecode_isdonefallback(UPB_PARSE_PARAMS) {
int overrun = data;
int status;
ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status);
if (ptr == NULL) _upb_FastDecoder_ErrorJmp(d, status);
ptr = _upb_EpsCopyInputStream_IsDoneFallbackInline(
&d->input, ptr, overrun, _upb_Decoder_BufferFlipCallback);
data = _upb_FastDecoder_LoadTag(ptr);
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS);
}
UPB_FORCEINLINE
static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) {
if (UPB_UNLIKELY(ptr >= d->limit_ptr)) {
int overrun = ptr - d->end;
if (UPB_LIKELY(overrun == d->limit)) {
// Parse is finished.
int overrun;
switch (upb_EpsCopyInputStream_IsDoneStatus(&d->input, ptr, &overrun)) {
case kUpb_IsDoneStatus_Done:
*(uint32_t*)msg |= hasbits; // Sync hasbits.
const upb_MiniTable* l = decode_totablep(table);
return UPB_UNLIKELY(l->required_count)
? _upb_Decoder_CheckRequired(d, ptr, msg, l)
: ptr;
} else {
case kUpb_IsDoneStatus_NotDone:
break;
case kUpb_IsDoneStatus_NeedFallback:
data = overrun;
UPB_MUSTTAIL return fastdecode_isdonefallback(UPB_PARSE_ARGS);
}
}
// Read two bytes of tag data (for a one-byte tag, the high byte is junk).
@ -12094,37 +12104,17 @@ static const char* fastdecode_longsize(const char* ptr, int* size) {
}
UPB_FORCEINLINE
static bool fastdecode_boundscheck(const char* ptr, size_t len,
const char* end) {
uintptr_t uptr = (uintptr_t)ptr;
uintptr_t uend = (uintptr_t)end + 16;
uintptr_t res = uptr + len;
return res < uptr || res > uend;
}
UPB_FORCEINLINE
static bool fastdecode_boundscheck2(const char* ptr, size_t len,
const char* end) {
// This is one extra branch compared to the more normal:
// return (size_t)(end - ptr) < size;
// However it is one less computation if we are just about to use "ptr + len":
// https://godbolt.org/z/35YGPz
// In microbenchmarks this shows an overall 4% improvement.
uintptr_t uptr = (uintptr_t)ptr;
uintptr_t uend = (uintptr_t)end;
uintptr_t res = uptr + len;
return res < uptr || res > uend;
}
typedef const char* fastdecode_delimfunc(upb_Decoder* d, const char* ptr,
void* ctx);
UPB_FORCEINLINE
static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr,
fastdecode_delimfunc* func, void* ctx) {
static const char* fastdecode_delimited(
upb_Decoder* d, const char* ptr,
upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
ptr++;
// Sign-extend so varint greater than one byte becomes negative, causing
// fast delimited parse to fail.
int len = (int8_t)ptr[-1];
if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) {
if (!upb_EpsCopyInputStream_TryParseDelimitedFast(&d->input, &ptr, len, func,
ctx)) {
// Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer.
// If it exceeds the buffer limit, limit/limit_ptr will change during
// sub-message parsing, so we need to preserve delta, not limit.
@ -12136,25 +12126,13 @@ static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr,
return NULL;
}
}
if (ptr - d->end + (int)len > d->limit) {
if (!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, len)) {
// Corrupt wire format: invalid limit.
return NULL;
}
int delta = _upb_Decoder_PushLimit(d, ptr, len);
ptr = func(d, ptr, ctx);
_upb_Decoder_PopLimit(d, ptr, delta);
} else {
// Fast case: Sub-message is <128 bytes and fits in the current buffer.
// This means we can preserve limit/limit_ptr verbatim.
const char* saved_limit_ptr = d->limit_ptr;
int saved_limit = d->limit;
d->limit_ptr = ptr + len;
d->limit = d->limit_ptr - d->end;
UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
ptr = func(d, ptr, ctx);
d->limit_ptr = saved_limit_ptr;
d->limit = saved_limit;
UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
int delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, len);
ptr = func(&d->input, ptr, ctx);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, delta);
}
return ptr;
}
@ -12395,8 +12373,9 @@ typedef struct {
} fastdecode_varintdata;
UPB_FORCEINLINE
static const char* fastdecode_topackedvarint(upb_Decoder* d, const char* ptr,
void* ctx) {
static const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e,
const char* ptr, void* ctx) {
upb_Decoder* d = (upb_Decoder*)e;
fastdecode_varintdata* data = ctx;
void* dst = data->dst;
uint64_t val;
@ -12544,7 +12523,8 @@ TAGBYTES(p)
ptr = fastdecode_longsize(ptr, &size); \
} \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr) || \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size) || \
(size % valbytes) != 0)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \
} \
@ -12636,7 +12616,8 @@ static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr,
ptr = fastdecode_longsize(ptr, &size); \
} \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size))) { \
dst->size = 0; \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \
} \
@ -12689,91 +12670,92 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size,
UPB_POISON_MEMORY_REGION(data + size, copy - size);
}
#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
card, validate_utf8) \
upb_StringView* dst; \
fastdecode_arr farr; \
int64_t size; \
size_t arena_has; \
size_t common_has; \
char* buf; \
\
UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \
UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \
\
dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
sizeof(upb_StringView), card); \
\
again: \
if (card == CARD_r) { \
dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \
} \
\
size = (uint8_t)ptr[tagbytes]; \
ptr += tagbytes + 1; \
dst->size = size; \
\
buf = d->arena.head.ptr; \
arena_has = _upb_ArenaHas(&d->arena); \
common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); \
\
if (UPB_LIKELY(size <= 15 - tagbytes)) { \
if (arena_has < 16) goto longstr; \
d->arena.head.ptr += 16; \
memcpy(buf, ptr - tagbytes - 1, 16); \
dst->data = buf + tagbytes + 1; \
} else if (UPB_LIKELY(size <= 32)) { \
if (UPB_UNLIKELY(common_has < 32)) goto longstr; \
fastdecode_docopy(d, ptr, size, 32, buf, dst); \
} else if (UPB_LIKELY(size <= 64)) { \
if (UPB_UNLIKELY(common_has < 64)) goto longstr; \
fastdecode_docopy(d, ptr, size, 64, buf, dst); \
} else if (UPB_LIKELY(size < 128)) { \
if (UPB_UNLIKELY(common_has < 128)) goto longstr; \
fastdecode_docopy(d, ptr, size, 128, buf, dst); \
} else { \
goto longstr; \
} \
\
ptr += size; \
\
if (card == CARD_r) { \
if (validate_utf8 && \
!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \
} \
fastdecode_nextret ret = fastdecode_nextrepeated( \
d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \
switch (ret.next) { \
case FD_NEXT_SAMEFIELD: \
dst = ret.dst; \
goto again; \
case FD_NEXT_OTHERFIELD: \
data = ret.tag; \
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \
case FD_NEXT_ATLIMIT: \
return ptr; \
} \
} \
\
if (card != CARD_r && validate_utf8) { \
data = (uint64_t)dst; \
UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
} \
\
UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
\
longstr: \
if (card == CARD_r) { \
fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \
} \
ptr--; \
if (validate_utf8) { \
UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
} else { \
UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
card, validate_utf8) \
upb_StringView* dst; \
fastdecode_arr farr; \
int64_t size; \
size_t arena_has; \
size_t common_has; \
char* buf; \
\
UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \
UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \
\
dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
sizeof(upb_StringView), card); \
\
again: \
if (card == CARD_r) { \
dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \
} \
\
size = (uint8_t)ptr[tagbytes]; \
ptr += tagbytes + 1; \
dst->size = size; \
\
buf = d->arena.head.ptr; \
arena_has = _upb_ArenaHas(&d->arena); \
common_has = UPB_MIN(arena_has, \
upb_EpsCopyInputStream_BytesAvailable(&d->input, ptr)); \
\
if (UPB_LIKELY(size <= 15 - tagbytes)) { \
if (arena_has < 16) goto longstr; \
d->arena.head.ptr += 16; \
memcpy(buf, ptr - tagbytes - 1, 16); \
dst->data = buf + tagbytes + 1; \
} else if (UPB_LIKELY(size <= 32)) { \
if (UPB_UNLIKELY(common_has < 32)) goto longstr; \
fastdecode_docopy(d, ptr, size, 32, buf, dst); \
} else if (UPB_LIKELY(size <= 64)) { \
if (UPB_UNLIKELY(common_has < 64)) goto longstr; \
fastdecode_docopy(d, ptr, size, 64, buf, dst); \
} else if (UPB_LIKELY(size < 128)) { \
if (UPB_UNLIKELY(common_has < 128)) goto longstr; \
fastdecode_docopy(d, ptr, size, 128, buf, dst); \
} else { \
goto longstr; \
} \
\
ptr += size; \
\
if (card == CARD_r) { \
if (validate_utf8 && \
!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \
} \
fastdecode_nextret ret = fastdecode_nextrepeated( \
d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \
switch (ret.next) { \
case FD_NEXT_SAMEFIELD: \
dst = ret.dst; \
goto again; \
case FD_NEXT_OTHERFIELD: \
data = ret.tag; \
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \
case FD_NEXT_ATLIMIT: \
return ptr; \
} \
} \
\
if (card != CARD_r && validate_utf8) { \
data = (uint64_t)dst; \
UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
} \
\
UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
\
longstr: \
if (card == CARD_r) { \
fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \
} \
ptr--; \
if (validate_utf8) { \
UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
} else { \
UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
}
#define FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, card, \
@ -12803,7 +12785,8 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size,
dst->data = ptr; \
dst->size = size; \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size))) { \
ptr--; \
if (validate_utf8) { \
return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, \
@ -12916,8 +12899,9 @@ typedef struct {
} fastdecode_submsgdata;
UPB_FORCEINLINE
static const char* fastdecode_tosubmsg(upb_Decoder* d, const char* ptr,
void* ctx) {
static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e,
const char* ptr, void* ctx) {
upb_Decoder* d = (upb_Decoder*)e;
fastdecode_submsgdata* submsg = ctx;
ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0, 0);
UPB_ASSUME(ptr != NULL);

File diff suppressed because it is too large Load Diff

@ -135,6 +135,6 @@ def protobuf_deps():
_github_archive(
name = "upb",
repo = "https://github.com/protocolbuffers/upb",
commit = "b747edb830b0fab524e0063fb2e156c390405dfa",
sha256 = "99f69a3b8a583961e9db8d16d3a654f4bac5f546077e07dfa26c561de5215005",
commit = "ea1996f40d258c469ddef691de85b7c780db1999",
sha256 = "1c06a558012fef70b916e755e606e0143d9a02ee33aaf1ed784a093e726b0341",
)

@ -10,6 +10,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_python//python:defs.bzl", "py_library")
load("@pip_deps//:requirements.bzl", "requirement")
load("//:protobuf.bzl", "internal_py_proto_library")
load("//build_defs:arch_tests.bzl", "aarch64_test", "x86_64_test")
load("//build_defs:cpp_opts.bzl", "COPTS")
load("//conformance:defs.bzl", "conformance_test")
load(":internal.bzl", "internal_copy_files", "internal_py_test")
@ -118,6 +119,22 @@ cc_binary(
}),
)
aarch64_test(
name = "aarch64_test",
bazel_binaries = [
"google/protobuf/internal/_api_implementation.so",
"google/protobuf/pyext/_message.so",
],
)
x86_64_test(
name = "x86_64_test",
bazel_binaries = [
"google/protobuf/internal/_api_implementation.so",
"google/protobuf/pyext/_message.so",
],
)
py_library(
name = "python_srcs",
srcs = glob(

@ -37,8 +37,8 @@ argument tuples.
A simple example:
class AdditionExample(parameterized.TestCase):
@parameterized.parameters(
class AdditionExample(_parameterized.TestCase):
@_parameterized.parameters(
(1, 2, 3),
(4, 5, 9),
(1, 1, 3))
@ -54,8 +54,8 @@ fail due to an assertion error (1 + 1 != 3).
Parameters for individual test cases can be tuples (with positional parameters)
or dictionaries (with named parameters):
class AdditionExample(parameterized.TestCase):
@parameterized.parameters(
class AdditionExample(_parameterized.TestCase):
@_parameterized.parameters(
{'op1': 1, 'op2': 2, 'result': 3},
{'op1': 4, 'op2': 5, 'result': 9},
)
@ -82,8 +82,8 @@ this case, only tuples are supported, and the first parameters has to
be a string (or an object that returns an apt name when converted via
str()):
class NamedExample(parameterized.TestCase):
@parameterized.named_parameters(
class NamedExample(_parameterized.TestCase):
@_parameterized.named_parameters(
('Normal', 'aa', 'aaa', True),
('EmptyPrefix', '', 'abc', True),
('BothEmpty', '', '', True))
@ -106,10 +106,10 @@ If invocation arguments are shared across test methods in a single
TestCase class, instead of decorating all test methods
individually, the class itself can be decorated:
@parameterized.parameters(
@_parameterized.parameters(
(1, 2, 3)
(4, 5, 9))
class ArithmeticTest(parameterized.TestCase):
class ArithmeticTest(_parameterized.TestCase):
def testAdd(self, arg1, arg2, result):
self.assertEqual(arg1 + arg2, result)
@ -122,8 +122,8 @@ If parameters should be shared across several test cases, or are dynamically
created from other sources, a single non-tuple iterable can be passed into
the decorator. This iterable will be used to obtain the test cases:
class AdditionExample(parameterized.TestCase):
@parameterized.parameters(
class AdditionExample(_parameterized.TestCase):
@_parameterized.parameters(
c.op1, c.op2, c.result for c in testcases
)
def testAddition(self, op1, op2, result):
@ -135,8 +135,8 @@ Single-Argument Test Methods
If a test method takes only one argument, the single argument does not need to
be wrapped into a tuple:
class NegativeNumberExample(parameterized.TestCase):
@parameterized.parameters(
class NegativeNumberExample(_parameterized.TestCase):
@_parameterized.parameters(
-1, -3, -4, -5
)
def testIsNegative(self, arg):
@ -423,7 +423,7 @@ def CoopTestCase(other_base_class):
import google3
import mox
from google3.testing.pybase import parameterized
from google.protobuf.internal import _parameterized
class ExampleTest(parameterized.CoopTestCase(mox.MoxTestBase)):
...

@ -32,6 +32,8 @@
#include "google/protobuf/pyext/descriptor.h"
#include "google/protobuf/stubs/logging.h"
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <frameobject.h>
@ -404,7 +406,7 @@ PyObject* NewInternedDescriptor(PyTypeObject* type,
std::unordered_map<const void*, PyObject*>::iterator it =
interned_descriptors->find(descriptor);
if (it != interned_descriptors->end()) {
GOOGLE_DCHECK(Py_TYPE(it->second) == type);
GOOGLE_ABSL_DCHECK(Py_TYPE(it->second) == type);
Py_INCREF(it->second);
return it->second;
}

@ -37,8 +37,8 @@
#include <string>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/pyext/message.h"
#include "google/protobuf/pyext/scoped_pyobject_ptr.h"
@ -62,7 +62,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
// Expected error: item was simply not found.
PyErr_Clear();
} else {
GOOGLE_LOG(ERROR) << "DescriptorDatabase method raised an error";
GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method raised an error";
PyErr_Print();
}
return false;
@ -86,7 +86,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
ScopedPyObjectPtr serialized_pb(
PyObject_CallMethod(py_descriptor, "SerializeToString", nullptr));
if (serialized_pb == nullptr) {
GOOGLE_LOG(ERROR)
GOOGLE_ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
PyErr_Print();
return false;
@ -94,14 +94,14 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor,
char* str;
Py_ssize_t len;
if (PyBytes_AsStringAndSize(serialized_pb.get(), &str, &len) < 0) {
GOOGLE_LOG(ERROR)
GOOGLE_ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
PyErr_Print();
return false;
}
FileDescriptorProto file_proto;
if (!file_proto.ParseFromArray(str, len)) {
GOOGLE_LOG(ERROR)
GOOGLE_ABSL_LOG(ERROR)
<< "DescriptorDatabase method did not return a FileDescriptorProto";
return false;
}
@ -172,9 +172,8 @@ bool PyDescriptorDatabase::FindAllExtensionNumbers(
ScopedPyObjectPtr item(PySequence_GetItem(py_list.get(), i));
item_value = PyLong_AsLong(item.get());
if (item_value < 0) {
GOOGLE_LOG(ERROR)
<< "FindAllExtensionNumbers method did not return "
<< "valid extension numbers.";
GOOGLE_ABSL_LOG(ERROR) << "FindAllExtensionNumbers method did not return "
<< "valid extension numbers.";
PyErr_Print();
return false;
}

@ -37,7 +37,6 @@
#include <memory>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"

@ -36,7 +36,6 @@
#include <memory>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/map.h"
#include "google/protobuf/map_field.h"
#include "google/protobuf/message.h"
@ -125,27 +124,27 @@ static bool PythonToMapKey(MapContainer* self, PyObject* obj, MapKey* key) {
self->parent_field_descriptor->message_type()->map_key();
switch (field_descriptor->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32: {
GOOGLE_CHECK_GET_INT32(obj, value, false);
PROTOBUF_CHECK_GET_INT32(obj, value, false);
key->SetInt32Value(value);
break;
}
case FieldDescriptor::CPPTYPE_INT64: {
GOOGLE_CHECK_GET_INT64(obj, value, false);
PROTOBUF_CHECK_GET_INT64(obj, value, false);
key->SetInt64Value(value);
break;
}
case FieldDescriptor::CPPTYPE_UINT32: {
GOOGLE_CHECK_GET_UINT32(obj, value, false);
PROTOBUF_CHECK_GET_UINT32(obj, value, false);
key->SetUInt32Value(value);
break;
}
case FieldDescriptor::CPPTYPE_UINT64: {
GOOGLE_CHECK_GET_UINT64(obj, value, false);
PROTOBUF_CHECK_GET_UINT64(obj, value, false);
key->SetUInt64Value(value);
break;
}
case FieldDescriptor::CPPTYPE_BOOL: {
GOOGLE_CHECK_GET_BOOL(obj, value, false);
PROTOBUF_CHECK_GET_BOOL(obj, value, false);
key->SetBoolValue(value);
break;
}
@ -231,37 +230,37 @@ static bool PythonToMapValueRef(MapContainer* self, PyObject* obj,
self->parent_field_descriptor->message_type()->map_value();
switch (field_descriptor->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32: {
GOOGLE_CHECK_GET_INT32(obj, value, false);
PROTOBUF_CHECK_GET_INT32(obj, value, false);
value_ref->SetInt32Value(value);
return true;
}
case FieldDescriptor::CPPTYPE_INT64: {
GOOGLE_CHECK_GET_INT64(obj, value, false);
PROTOBUF_CHECK_GET_INT64(obj, value, false);
value_ref->SetInt64Value(value);
return true;
}
case FieldDescriptor::CPPTYPE_UINT32: {
GOOGLE_CHECK_GET_UINT32(obj, value, false);
PROTOBUF_CHECK_GET_UINT32(obj, value, false);
value_ref->SetUInt32Value(value);
return true;
}
case FieldDescriptor::CPPTYPE_UINT64: {
GOOGLE_CHECK_GET_UINT64(obj, value, false);
PROTOBUF_CHECK_GET_UINT64(obj, value, false);
value_ref->SetUInt64Value(value);
return true;
}
case FieldDescriptor::CPPTYPE_FLOAT: {
GOOGLE_CHECK_GET_FLOAT(obj, value, false);
PROTOBUF_CHECK_GET_FLOAT(obj, value, false);
value_ref->SetFloatValue(value);
return true;
}
case FieldDescriptor::CPPTYPE_DOUBLE: {
GOOGLE_CHECK_GET_DOUBLE(obj, value, false);
PROTOBUF_CHECK_GET_DOUBLE(obj, value, false);
value_ref->SetDoubleValue(value);
return true;
}
case FieldDescriptor::CPPTYPE_BOOL: {
GOOGLE_CHECK_GET_BOOL(obj, value, false);
PROTOBUF_CHECK_GET_BOOL(obj, value, false);
value_ref->SetBoolValue(value);
return true;
}
@ -274,7 +273,7 @@ static bool PythonToMapValueRef(MapContainer* self, PyObject* obj,
return true;
}
case FieldDescriptor::CPPTYPE_ENUM: {
GOOGLE_CHECK_GET_INT32(obj, value, false);
PROTOBUF_CHECK_GET_INT32(obj, value, false);
if (allow_unknown_enum_values) {
value_ref->SetEnumValue(value);
return true;

@ -42,6 +42,7 @@
#include <string>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/match.h"
#ifndef PyVarObject_HEAD_INIT
@ -51,7 +52,6 @@
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
@ -252,10 +252,10 @@ static PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
if (WKT_classes == nullptr) {
ScopedPyObjectPtr well_known_types(
PyImport_ImportModule(PROTOBUF_PYTHON_INTERNAL ".well_known_types"));
GOOGLE_DCHECK(well_known_types != nullptr);
GOOGLE_ABSL_DCHECK(well_known_types != nullptr);
WKT_classes = PyObject_GetAttrString(well_known_types.get(), "WKTBASES");
GOOGLE_DCHECK(WKT_classes != nullptr);
GOOGLE_ABSL_DCHECK(WKT_classes != nullptr);
}
PyObject* well_known_class = PyDict_GetItemString(
@ -680,8 +680,8 @@ bool IsValidUTF8(PyObject* obj) {
bool AllowInvalidUTF8(const FieldDescriptor* field) { return false; }
PyObject* CheckString(PyObject* arg, const FieldDescriptor* descriptor) {
GOOGLE_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING ||
descriptor->type() == FieldDescriptor::TYPE_BYTES);
GOOGLE_ABSL_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING ||
descriptor->type() == FieldDescriptor::TYPE_BYTES);
if (descriptor->type() == FieldDescriptor::TYPE_STRING) {
if (!PyBytes_Check(arg) && !PyUnicode_Check(arg)) {
FormatTypeError(arg, "bytes, unicode");
@ -784,7 +784,7 @@ bool CheckFieldBelongsToMessage(const FieldDescriptor* field_descriptor,
namespace cmessage {
PyMessageFactory* GetFactoryForMessage(CMessage* message) {
GOOGLE_DCHECK(PyObject_TypeCheck(message, CMessage_Type));
GOOGLE_ABSL_DCHECK(PyObject_TypeCheck(message, CMessage_Type));
return reinterpret_cast<CMessageClass*>(Py_TYPE(message))->py_message_factory;
}
@ -856,7 +856,7 @@ int AssureWritable(CMessage* self) {
}
// Toplevel messages are always mutable.
GOOGLE_DCHECK(self->parent);
GOOGLE_ABSL_DCHECK(self->parent);
if (AssureWritable(self->parent) == -1) {
return -1;
@ -988,7 +988,7 @@ int DeleteRepeatedField(
}
Arena* arena = Arena::InternalGetArenaForAllocation(message);
GOOGLE_DCHECK_EQ(arena, nullptr)
GOOGLE_ABSL_DCHECK_EQ(arena, nullptr)
<< "python protobuf is expected to be allocated from heap";
// Remove items, starting from the end.
for (; length > to; length--) {
@ -1001,9 +1001,10 @@ int DeleteRepeatedField(
//
// To work around a debug hardening (PROTOBUF_FORCE_COPY_IN_RELEASE),
// explicitly use UnsafeArenaReleaseLast. To not break rare use cases where
// arena is used, we fallback to ReleaseLast (but GOOGLE_DCHECK to find/fix it).
// arena is used, we fallback to ReleaseLast (but GOOGLE_ABSL_DCHECK to find/fix
// it).
//
// Note that arena is likely null and GOOGLE_DCHECK and ReleaesLast might be
// Note that arena is likely null and GOOGLE_ABSL_DCHECK and ReleaesLast might be
// redundant. The current approach takes extra cautious path not to disrupt
// production.
Message* sub_message =
@ -1268,8 +1269,8 @@ static void Dealloc(CMessage* self) {
PyObject_ClearWeakRefs(reinterpret_cast<PyObject*>(self));
}
// At this point all dependent objects have been removed.
GOOGLE_DCHECK(!self->child_submessages || self->child_submessages->empty());
GOOGLE_DCHECK(!self->composite_fields || self->composite_fields->empty());
GOOGLE_ABSL_DCHECK(!self->child_submessages || self->child_submessages->empty());
GOOGLE_ABSL_DCHECK(!self->composite_fields || self->composite_fields->empty());
delete self->child_submessages;
delete self->composite_fields;
if (self->unknown_field_set) {
@ -1714,7 +1715,7 @@ static PyObject* InternalSerializeToString(
coded_out.SetSerializationDeterministic(deterministic);
}
self->message->SerializeWithCachedSizes(&coded_out);
GOOGLE_CHECK(!coded_out.HadError());
GOOGLE_ABSL_CHECK(!coded_out.HadError());
return result;
}
@ -2256,37 +2257,37 @@ int InternalSetNonOneofScalar(
switch (field_descriptor->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32: {
GOOGLE_CHECK_GET_INT32(arg, value, -1);
PROTOBUF_CHECK_GET_INT32(arg, value, -1);
reflection->SetInt32(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_INT64: {
GOOGLE_CHECK_GET_INT64(arg, value, -1);
PROTOBUF_CHECK_GET_INT64(arg, value, -1);
reflection->SetInt64(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT32: {
GOOGLE_CHECK_GET_UINT32(arg, value, -1);
PROTOBUF_CHECK_GET_UINT32(arg, value, -1);
reflection->SetUInt32(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT64: {
GOOGLE_CHECK_GET_UINT64(arg, value, -1);
PROTOBUF_CHECK_GET_UINT64(arg, value, -1);
reflection->SetUInt64(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_FLOAT: {
GOOGLE_CHECK_GET_FLOAT(arg, value, -1);
PROTOBUF_CHECK_GET_FLOAT(arg, value, -1);
reflection->SetFloat(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_DOUBLE: {
GOOGLE_CHECK_GET_DOUBLE(arg, value, -1);
PROTOBUF_CHECK_GET_DOUBLE(arg, value, -1);
reflection->SetDouble(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_BOOL: {
GOOGLE_CHECK_GET_BOOL(arg, value, -1);
PROTOBUF_CHECK_GET_BOOL(arg, value, -1);
reflection->SetBool(message, field_descriptor, value);
break;
}
@ -2298,7 +2299,7 @@ int InternalSetNonOneofScalar(
break;
}
case FieldDescriptor::CPPTYPE_ENUM: {
GOOGLE_CHECK_GET_INT32(arg, value, -1);
PROTOBUF_CHECK_GET_INT32(arg, value, -1);
if (reflection->SupportsUnknownEnumValues()) {
reflection->SetEnumValue(message, field_descriptor, value);
} else {

@ -287,46 +287,46 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg);
#define FIELD_IS_REPEATED(field_descriptor) \
((field_descriptor)->label() == FieldDescriptor::LABEL_REPEATED)
#define GOOGLE_CHECK_GET_INT32(arg, value, err) \
int32_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_INT32(arg, value, err) \
int32_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_INT64(arg, value, err) \
int64_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_INT64(arg, value, err) \
int64_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_UINT32(arg, value, err) \
uint32_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_UINT32(arg, value, err) \
uint32_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_UINT64(arg, value, err) \
uint64_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_UINT64(arg, value, err) \
uint64_t value; \
if (!CheckAndGetInteger(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_FLOAT(arg, value, err) \
float value; \
if (!CheckAndGetFloat(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_FLOAT(arg, value, err) \
float value; \
if (!CheckAndGetFloat(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_DOUBLE(arg, value, err) \
double value; \
if (!CheckAndGetDouble(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_DOUBLE(arg, value, err) \
double value; \
if (!CheckAndGetDouble(arg, &value)) { \
return err; \
}
#define GOOGLE_CHECK_GET_BOOL(arg, value, err) \
bool value; \
if (!CheckAndGetBool(arg, &value)) { \
return err; \
#define PROTOBUF_CHECK_GET_BOOL(arg, value, err) \
bool value; \
if (!CheckAndGetBool(arg, &value)) { \
return err; \
}
#define FULL_MODULE_NAME "google.protobuf.pyext._message"

@ -1,40 +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.
syntax = "proto2";
package google.protobuf.python.internal;
import "google/protobuf/internal/cpp/proto1_api_test.proto";
message TestNestedProto1APIMessage {
optional int32 a = 1;
optional TestMessage.NestedMessage b = 2;
}

@ -35,7 +35,6 @@
#include <memory>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/message.h"

@ -38,7 +38,6 @@
#include <string>
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/message.h"
@ -109,37 +108,37 @@ static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) {
switch (field_descriptor->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32: {
GOOGLE_CHECK_GET_INT32(arg, value, -1);
PROTOBUF_CHECK_GET_INT32(arg, value, -1);
reflection->SetRepeatedInt32(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_INT64: {
GOOGLE_CHECK_GET_INT64(arg, value, -1);
PROTOBUF_CHECK_GET_INT64(arg, value, -1);
reflection->SetRepeatedInt64(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT32: {
GOOGLE_CHECK_GET_UINT32(arg, value, -1);
PROTOBUF_CHECK_GET_UINT32(arg, value, -1);
reflection->SetRepeatedUInt32(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT64: {
GOOGLE_CHECK_GET_UINT64(arg, value, -1);
PROTOBUF_CHECK_GET_UINT64(arg, value, -1);
reflection->SetRepeatedUInt64(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_FLOAT: {
GOOGLE_CHECK_GET_FLOAT(arg, value, -1);
PROTOBUF_CHECK_GET_FLOAT(arg, value, -1);
reflection->SetRepeatedFloat(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_DOUBLE: {
GOOGLE_CHECK_GET_DOUBLE(arg, value, -1);
PROTOBUF_CHECK_GET_DOUBLE(arg, value, -1);
reflection->SetRepeatedDouble(message, field_descriptor, index, value);
break;
}
case FieldDescriptor::CPPTYPE_BOOL: {
GOOGLE_CHECK_GET_BOOL(arg, value, -1);
PROTOBUF_CHECK_GET_BOOL(arg, value, -1);
reflection->SetRepeatedBool(message, field_descriptor, index, value);
break;
}
@ -151,7 +150,7 @@ static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) {
break;
}
case FieldDescriptor::CPPTYPE_ENUM: {
GOOGLE_CHECK_GET_INT32(arg, value, -1);
PROTOBUF_CHECK_GET_INT32(arg, value, -1);
if (reflection->SupportsUnknownEnumValues()) {
reflection->SetRepeatedEnumValue(message, field_descriptor, index,
value);
@ -334,37 +333,37 @@ PyObject* Append(RepeatedScalarContainer* self, PyObject* item) {
const Reflection* reflection = message->GetReflection();
switch (field_descriptor->cpp_type()) {
case FieldDescriptor::CPPTYPE_INT32: {
GOOGLE_CHECK_GET_INT32(item, value, nullptr);
PROTOBUF_CHECK_GET_INT32(item, value, nullptr);
reflection->AddInt32(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_INT64: {
GOOGLE_CHECK_GET_INT64(item, value, nullptr);
PROTOBUF_CHECK_GET_INT64(item, value, nullptr);
reflection->AddInt64(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT32: {
GOOGLE_CHECK_GET_UINT32(item, value, nullptr);
PROTOBUF_CHECK_GET_UINT32(item, value, nullptr);
reflection->AddUInt32(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_UINT64: {
GOOGLE_CHECK_GET_UINT64(item, value, nullptr);
PROTOBUF_CHECK_GET_UINT64(item, value, nullptr);
reflection->AddUInt64(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_FLOAT: {
GOOGLE_CHECK_GET_FLOAT(item, value, nullptr);
PROTOBUF_CHECK_GET_FLOAT(item, value, nullptr);
reflection->AddFloat(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_DOUBLE: {
GOOGLE_CHECK_GET_DOUBLE(item, value, nullptr);
PROTOBUF_CHECK_GET_DOUBLE(item, value, nullptr);
reflection->AddDouble(message, field_descriptor, value);
break;
}
case FieldDescriptor::CPPTYPE_BOOL: {
GOOGLE_CHECK_GET_BOOL(item, value, nullptr);
PROTOBUF_CHECK_GET_BOOL(item, value, nullptr);
reflection->AddBool(message, field_descriptor, value);
break;
}
@ -376,7 +375,7 @@ PyObject* Append(RepeatedScalarContainer* self, PyObject* item) {
break;
}
case FieldDescriptor::CPPTYPE_ENUM: {
GOOGLE_CHECK_GET_INT32(item, value, nullptr);
PROTOBUF_CHECK_GET_INT32(item, value, nullptr);
if (reflection->SupportsUnknownEnumValues()) {
reflection->AddEnumValue(message, field_descriptor, value);
} else {

@ -152,7 +152,7 @@ inline bool IsValidNumericCast(Source source) {
// (this is static_asserted), though this could be supported if necessary.
template <class Dest, class Source>
inline Dest checked_numeric_cast(Source source) {
GOOGLE_CHECK(IsValidNumericCast<Dest>(source));
GOOGLE_ABSL_CHECK(IsValidNumericCast<Dest>(source));
return static_cast<Dest>(source);
}

@ -883,7 +883,7 @@ class _Parser(object):
type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer)
tokenizer.Consume(']')
tokenizer.TryConsume(':')
self._DetectSilentMarker(tokenizer,
self._DetectSilentMarker(tokenizer, message_descriptor.full_name,
type_url_prefix + '/' + packed_type_name)
if tokenizer.TryConsume('<'):
expanded_any_end_token = '>'
@ -982,11 +982,13 @@ class _Parser(object):
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
tokenizer.TryConsume(':')
self._DetectSilentMarker(tokenizer, field.full_name)
self._DetectSilentMarker(tokenizer, message_descriptor.full_name,
field.full_name)
merger = self._MergeMessageField
else:
tokenizer.Consume(':')
self._DetectSilentMarker(tokenizer, field.full_name)
self._DetectSilentMarker(tokenizer, message_descriptor.full_name,
field.full_name)
merger = self._MergeScalarField
if (field.label == descriptor.FieldDescriptor.LABEL_REPEATED and
@ -1004,19 +1006,19 @@ class _Parser(object):
else: # Proto field is unknown.
assert (self.allow_unknown_extension or self.allow_unknown_field)
self._SkipFieldContents(tokenizer, name)
self._SkipFieldContents(tokenizer, name, message_descriptor.full_name)
# For historical reasons, fields may optionally be separated by commas or
# semicolons.
if not tokenizer.TryConsume(','):
tokenizer.TryConsume(';')
def _LogSilentMarker(self, field_name):
def _LogSilentMarker(self, immediate_message_type, field_name):
pass
def _DetectSilentMarker(self, tokenizer, field_name):
def _DetectSilentMarker(self, tokenizer, immediate_message_type, field_name):
if tokenizer.contains_silent_marker_before_current_token:
self._LogSilentMarker(field_name)
self._LogSilentMarker(immediate_message_type, field_name)
def _ConsumeAnyTypeUrl(self, tokenizer):
"""Consumes a google.protobuf.Any type URL and returns the type name."""
@ -1166,12 +1168,14 @@ class _Parser(object):
else:
setattr(message, field.name, value)
def _SkipFieldContents(self, tokenizer, field_name):
def _SkipFieldContents(self, tokenizer, field_name, immediate_message_type):
"""Skips over contents (value or message) of a field.
Args:
tokenizer: A tokenizer to parse the field name and values.
field_name: The field name currently being parsed.
immediate_message_type: The type of the message immediately containing
the silent marker.
"""
# Try to guess the type of this field.
# If this field is not a message, there should be a ":" between the
@ -1181,20 +1185,22 @@ class _Parser(object):
# to be a message or the input is ill-formed.
if tokenizer.TryConsume(
':') and not tokenizer.LookingAt('{') and not tokenizer.LookingAt('<'):
self._DetectSilentMarker(tokenizer, field_name)
self._DetectSilentMarker(tokenizer, immediate_message_type, field_name)
if tokenizer.LookingAt('['):
self._SkipRepeatedFieldValue(tokenizer)
else:
self._SkipFieldValue(tokenizer)
else:
self._DetectSilentMarker(tokenizer, field_name)
self._SkipFieldMessage(tokenizer)
self._DetectSilentMarker(tokenizer, immediate_message_type, field_name)
self._SkipFieldMessage(tokenizer, immediate_message_type)
def _SkipField(self, tokenizer):
def _SkipField(self, tokenizer, immediate_message_type):
"""Skips over a complete field (name and value/message).
Args:
tokenizer: A tokenizer to parse the field name and values.
immediate_message_type: The type of the message immediately containing
the silent marker.
"""
field_name = ''
if tokenizer.TryConsume('['):
@ -1214,18 +1220,20 @@ class _Parser(object):
else:
field_name += tokenizer.ConsumeIdentifierOrNumber()
self._SkipFieldContents(tokenizer, field_name)
self._SkipFieldContents(tokenizer, field_name, immediate_message_type)
# For historical reasons, fields may optionally be separated by commas or
# semicolons.
if not tokenizer.TryConsume(','):
tokenizer.TryConsume(';')
def _SkipFieldMessage(self, tokenizer):
def _SkipFieldMessage(self, tokenizer, immediate_message_type):
"""Skips over a field message.
Args:
tokenizer: A tokenizer to parse the field name and values.
immediate_message_type: The type of the message immediately containing
the silent marker
"""
if tokenizer.TryConsume('<'):
delimiter = '>'
@ -1234,7 +1242,7 @@ class _Parser(object):
delimiter = '}'
while not tokenizer.LookingAt('>') and not tokenizer.LookingAt('}'):
self._SkipField(tokenizer)
self._SkipField(tokenizer, immediate_message_type)
tokenizer.Consume(delimiter)

@ -147,6 +147,12 @@
#if defined(__GNUC__) || defined(__clang__)
#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
#elif defined(_MSC_VER)
#define UPB_UNREACHABLE() \
do { \
assert(0); \
__assume(0); \
} while (0)
#else
#define UPB_UNREACHABLE() do { assert(0); } while(0)
#endif
@ -972,18 +978,19 @@ static const upb_MiniTableSub google_protobuf_MessageOptions_submsgs[1] = {
{.submsg = &google_protobuf_UninterpretedOption_msg_init},
};
static const upb_MiniTableField google_protobuf_MessageOptions__fields[5] = {
static const upb_MiniTableField google_protobuf_MessageOptions__fields[6] = {
{1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_protobuf_MessageOptions_msg_init = {
&google_protobuf_MessageOptions_submsgs[0],
&google_protobuf_MessageOptions__fields[0],
16, 5, kUpb_ExtMode_Extendable, 3, 255, 0,
16, 6, kUpb_ExtMode_Extendable, 3, 255, 0,
};
static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[3] = {
@ -1027,16 +1034,17 @@ static const upb_MiniTableSub google_protobuf_EnumOptions_submsgs[1] = {
{.submsg = &google_protobuf_UninterpretedOption_msg_init},
};
static const upb_MiniTableField google_protobuf_EnumOptions__fields[3] = {
static const upb_MiniTableField google_protobuf_EnumOptions__fields[4] = {
{2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
{999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_protobuf_EnumOptions_msg_init = {
&google_protobuf_EnumOptions_submsgs[0],
&google_protobuf_EnumOptions__fields[0],
UPB_SIZE(8, 16), 3, kUpb_ExtMode_Extendable, 0, 255, 0,
UPB_SIZE(8, 16), 4, kUpb_ExtMode_Extendable, 0, 255, 0,
};
static const upb_MiniTableSub google_protobuf_EnumValueOptions_submsgs[1] = {
@ -5174,6 +5182,11 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray(
if (ret.status == kUpb_UnknownToMessage_Ok) {
upb_MessageValue value;
value.msg_val = ret.message;
// Allocate array on demand before append.
if (!repeated_messages) {
upb_MiniTable_ResizeArray(msg, field, 0, arena);
repeated_messages = upb_MiniTable_GetMutableArray(msg, field);
}
if (!upb_Array_Append(repeated_messages, value, arena)) {
return kUpb_UnknownToMessage_OutOfMemory;
}
@ -5316,20 +5329,6 @@ const upb_Message_Extension* _upb_Message_Getext(
return NULL;
}
void _upb_Message_Clearext(upb_Message* msg,
const upb_MiniTableExtension* ext_l) {
upb_Message_Internal* in = upb_Message_Getinternal(msg);
if (!in->internal) return;
const upb_Message_Extension* base =
UPB_PTR_AT(in->internal, in->internal->ext_begin, void);
upb_Message_Extension* ext =
(upb_Message_Extension*)_upb_Message_Getext(msg, ext_l);
if (ext) {
*ext = *base;
in->internal->ext_begin += sizeof(upb_Message_Extension);
}
}
upb_Message_Extension* _upb_Message_GetOrCreateExtension(
upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* arena) {
upb_Message_Extension* ext =
@ -6057,6 +6056,21 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data,
}
upb_MtDecoder_ParseMessage(d, data, len);
if (UPB_UNLIKELY(d->table->field_count != 2)) {
upb_MtDecoder_ErrorFormat(d, "%hu fields in map", d->table->field_count);
UPB_UNREACHABLE();
}
if (UPB_UNLIKELY(d->table->fields[0].number != 1)) {
upb_MtDecoder_ErrorFormat(d, "field %d in map key",
d->table->fields[0].number);
UPB_UNREACHABLE();
}
if (UPB_UNLIKELY(d->table->fields[1].number != 2)) {
upb_MtDecoder_ErrorFormat(d, "field %d in map val",
d->table->fields[1].number);
UPB_UNREACHABLE();
}
upb_MtDecoder_AssignHasbits(d->table);
// Map entries have a pre-determined layout, regardless of types.
@ -7745,7 +7759,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]);
const int32_t end =
google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]);
const int32_t max = kUpb_MaxFieldNumber + 1;
// A full validation would also check that each range is disjoint, and that
// none of the fields overlap with the extension ranges, but we are just
@ -7753,7 +7766,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
// Note: Not a typo! Unlike extension ranges and message reserved ranges,
// the end value of an enum reserved range is *inclusive*!
if (start < 1 || end < start || end > max) {
if (end < start) {
_upb_DefBuilder_Errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n",
(int)start, (int)end, upb_EnumDef_FullName(e));
}
@ -9148,7 +9161,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx,
bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f) {
UPB_ASSERT(upb_FieldDef_HasPresence(f));
return _upb_MiniTable_HasField(msg, upb_FieldDef_MiniTable(f));
return upb_Message_HasField(msg, upb_FieldDef_MiniTable(f));
}
const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg,
@ -9170,7 +9183,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg,
const upb_FieldDef* f) {
upb_MessageValue default_val = upb_FieldDef_Default(f);
upb_MessageValue ret;
_upb_MiniTable_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret);
_upb_Message_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret);
return ret;
}
@ -9215,11 +9228,11 @@ make:
bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f,
upb_MessageValue val, upb_Arena* a) {
return _upb_MiniTable_SetField(msg, upb_FieldDef_MiniTable(f), &val, a);
return _upb_Message_SetField(msg, upb_FieldDef_MiniTable(f), &val, a);
}
void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) {
_upb_MiniTable_ClearField(msg, upb_FieldDef_MiniTable(f));
upb_Message_ClearField(msg, upb_FieldDef_MiniTable(f));
}
void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) {
@ -10454,6 +10467,7 @@ const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status) {
UPB_LONGJMP(d->err, status);
return NULL;
}
static void _upb_Decoder_VerifyUtf8(upb_Decoder* d, const char* buf, int len) {
if (!_upb_Decoder_VerifyUtf8Inline(buf, len)) {
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8);
@ -10529,7 +10543,8 @@ static const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr,
uint32_t* size) {
uint64_t size64;
ptr = _upb_Decoder_DecodeVarint(d, ptr, &size64);
if (size64 >= INT32_MAX || ptr - d->end + (int)size64 > d->limit) {
if (size64 >= INT32_MAX ||
!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, (int)size64)) {
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed);
}
*size = size64;
@ -10576,15 +10591,6 @@ static upb_Message* _upb_Decoder_NewSubMessage(
return msg;
}
UPB_NOINLINE
const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr,
int overrun) {
int status;
ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status);
if (ptr == NULL) _upb_Decoder_ErrorJmp(d, status);
return ptr;
}
static const char* _upb_Decoder_ReadString(upb_Decoder* d, const char* ptr,
int size, upb_StringView* str) {
if (d->options & kUpb_DecodeOption_AliasString) {
@ -10620,11 +10626,11 @@ UPB_FORCEINLINE
static const char* _upb_Decoder_DecodeSubMessage(
upb_Decoder* d, const char* ptr, upb_Message* submsg,
const upb_MiniTableSub* subs, const upb_MiniTableField* field, int size) {
int saved_delta = _upb_Decoder_PushLimit(d, ptr, size);
int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size);
const upb_MiniTable* subl = subs[field->submsg_index].submsg;
UPB_ASSERT(subl);
ptr = _upb_Decoder_RecurseSubMessage(d, ptr, submsg, subl, DECODE_NOGROUP);
_upb_Decoder_PopLimit(d, ptr, saved_delta);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_delta);
return ptr;
}
@ -10771,7 +10777,7 @@ static const char* _upb_Decoder_DecodeVarintPacked(
upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val,
const upb_MiniTableField* field, int lg2) {
int scale = 1 << lg2;
int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size);
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size);
char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size << lg2, void);
while (!_upb_Decoder_IsDone(d, &ptr)) {
wireval elem;
@ -10784,7 +10790,7 @@ static const char* _upb_Decoder_DecodeVarintPacked(
memcpy(out, &elem, scale);
out += scale;
}
_upb_Decoder_PopLimit(d, ptr, saved_limit);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit);
return ptr;
}
@ -10794,7 +10800,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
const upb_MiniTableSub* subs, const upb_MiniTableField* field,
wireval* val) {
const upb_MiniTableEnum* e = subs[field->submsg_index].subenum;
int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size);
int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size);
char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size * 4, void);
while (!_upb_Decoder_IsDone(d, &ptr)) {
wireval elem;
@ -10810,7 +10816,7 @@ static const char* _upb_Decoder_DecodeEnumPacked(
memcpy(out, &elem, 4);
out += 4;
}
_upb_Decoder_PopLimit(d, ptr, saved_limit);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit);
return ptr;
}
@ -11558,7 +11564,7 @@ static const char* _upb_Decoder_DecodeMessage(upb_Decoder* d, const char* ptr,
d->debug_tagstart = ptr;
#endif
UPB_ASSERT(ptr < d->limit_ptr);
UPB_ASSERT(ptr < d->input.limit_ptr);
ptr = _upb_Decoder_DecodeTag(d, ptr, &tag);
field_number = tag >> 3;
wire_type = tag & 7;
@ -11616,6 +11622,13 @@ static upb_DecodeStatus _upb_Decoder_DecodeTop(struct upb_Decoder* d,
return kUpb_DecodeStatus_Ok;
}
UPB_NOINLINE
const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e,
const char* ptr, int overrun) {
return _upb_EpsCopyInputStream_IsDoneFallbackInline(
e, ptr, overrun, _upb_Decoder_BufferFlipCallback);
}
upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg,
const upb_MiniTable* l,
const upb_ExtensionRegistry* extreg, int options,
@ -11623,20 +11636,11 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg,
upb_Decoder state;
unsigned depth = (unsigned)options >> 16;
if (size <= 16) {
memset(&state.patch, 0, 32);
if (size) memcpy(&state.patch, buf, size);
buf = state.patch;
state.end = buf + size;
state.limit = 0;
if (upb_EpsCopyInputStream_Init(&state.input, &buf, size)) {
options &= ~kUpb_DecodeOption_AliasString; // Can't alias patch buf.
} else {
state.end = buf + size - 16;
state.limit = 16;
}
state.extreg = extreg;
state.limit_ptr = state.end;
state.unknown = NULL;
state.depth = depth ? depth : 64;
state.end_group = DECODE_NOGROUP;
@ -11701,28 +11705,27 @@ typedef enum {
UPB_NOINLINE
static const char* fastdecode_isdonefallback(UPB_PARSE_PARAMS) {
int overrun = data;
int status;
ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status);
if (ptr == NULL) _upb_FastDecoder_ErrorJmp(d, status);
ptr = _upb_EpsCopyInputStream_IsDoneFallbackInline(
&d->input, ptr, overrun, _upb_Decoder_BufferFlipCallback);
data = _upb_FastDecoder_LoadTag(ptr);
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS);
}
UPB_FORCEINLINE
static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) {
if (UPB_UNLIKELY(ptr >= d->limit_ptr)) {
int overrun = ptr - d->end;
if (UPB_LIKELY(overrun == d->limit)) {
// Parse is finished.
int overrun;
switch (upb_EpsCopyInputStream_IsDoneStatus(&d->input, ptr, &overrun)) {
case kUpb_IsDoneStatus_Done:
*(uint32_t*)msg |= hasbits; // Sync hasbits.
const upb_MiniTable* l = decode_totablep(table);
return UPB_UNLIKELY(l->required_count)
? _upb_Decoder_CheckRequired(d, ptr, msg, l)
: ptr;
} else {
case kUpb_IsDoneStatus_NotDone:
break;
case kUpb_IsDoneStatus_NeedFallback:
data = overrun;
UPB_MUSTTAIL return fastdecode_isdonefallback(UPB_PARSE_ARGS);
}
}
// Read two bytes of tag data (for a one-byte tag, the high byte is junk).
@ -11760,37 +11763,17 @@ static const char* fastdecode_longsize(const char* ptr, int* size) {
}
UPB_FORCEINLINE
static bool fastdecode_boundscheck(const char* ptr, size_t len,
const char* end) {
uintptr_t uptr = (uintptr_t)ptr;
uintptr_t uend = (uintptr_t)end + 16;
uintptr_t res = uptr + len;
return res < uptr || res > uend;
}
UPB_FORCEINLINE
static bool fastdecode_boundscheck2(const char* ptr, size_t len,
const char* end) {
// This is one extra branch compared to the more normal:
// return (size_t)(end - ptr) < size;
// However it is one less computation if we are just about to use "ptr + len":
// https://godbolt.org/z/35YGPz
// In microbenchmarks this shows an overall 4% improvement.
uintptr_t uptr = (uintptr_t)ptr;
uintptr_t uend = (uintptr_t)end;
uintptr_t res = uptr + len;
return res < uptr || res > uend;
}
typedef const char* fastdecode_delimfunc(upb_Decoder* d, const char* ptr,
void* ctx);
UPB_FORCEINLINE
static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr,
fastdecode_delimfunc* func, void* ctx) {
static const char* fastdecode_delimited(
upb_Decoder* d, const char* ptr,
upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) {
ptr++;
// Sign-extend so varint greater than one byte becomes negative, causing
// fast delimited parse to fail.
int len = (int8_t)ptr[-1];
if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) {
if (!upb_EpsCopyInputStream_TryParseDelimitedFast(&d->input, &ptr, len, func,
ctx)) {
// Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer.
// If it exceeds the buffer limit, limit/limit_ptr will change during
// sub-message parsing, so we need to preserve delta, not limit.
@ -11802,25 +11785,13 @@ static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr,
return NULL;
}
}
if (ptr - d->end + (int)len > d->limit) {
if (!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, len)) {
// Corrupt wire format: invalid limit.
return NULL;
}
int delta = _upb_Decoder_PushLimit(d, ptr, len);
ptr = func(d, ptr, ctx);
_upb_Decoder_PopLimit(d, ptr, delta);
} else {
// Fast case: Sub-message is <128 bytes and fits in the current buffer.
// This means we can preserve limit/limit_ptr verbatim.
const char* saved_limit_ptr = d->limit_ptr;
int saved_limit = d->limit;
d->limit_ptr = ptr + len;
d->limit = d->limit_ptr - d->end;
UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
ptr = func(d, ptr, ctx);
d->limit_ptr = saved_limit_ptr;
d->limit = saved_limit;
UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit));
int delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, len);
ptr = func(&d->input, ptr, ctx);
upb_EpsCopyInputStream_PopLimit(&d->input, ptr, delta);
}
return ptr;
}
@ -12061,8 +12032,9 @@ typedef struct {
} fastdecode_varintdata;
UPB_FORCEINLINE
static const char* fastdecode_topackedvarint(upb_Decoder* d, const char* ptr,
void* ctx) {
static const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e,
const char* ptr, void* ctx) {
upb_Decoder* d = (upb_Decoder*)e;
fastdecode_varintdata* data = ctx;
void* dst = data->dst;
uint64_t val;
@ -12210,7 +12182,8 @@ TAGBYTES(p)
ptr = fastdecode_longsize(ptr, &size); \
} \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr) || \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size) || \
(size % valbytes) != 0)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \
} \
@ -12302,7 +12275,8 @@ static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr,
ptr = fastdecode_longsize(ptr, &size); \
} \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size))) { \
dst->size = 0; \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \
} \
@ -12355,91 +12329,92 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size,
UPB_POISON_MEMORY_REGION(data + size, copy - size);
}
#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
card, validate_utf8) \
upb_StringView* dst; \
fastdecode_arr farr; \
int64_t size; \
size_t arena_has; \
size_t common_has; \
char* buf; \
\
UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \
UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \
\
dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
sizeof(upb_StringView), card); \
\
again: \
if (card == CARD_r) { \
dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \
} \
\
size = (uint8_t)ptr[tagbytes]; \
ptr += tagbytes + 1; \
dst->size = size; \
\
buf = d->arena.head.ptr; \
arena_has = _upb_ArenaHas(&d->arena); \
common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); \
\
if (UPB_LIKELY(size <= 15 - tagbytes)) { \
if (arena_has < 16) goto longstr; \
d->arena.head.ptr += 16; \
memcpy(buf, ptr - tagbytes - 1, 16); \
dst->data = buf + tagbytes + 1; \
} else if (UPB_LIKELY(size <= 32)) { \
if (UPB_UNLIKELY(common_has < 32)) goto longstr; \
fastdecode_docopy(d, ptr, size, 32, buf, dst); \
} else if (UPB_LIKELY(size <= 64)) { \
if (UPB_UNLIKELY(common_has < 64)) goto longstr; \
fastdecode_docopy(d, ptr, size, 64, buf, dst); \
} else if (UPB_LIKELY(size < 128)) { \
if (UPB_UNLIKELY(common_has < 128)) goto longstr; \
fastdecode_docopy(d, ptr, size, 128, buf, dst); \
} else { \
goto longstr; \
} \
\
ptr += size; \
\
if (card == CARD_r) { \
if (validate_utf8 && \
!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \
} \
fastdecode_nextret ret = fastdecode_nextrepeated( \
d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \
switch (ret.next) { \
case FD_NEXT_SAMEFIELD: \
dst = ret.dst; \
goto again; \
case FD_NEXT_OTHERFIELD: \
data = ret.tag; \
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \
case FD_NEXT_ATLIMIT: \
return ptr; \
} \
} \
\
if (card != CARD_r && validate_utf8) { \
data = (uint64_t)dst; \
UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
} \
\
UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
\
longstr: \
if (card == CARD_r) { \
fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \
} \
ptr--; \
if (validate_utf8) { \
UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
} else { \
UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
card, validate_utf8) \
upb_StringView* dst; \
fastdecode_arr farr; \
int64_t size; \
size_t arena_has; \
size_t common_has; \
char* buf; \
\
UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \
UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \
\
dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
sizeof(upb_StringView), card); \
\
again: \
if (card == CARD_r) { \
dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \
} \
\
size = (uint8_t)ptr[tagbytes]; \
ptr += tagbytes + 1; \
dst->size = size; \
\
buf = d->arena.head.ptr; \
arena_has = _upb_ArenaHas(&d->arena); \
common_has = UPB_MIN(arena_has, \
upb_EpsCopyInputStream_BytesAvailable(&d->input, ptr)); \
\
if (UPB_LIKELY(size <= 15 - tagbytes)) { \
if (arena_has < 16) goto longstr; \
d->arena.head.ptr += 16; \
memcpy(buf, ptr - tagbytes - 1, 16); \
dst->data = buf + tagbytes + 1; \
} else if (UPB_LIKELY(size <= 32)) { \
if (UPB_UNLIKELY(common_has < 32)) goto longstr; \
fastdecode_docopy(d, ptr, size, 32, buf, dst); \
} else if (UPB_LIKELY(size <= 64)) { \
if (UPB_UNLIKELY(common_has < 64)) goto longstr; \
fastdecode_docopy(d, ptr, size, 64, buf, dst); \
} else if (UPB_LIKELY(size < 128)) { \
if (UPB_UNLIKELY(common_has < 128)) goto longstr; \
fastdecode_docopy(d, ptr, size, 128, buf, dst); \
} else { \
goto longstr; \
} \
\
ptr += size; \
\
if (card == CARD_r) { \
if (validate_utf8 && \
!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \
_upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \
} \
fastdecode_nextret ret = fastdecode_nextrepeated( \
d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \
switch (ret.next) { \
case FD_NEXT_SAMEFIELD: \
dst = ret.dst; \
goto again; \
case FD_NEXT_OTHERFIELD: \
data = ret.tag; \
UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \
case FD_NEXT_ATLIMIT: \
return ptr; \
} \
} \
\
if (card != CARD_r && validate_utf8) { \
data = (uint64_t)dst; \
UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
} \
\
UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
\
longstr: \
if (card == CARD_r) { \
fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \
} \
ptr--; \
if (validate_utf8) { \
UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
} else { \
UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \
hasbits, (uint64_t)dst); \
}
#define FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, card, \
@ -12469,7 +12444,8 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size,
dst->data = ptr; \
dst->size = size; \
\
if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { \
if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \
&d->input, ptr, size))) { \
ptr--; \
if (validate_utf8) { \
return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, \
@ -12582,8 +12558,9 @@ typedef struct {
} fastdecode_submsgdata;
UPB_FORCEINLINE
static const char* fastdecode_tosubmsg(upb_Decoder* d, const char* ptr,
void* ctx) {
static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e,
const char* ptr, void* ctx) {
upb_Decoder* d = (upb_Decoder*)e;
fastdecode_submsgdata* submsg = ctx;
ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0, 0);
UPB_ASSUME(ptr != NULL);

File diff suppressed because it is too large Load Diff

@ -103,7 +103,6 @@ set(libprotobuf_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_config.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.h
@ -169,6 +168,7 @@ set(libprotobuf_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/service.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h
@ -178,6 +178,7 @@ set(libprotobuf_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h
${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h
${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h
@ -227,7 +228,6 @@ set(libprotobuf_lite_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_config.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h
${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h
${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h
@ -258,6 +258,7 @@ set(libprotobuf_lite_hdrs
${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h
${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h
@ -265,6 +266,7 @@ set(libprotobuf_lite_hdrs
${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_macros.h
${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h
)

@ -244,8 +244,9 @@ cc_library(
hdrs = [
"arena.h",
"arena_config.h",
"arena_impl.h",
"arenaz_sampler.h",
"serial_arena.h",
"thread_safe_arena.h",
],
include_prefix = "google/protobuf",
visibility = [
@ -253,6 +254,7 @@ cc_library(
"//src/google/protobuf:__subpackages__",
],
deps = [
":arena_align",
":arena_allocation_policy",
":arena_cleanup",
":arena_config",
@ -283,7 +285,6 @@ cc_library(
hdrs = [
"any.h",
"arena.h",
"arena_impl.h",
"arenastring.h",
"arenaz_sampler.h",
"endian.h",
@ -307,6 +308,8 @@ cc_library(
"port.h",
"repeated_field.h",
"repeated_ptr_field.h",
"serial_arena.h",
"thread_safe_arena.h",
"wire_format_lite.h",
],
copts = COPTS + select({
@ -325,6 +328,7 @@ cc_library(
# In Bazel 6.0+, these will be `interface_deps`:
deps = [
":arena",
":arena_align",
":arena_config",
"//src/google/protobuf/io",
"//src/google/protobuf/stubs:lite",

@ -40,9 +40,10 @@
#include "absl/base/attributes.h"
#include "absl/synchronization/mutex.h"
#include "google/protobuf/arena_allocation_policy.h"
#include "google/protobuf/arena_impl.h"
#include "google/protobuf/arenaz_sampler.h"
#include "google/protobuf/port.h"
#include "google/protobuf/serial_arena.h"
#include "google/protobuf/thread_safe_arena.h"
#ifdef ADDRESS_SANITIZER
@ -93,8 +94,8 @@ static SerialArena::Memory AllocateMemory(const AllocationPolicy* policy_ptr,
size = policy.start_block_size;
}
// Verify that min_bytes + kBlockHeaderSize won't overflow.
GOOGLE_CHECK_LE(min_bytes,
std::numeric_limits<size_t>::max() - SerialArena::kBlockHeaderSize);
GOOGLE_ABSL_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() -
SerialArena::kBlockHeaderSize);
size = std::max(size, SerialArena::kBlockHeaderSize + min_bytes);
void* mem;
@ -139,7 +140,7 @@ SerialArena::SerialArena(ArenaBlock* b, ThreadSafeArena& parent)
head_{b},
space_allocated_{b->size},
parent_{parent} {
GOOGLE_DCHECK(!b->IsSentry());
GOOGLE_ABSL_DCHECK(!b->IsSentry());
}
// It is guaranteed that this is the first SerialArena. Use sentry block.
@ -168,7 +169,8 @@ void SerialArena::Init(ArenaBlock* b, size_t offset) {
}
SerialArena* SerialArena::New(Memory mem, ThreadSafeArena& parent) {
GOOGLE_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize, mem.size);
GOOGLE_ABSL_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize,
mem.size);
ThreadSafeArenaStats::RecordAllocateStats(parent.arena_stats_.MutableStats(),
/*used=*/0, /*allocated=*/mem.size,
/*wasted=*/0);
@ -277,7 +279,7 @@ void SerialArena::CleanupList() {
do {
char* limit = b->Limit();
char* it = reinterpret_cast<char*>(b->cleanup_nodes);
GOOGLE_DCHECK(!b->IsSentry() || it == limit);
GOOGLE_ABSL_DCHECK(!b->IsSentry() || it == limit);
while (it < limit) {
it += cleanup::DestroyNode(it);
}
@ -350,7 +352,7 @@ class ThreadSafeArena::SerialArenaChunk {
return Layout(capacity()).Slice<kIds>(ptr()).first(safe_size());
}
std::atomic<void*>& id(uint32_t i) {
GOOGLE_DCHECK_LT(i, capacity());
GOOGLE_ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kIds>(ptr())[i];
}
@ -362,11 +364,11 @@ class ThreadSafeArena::SerialArenaChunk {
return Layout(capacity()).Slice<kArenas>(ptr()).first(safe_size());
}
const std::atomic<SerialArena*>& arena(uint32_t i) const {
GOOGLE_DCHECK_LT(i, capacity());
GOOGLE_ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kArenas>(ptr())[i];
}
std::atomic<SerialArena*>& arena(uint32_t i) {
GOOGLE_DCHECK_LT(i, capacity());
GOOGLE_ABSL_DCHECK_LT(i, capacity());
return Layout(capacity()).Pointer<kArenas>(ptr())[i];
}
@ -473,7 +475,7 @@ ThreadSafeArena::ThreadSafeArena(void* mem, size_t size,
}
ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size) {
GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
if (buf == nullptr || size <= kBlockHeaderSize) {
return SentryArenaBlock();
}
@ -486,7 +488,7 @@ ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size,
const AllocationPolicy& policy) {
if (policy.IsDefault()) return FirstBlock(buf, size);
GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(buf) & 7, 0u);
SerialArena::Memory mem;
if (buf == nullptr || size < kBlockHeaderSize + kAllocPolicySize) {
@ -508,26 +510,26 @@ void ThreadSafeArena::InitializeWithPolicy(const AllocationPolicy& policy) {
#ifndef NDEBUG
const uint64_t old_alloc_policy = alloc_policy_.get_raw();
// If there was a policy (e.g., in Reset()), make sure flags were preserved.
#define GOOGLE_DCHECK_POLICY_FLAGS_() \
if (old_alloc_policy > 3) \
GOOGLE_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3)
#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_() \
if (old_alloc_policy > 3) \
GOOGLE_ABSL_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3)
#else
#define GOOGLE_DCHECK_POLICY_FLAGS_()
#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_()
#endif // NDEBUG
// We ensured enough space so this cannot fail.
void* p;
if (!first_arena_.MaybeAllocateAligned(kAllocPolicySize, &p)) {
GOOGLE_LOG(FATAL) << "MaybeAllocateAligned cannot fail here.";
GOOGLE_ABSL_LOG(FATAL) << "MaybeAllocateAligned cannot fail here.";
return;
}
new (p) AllocationPolicy{policy};
// Low bits store flags, so they mustn't be overwritten.
GOOGLE_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3);
GOOGLE_ABSL_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3);
alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p));
GOOGLE_DCHECK_POLICY_FLAGS_();
GOOGLE_ABSL_DCHECK_POLICY_FLAGS_();
#undef GOOGLE_DCHECK_POLICY_FLAGS_
#undef GOOGLE_ABSL_DCHECK_POLICY_FLAGS_
}
uint64_t ThreadSafeArena::GetNextLifeCycleId() {
@ -602,7 +604,6 @@ void ThreadSafeArena::AddSerialArena(void* id, SerialArena* serial) {
}
void ThreadSafeArena::Init() {
// Message-owned arenas bypass thread cache and do not need life cycle ID.
tag_and_id_ = GetNextLifeCycleId();
arena_stats_ = Sample();
head_.store(SentrySerialArenaChunk(), std::memory_order_relaxed);
@ -647,10 +648,10 @@ SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) {
// necessary to Free and we should revisit this. (b/247560530)
for (auto it = span.rbegin(); it != span.rend(); ++it) {
SerialArena* serial = it->load(std::memory_order_relaxed);
GOOGLE_DCHECK_NE(serial, nullptr);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
// Always frees the first block of "serial" as it cannot be user-provided.
SerialArena::Memory mem = serial->Free(deallocator);
GOOGLE_DCHECK_NE(mem.ptr, nullptr);
GOOGLE_ABSL_DCHECK_NE(mem.ptr, nullptr);
deallocator(mem);
}
@ -794,7 +795,7 @@ void ThreadSafeArena::CleanupList() {
// and required not to break inter-object dependencies. (b/247560530)
for (auto it = span.rbegin(); it != span.rend(); ++it) {
SerialArena* serial = it->load(std::memory_order_relaxed);
GOOGLE_DCHECK_NE(serial, nullptr);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
serial->CleanupList();
}
});
@ -817,7 +818,7 @@ SerialArena* ThreadSafeArena::GetSerialArenaFallback(size_t n) {
for (uint32_t i = 0; i < ids.size(); ++i) {
if (ids[i].load(std::memory_order_relaxed) == id) {
serial = chunk->arena(i).load(std::memory_order_relaxed);
GOOGLE_DCHECK_NE(serial, nullptr);
GOOGLE_ABSL_DCHECK_NE(serial, nullptr);
break;
}
}

@ -49,9 +49,11 @@ using type_info = ::type_info;
#endif
#include <type_traits>
#include "google/protobuf/arena_align.h"
#include "google/protobuf/arena_config.h"
#include "google/protobuf/arena_impl.h"
#include "google/protobuf/port.h"
#include "google/protobuf/serial_arena.h"
#include "google/protobuf/thread_safe_arena.h"
// Must be included last.
#include "google/protobuf/port_def.inc"
@ -270,7 +272,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
// is obtained from the arena).
template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) {
if (arena == nullptr) {
if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) {
return new T(std::forward<Args>(args)...);
}
auto destructor =
@ -291,15 +293,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
// Allocates memory with the specific size and alignment.
void* AllocateAligned(size_t size, size_t align = 8) {
if (align <= 8) {
return Allocate(internal::AlignUpTo8(size));
if (align <= internal::ArenaAlignDefault::align) {
return Allocate(internal::ArenaAlignDefault::Ceil(size));
} else {
// We are wasting space by over allocating align - 8 bytes. Compared
// to a dedicated function that takes current alignment in consideration.
// Such a scheme would only waste (align - 8)/2 bytes on average, but
// requires a dedicated function in the outline arena allocation
// functions. Possibly re-evaluate tradeoffs later.
return internal::AlignTo(Allocate(size + align - 8), align);
auto align_as = internal::ArenaAlignAs(align);
return align_as.Ceil(Allocate(align_as.Padded(size)));
}
}
@ -316,12 +319,15 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
"CreateArray requires a trivially constructible type");
static_assert(std::is_trivially_destructible<T>::value,
"CreateArray requires a trivially destructible type");
GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
<< "Requested size is too large to fit into size_t.";
if (arena == nullptr) {
if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) {
return static_cast<T*>(::operator new[](num_elements * sizeof(T)));
} else {
return arena->CreateInternalRawArray<T>(num_elements);
// We count on compiler to realize that if sizeof(T) is a multiple of
// 8 AlignUpTo can be elided.
return static_cast<T*>(
arena->AllocateAlignedForArray(sizeof(T) * num_elements, alignof(T)));
}
}
@ -596,18 +602,6 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
std::forward<Args>(args)...);
}
// Just allocate the required size for the given type assuming the
// type has a trivial constructor.
template <typename T>
PROTOBUF_NDEBUG_INLINE T* CreateInternalRawArray(size_t num_elements) {
GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
<< "Requested size is too large to fit into size_t.";
// We count on compiler to realize that if sizeof(T) is a multiple of
// 8 AlignUpTo can be elided.
const size_t n = sizeof(T) * num_elements;
return static_cast<T*>(AllocateAlignedForArray(n, alignof(T)));
}
template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) {
return InternalHelper<T>::Construct(
@ -662,15 +656,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
}
void* AllocateAlignedForArray(size_t n, size_t align) {
if (align <= 8) {
return AllocateForArray(internal::AlignUpTo8(n));
if (align <= internal::ArenaAlignDefault::align) {
return AllocateForArray(internal::ArenaAlignDefault::Ceil(n));
} else {
// We are wasting space by over allocating align - 8 bytes. Compared
// to a dedicated function that takes current alignment in consideration.
// Such a scheme would only waste (align - 8)/2 bytes on average, but
// requires a dedicated function in the outline arena allocation
// functions. Possibly re-evaluate tradeoffs later.
return internal::AlignTo(AllocateForArray(n + align - 8), align);
auto align_as = internal::ArenaAlignAs(align);
return align_as.Ceil(AllocateForArray(align_as.Padded(n)));
}
}

@ -35,14 +35,21 @@
//
// Ceil(size_t n) - rounds `n` up to the nearest `align` boundary.
// Floor(size_t n) - rounds `n` down to the nearest `align` boundary.
// Ceil(T* P) - rounds `p` up to the nearest `align` boundary.
// Padded(size_t n) - returns the unaligned size to align 'n' bytes. (1)
// Ceil(T* P) - rounds `p` up to the nearest `align` boundary. (2)
// IsAligned(size_t n) - returns true if `n` is aligned to `align`
// IsAligned(T* p) - returns true if `p` is aligned to `align`
// CheckAligned(T* p) - returns `p`. Checks alignment of `p` in debug.
//
// Additionally there is an optimized `CeilDefaultAligned(T*)` method which is
// equivalent to `Ceil(ArenaAlignDefault().CheckAlign(p))` but more efficiently
// implemented as a 'check only' for ArenaAlignDefault.
// 1) `Padded(n)` returns the minimum size needed to align an object of size 'n'
// into a memory area that is default aligned. For example, allocating 'n'
// bytes aligned at 32 bytes requires a size of 'n + 32 - 8' to align at 32
// bytes for any 8 byte boundary.
//
// 2) There is an optimized `CeilDefaultAligned(T*)` method which is equivalent
// to `Ceil(ArenaAlignDefault::CheckAlign(p))` but more efficiently
// implemented as a 'check only' for ArenaAlignDefault.
//
// These classes allow for generic arena logic using 'alignment policies'.
//
@ -50,10 +57,14 @@
//
// template <Align>
// void* NaiveAlloc(size_t n, Align align) {
// align.CheckAligned(n);
// uint8_t* ptr = align.CeilDefaultAligned(ptr_);
// ptr_ += n;
// return ptr;
// ABSL_ASSERT(align.IsAligned(n));
// const size_t required = align.Padded(n);
// if (required <= static_cast<size_t>(ptr_ - limit_)) {
// uint8_t* ptr = align.CeilDefaultAligned(ptr_);
// ptr_ = ptr + n;
// return ptr;
// }
// return nullptr;
// }
//
// void CallSites() {
@ -80,31 +91,41 @@ namespace internal {
struct ArenaAlignDefault {
PROTOBUF_EXPORT static constexpr size_t align = 8; // NOLINT
static constexpr bool IsAligned(size_t n) { return (n & (align - 1)) == 0; }
static constexpr bool IsAligned(size_t n) { return (n & (align - 1)) == 0U; }
template <typename T>
static bool IsAligned(T* ptr) {
return (reinterpret_cast<uintptr_t>(ptr) & (align - 1)) == 0;
static inline PROTOBUF_ALWAYS_INLINE bool IsAligned(T* ptr) {
return (reinterpret_cast<uintptr_t>(ptr) & (align - 1)) == 0U;
}
static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Ceil(size_t n) {
return (n + align - 1) & -align;
}
static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Floor(size_t n) {
return (n & ~(align - 1));
}
static constexpr size_t Ceil(size_t n) { return (n + align - 1) & -align; }
static constexpr size_t Floor(size_t n) { return (n & ~(align - 1)); }
static inline PROTOBUF_ALWAYS_INLINE size_t Padded(size_t n) {
ABSL_ASSERT(IsAligned(n));
return n;
}
template <typename T>
T* Ceil(T* ptr) const {
static inline PROTOBUF_ALWAYS_INLINE T* Ceil(T* ptr) {
uintptr_t intptr = reinterpret_cast<uintptr_t>(ptr);
return reinterpret_cast<T*>((intptr + align - 1) & -align);
}
template <typename T>
T* CeilDefaultAligned(T* ptr) const {
return ArenaAlignDefault().CheckAligned(ptr);
static inline PROTOBUF_ALWAYS_INLINE T* CeilDefaultAligned(T* ptr) {
ABSL_ASSERT(IsAligned(ptr));
return ptr;
}
// Address sanitizer enabled alignment check
template <typename T>
static T* CheckAligned(T* ptr) {
GOOGLE_DCHECK(IsAligned(ptr)) << static_cast<void*>(ptr);
static inline PROTOBUF_ALWAYS_INLINE T* CheckAligned(T* ptr) {
ABSL_ASSERT(IsAligned(ptr));
return ptr;
}
};
@ -114,16 +135,24 @@ struct ArenaAlign {
size_t align;
constexpr bool IsAligned(size_t n) const { return (n & (align - 1)) == 0; }
constexpr bool IsAligned(size_t n) const { return (n & (align - 1)) == 0U; }
template <typename T>
bool IsAligned(T* ptr) const {
return (reinterpret_cast<uintptr_t>(ptr) & (align - 1)) == 0;
return (reinterpret_cast<uintptr_t>(ptr) & (align - 1)) == 0U;
}
constexpr size_t Ceil(size_t n) const { return (n + align - 1) & -align; }
constexpr size_t Floor(size_t n) const { return (n & ~(align - 1)); }
constexpr size_t Padded(size_t n) const {
// TODO(mvels): there are direct callers of AllocateAligned() that violate
// `size` being a multiple of `align`: that should be an error / assert.
// ABSL_ASSERT(IsAligned(n));
ABSL_ASSERT(ArenaAlignDefault::IsAligned(align));
return n + align - ArenaAlignDefault::align;
}
template <typename T>
T* Ceil(T* ptr) const {
uintptr_t intptr = reinterpret_cast<uintptr_t>(ptr);
@ -132,24 +161,55 @@ struct ArenaAlign {
template <typename T>
T* CeilDefaultAligned(T* ptr) const {
return Ceil(ArenaAlignDefault().CheckAligned(ptr));
ABSL_ASSERT(ArenaAlignDefault::IsAligned(ptr));
return Ceil(ptr);
}
// Address sanitizer enabled alignment check
template <typename T>
T* CheckAligned(T* ptr) const {
GOOGLE_DCHECK(IsAligned(ptr)) << static_cast<void*>(ptr);
ABSL_ASSERT(IsAligned(ptr));
return ptr;
}
};
inline ArenaAlign ArenaAlignAs(size_t align) {
// align must be a non zero power of 2 >= 8
GOOGLE_DCHECK_NE(align, 0);
GOOGLE_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align;
GOOGLE_ABSL_DCHECK_NE(align, 0U);
GOOGLE_ABSL_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align;
return ArenaAlign{align};
}
template <bool, size_t align>
struct AlignFactory {
static_assert(align > ArenaAlignDefault::align, "Not over-aligned");
static_assert((align & (align - 1)) == 0U, "Not power of 2");
static constexpr ArenaAlign Create() { return ArenaAlign{align}; }
};
template <size_t align>
struct AlignFactory<true, align> {
static_assert(align <= ArenaAlignDefault::align, "Over-aligned");
static_assert((align & (align - 1)) == 0U, "Not power of 2");
static constexpr ArenaAlignDefault Create() { return ArenaAlignDefault{}; }
};
// Returns an `ArenaAlignDefault` instance for `align` less than or equal to the
// default alignment, and `AlignAs(align)` for over-aligned values of `align`.
// The purpose is to take advantage of invoking functions accepting a template
// overloaded 'Align align` argument reducing the alignment operations on
// `ArenaAlignDefault` implementations to no-ops.
template <size_t align>
inline constexpr auto ArenaAlignAs() {
return AlignFactory<align <= ArenaAlignDefault::align, align>::Create();
}
// Returns ArenaAlignAs<alignof(T)>
template <typename T>
inline constexpr auto ArenaAlignOf() {
return ArenaAlignAs<alignof(T)>();
}
} // namespace internal
} // namespace protobuf
} // namespace google

@ -67,6 +67,16 @@ TEST(ArenaAlignDefault, Ceil) {
EXPECT_THAT(align_default.Ceil(16), Eq(16));
}
TEST(ArenaAlignDefault, Padded) {
auto align_default = ArenaAlignDefault();
EXPECT_THAT(align_default.Padded(0), Eq(0));
EXPECT_THAT(align_default.Padded(8), Eq(8));
EXPECT_THAT(align_default.Padded(64), Eq(64));
#ifdef PROTOBUF_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH(align_default.Padded(1), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
}
TEST(ArenaAlignDefault, CeilPtr) {
alignas(8) char p[17] = {0};
auto align_default = ArenaAlignDefault();
@ -147,6 +157,18 @@ TEST(ArenaAlign, Ceil) {
EXPECT_THAT(align_64.Ceil(128), Eq(128));
}
TEST(ArenaAlign, Padded) {
auto align_64 = ArenaAlignAs(64);
EXPECT_THAT(align_64.Padded(64), Eq(64 + 64 - ArenaAlignDefault::align));
EXPECT_THAT(align_64.Padded(128), Eq(128 + 64 - ArenaAlignDefault::align));
#ifdef PROTOBUF_HAS_DEATH_TEST
// TODO(mvels): there are direct callers of AllocateAligned() that violate
// `size` being a multiple of `align`: that should be an error / assert.
// EXPECT_DEBUG_DEATH(align_64.Padded(16), ".*");
EXPECT_DEBUG_DEATH(ArenaAlignAs(2).Padded(8), ".*");
#endif // PROTOBUF_HAS_DEATH_TEST
}
TEST(ArenaAlign, CeilPtr) {
alignas(64) char p[129] = {0};
auto align_64 = ArenaAlignAs(64);

@ -35,8 +35,9 @@
#include <cstdint>
#include <string>
#include "google/protobuf/stubs/logging.h"
#include "absl/base/attributes.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/cord.h"
@ -91,7 +92,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE void CreateNode(Tag tag, void* pos,
void (*destructor)(void*)) {
auto elem = reinterpret_cast<uintptr_t>(elem_raw);
if (EnableSpecializedTags()) {
GOOGLE_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned
GOOGLE_ABSL_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned
switch (tag) {
case Tag::kString: {
TaggedNode n = {elem | static_cast<uintptr_t>(Tag::kString)};
@ -186,7 +187,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE Tag Type(void* raw) {
case Tag::kCord:
return Tag::kCord;
default:
GOOGLE_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL);
GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL);
return Tag::kDynamic;
}
}
@ -203,7 +204,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE size_t Size(Tag tag) {
case Tag::kCord:
return sizeof(TaggedNode);
default:
GOOGLE_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast<int>(tag);
GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast<int>(tag);
return sizeof(DynamicNode);
}
}

@ -33,7 +33,7 @@
#include "google/protobuf/stubs/logging.h"
#define EXPECT_EQ GOOGLE_CHECK_EQ
#define EXPECT_EQ GOOGLE_ABSL_CHECK_EQ
namespace google {
namespace protobuf {

@ -70,7 +70,7 @@ void TestParseCorruptedString(const T& message) {
}
// This next line is a low bar. But getting through the test without crashing
// due to use-after-free or other bugs is a big part of what we're checking.
GOOGLE_CHECK_GT(success_count, 0);
GOOGLE_ABSL_CHECK_GT(success_count, 0);
}
namespace internal {
@ -105,8 +105,8 @@ class ArenaHolder {
explicit ArenaHolder(Arena* arena)
: field_(Arena::CreateMessage<T>(arena)),
owned_by_arena_(arena != nullptr) {
GOOGLE_DCHECK(google::protobuf::Arena::is_arena_constructable<T>::value);
GOOGLE_DCHECK(google::protobuf::Arena::is_destructor_skippable<T>::value);
GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_arena_constructable<T>::value);
GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_destructor_skippable<T>::value);
}
~ArenaHolder() {

@ -39,9 +39,9 @@
#include <typeinfo>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/barrier.h"
#include "google/protobuf/arena_test_util.h"
@ -1467,7 +1467,7 @@ TEST(ArenaTest, Alignment) {
Arena arena;
for (int i = 0; i < 200; i++) {
void* p = Arena::CreateArray<char>(&arena, i);
GOOGLE_CHECK_EQ(reinterpret_cast<uintptr_t>(p) % 8, 0) << i << ": " << p;
GOOGLE_ABSL_CHECK_EQ(reinterpret_cast<uintptr_t>(p) % 8, 0) << i << ": " << p;
}
}

@ -202,7 +202,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) {
if (tagged_ptr_.IsMutable()) {
return tagged_ptr_.Get();
} else {
GOOGLE_DCHECK(IsDefault());
GOOGLE_ABSL_DCHECK(IsDefault());
// Allocate empty. The contents are not relevant.
return NewString(arena);
}
@ -211,7 +211,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) {
template <typename... Lazy>
std::string* ArenaStringPtr::MutableSlow(::google::protobuf::Arena* arena,
const Lazy&... lazy_default) {
GOOGLE_DCHECK(IsDefault());
GOOGLE_ABSL_DCHECK(IsDefault());
// For empty defaults, this ends up calling the default constructor which is
// more efficient than a copy construction from
@ -285,7 +285,7 @@ const char* EpsCopyInputStream::ReadArenaString(const char* ptr,
ArenaStringPtr* s,
Arena* arena) {
ScopedCheckPtrInvariants check(&s->tagged_ptr_);
GOOGLE_DCHECK(arena != nullptr);
GOOGLE_ABSL_DCHECK(arena != nullptr);
int size = ReadSize(&ptr);
if (!ptr) return nullptr;

@ -197,11 +197,11 @@ class TaggedStringPtr {
private:
static inline void assert_aligned(const void* p) {
GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & kMask, 0UL);
GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & kMask, 0UL);
}
inline std::string* TagAs(Type type, std::string* p) {
GOOGLE_DCHECK(p != nullptr);
GOOGLE_ABSL_DCHECK(p != nullptr);
assert_aligned(p);
ptr_ = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(p) | type);
return p;
@ -478,8 +478,8 @@ inline void ArenaStringPtr::ClearNonDefaultToEmpty() {
}
inline std::string* ArenaStringPtr::UnsafeMutablePointer() {
GOOGLE_DCHECK(tagged_ptr_.IsMutable());
GOOGLE_DCHECK(tagged_ptr_.Get() != nullptr);
GOOGLE_ABSL_DCHECK(tagged_ptr_.IsMutable());
GOOGLE_ABSL_DCHECK(tagged_ptr_.Get() != nullptr);
return tagged_ptr_.Get();
}

@ -37,10 +37,10 @@
#include <utility>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/generated_message_util.h"
#include "google/protobuf/message_lite.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"

@ -445,7 +445,7 @@ class ThreadSafeArenazSamplerTestThread : public Thread {
protobuf_test_messages::proto2::TestAllTypesProto2>
message = google::protobuf::MakeArenaSafeUnique<
protobuf_test_messages::proto2::TestAllTypesProto2>(arena_);
GOOGLE_CHECK(message != nullptr);
GOOGLE_ABSL_CHECK(message != nullptr);
// Signal that a message on the arena has been created. This should create
// a SerialArena for this thread.
if (barrier_->Block()) {
@ -508,7 +508,7 @@ class SampleFirstArenaThread : public Thread {
protobuf_test_messages::proto2::TestAllTypesProto2>
message = google::protobuf::MakeArenaSafeUnique<
protobuf_test_messages::proto2::TestAllTypesProto2>(&arena);
GOOGLE_CHECK(message != nullptr);
GOOGLE_ABSL_CHECK(message != nullptr);
arena_created_.Notify();
samples_counted_.WaitForNotification();
}

@ -40,6 +40,7 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
@ -70,8 +71,8 @@ class DescriptorCapturingGenerator : public CodeGenerator {
} // namespace
void AddFile(const std::string& filename, const std::string& data) {
GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data,
true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data,
true));
}
bool RunProtoCompiler(const std::string& filename,
@ -94,7 +95,7 @@ bool RunProtoCompiler(const std::string& filename,
bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info) {
std::string data;
GOOGLE_CHECK_OK(File::GetContents(path, &data, true));
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &data, true));
io::ArrayInputStream input(data.data(), data.size());
return info->ParseFromZeroCopyStream(&input);
}

@ -34,9 +34,9 @@
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_split.h"
#include "absl/strings/strip.h"
@ -81,7 +81,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForAppend(
io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert(
const std::string& filename, const std::string& insertion_point) {
GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion.";
GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support insertion.";
return nullptr; // make compiler happy
}
@ -93,7 +93,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo(
void GeneratorContext::ListParsedFiles(
std::vector<const FileDescriptor*>* output) {
GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
}
void GeneratorContext::GetCompilerVersion(Version* version) const {

@ -74,6 +74,7 @@
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/compiler/subprocess.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "absl/container/flat_hash_set.h"
@ -141,7 +142,7 @@ void SetFdToTextMode(int fd) {
#ifdef _WIN32
if (setmode(fd, _O_TEXT) == -1) {
// This should never happen, I think.
GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno);
GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno);
}
#endif
// (Text and binary are the same on non-Windows platforms.)
@ -151,7 +152,8 @@ void SetFdToBinaryMode(int fd) {
#ifdef _WIN32
if (setmode(fd, _O_BINARY) == -1) {
// This should never happen, I think.
GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_BINARY): " << strerror(errno);
GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd
<< ", _O_BINARY): " << strerror(errno);
}
#endif
// (Text and binary are the same on non-Windows platforms.)
@ -892,7 +894,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() {
data_pos += line_length;
}
GOOGLE_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size);
GOOGLE_ABSL_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size);
UpdateMetadata(data_, pos, data_.size() + indent_size, indent_.size());
}
@ -1106,7 +1108,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
if (!dependency_out_name_.empty()) {
GOOGLE_DCHECK(disk_source_tree.get());
GOOGLE_ABSL_DCHECK(disk_source_tree.get());
if (!GenerateDependencyManifestFile(parsed_files, output_directories,
disk_source_tree.get())) {
return 1;
@ -1126,7 +1128,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
FileDescriptorProto file;
file.set_name("empty_message.proto");
file.add_message_type()->set_name("EmptyMessage");
GOOGLE_CHECK(pool.BuildFile(file) != nullptr);
GOOGLE_ABSL_CHECK(pool.BuildFile(file) != nullptr);
codec_type_ = "EmptyMessage";
if (!EncodeOrDecode(&pool)) {
return 1;
@ -1154,8 +1156,9 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
break;
case PRINT_NONE:
GOOGLE_LOG(ERROR) << "If the code reaches here, it usually means a bug of "
"flag parsing in the CommandLineInterface.";
GOOGLE_ABSL_LOG(ERROR)
<< "If the code reaches here, it usually means a bug of "
"flag parsing in the CommandLineInterface.";
return 1;
// Do not add a default case.
@ -1558,7 +1561,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
input_files_.empty() && descriptor_set_in_names_.empty();
break;
default:
GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_;
GOOGLE_ABSL_LOG(FATAL) << "Unexpected mode: " << mode_;
}
if (missing_proto_definitions) {
std::cerr << "Missing input file." << std::endl;
@ -1763,7 +1766,7 @@ CommandLineInterface::InterpretArgument(const std::string& name,
direct_dependencies_explicitly_set_ = true;
std::vector<std::string> direct =
absl::StrSplit(value, ":", absl::SkipEmpty());
GOOGLE_DCHECK(direct_dependencies_.empty());
GOOGLE_ABSL_DCHECK(direct_dependencies_.empty());
direct_dependencies_.insert(direct.begin(), direct.end());
} else if (name == "--direct_dependencies_violation_msg") {
@ -2163,8 +2166,8 @@ bool CommandLineInterface::GenerateOutput(
std::string error;
if (output_directive.generator == nullptr) {
// This is a plugin.
GOOGLE_CHECK(absl::StartsWith(output_directive.name, "--") &&
absl::EndsWith(output_directive.name, "_out"))
GOOGLE_ABSL_CHECK(absl::StartsWith(output_directive.name, "--") &&
absl::EndsWith(output_directive.name, "_out"))
<< "Bad name for plugin generator: " << output_directive.name;
std::string plugin_name = PluginName(plugin_prefix_, output_directive.name);

@ -38,6 +38,7 @@
#include <cstdint>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_format.h"
#ifndef _MSC_VER
@ -288,7 +289,7 @@ void CommandLineInterfaceTest::SetUp() {
}
// Create the temp directory.
GOOGLE_CHECK_OK(File::CreateDir(temp_directory_, 0777));
GOOGLE_ABSL_CHECK_OK(File::CreateDir(temp_directory_, 0777));
// Register generators.
CodeGenerator* generator = new MockCodeGenerator("test_generator");
@ -361,7 +362,7 @@ void CommandLineInterfaceTest::RunWithArgs(std::vector<std::string> args) {
#endif
if (plugin_path.empty() || !FileExists(plugin_path)) {
GOOGLE_LOG(ERROR)
GOOGLE_ABSL_LOG(ERROR)
<< "Plugin executable not found. Plugin tests are likely to fail."
<< plugin_path;
} else {
@ -401,21 +402,21 @@ void CommandLineInterfaceTest::CreateTempFile(const std::string& name,
if (slash_pos != std::string::npos) {
std::string dir = name.substr(0, slash_pos);
if (!FileExists(temp_directory_ + "/" + dir)) {
GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir,
0777));
GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir,
0777));
}
}
// Write file.
std::string full_name = temp_directory_ + "/" + name;
GOOGLE_CHECK_OK(File::SetContents(
GOOGLE_ABSL_CHECK_OK(File::SetContents(
full_name, absl::StrReplaceAll(contents, {{"$tmpdir", temp_directory_}}),
true));
}
void CommandLineInterfaceTest::CreateTempDir(const std::string& name) {
GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name,
0777));
GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name,
0777));
}
// -------------------------------------------------------------------
@ -503,7 +504,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet(
const std::string& filename, FileDescriptorSet* descriptor_set) {
std::string path = temp_directory_ + "/" + filename;
std::string file_contents;
GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true));
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
if (!descriptor_set->ParseFromString(file_contents)) {
FAIL() << "Could not parse file contents: " << path;
@ -513,7 +514,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet(
void CommandLineInterfaceTest::WriteDescriptorSet(
const std::string& filename, const FileDescriptorSet* descriptor_set) {
std::string binary_proto;
GOOGLE_CHECK(descriptor_set->SerializeToString(&binary_proto));
GOOGLE_ABSL_CHECK(descriptor_set->SerializeToString(&binary_proto));
CreateTempFile(filename, binary_proto);
}
@ -539,7 +540,7 @@ void CommandLineInterfaceTest::ExpectFileContent(const std::string& filename,
const std::string& content) {
std::string path = temp_directory_ + "/" + filename;
std::string file_contents;
GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true));
GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true));
EXPECT_EQ(absl::StrReplaceAll(content, {{"$tmpdir", temp_directory_}}),
file_contents);
@ -2560,8 +2561,8 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void RedirectStdinFromText(const std::string& input) {
std::string filename = TestTempDir() + "/test_stdin";
GOOGLE_CHECK_OK(File::SetContents(filename, input, true));
GOOGLE_CHECK(RedirectStdinFromFile(filename));
GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, input, true));
GOOGLE_ABSL_CHECK(RedirectStdinFromFile(filename));
}
bool RedirectStdinFromFile(const std::string& filename) {
@ -2629,7 +2630,8 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void ExpectStdoutMatchesBinaryFile(const std::string& filename) {
std::string expected_output;
GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true));
GOOGLE_ABSL_CHECK_OK(
File::GetContents(filename, &expected_output, true));
// Don't use EXPECT_EQ because we don't want to print raw binary data to
// stdout on failure.
@ -2638,7 +2640,8 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
void ExpectStdoutMatchesTextFile(const std::string& filename) {
std::string expected_output;
GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true));
GOOGLE_ABSL_CHECK_OK(
File::GetContents(filename, &expected_output, true));
ExpectStdoutMatchesText(expected_output);
}
@ -2670,12 +2673,12 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> {
protobuf_unittest_import::PublicImportMessage public_import_message;
public_import_message.descriptor()->file()->CopyTo(
file_descriptor_set.add_file());
GOOGLE_DCHECK(file_descriptor_set.IsInitialized());
GOOGLE_ABSL_DCHECK(file_descriptor_set.IsInitialized());
std::string binary_proto;
GOOGLE_CHECK(file_descriptor_set.SerializeToString(&binary_proto));
GOOGLE_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_,
binary_proto, true));
GOOGLE_ABSL_CHECK(file_descriptor_set.SerializeToString(&binary_proto));
GOOGLE_ABSL_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_,
binary_proto, true));
}
int duped_stdin_;

@ -54,6 +54,8 @@ namespace protobuf {
namespace compiler {
namespace cpp {
namespace {
using Sub = ::google::protobuf::io::Printer::Sub;
absl::flat_hash_map<absl::string_view, std::string> EnumVars(
const EnumDescriptor* enum_, const Options& options,
const EnumValueDescriptor* min, const EnumValueDescriptor* max) {
@ -120,10 +122,12 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
auto v1 = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max));
auto v2 = p->WithVars({
{"Msg_Enum_Enum_MIN",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MIN"), enum_},
{"Msg_Enum_Enum_MAX",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MAX"), enum_},
Sub("Msg_Enum_Enum_MIN",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MIN"))
.AnnotatedAs(enum_),
Sub("Msg_Enum_Enum_MAX",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MAX"))
.AnnotatedAs(enum_),
});
p->Emit(
{
@ -133,12 +137,10 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
const auto* value = enum_->value(i);
p->Emit(
{
{
"Msg_Enum_VALUE",
Sub("Msg_Enum_VALUE",
absl::StrCat(p->LookupVar("Msg_Enum_"),
EnumValueName(value)),
value,
},
EnumValueName(value)))
.AnnotatedAs(value),
{"kNumber", Int32ToString(value->number())},
{"DEPRECATED", value->options().deprecated()
? "PROTOBUF_DEPRECATED_ENUM"
@ -151,7 +153,8 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
}},
// Only emit annotations for the $Msg_Enum$ used in the `enum`
// definition.
{"Msg_Enum_annotated", p->LookupVar("Msg_Enum"), enum_},
Sub("Msg_Enum_annotated", p->LookupVar("Msg_Enum"))
.AnnotatedAs(enum_),
{"open_enum_sentinels",
[&] {
if (enum_->is_closed()) {
@ -183,13 +186,13 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
)cc");
if (generate_array_size_) {
p->Emit(
{{"Msg_Enum_Enum_ARRAYSIZE",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_ARRAYSIZE"),
enum_}},
R"cc(
constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1;
)cc");
p->Emit({Sub("Msg_Enum_Enum_ARRAYSIZE",
absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(),
"_ARRAYSIZE"))
.AnnotatedAs(enum_)},
R"cc(
constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1;
)cc");
}
if (has_reflection_) {
@ -289,18 +292,15 @@ void EnumGenerator::GenerateGetEnumDescriptorSpecializations(io::Printer* p) {
void EnumGenerator::GenerateSymbolImports(io::Printer* p) const {
auto v = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max));
{
auto a = p->WithVars({{"Enum_annotated", p->LookupVar("Enum_"), enum_}});
p->Emit(R"cc(
using $Enum_annotated$ = $Msg_Enum$;
)cc");
}
p->Emit({Sub("Enum_", p->LookupVar("Enum_")).AnnotatedAs(enum_)}, R"cc(
using $Enum_$ = $Msg_Enum$;
)cc");
for (int j = 0; j < enum_->value_count(); ++j) {
const auto* value = enum_->value(j);
p->Emit(
{
{"VALUE", EnumValueName(enum_->value(j)), value},
Sub("VALUE", EnumValueName(enum_->value(j))).AnnotatedAs(value),
{"DEPRECATED",
value->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM" : ""},
},
@ -311,8 +311,10 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const {
p->Emit(
{
{"Enum_MIN", absl::StrCat(enum_->name(), "_MIN"), enum_},
{"Enum_MAX", absl::StrCat(enum_->name(), "_MAX"), enum_},
Sub("Enum_MIN", absl::StrCat(enum_->name(), "_MIN"))
.AnnotatedAs(enum_),
Sub("Enum_MAX", absl::StrCat(enum_->name(), "_MAX"))
.AnnotatedAs(enum_),
},
R"cc(
static inline bool $Enum$_IsValid(int value) {
@ -324,7 +326,10 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const {
if (generate_array_size_) {
p->Emit(
{{"Enum_ARRAYSIZE", absl::StrCat(enum_->name(), "_ARRAYSIZE"), enum_}},
{
Sub("Enum_ARRAYSIZE", absl::StrCat(enum_->name(), "_ARRAYSIZE"))
.AnnotatedAs(enum_),
},
R"cc(
static constexpr int $Enum_ARRAYSIZE$ = $Msg_Enum$_$Enum$_ARRAYSIZE;
)cc");

@ -69,6 +69,8 @@ namespace protobuf {
namespace compiler {
namespace cpp {
namespace {
using Sub = ::google::protobuf::io::Printer::Sub;
absl::flat_hash_map<absl::string_view, std::string> FileVars(
const FileDescriptor* file, const Options& options) {
return {
@ -1121,7 +1123,7 @@ class FileGenerator::ForwardDeclarations {
void Print(io::Printer* p, const Options& options) const {
for (const auto& e : enums_) {
p->Emit({{"enum", e.first, e.second}}, R"cc(
p->Emit({Sub("enum", e.first).AnnotatedAs(e.second)}, R"cc(
enum $enum$ : int;
bool $enum$_IsValid(int value);
)cc");
@ -1131,7 +1133,7 @@ class FileGenerator::ForwardDeclarations {
const Descriptor* desc = c.second;
p->Emit(
{
{"class", c.first, desc},
Sub("class", c.first).AnnotatedAs(desc),
{"default_type", DefaultInstanceType(desc, options)},
{"default_name", DefaultInstanceName(desc, options)},
},

@ -3602,20 +3602,21 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* p) {
// It is also disabled if a message has neither message fields nor
// extensions, as it's impossible to copy from its descendant.
//
// Note that FailIfCopyFromDescendant is implemented by reflection and not
// available for lite runtime. In that case, check if the size of the source
// has changed after Clear.
format("#ifndef NDEBUG\n");
// Note that IsDescendant is implemented by reflection and not available for
// lite runtime. In that case, check if the size of the source has changed
// after Clear.
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format("FailIfCopyFromDescendant(*this, from);\n");
format(
"$DCHK$(!::_pbi::IsDescendant(*this, from))\n"
" << \"Source of CopyFrom cannot be a descendant of the "
"target.\";\n"
"Clear();\n");
} else {
format("::size_t from_size = from.ByteSizeLong();\n");
}
format(
"#endif\n"
"Clear();\n");
if (!HasDescriptorMethods(descriptor_->file(), options_)) {
format(
"#ifndef NDEBUG\n"
"::size_t from_size = from.ByteSizeLong();\n"
"#endif\n"
"Clear();\n"
"#ifndef NDEBUG\n"
"$CHK$_EQ(from_size, from.ByteSizeLong())\n"
" << \"Source of CopyFrom changed when clearing target. Either \"\n"

@ -83,9 +83,8 @@ class MockGeneratorContext : public GeneratorContext {
std::string expected_contents = *it->second;
std::string actual_contents;
GOOGLE_CHECK_OK(
File::GetContentsAsText(TestSourceDir() + "/" + physical_filename,
&actual_contents, true))
GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(
TestSourceDir() + "/" + physical_filename, &actual_contents, true))
<< "Unable to get " << physical_filename;
EXPECT_TRUE(actual_contents == expected_contents)
<< physical_filename << " needs to be regenerated. Please run "

@ -35,6 +35,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/csharp/csharp_doc_comment.h"
#include "google/protobuf/compiler/csharp/csharp_helpers.h"
@ -78,8 +79,9 @@ void EnumGenerator::Generate(io::Printer* printer) {
// Make sure we don't get any duplicate names due to prefix removal.
while (!used_names.insert(name).second) {
// It's possible we'll end up giving this warning multiple times, but that's better than not at all.
GOOGLE_LOG(WARNING) << "Duplicate enum value " << name << " (originally " << original_name
<< ") in " << descriptor_->name() << "; adding underscore to distinguish";
GOOGLE_ABSL_LOG(WARNING) << "Duplicate enum value " << name << " (originally "
<< original_name << ") in " << descriptor_->name()
<< "; adding underscore to distinguish";
name += "_";
}
int number = descriptor_->value(i)->number();

@ -36,6 +36,7 @@
#include <string>
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/compiler/csharp/csharp_helpers.h"
#include "google/protobuf/compiler/csharp/names.h"
#include "google/protobuf/descriptor.h"
@ -278,7 +279,7 @@ std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) {
case FieldDescriptor::TYPE_SINT64:
return "long";
default:
GOOGLE_LOG(FATAL)<< "Unknown field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}
@ -320,7 +321,7 @@ bool FieldGeneratorBase::has_default_value() {
case FieldDescriptor::TYPE_SINT64:
return descriptor_->default_value_int64() != 0L;
default:
GOOGLE_LOG(FATAL)<< "Unknown field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
return true;
}
}
@ -420,7 +421,7 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor)
case FieldDescriptor::TYPE_SINT64:
return absl::StrCat(descriptor->default_value_int64()) + "L";
default:
GOOGLE_LOG(FATAL)<< "Unknown field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}
@ -468,7 +469,7 @@ std::string FieldGeneratorBase::capitalized_type_name() {
case FieldDescriptor::TYPE_SINT64:
return "SInt64";
default:
GOOGLE_LOG(FATAL)<< "Unknown field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
return "";
}
}

@ -40,6 +40,7 @@
#include <vector>
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
@ -106,7 +107,7 @@ CSharpType GetCSharpType(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_LOG(FATAL)<< "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return (CSharpType) -1;
}
@ -336,7 +337,7 @@ int GetFixedSize(FieldDescriptor::Type type) {
// No default because we want the compiler to complain if any new
// types are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return -1;
}
@ -461,7 +462,7 @@ bool IsNullable(const FieldDescriptor* descriptor) {
return true;
default:
GOOGLE_LOG(FATAL) << "Unknown field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unknown field type.";
return true;
}
}

@ -35,6 +35,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/csharp/csharp_doc_comment.h"
#include "google/protobuf/compiler/csharp/csharp_enum.h"
@ -764,7 +765,8 @@ int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) {
index++;
}
}
GOOGLE_LOG(DFATAL)<< "Could not find presence index for field " << descriptor->name();
GOOGLE_ABSL_LOG(DFATAL) << "Could not find presence index for field "
<< descriptor->name();
return -1;
}

@ -36,7 +36,6 @@
#include <memory>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
@ -44,6 +43,7 @@
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/status/status.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"
@ -266,7 +266,7 @@ class DiskSourceTreeTest : public testing::Test {
if (FileExists(dirnames_[i])) {
File::DeleteRecursively(dirnames_[i], NULL, NULL);
}
GOOGLE_CHECK_OK(File::CreateDir(dirnames_[i], 0777));
GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirnames_[i], 0777));
}
}
@ -279,11 +279,11 @@ class DiskSourceTreeTest : public testing::Test {
}
void AddFile(const std::string& filename, const char* contents) {
GOOGLE_CHECK_OK(File::SetContents(filename, contents, true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, contents, true));
}
void AddSubdir(const std::string& dirname) {
GOOGLE_CHECK_OK(File::CreateDir(dirname, 0777));
GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirname, 0777));
}
void ExpectFileContents(const std::string& filename,
@ -397,7 +397,8 @@ TEST_F(DiskSourceTreeTest, OrderingTrumpsSpecificity) {
// directory is more-specific than a former one.
// Create the "bar" directory so we can put a file in it.
GOOGLE_CHECK_OK(File::CreateDir(dirnames_[0] + "/bar", 0777));
GOOGLE_ABSL_CHECK_OK(
File::CreateDir(dirnames_[0] + "/bar", 0777));
// Add files and map paths.
AddFile(dirnames_[0] + "/bar/foo", "Hello World!");

@ -39,12 +39,13 @@
#include <memory>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/testing/file.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/descriptor.pb.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/str_split.h"
@ -105,7 +106,7 @@ void MockCodeGenerator::ExpectGenerated(
const std::string& first_parsed_file_name,
const std::string& output_directory) {
std::string content;
GOOGLE_CHECK_OK(
GOOGLE_ABSL_CHECK_OK(
File::GetContents(output_directory + "/" + GetOutputFileName(name, file),
&content, true));
@ -163,15 +164,15 @@ void MockCodeGenerator::CheckGeneratedAnnotations(
const std::string& name, const std::string& file,
const std::string& output_directory) {
std::string file_content;
GOOGLE_CHECK_OK(
GOOGLE_ABSL_CHECK_OK(
File::GetContents(output_directory + "/" + GetOutputFileName(name, file),
&file_content, true));
std::string meta_content;
GOOGLE_CHECK_OK(File::GetContents(
GOOGLE_ABSL_CHECK_OK(File::GetContents(
output_directory + "/" + GetOutputFileName(name, file) + ".pb.meta",
&meta_content, true));
GeneratedCodeInfo annotations;
GOOGLE_CHECK(TextFormat::ParseFromString(meta_content, &annotations));
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(meta_content, &annotations));
ASSERT_EQ(7, annotations.annotation_size());
CheckSingleAnnotation("first_annotation", "first", file_content,
@ -245,7 +246,7 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file,
<< " " << compiler_version.suffix() << std::endl;
abort();
} else {
GOOGLE_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command;
GOOGLE_ABSL_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command;
}
}
}

@ -36,6 +36,8 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/enum_field.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
@ -167,7 +169,7 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return false;
}
@ -476,7 +478,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor)
const FieldGenerator& FieldGeneratorMap::get(
const FieldDescriptor* field) const {
GOOGLE_CHECK_EQ(field->containing_type(), descriptor_);
GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_);
return *field_generators_[field->index()];
}

@ -34,6 +34,7 @@
#include <vector>
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
@ -66,7 +67,7 @@ std::string GetZeroEnumNameForFlagType(const FlagType flag_type) {
case FLAGTYPE_FIELD:
return "GPBFieldNone";
default:
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return "0";
}
}
@ -80,7 +81,7 @@ std::string GetEnumNameForFlagType(const FlagType flag_type) {
case FLAGTYPE_FIELD:
return "GPBFieldFlags";
default:
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
}
@ -147,7 +148,7 @@ std::string GetCapitalizedType(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
@ -196,7 +197,7 @@ ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return OBJECTIVECTYPE_INT32;
}
@ -235,7 +236,7 @@ std::string GPBGenericValueFieldName(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}
@ -306,7 +307,7 @@ std::string DefaultValue(const FieldDescriptor* field) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return std::string();
}

@ -36,6 +36,7 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "google/protobuf/compiler/objectivec/line_consumer.h"
@ -197,7 +198,7 @@ void ImportWriter::PrintRuntimeImports(io::Printer* p,
// If bundled, no need to do the framework support below.
if (for_bundled_proto_) {
GOOGLE_DCHECK(!default_cpp_symbol);
GOOGLE_ABSL_DCHECK(!default_cpp_symbol);
for (const auto& header : protobuf_imports_) {
p->Print("#import \"$header$\"\n", "header", header);
}

@ -34,6 +34,7 @@
#include <vector>
#include "absl/container/btree_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/match.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
#include "google/protobuf/compiler/objectivec/names.h"
@ -78,7 +79,7 @@ const char* MapEntryTypeName(const FieldDescriptor* descriptor, bool isKey) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}

@ -38,6 +38,7 @@
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/extension.h"
@ -127,7 +128,7 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return 0;
}

@ -33,6 +33,7 @@
#include <string>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/helpers.h"
#include "google/protobuf/io/printer.h"
@ -73,7 +74,7 @@ const char* PrimitiveTypeName(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}
@ -107,7 +108,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) {
// Some compilers report reaching end of function even though all cases of
// the enum are handed in the switch.
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}

@ -44,10 +44,11 @@
#include <tuple>
#include <utility>
#include "google/protobuf/stubs/logging.h"
#include "absl/base/casts.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -516,8 +517,8 @@ int Parser::LocationRecorder::CurrentPathSize() const {
void Parser::LocationRecorder::AttachComments(
std::string* leading, std::string* trailing,
std::vector<std::string>* detached_comments) const {
GOOGLE_CHECK(!location_->has_leading_comments());
GOOGLE_CHECK(!location_->has_trailing_comments());
GOOGLE_ABSL_CHECK(!location_->has_leading_comments());
GOOGLE_ABSL_CHECK(!location_->has_trailing_comments());
if (!leading->empty()) {
location_->mutable_leading_comments()->swap(*leading);
@ -671,10 +672,11 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) {
file->set_syntax(syntax_identifier_);
}
} else if (!stop_after_syntax_identifier_) {
GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name()
<< ". Please use 'syntax = \"proto2\";' "
<< "or 'syntax = \"proto3\";' to specify a syntax "
<< "version. (Defaulted to proto2 syntax.)";
GOOGLE_ABSL_LOG(WARNING) << "No syntax specified for the proto file: "
<< file->name()
<< ". Please use 'syntax = \"proto2\";' "
<< "or 'syntax = \"proto3\";' to specify a syntax "
<< "version. (Defaulted to proto2 syntax.)";
syntax_identifier_ = "proto2";
}
@ -1488,7 +1490,7 @@ bool Parser::ParseOption(Message* options,
// Create an entry in the uninterpreted_option field.
const FieldDescriptor* uninterpreted_option_field =
options->GetDescriptor()->FindFieldByName("uninterpreted_option");
GOOGLE_CHECK(uninterpreted_option_field != nullptr)
GOOGLE_ABSL_CHECK(uninterpreted_option_field != nullptr)
<< "No field named \"uninterpreted_option\" in the Options proto.";
const Reflection* reflection = options->GetReflection();
@ -1541,7 +1543,8 @@ bool Parser::ParseOption(Message* options,
switch (input_->current().type) {
case io::Tokenizer::TYPE_START:
GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read.";
GOOGLE_ABSL_LOG(FATAL)
<< "Trying to read value before any tokens have been read.";
return false;
case io::Tokenizer::TYPE_END:
@ -1550,9 +1553,9 @@ bool Parser::ParseOption(Message* options,
case io::Tokenizer::TYPE_WHITESPACE:
case io::Tokenizer::TYPE_NEWLINE:
GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines())
GOOGLE_ABSL_CHECK(!input_->report_whitespace() && !input_->report_newlines())
<< "Whitespace tokens were not requested.";
GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace.";
GOOGLE_ABSL_LOG(FATAL) << "Tokenizer reported whitespace.";
return false;
case io::Tokenizer::TYPE_IDENTIFIER: {

@ -45,6 +45,7 @@
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_join.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/test_util2.h"
@ -2855,14 +2856,14 @@ class SourceInfoTest : public ParserTest {
while (*text != '\0') {
if (*text == '$') {
++text;
GOOGLE_CHECK_NE('\0', *text);
GOOGLE_ABSL_CHECK_NE('\0', *text);
if (*text == '$') {
text_without_markers_ += '$';
++column;
} else {
markers_[*text] = std::make_pair(line, column);
++text;
GOOGLE_CHECK_EQ('$', *text);
GOOGLE_ABSL_CHECK_EQ('$', *text);
}
} else if (*text == '\n') {
++line;

@ -36,6 +36,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_replace.h"
@ -2309,14 +2310,14 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
options.aggregate_metadata = true;
for (const auto& prefix : absl::StrSplit(option_pair[1], "#", absl::AllowEmpty())) {
options.aggregate_metadata_prefixes.emplace(prefix);
GOOGLE_LOG(INFO) << prefix;
GOOGLE_ABSL_LOG(INFO) << prefix;
}
} else if (option_pair[0] == "internal") {
options.is_descriptor = true;
} else if (option_pair[0] == "internal_generate_c_wkt") {
GenerateCWellKnownTypes(files, generator_context);
} else {
GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0];
GOOGLE_ABSL_LOG(FATAL) << "Unknown codegen option: " << option_pair[0];
}
}

@ -39,7 +39,6 @@
#include <unistd.h>
#endif
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/descriptor.h"

@ -51,8 +51,9 @@
#include <utility>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -167,7 +168,7 @@ std::string StringifyDefaultValue(const FieldDescriptor& field) {
}
// (We could add a default case above but then we wouldn't get the nice
// compiler warning when a new type is added.)
GOOGLE_LOG(FATAL) << "Not reached.";
GOOGLE_ABSL_LOG(FATAL) << "Not reached.";
return "";
}
@ -179,8 +180,9 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) {
return "proto3";
case FileDescriptor::SYNTAX_UNKNOWN:
default:
GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports proto2 "
"and proto3 syntax.";
GOOGLE_ABSL_LOG(FATAL)
<< "Unsupported syntax; this generator only supports proto2 "
"and proto3 syntax.";
return "";
}
}
@ -290,7 +292,7 @@ bool Generator::Generate(const FileDescriptor* file,
}
std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GOOGLE_CHECK(output.get());
GOOGLE_ABSL_CHECK(output.get());
io::Printer printer(output.get(), '$');
printer_ = &printer;
@ -947,7 +949,7 @@ std::string Generator::FieldReferencingExpression(
const std::string& python_dict_name) const {
// We should only ever be looking up fields in the current file.
// The only things we refer to from other files are message descriptors.
GOOGLE_CHECK_EQ(field.file(), file_)
GOOGLE_ABSL_CHECK_EQ(field.file(), file_)
<< field.file()->name() << " vs. " << file_->name();
if (!containing_type) {
return ResolveKeyword(field.name());
@ -1013,7 +1015,7 @@ void Generator::FixForeignFieldsInExtensions() const {
void Generator::FixForeignFieldsInExtension(
const FieldDescriptor& extension_field) const {
GOOGLE_CHECK(extension_field.is_extension());
GOOGLE_ABSL_CHECK(extension_field.is_extension());
absl::flat_hash_map<absl::string_view, std::string> m;
// Confusingly, for FieldDescriptors that happen to be extensions,
@ -1228,7 +1230,7 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
std::string sp;
proto.SerializeToString(&sp);
int offset = file_descriptor_serialized_.find(sp);
GOOGLE_CHECK_GE(offset, 0);
GOOGLE_ABSL_CHECK_GE(offset, 0);
printer_->Print(
"_globals['$name$']._serialized_start=$serialized_start$\n"

@ -32,6 +32,7 @@
#include <algorithm>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
#include "absl/strings/str_replace.h"

@ -39,6 +39,7 @@
#include "google/protobuf/compiler/python/generator.h"
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_split.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
@ -78,19 +79,19 @@ class TestGenerator : public CodeGenerator {
TEST(PythonPluginTest, ImportTest) {
// Create files test1.proto and test2.proto with the former importing the
// latter.
GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto",
"syntax = \"proto3\";\n"
"package foo;\n"
"import \"test2.proto\";"
"message Message1 {\n"
" Message2 message_2 = 1;\n"
"}\n",
true));
GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto",
"syntax = \"proto3\";\n"
"package foo;\n"
"message Message2 {}\n",
true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto",
"syntax = \"proto3\";\n"
"package foo;\n"
"import \"test2.proto\";"
"message Message1 {\n"
" Message2 message_2 = 1;\n"
"}\n",
true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto",
"syntax = \"proto3\";\n"
"package foo;\n"
"message Message2 {}\n",
true));
compiler::CommandLineInterface cli;
cli.SetInputsAreProtoPathRelative(true);
@ -105,8 +106,8 @@ TEST(PythonPluginTest, ImportTest) {
// Loop over the lines of the generated code and verify that we find an
// ordinary Python import but do not find the string "importlib".
std::string output;
GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output,
true));
GOOGLE_ABSL_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output,
true));
std::vector<std::string> lines = absl::StrSplit(output, "\n");
std::string expected_import = "import test2_pb2";
bool found_expected_import = false;

@ -34,6 +34,8 @@
#include <utility>
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "absl/strings/str_split.h"
@ -384,7 +386,7 @@ std::string PyiGenerator::GetFieldType(
return name;
}
default:
GOOGLE_LOG(FATAL) << "Unsupported field type.";
GOOGLE_ABSL_LOG(FATAL) << "Unsupported field type.";
}
return "";
}
@ -599,7 +601,7 @@ bool PyiGenerator::Generate(const FileDescriptor* file,
}
std::unique_ptr<io::ZeroCopyOutputStream> output(context->Open(filename));
GOOGLE_CHECK(output.get());
GOOGLE_ABSL_CHECK(output.get());
GeneratedCodeInfo annotations;
io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
&annotations);

@ -34,6 +34,7 @@
#include <sstream>
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor.pb.h"
@ -121,8 +122,8 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) {
return "proto3";
case FileDescriptor::SYNTAX_UNKNOWN:
default:
GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports "
"proto2 and proto3 syntax.";
GOOGLE_ABSL_LOG(FATAL) << "Unsupported syntax; this generator only supports "
"proto2 and proto3 syntax.";
return "";
}
}
@ -247,7 +248,8 @@ void GenerateOneof(const OneofDescriptor* oneof, io::Printer* printer) {
bool GenerateMessage(const Descriptor* message, io::Printer* printer,
std::string* error) {
if (message->extension_range_count() > 0 || message->extension_count() > 0) {
GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files.";
GOOGLE_ABSL_LOG(WARNING)
<< "Extensions are not yet supported for proto2 .proto files.";
}
// Don't generate MapEntry messages -- we use the Ruby extension's native
@ -422,8 +424,8 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) {
if (package_name.find("::") != std::string::npos) {
need_change_to_module = false;
} else if (package_name.find('.') != std::string::npos) {
GOOGLE_LOG(WARNING) << "ruby_package option should be in the form of:"
<< " 'A::B::C' and not 'A.B.C'";
GOOGLE_ABSL_LOG(WARNING) << "ruby_package option should be in the form of:"
<< " 'A::B::C' and not 'A.B.C'";
}
} else {
package_name = file->package();
@ -519,7 +521,8 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer,
// TODO: Remove this when ruby supports extensions for proto2 syntax.
if (file->syntax() == FileDescriptor::SYNTAX_PROTO2 &&
file->extension_count() > 0) {
GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files.";
GOOGLE_ABSL_LOG(WARNING)
<< "Extensions are not yet supported for proto2 .proto files.";
}
bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto";

@ -68,26 +68,18 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") {
// Copy generated_code.proto to the temporary test directory.
std::string test_input;
GOOGLE_CHECK_OK(File::GetContents(
ruby_tests + proto_file + ".proto",
&test_input,
true));
GOOGLE_CHECK_OK(File::SetContents(
TestTempDir() + proto_file + ".proto",
test_input,
true));
GOOGLE_ABSL_CHECK_OK(
File::GetContents(ruby_tests + proto_file + ".proto", &test_input, true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + proto_file + ".proto",
test_input, true));
// Copy generated_code_import.proto to the temporary test directory.
std::string test_import;
if (!import_proto_file.empty()) {
GOOGLE_CHECK_OK(File::GetContents(
ruby_tests + import_proto_file + ".proto",
&test_import,
true));
GOOGLE_CHECK_OK(File::SetContents(
TestTempDir() + import_proto_file + ".proto",
test_import,
true));
GOOGLE_ABSL_CHECK_OK(File::GetContents(ruby_tests + import_proto_file + ".proto",
&test_import, true));
GOOGLE_ABSL_CHECK_OK(File::SetContents(
TestTempDir() + import_proto_file + ".proto", test_import, true));
}
// Invoke the proto compiler (we will be inside TestTempDir() at this point).
@ -106,15 +98,11 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") {
// Load the generated output and compare to the expected result.
std::string output;
GOOGLE_CHECK_OK(File::GetContentsAsText(
TestTempDir() + proto_file + "_pb.rb",
&output,
true));
GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(TestTempDir() + proto_file + "_pb.rb",
&output, true));
std::string expected_output;
GOOGLE_CHECK_OK(File::GetContentsAsText(
ruby_tests + proto_file + "_pb.rb",
&expected_output,
true));
GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(ruby_tests + proto_file + "_pb.rb",
&expected_output, true));
EXPECT_EQ(expected_output, output);
}

@ -33,9 +33,9 @@
#include <memory>
#include "google/protobuf/stubs/logging.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/memory/memory.h"
#include "google/protobuf/descriptor.h"
@ -99,7 +99,7 @@ class PROTOC_EXPORT SCCAnalyzer {
// Mark visited by inserting in map.
auto ins = cache_.try_emplace(descriptor, absl::make_unique<NodeData>());
// Must not have visited already.
GOOGLE_DCHECK(ins.second);
GOOGLE_ABSL_DCHECK(ins.second);
NodeData& result = *ins.first->second;
// Initialize data structures.
result.index = result.lowlink = index_++;
@ -107,7 +107,7 @@ class PROTOC_EXPORT SCCAnalyzer {
// Recurse the fields / nodes in graph
for (const auto* dep : DepsGenerator()(descriptor)) {
GOOGLE_CHECK(dep);
GOOGLE_ABSL_CHECK(dep);
auto it = cache_.find(dep);
if (it == cache_.end()) {
// unexplored node
@ -150,7 +150,7 @@ class PROTOC_EXPORT SCCAnalyzer {
absl::flat_hash_set<const SCC*> seen;
for (auto descriptor : scc->descriptors) {
for (auto child_msg : DepsGenerator()(descriptor)) {
GOOGLE_CHECK(child_msg);
GOOGLE_ABSL_CHECK(child_msg);
const SCC* child = GetSCC(child_msg);
if (child == scc) continue;
if (seen.insert(child).second) {

@ -43,6 +43,7 @@
#include <sys/wait.h>
#endif
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/escaping.h"
#include "absl/strings/substitute.h"
@ -57,8 +58,8 @@ namespace compiler {
static void CloseHandleOrDie(HANDLE handle) {
if (!CloseHandle(handle)) {
GOOGLE_LOG(FATAL) << "CloseHandle: "
<< Subprocess::Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "CloseHandle: "
<< Subprocess::Win32ErrorMessage(GetLastError());
}
}
@ -85,22 +86,22 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
HANDLE stdout_pipe_write;
if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, nullptr, 0)) {
GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
}
if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, nullptr, 0)) {
GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError());
}
// Make child side of the pipes inheritable.
if (!SetHandleInformation(stdin_pipe_read, HANDLE_FLAG_INHERIT,
HANDLE_FLAG_INHERIT)) {
GOOGLE_LOG(FATAL) << "SetHandleInformation: "
<< Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: "
<< Win32ErrorMessage(GetLastError());
}
if (!SetHandleInformation(stdout_pipe_write, HANDLE_FLAG_INHERIT,
HANDLE_FLAG_INHERIT)) {
GOOGLE_LOG(FATAL) << "SetHandleInformation: "
<< Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: "
<< Win32ErrorMessage(GetLastError());
}
// Setup STARTUPINFO to redirect handles.
@ -113,13 +114,13 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE);
if (startup_info.hStdError == INVALID_HANDLE_VALUE) {
GOOGLE_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError());
}
// get wide string version of program as the path may contain non-ascii characters
std::wstring wprogram;
if (!io::win32::strings::utf8_to_wcs(program.c_str(), &wprogram)) {
GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError());
}
// Invoking cmd.exe allows for '.bat' files from the path as well as '.exe'.
@ -128,7 +129,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
// get wide string version of command line as the path may contain non-ascii characters
std::wstring wcommand_line;
if (!io::win32::strings::utf8_to_wcs(command_line.c_str(), &wcommand_line)) {
GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError());
}
// Using a malloc'ed string because CreateProcess() can mutate its second
@ -169,7 +170,7 @@ bool Subprocess::Communicate(const Message& input, Message* output,
return false;
}
GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first.";
GOOGLE_ABSL_CHECK(child_handle_ != nullptr) << "Must call Start() first.";
std::string input_data;
if (!input.SerializeToString(&input_data)) {
@ -199,11 +200,11 @@ bool Subprocess::Communicate(const Message& input, Message* output,
wait_result < WAIT_OBJECT_0 + handle_count) {
signaled_handle = handles[wait_result - WAIT_OBJECT_0];
} else if (wait_result == WAIT_FAILED) {
GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: "
<< Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: "
<< Win32ErrorMessage(GetLastError());
} else {
GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: "
<< wait_result;
GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: "
<< wait_result;
}
if (signaled_handle == child_stdin_) {
@ -246,17 +247,17 @@ bool Subprocess::Communicate(const Message& input, Message* output,
DWORD wait_result = WaitForSingleObject(child_handle_, INFINITE);
if (wait_result == WAIT_FAILED) {
GOOGLE_LOG(FATAL) << "WaitForSingleObject: "
<< Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: "
<< Win32ErrorMessage(GetLastError());
} else if (wait_result != WAIT_OBJECT_0) {
GOOGLE_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: "
<< wait_result;
GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: "
<< wait_result;
}
DWORD exit_code;
if (!GetExitCodeProcess(child_handle_, &exit_code)) {
GOOGLE_LOG(FATAL) << "GetExitCodeProcess: "
<< Win32ErrorMessage(GetLastError());
GOOGLE_ABSL_LOG(FATAL) << "GetExitCodeProcess: "
<< Win32ErrorMessage(GetLastError());
}
CloseHandleOrDie(child_handle_);
@ -325,14 +326,14 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
int stdin_pipe[2];
int stdout_pipe[2];
GOOGLE_CHECK(pipe(stdin_pipe) != -1);
GOOGLE_CHECK(pipe(stdout_pipe) != -1);
GOOGLE_ABSL_CHECK(pipe(stdin_pipe) != -1);
GOOGLE_ABSL_CHECK(pipe(stdout_pipe) != -1);
char* argv[2] = {portable_strdup(program.c_str()), nullptr};
child_pid_ = fork();
if (child_pid_ == -1) {
GOOGLE_LOG(FATAL) << "fork: " << strerror(errno);
GOOGLE_ABSL_LOG(FATAL) << "fork: " << strerror(errno);
} else if (child_pid_ == 0) {
// We are the child.
dup2(stdin_pipe[0], STDIN_FILENO);
@ -379,7 +380,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) {
bool Subprocess::Communicate(const Message& input, Message* output,
std::string* error) {
GOOGLE_CHECK_NE(child_stdin_, -1) << "Must call Start() first.";
GOOGLE_ABSL_CHECK_NE(child_stdin_, -1) << "Must call Start() first.";
// The "sighandler_t" typedef is GNU-specific, so define our own.
typedef void SignalHandler(int);
@ -414,7 +415,7 @@ bool Subprocess::Communicate(const Message& input, Message* output,
// Interrupted by signal. Try again.
continue;
} else {
GOOGLE_LOG(FATAL) << "select: " << strerror(errno);
GOOGLE_ABSL_LOG(FATAL) << "select: " << strerror(errno);
}
}
@ -460,7 +461,7 @@ bool Subprocess::Communicate(const Message& input, Message* output,
int status;
while (waitpid(child_pid_, &status, 0) == -1) {
if (errno != EINTR) {
GOOGLE_LOG(FATAL) << "waitpid: " << strerror(errno);
GOOGLE_ABSL_LOG(FATAL) << "waitpid: " << strerror(errno);
}
}

@ -48,13 +48,14 @@
#include <vector>
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/base/call_once.h"
#include "absl/base/casts.h"
#include "absl/base/dynamic_annotations.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/hash/hash.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -361,7 +362,7 @@ class FlatAllocatorImpl {
template <typename U>
void PlanArray(int array_size) {
// We can't call PlanArray after FinalizePlanning has been called.
GOOGLE_CHECK(!has_allocated());
GOOGLE_ABSL_CHECK(!has_allocated());
if (std::is_trivially_destructible<U>::value) {
// Trivial types are aligned to 8 bytes.
static_assert(alignof(U) <= 8, "");
@ -382,13 +383,13 @@ class FlatAllocatorImpl {
using TypeToUse = typename std::conditional<trivial, char, U>::type;
// We can only allocate after FinalizePlanning has been called.
GOOGLE_CHECK(has_allocated());
GOOGLE_ABSL_CHECK(has_allocated());
TypeToUse*& data = pointers_.template Get<TypeToUse>();
int& used = used_.template Get<TypeToUse>();
U* res = reinterpret_cast<U*>(data + used);
used += trivial ? RoundUpTo<8>(array_size * sizeof(U)) : array_size;
GOOGLE_CHECK_LE(used, total_.template Get<TypeToUse>());
GOOGLE_ABSL_CHECK_LE(used, total_.template Get<TypeToUse>());
return res;
}
@ -407,7 +408,7 @@ class FlatAllocatorImpl {
// and the other 3 indices are specified in the result.
void PlanFieldNames(const std::string& name,
const std::string* opt_json_name) {
GOOGLE_CHECK(!has_allocated());
GOOGLE_ABSL_CHECK(!has_allocated());
// Fast path for snake_case names, which follow the style guide.
if (opt_json_name == nullptr) {
@ -448,7 +449,7 @@ class FlatAllocatorImpl {
FieldNamesResult AllocateFieldNames(const std::string& name,
const std::string& scope,
const std::string* opt_json_name) {
GOOGLE_CHECK(has_allocated());
GOOGLE_ABSL_CHECK(has_allocated());
std::string full_name =
scope.empty() ? name : absl::StrCat(scope, ".", name);
@ -504,11 +505,11 @@ class FlatAllocatorImpl {
template <typename Alloc>
void FinalizePlanning(Alloc& alloc) {
GOOGLE_CHECK(!has_allocated());
GOOGLE_ABSL_CHECK(!has_allocated());
pointers_ = alloc->CreateFlatAlloc(total_)->Pointers();
GOOGLE_CHECK(has_allocated());
GOOGLE_ABSL_CHECK(has_allocated());
}
void ExpectConsumed() const {
@ -544,7 +545,7 @@ class FlatAllocatorImpl {
template <typename U>
bool ExpectConsumed() const {
GOOGLE_CHECK_EQ(total_.template Get<U>(), used_.template Get<U>());
GOOGLE_ABSL_CHECK_EQ(total_.template Get<U>(), used_.template Get<U>());
return true;
}
@ -693,7 +694,7 @@ class Symbol {
return absl::string_view(sub_package_file_descriptor()->file->package())
.substr(0, sub_package_file_descriptor()->name_size);
default:
GOOGLE_CHECK(false);
GOOGLE_ABSL_CHECK(false);
}
return "";
}
@ -726,7 +727,7 @@ class Symbol {
case METHOD:
return {method_descriptor()->service(), method_descriptor()->name()};
default:
GOOGLE_CHECK(false);
GOOGLE_ABSL_CHECK(false);
}
return {};
}
@ -814,7 +815,7 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) {
case SYNTAX_UNKNOWN:
return "unknown";
}
GOOGLE_LOG(FATAL) << "can't reach here.";
GOOGLE_ABSL_LOG(FATAL) << "can't reach here.";
return nullptr;
}
@ -1393,7 +1394,7 @@ DescriptorPool::Tables::Tables() {
});
}
DescriptorPool::Tables::~Tables() { GOOGLE_DCHECK(checkpoints_.empty()); }
DescriptorPool::Tables::~Tables() { GOOGLE_ABSL_DCHECK(checkpoints_.empty()); }
FileDescriptorTables::FileDescriptorTables() {}
@ -1413,7 +1414,7 @@ void DescriptorPool::Tables::AddCheckpoint() {
}
void DescriptorPool::Tables::ClearLastCheckpoint() {
GOOGLE_DCHECK(!checkpoints_.empty());
GOOGLE_ABSL_DCHECK(!checkpoints_.empty());
checkpoints_.pop_back();
if (checkpoints_.empty()) {
// All checkpoints have been cleared: we can now commit all of the pending
@ -1425,7 +1426,7 @@ void DescriptorPool::Tables::ClearLastCheckpoint() {
}
void DescriptorPool::Tables::RollbackToLastCheckpoint() {
GOOGLE_DCHECK(!checkpoints_.empty());
GOOGLE_ABSL_DCHECK(!checkpoints_.empty());
const CheckPoint& checkpoint = checkpoints_.back();
for (size_t i = checkpoint.pending_symbols_before_checkpoint;
@ -1679,7 +1680,7 @@ inline void DescriptorPool::Tables::FindAllExtensions(
bool DescriptorPool::Tables::AddSymbol(const std::string& full_name,
Symbol symbol) {
GOOGLE_DCHECK_EQ(full_name, symbol.full_name());
GOOGLE_ABSL_DCHECK_EQ(full_name, symbol.full_name());
if (symbols_by_name_.insert(symbol).second) {
symbols_after_checkpoint_.push_back(symbol);
return true;
@ -1691,8 +1692,8 @@ bool DescriptorPool::Tables::AddSymbol(const std::string& full_name,
bool FileDescriptorTables::AddAliasUnderParent(const void* parent,
const std::string& name,
Symbol symbol) {
GOOGLE_DCHECK_EQ(name, symbol.parent_name_key().second);
GOOGLE_DCHECK_EQ(parent, symbol.parent_name_key().first);
GOOGLE_ABSL_DCHECK_EQ(name, symbol.parent_name_key().second);
GOOGLE_ABSL_DCHECK_EQ(parent, symbol.parent_name_key().first);
return symbols_by_parent_.insert(symbol).second;
}
@ -1926,7 +1927,7 @@ void DescriptorPool::InternalAddGeneratedFile(
// Therefore, when we parse one, we have to be very careful to avoid using
// any descriptor-based operations, since this might cause infinite recursion
// or deadlock.
GOOGLE_CHECK(GeneratedDatabase()->Add(encoded_file_descriptor, size));
GOOGLE_ABSL_CHECK(GeneratedDatabase()->Add(encoded_file_descriptor, size));
}
@ -2230,13 +2231,13 @@ const EnumValueDescriptor* Descriptor::FindEnumValueByName(
const FieldDescriptor* Descriptor::map_key() const {
if (!options().map_entry()) return nullptr;
GOOGLE_DCHECK_EQ(field_count(), 2);
GOOGLE_ABSL_DCHECK_EQ(field_count(), 2);
return field(0);
}
const FieldDescriptor* Descriptor::map_value() const {
if (!options().map_entry()) return nullptr;
GOOGLE_DCHECK_EQ(field_count(), 2);
GOOGLE_ABSL_DCHECK_EQ(field_count(), 2);
return field(1);
}
@ -2473,7 +2474,7 @@ bool FieldDescriptor::is_map_message_type() const {
std::string FieldDescriptor::DefaultValueAsString(
bool quote_string_type) const {
GOOGLE_CHECK(has_default_value()) << "No default value";
GOOGLE_ABSL_CHECK(has_default_value()) << "No default value";
switch (cpp_type()) {
case CPPTYPE_INT32:
return absl::StrCat(default_value_int32_t());
@ -2502,10 +2503,10 @@ std::string FieldDescriptor::DefaultValueAsString(
case CPPTYPE_ENUM:
return default_value_enum()->name();
case CPPTYPE_MESSAGE:
GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
GOOGLE_ABSL_LOG(DFATAL) << "Messages can't have default values!";
break;
}
GOOGLE_LOG(FATAL) << "Can't get here: failed to get default value as string";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here: failed to get default value as string";
return "";
}
@ -2559,7 +2560,7 @@ void FileDescriptor::CopyHeadingTo(FileDescriptorProto* proto) const {
void FileDescriptor::CopyJsonNameTo(FileDescriptorProto* proto) const {
if (message_type_count() != proto->message_type_size() ||
extension_count() != proto->extension_size()) {
GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
GOOGLE_ABSL_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
return;
}
for (int i = 0; i < message_type_count(); i++) {
@ -2616,7 +2617,7 @@ void Descriptor::CopyJsonNameTo(DescriptorProto* proto) const {
if (field_count() != proto->field_size() ||
nested_type_count() != proto->nested_type_size() ||
extension_count() != proto->extension_size()) {
GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
GOOGLE_ABSL_LOG(ERROR) << "Cannot copy json_name to a proto of a different size.";
return;
}
for (int i = 0; i < field_count(); i++) {
@ -2838,8 +2839,8 @@ bool RetrieveOptions(int depth, const Message& options,
return RetrieveOptionsAssumingRightPool(depth, *dynamic_options,
option_entries);
} else {
GOOGLE_LOG(ERROR) << "Found invalid proto option data for: "
<< options.GetDescriptor()->full_name();
GOOGLE_ABSL_LOG(ERROR) << "Found invalid proto option data for: "
<< options.GetDescriptor()->full_name();
return RetrieveOptionsAssumingRightPool(depth, options, option_entries);
}
}
@ -3461,7 +3462,7 @@ void MethodDescriptor::DebugString(
bool FileDescriptor::GetSourceLocation(const std::vector<int>& path,
SourceLocation* out_location) const {
GOOGLE_CHECK(out_location != nullptr);
GOOGLE_ABSL_CHECK(out_location != nullptr);
if (source_code_info_) {
if (const SourceCodeInfo_Location* loc =
tables_->GetSourceLocation(path, source_code_info_)) {
@ -4108,11 +4109,11 @@ class DescriptorBuilder {
const FileDescriptor* DescriptorPool::BuildFile(
const FileDescriptorProto& proto) {
GOOGLE_CHECK(fallback_database_ == nullptr)
GOOGLE_ABSL_CHECK(fallback_database_ == nullptr)
<< "Cannot call BuildFile on a DescriptorPool that uses a "
"DescriptorDatabase. You must instead find a way to get your file "
"into the underlying database.";
GOOGLE_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_CHECK.
GOOGLE_ABSL_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_ABSL_CHECK.
tables_->known_bad_symbols_.clear();
tables_->known_bad_files_.clear();
return DescriptorBuilder::New(this, tables_.get(), nullptr)->BuildFile(proto);
@ -4120,11 +4121,11 @@ const FileDescriptor* DescriptorPool::BuildFile(
const FileDescriptor* DescriptorPool::BuildFileCollectingErrors(
const FileDescriptorProto& proto, ErrorCollector* error_collector) {
GOOGLE_CHECK(fallback_database_ == nullptr)
GOOGLE_ABSL_CHECK(fallback_database_ == nullptr)
<< "Cannot call BuildFile on a DescriptorPool that uses a "
"DescriptorDatabase. You must instead find a way to get your file "
"into the underlying database.";
GOOGLE_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_CHECK.
GOOGLE_ABSL_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_ABSL_CHECK.
tables_->known_bad_symbols_.clear();
tables_->known_bad_files_.clear();
return DescriptorBuilder::New(this, tables_.get(), error_collector)
@ -4164,10 +4165,10 @@ PROTOBUF_NOINLINE void DescriptorBuilder::AddError(
const std::string& error) {
if (error_collector_ == nullptr) {
if (!had_errors_) {
GOOGLE_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_
<< "\":";
GOOGLE_ABSL_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_
<< "\":";
}
GOOGLE_LOG(ERROR) << " " << element_name << ": " << error;
GOOGLE_ABSL_LOG(ERROR) << " " << element_name << ": " << error;
} else {
error_collector_->AddError(filename_, element_name, &descriptor, location,
error);
@ -4218,7 +4219,7 @@ PROTOBUF_NOINLINE void DescriptorBuilder::AddWarning(
DescriptorPool::ErrorCollector::ErrorLocation location,
const std::string& error) {
if (error_collector_ == nullptr) {
GOOGLE_LOG(WARNING) << filename_ << " " << element_name << ": " << error;
GOOGLE_ABSL_LOG(WARNING) << filename_ << " " << element_name << ": " << error;
} else {
error_collector_->AddWarning(filename_, element_name, &descriptor, location,
error);
@ -4596,10 +4597,10 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name,
// This is only possible if there was already an error adding something of
// the same name.
if (!had_errors_) {
GOOGLE_LOG(DFATAL) << "\"" << full_name
<< "\" not previously defined in "
"symbols_by_name_, but was defined in "
"symbols_by_parent_; this shouldn't be possible.";
GOOGLE_ABSL_LOG(DFATAL) << "\"" << full_name
<< "\" not previously defined in "
"symbols_by_name_, but was defined in "
"symbols_by_parent_; this shouldn't be possible.";
}
return false;
}
@ -4842,7 +4843,7 @@ PROTOBUF_NOINLINE static bool ExistingFileMatchesProto(
// necessary memory allocations that BuildXXX functions below will do on the
// Tables object.
// They *must* be kept in sync. If we miss some PlanArray call we won't have
// enough memory and will GOOGLE_CHECK-fail.
// enough memory and will GOOGLE_ABSL_CHECK-fail.
static void PlanAllocationSize(
const RepeatedPtrField<EnumValueDescriptorProto>& values,
internal::FlatAllocator& alloc) {
@ -6273,8 +6274,8 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message,
// Verify that they are contiguous.
// This is assumed by OneofDescriptor::field(i).
// But only if there are no errors.
GOOGLE_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_,
message->field(i));
GOOGLE_ABSL_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_,
message->field(i));
}
++out_oneof_decl.field_count_;
}
@ -7250,7 +7251,7 @@ void DescriptorBuilder::ValidateJSType(FieldDescriptor* field,
DescriptorBuilder::OptionInterpreter::OptionInterpreter(
DescriptorBuilder* builder)
: builder_(builder) {
GOOGLE_CHECK(builder_);
GOOGLE_ABSL_CHECK(builder_);
}
DescriptorBuilder::OptionInterpreter::~OptionInterpreter() {}
@ -7269,7 +7270,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions(
// and clear them, since we're about to interpret them.
const FieldDescriptor* uninterpreted_options_field =
options->GetDescriptor()->FindFieldByName("uninterpreted_option");
GOOGLE_CHECK(uninterpreted_options_field != nullptr)
GOOGLE_ABSL_CHECK(uninterpreted_options_field != nullptr)
<< "No field named \"uninterpreted_option\" in the Options proto.";
options->GetReflection()->ClearField(options, uninterpreted_options_field);
@ -7280,7 +7281,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions(
const FieldDescriptor* original_uninterpreted_options_field =
original_options->GetDescriptor()->FindFieldByName(
"uninterpreted_option");
GOOGLE_CHECK(original_uninterpreted_options_field != nullptr)
GOOGLE_ABSL_CHECK(original_uninterpreted_options_field != nullptr)
<< "No field named \"uninterpreted_option\" in the Options proto.";
const int num_uninterpreted_options =
@ -7373,7 +7374,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
// generated pool's mutex, so we can search it the straightforward way.
options_descriptor = options->GetDescriptor();
}
GOOGLE_CHECK(options_descriptor);
GOOGLE_ABSL_CHECK(options_descriptor);
// We iterate over the name parts to drill into the submessages until we find
// the leaf field for the option. As we drill down we remember the current
@ -7508,7 +7509,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
case FieldDescriptor::TYPE_MESSAGE: {
std::string* outstr =
parent_unknown_fields->AddLengthDelimited((*iter)->number());
GOOGLE_CHECK(unknown_fields->SerializeToString(outstr))
GOOGLE_ABSL_CHECK(unknown_fields->SerializeToString(outstr))
<< "Unexpected failure while serializing option submessage "
<< debug_msg_name << "\".";
break;
@ -7521,8 +7522,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
}
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: "
<< (*iter)->type();
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: "
<< (*iter)->type();
return false;
}
unknown_fields.reset(parent_unknown_fields.release());
@ -7640,7 +7641,7 @@ void DescriptorBuilder::OptionInterpreter::AddWithoutInterpreting(
const UninterpretedOption& uninterpreted_option, Message* options) {
const FieldDescriptor* field =
options->GetDescriptor()->FindFieldByName("uninterpreted_option");
GOOGLE_CHECK(field != nullptr);
GOOGLE_ABSL_CHECK(field != nullptr);
options->GetReflection()
->AddMessage(options, field)
@ -7700,7 +7701,7 @@ bool DescriptorBuilder::OptionInterpreter::ExamineIfOptionIsSet(
break;
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " << type;
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " << type;
return false;
}
}
@ -8023,7 +8024,7 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption(
const Descriptor* type = option_field->message_type();
std::unique_ptr<Message> dynamic(dynamic_factory_.GetPrototype(type)->New());
GOOGLE_CHECK(dynamic.get() != nullptr)
GOOGLE_ABSL_CHECK(dynamic.get() != nullptr)
<< "Could not create an instance of " << option_field->DebugString();
AggregateErrorCollector collector;
@ -8043,7 +8044,7 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption(
if (option_field->type() == FieldDescriptor::TYPE_MESSAGE) {
unknown_fields->AddLengthDelimited(option_field->number(), serial);
} else {
GOOGLE_CHECK_EQ(option_field->type(), FieldDescriptor::TYPE_GROUP);
GOOGLE_ABSL_CHECK_EQ(option_field->type(), FieldDescriptor::TYPE_GROUP);
UnknownFieldSet* group = unknown_fields->AddGroup(option_field->number());
group->ParseFromString(serial);
}
@ -8070,7 +8071,7 @@ void DescriptorBuilder::OptionInterpreter::SetInt32(
break;
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT32: " << type;
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT32: " << type;
break;
}
}
@ -8093,7 +8094,7 @@ void DescriptorBuilder::OptionInterpreter::SetInt64(
break;
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT64: " << type;
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT64: " << type;
break;
}
}
@ -8111,7 +8112,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt32(
break;
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT32: " << type;
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT32: " << type;
break;
}
}
@ -8129,7 +8130,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt64(
break;
default:
GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT64: " << type;
GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT64: " << type;
break;
}
}
@ -8171,7 +8172,7 @@ Symbol DescriptorPool::CrossLinkOnDemandHelper(absl::string_view name,
// be looked up when the accessor for the type was called. Set type_,
// enum_type_, message_type_, and default_value_enum_ appropriately.
void FieldDescriptor::InternalTypeOnceInit() const {
GOOGLE_CHECK(file()->finished_building_ == true);
GOOGLE_ABSL_CHECK(file()->finished_building_ == true);
const EnumDescriptor* enum_type = nullptr;
const char* lazy_type_name = reinterpret_cast<const char*>(type_once_ + 1);
const char* lazy_default_value_enum_name =
@ -8206,7 +8207,7 @@ void FieldDescriptor::InternalTypeOnceInit() const {
if (!default_value_enum_) {
// We use the first defined value as the default
// if a default is not explicitly defined.
GOOGLE_CHECK(enum_type->value_count());
GOOGLE_ABSL_CHECK(enum_type->value_count());
default_value_enum_ = enum_type->value(0);
}
}
@ -8252,7 +8253,7 @@ const std::string& FieldDescriptor::PrintableNameForExtension() const {
}
void FileDescriptor::InternalDependenciesOnceInit() const {
GOOGLE_CHECK(finished_building_ == true);
GOOGLE_ABSL_CHECK(finished_building_ == true);
const char* names_ptr = reinterpret_cast<const char*>(dependencies_once_ + 1);
for (int i = 0; i < dependency_count(); i++) {
const char* name = names_ptr;
@ -8287,18 +8288,18 @@ const Descriptor* MethodDescriptor::output_type() const {
namespace internal {
void LazyDescriptor::Set(const Descriptor* descriptor) {
GOOGLE_CHECK(!once_);
GOOGLE_ABSL_CHECK(!once_);
descriptor_ = descriptor;
}
void LazyDescriptor::SetLazy(absl::string_view name,
const FileDescriptor* file) {
// verify Init() has been called and Set hasn't been called yet.
GOOGLE_CHECK(!descriptor_);
GOOGLE_CHECK(!once_);
GOOGLE_CHECK(file && file->pool_);
GOOGLE_CHECK(file->pool_->lazily_build_dependencies_);
GOOGLE_CHECK(!file->finished_building_);
GOOGLE_ABSL_CHECK(!descriptor_);
GOOGLE_ABSL_CHECK(!once_);
GOOGLE_ABSL_CHECK(file && file->pool_);
GOOGLE_ABSL_CHECK(file->pool_->lazily_build_dependencies_);
GOOGLE_ABSL_CHECK(!file->finished_building_);
once_ = ::new (file->pool_->tables_->AllocateBytes(static_cast<int>(
sizeof(absl::once_flag) + name.size() + 1))) absl::once_flag{};
char* lazy_name = reinterpret_cast<char*>(once_ + 1);
@ -8310,7 +8311,7 @@ void LazyDescriptor::Once(const ServiceDescriptor* service) {
if (once_) {
absl::call_once(*once_, [&] {
auto* file = service->file();
GOOGLE_CHECK(file->finished_building_);
GOOGLE_ABSL_CHECK(file->finished_building_);
const char* lazy_name = reinterpret_cast<const char*>(once_ + 1);
descriptor_ =
file->pool_->CrossLinkOnDemandHelper(lazy_name, false).descriptor();

@ -64,9 +64,10 @@
#include <vector>
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/port.h"
#include "absl/base/call_once.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "google/protobuf/port.h"
@ -1799,7 +1800,7 @@ class PROTOBUF_EXPORT DescriptorPool {
// this pool will be slower, since they will have to obtain locks too.
// - An ErrorCollector may optionally be given to collect validation errors
// in files loaded from the database. If not given, errors will be printed
// to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this
// to GOOGLE_ABSL_LOG(ERROR). Remember that files are built on-demand, so this
// ErrorCollector may be called from any thread that calls one of the
// Find*By*() methods.
// - The DescriptorDatabase must not be mutated during the lifetime of
@ -1926,7 +1927,7 @@ class PROTOBUF_EXPORT DescriptorPool {
// this DescriptorPool. All dependencies of the file must already be in
// the pool. Returns the resulting FileDescriptor, or nullptr if there were
// problems with the input (e.g. the message was invalid, or dependencies
// were missing). Details about the errors are written to GOOGLE_LOG(ERROR).
// were missing). Details about the errors are written to GOOGLE_ABSL_LOG(ERROR).
const FileDescriptor* BuildFile(const FileDescriptorProto& proto);
// Same as BuildFile() except errors are sent to the given ErrorCollector.
@ -2325,12 +2326,12 @@ inline const OneofDescriptor* FieldDescriptor::containing_oneof() const {
}
inline int FieldDescriptor::index_in_oneof() const {
GOOGLE_DCHECK(is_oneof_);
GOOGLE_ABSL_DCHECK(is_oneof_);
return static_cast<int>(this - scope_.containing_oneof->field(0));
}
inline const Descriptor* FieldDescriptor::extension_scope() const {
GOOGLE_CHECK(is_extension_);
GOOGLE_ABSL_CHECK(is_extension_);
return scope_.extension_scope;
}
@ -2514,7 +2515,7 @@ struct FieldRangeImpl {
value_type operator*() { return descriptor->field(idx); }
friend bool operator==(const Iterator& a, const Iterator& b) {
GOOGLE_DCHECK(a.descriptor == b.descriptor);
GOOGLE_ABSL_DCHECK(a.descriptor == b.descriptor);
return a.idx == b.idx;
}
friend bool operator!=(const Iterator& a, const Iterator& b) {

@ -307,7 +307,8 @@ PROTOBUF_CONSTEXPR MessageOptions::MessageOptions(
, /*decltype(_impl_.message_set_wire_format_)*/false
, /*decltype(_impl_.no_standard_descriptor_accessor_)*/false
, /*decltype(_impl_.deprecated_)*/false
, /*decltype(_impl_.map_entry_)*/false} {}
, /*decltype(_impl_.map_entry_)*/false
, /*decltype(_impl_.deprecated_legacy_json_field_conflicts_)*/false} {}
struct MessageOptionsDefaultTypeInternal {
PROTOBUF_CONSTEXPR MessageOptionsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
~MessageOptionsDefaultTypeInternal() {}
@ -363,7 +364,8 @@ PROTOBUF_CONSTEXPR EnumOptions::EnumOptions(
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.uninterpreted_option_)*/{}
, /*decltype(_impl_.allow_alias_)*/false
, /*decltype(_impl_.deprecated_)*/false} {}
, /*decltype(_impl_.deprecated_)*/false
, /*decltype(_impl_.deprecated_legacy_json_field_conflicts_)*/false} {}
struct EnumOptionsDefaultTypeInternal {
PROTOBUF_CONSTEXPR EnumOptionsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
~EnumOptionsDefaultTypeInternal() {}
@ -827,11 +829,13 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.no_standard_descriptor_accessor_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.deprecated_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.map_entry_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.deprecated_legacy_json_field_conflicts_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.uninterpreted_option_),
0,
1,
2,
3,
4,
~0u,
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _internal_metadata_),
@ -876,9 +880,11 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P
~0u, // no sizeof(Split)
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.allow_alias_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.deprecated_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.deprecated_legacy_json_field_conflicts_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.uninterpreted_option_),
0,
1,
2,
~0u,
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _impl_._has_bits_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _internal_metadata_),
@ -1024,19 +1030,19 @@ static const ::_pbi::MigrationSchema
{ 192, 203, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)},
{ 206, 220, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)},
{ 226, 255, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)},
{ 276, 289, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)},
{ 294, 310, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)},
{ 318, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)},
{ 327, 338, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)},
{ 341, 351, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)},
{ 353, 363, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)},
{ 365, 376, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)},
{ 379, 389, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)},
{ 391, 406, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)},
{ 413, 426, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)},
{ 431, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)},
{ 440, 453, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)},
{ 458, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)},
{ 276, 290, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)},
{ 296, 312, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)},
{ 320, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)},
{ 329, 341, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)},
{ 345, 355, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)},
{ 357, 367, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)},
{ 369, 380, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)},
{ 383, 393, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)},
{ 395, 410, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)},
{ 417, 430, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)},
{ 435, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)},
{ 444, 457, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)},
{ 462, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -1163,74 +1169,76 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR
"terpreted_option\030\347\007 \003(\0132$.google.protobu"
"f.UninterpretedOption\":\n\014OptimizeMode\022\t\n"
"\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020"
"\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\204\002\n\016MessageOptions\022&\n"
"\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\270\002\n\016MessageOptions\022&\n"
"\027message_set_wire_format\030\001 \001(\010:\005false\022.\n"
"\037no_standard_descriptor_accessor\030\002 \001(\010:\005"
"false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_"
"entry\030\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003"
"(\0132$.google.protobuf.UninterpretedOption"
"*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005J\004\010\005\020\006J\004\010\006\020\007J\004\010\010\020\tJ\004\010\t\020"
"\n\"\276\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.goog"
"le.protobuf.FieldOptions.CType:\006STRING\022\016"
"\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.google."
"protobuf.FieldOptions.JSType:\tJS_NORMAL\022"
"\023\n\004lazy\030\005 \001(\010:\005false\022\036\n\017unverified_lazy\030"
"\017 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022"
"\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_op"
"tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre"
"tedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001"
"\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORMA"
"L\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200"
"\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninterpre"
"ted_option\030\347\007 \003(\0132$.google.protobuf.Unin"
"terpretedOption*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptio"
"ns\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 "
"\001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003("
"\0132$.google.protobuf.UninterpretedOption*"
"\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumValueOptions\022\031\n\n"
"deprecated\030\001 \001(\010:\005false\022C\n\024uninterpreted"
"entry\030\007 \001(\010\0222\n&deprecated_legacy_json_fi"
"eld_conflicts\030\013 \001(\010B\002\030\001\022C\n\024uninterpreted"
"_option\030\347\007 \003(\0132$.google.protobuf.Uninter"
"pretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOption"
"s\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninterp"
"reted_option\030\347\007 \003(\0132$.google.protobuf.Un"
"interpretedOption*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodO"
"ptions\022\031\n\ndeprecated\030! \001(\010:\005false\022_\n\021ide"
"mpotency_level\030\" \001(\0162/.google.protobuf.M"
"ethodOptions.IdempotencyLevel:\023IDEMPOTEN"
"CY_UNKNOWN\022C\n\024uninterpreted_option\030\347\007 \003("
"\0132$.google.protobuf.UninterpretedOption\""
"P\n\020IdempotencyLevel\022\027\n\023IDEMPOTENCY_UNKNO"
"WN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTENT\020"
"\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022;\n\004"
"name\030\002 \003(\0132-.google.protobuf.Uninterpret"
"edOption.NamePart\022\030\n\020identifier_value\030\003 "
"\001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022negat"
"ive_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 \001("
"\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_val"
"ue\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002(\t\022"
"\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeInfo"
"\022:\n\010location\030\001 \003(\0132(.google.protobuf.Sou"
"rceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004pat"
"h\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading"
"_comments\030\003 \001(\t\022\031\n\021trailing_comments\030\004 \001"
"(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"\234\002"
"\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\0132"
"-.google.protobuf.GeneratedCodeInfo.Anno"
"tation\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022"
"\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003e"
"nd\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.prot"
"obuf.GeneratedCodeInfo.Annotation.Semant"
"ic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALI"
"AS\020\002B~\n\023com.google.protobufB\020DescriptorP"
"rotosH\001Z-google.golang.org/protobuf/type"
"s/descriptorpb\370\001\001\242\002\003GPB\252\002\032Google.Protobu"
"f.Reflection"
"pretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005J\004\010\005\020\006J\004\010\006\020"
"\007J\004\010\010\020\tJ\004\010\t\020\n\"\276\003\n\014FieldOptions\022:\n\005ctype\030"
"\001 \001(\0162#.google.protobuf.FieldOptions.CTy"
"pe:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001"
"(\0162$.google.protobuf.FieldOptions.JSType"
":\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\036\n\017unve"
"rified_lazy\030\017 \001(\010:\005false\022\031\n\ndeprecated\030\003"
" \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024unin"
"terpreted_option\030\347\007 \003(\0132$.google.protobu"
"f.UninterpretedOption\"/\n\005CType\022\n\n\006STRING"
"\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType"
"\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUM"
"BER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C"
"\n\024uninterpreted_option\030\347\007 \003(\0132$.google.p"
"rotobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\307"
"\001\n\013EnumOptions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\nd"
"eprecated\030\003 \001(\010:\005false\0222\n&deprecated_leg"
"acy_json_field_conflicts\030\006 \001(\010B\002\030\001\022C\n\024un"
"interpreted_option\030\347\007 \003(\0132$.google.proto"
"buf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006"
"\"}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010"
":\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$"
".google.protobuf.UninterpretedOption*\t\010\350"
"\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030"
"! \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 "
"\003(\0132$.google.protobuf.UninterpretedOptio"
"n*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprec"
"ated\030! \001(\010:\005false\022_\n\021idempotency_level\030\""
" \001(\0162/.google.protobuf.MethodOptions.Ide"
"mpotencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024un"
"interpreted_option\030\347\007 \003(\0132$.google.proto"
"buf.UninterpretedOption\"P\n\020IdempotencyLe"
"vel\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_"
"EFFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n"
"\023UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goo"
"gle.protobuf.UninterpretedOption.NamePar"
"t\022\030\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_"
"int_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 "
"\001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_valu"
"e\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010Name"
"Part\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030"
"\002 \002(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003"
"(\0132(.google.protobuf.SourceCodeInfo.Loca"
"tion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004s"
"pan\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022"
"\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_de"
"tached_comments\030\006 \003(\t\"\234\002\n\021GeneratedCodeI"
"nfo\022A\n\nannotation\030\001 \003(\0132-.google.protobu"
"f.GeneratedCodeInfo.Annotation\032\303\001\n\nAnnot"
"ation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002"
" \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010sema"
"ntic\030\005 \001(\01626.google.protobuf.GeneratedCo"
"deInfo.Annotation.Semantic\"(\n\010Semantic\022\010"
"\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002B~\n\023com.goog"
"le.protobufB\020DescriptorProtosH\001Z-google."
"golang.org/protobuf/types/descriptorpb\370\001"
"\001\242\002\003GPB\252\002\032Google.Protobuf.Reflection"
};
static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = {
false,
false,
6212,
6316,
descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto,
"google/protobuf/descriptor.proto",
&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once,
@ -7607,6 +7615,9 @@ class MessageOptions::_Internal {
static void set_has_map_entry(HasBits* has_bits) {
(*has_bits)[0] |= 8u;
}
static void set_has_deprecated_legacy_json_field_conflicts(HasBits* has_bits) {
(*has_bits)[0] |= 16u;
}
};
MessageOptions::MessageOptions(::PROTOBUF_NAMESPACE_ID::Arena* arena)
@ -7625,13 +7636,14 @@ MessageOptions::MessageOptions(const MessageOptions& from)
, decltype(_impl_.message_set_wire_format_){}
, decltype(_impl_.no_standard_descriptor_accessor_){}
, decltype(_impl_.deprecated_){}
, decltype(_impl_.map_entry_){}};
, decltype(_impl_.map_entry_){}
, decltype(_impl_.deprecated_legacy_json_field_conflicts_){}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
::memcpy(&_impl_.message_set_wire_format_, &from._impl_.message_set_wire_format_,
static_cast<::size_t>(reinterpret_cast<char*>(&_impl_.map_entry_) -
reinterpret_cast<char*>(&_impl_.message_set_wire_format_)) + sizeof(_impl_.map_entry_));
static_cast<::size_t>(reinterpret_cast<char*>(&_impl_.deprecated_legacy_json_field_conflicts_) -
reinterpret_cast<char*>(&_impl_.message_set_wire_format_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions)
}
@ -7646,6 +7658,7 @@ inline void MessageOptions::SharedCtor(::_pb::Arena* arena) {
, decltype(_impl_.no_standard_descriptor_accessor_){false}
, decltype(_impl_.deprecated_){false}
, decltype(_impl_.map_entry_){false}
, decltype(_impl_.deprecated_legacy_json_field_conflicts_){false}
};
}
@ -7676,9 +7689,12 @@ void MessageOptions::Clear() {
_impl_._extensions_.Clear();
_impl_.uninterpreted_option_.Clear();
::memset(&_impl_.message_set_wire_format_, 0, static_cast<::size_t>(
reinterpret_cast<char*>(&_impl_.map_entry_) -
reinterpret_cast<char*>(&_impl_.message_set_wire_format_)) + sizeof(_impl_.map_entry_));
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x0000001fu) {
::memset(&_impl_.message_set_wire_format_, 0, static_cast<::size_t>(
reinterpret_cast<char*>(&_impl_.deprecated_legacy_json_field_conflicts_) -
reinterpret_cast<char*>(&_impl_.message_set_wire_format_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_));
}
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -7731,6 +7747,16 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::_pbi::ParseContext
goto handle_unusual;
}
continue;
// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 88)) {
_Internal::set_has_deprecated_legacy_json_field_conflicts(&has_bits);
_impl_.deprecated_legacy_json_field_conflicts_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else {
goto handle_unusual;
}
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) {
@ -7806,6 +7832,12 @@ failure:
target = ::_pbi::WireFormatLite::WriteBoolToArray(7, this->_internal_map_entry(), target);
}
// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
if (cached_has_bits & 0x00000010u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteBoolToArray(11, this->_internal_deprecated_legacy_json_field_conflicts(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned i = 0,
n = static_cast<unsigned>(this->_internal_uninterpreted_option_size()); i < n; i++) {
@ -7845,7 +7877,7 @@ failure:
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x0000001fu) {
// optional bool message_set_wire_format = 1 [default = false];
if (cached_has_bits & 0x00000001u) {
total_size += 1 + 1;
@ -7866,6 +7898,11 @@ failure:
total_size += 1 + 1;
}
// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
if (cached_has_bits & 0x00000010u) {
total_size += 1 + 1;
}
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
@ -7888,7 +7925,7 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const :
_this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_);
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x0000001fu) {
if (cached_has_bits & 0x00000001u) {
_this->_impl_.message_set_wire_format_ = from._impl_.message_set_wire_format_;
}
@ -7901,6 +7938,9 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const :
if (cached_has_bits & 0x00000008u) {
_this->_impl_.map_entry_ = from._impl_.map_entry_;
}
if (cached_has_bits & 0x00000010u) {
_this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
@ -7931,8 +7971,8 @@ void MessageOptions::InternalSwap(MessageOptions* other) {
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
_impl_.uninterpreted_option_.InternalSwap(&other->_impl_.uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.map_entry_)
+ sizeof(MessageOptions::_impl_.map_entry_)
PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.deprecated_legacy_json_field_conflicts_)
+ sizeof(MessageOptions::_impl_.deprecated_legacy_json_field_conflicts_)
- PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.message_set_wire_format_)>(
reinterpret_cast<char*>(&_impl_.message_set_wire_format_),
reinterpret_cast<char*>(&other->_impl_.message_set_wire_format_));
@ -8626,6 +8666,9 @@ class EnumOptions::_Internal {
static void set_has_deprecated(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
static void set_has_deprecated_legacy_json_field_conflicts(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
};
EnumOptions::EnumOptions(::PROTOBUF_NAMESPACE_ID::Arena* arena)
@ -8642,13 +8685,14 @@ EnumOptions::EnumOptions(const EnumOptions& from)
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.uninterpreted_option_){from._impl_.uninterpreted_option_}
, decltype(_impl_.allow_alias_){}
, decltype(_impl_.deprecated_){}};
, decltype(_impl_.deprecated_){}
, decltype(_impl_.deprecated_legacy_json_field_conflicts_){}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
::memcpy(&_impl_.allow_alias_, &from._impl_.allow_alias_,
static_cast<::size_t>(reinterpret_cast<char*>(&_impl_.deprecated_) -
reinterpret_cast<char*>(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_));
static_cast<::size_t>(reinterpret_cast<char*>(&_impl_.deprecated_legacy_json_field_conflicts_) -
reinterpret_cast<char*>(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions)
}
@ -8661,6 +8705,7 @@ inline void EnumOptions::SharedCtor(::_pb::Arena* arena) {
, decltype(_impl_.uninterpreted_option_){arena}
, decltype(_impl_.allow_alias_){false}
, decltype(_impl_.deprecated_){false}
, decltype(_impl_.deprecated_legacy_json_field_conflicts_){false}
};
}
@ -8692,8 +8737,8 @@ void EnumOptions::Clear() {
_impl_._extensions_.Clear();
_impl_.uninterpreted_option_.Clear();
::memset(&_impl_.allow_alias_, 0, static_cast<::size_t>(
reinterpret_cast<char*>(&_impl_.deprecated_) -
reinterpret_cast<char*>(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_));
reinterpret_cast<char*>(&_impl_.deprecated_legacy_json_field_conflicts_) -
reinterpret_cast<char*>(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_));
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -8726,6 +8771,16 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::_pbi::ParseContext* c
goto handle_unusual;
}
continue;
// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) {
_Internal::set_has_deprecated_legacy_json_field_conflicts(&has_bits);
_impl_.deprecated_legacy_json_field_conflicts_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else {
goto handle_unusual;
}
continue;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
case 999:
if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) {
@ -8789,6 +8844,12 @@ failure:
target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_deprecated(), target);
}
// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
if (cached_has_bits & 0x00000004u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteBoolToArray(6, this->_internal_deprecated_legacy_json_field_conflicts(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
for (unsigned i = 0,
n = static_cast<unsigned>(this->_internal_uninterpreted_option_size()); i < n; i++) {
@ -8828,7 +8889,7 @@ failure:
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000007u) {
// optional bool allow_alias = 2;
if (cached_has_bits & 0x00000001u) {
total_size += 1 + 1;
@ -8839,6 +8900,11 @@ failure:
total_size += 1 + 1;
}
// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
if (cached_has_bits & 0x00000004u) {
total_size += 1 + 1;
}
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
@ -8861,13 +8927,16 @@ void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PR
_this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_);
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_this->_impl_.allow_alias_ = from._impl_.allow_alias_;
}
if (cached_has_bits & 0x00000002u) {
_this->_impl_.deprecated_ = from._impl_.deprecated_;
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_);
@ -8898,8 +8967,8 @@ void EnumOptions::InternalSwap(EnumOptions* other) {
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
_impl_.uninterpreted_option_.InternalSwap(&other->_impl_.uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.deprecated_)
+ sizeof(EnumOptions::_impl_.deprecated_)
PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.deprecated_legacy_json_field_conflicts_)
+ sizeof(EnumOptions::_impl_.deprecated_legacy_json_field_conflicts_)
- PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.allow_alias_)>(
reinterpret_cast<char*>(&_impl_.allow_alias_),
reinterpret_cast<char*>(&other->_impl_.allow_alias_));

@ -4396,6 +4396,7 @@ class PROTOBUF_EXPORT MessageOptions final :
kNoStandardDescriptorAccessorFieldNumber = 2,
kDeprecatedFieldNumber = 3,
kMapEntryFieldNumber = 7,
kDeprecatedLegacyJsonFieldConflictsFieldNumber = 11,
};
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int uninterpreted_option_size() const;
@ -4455,6 +4456,16 @@ class PROTOBUF_EXPORT MessageOptions final :
void _internal_set_map_entry(bool value);
public:
// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
PROTOBUF_DEPRECATED bool has_deprecated_legacy_json_field_conflicts() const;
PROTOBUF_DEPRECATED void clear_deprecated_legacy_json_field_conflicts();
PROTOBUF_DEPRECATED bool deprecated_legacy_json_field_conflicts() const;
PROTOBUF_DEPRECATED void set_deprecated_legacy_json_field_conflicts(bool value);
private:
bool _internal_deprecated_legacy_json_field_conflicts() const;
void _internal_set_deprecated_legacy_json_field_conflicts(bool value);
public:
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
@ -4662,6 +4673,7 @@ class PROTOBUF_EXPORT MessageOptions final :
bool no_standard_descriptor_accessor_;
bool deprecated_;
bool map_entry_;
bool deprecated_legacy_json_field_conflicts_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
@ -5632,6 +5644,7 @@ class PROTOBUF_EXPORT EnumOptions final :
kUninterpretedOptionFieldNumber = 999,
kAllowAliasFieldNumber = 2,
kDeprecatedFieldNumber = 3,
kDeprecatedLegacyJsonFieldConflictsFieldNumber = 6,
};
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int uninterpreted_option_size() const;
@ -5671,6 +5684,16 @@ class PROTOBUF_EXPORT EnumOptions final :
void _internal_set_deprecated(bool value);
public:
// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
PROTOBUF_DEPRECATED bool has_deprecated_legacy_json_field_conflicts() const;
PROTOBUF_DEPRECATED void clear_deprecated_legacy_json_field_conflicts();
PROTOBUF_DEPRECATED bool deprecated_legacy_json_field_conflicts() const;
PROTOBUF_DEPRECATED void set_deprecated_legacy_json_field_conflicts(bool value);
private:
bool _internal_deprecated_legacy_json_field_conflicts() const;
void _internal_set_deprecated_legacy_json_field_conflicts(bool value);
public:
template <typename _proto_TypeTraits,
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
@ -5876,6 +5899,7 @@ class PROTOBUF_EXPORT EnumOptions final :
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_;
bool allow_alias_;
bool deprecated_;
bool deprecated_legacy_json_field_conflicts_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
@ -12604,6 +12628,31 @@ inline void MessageOptions::set_map_entry(bool value) {
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry)
}
// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
inline bool MessageOptions::has_deprecated_legacy_json_field_conflicts() const {
bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0;
return value;
}
inline void MessageOptions::clear_deprecated_legacy_json_field_conflicts() {
_impl_.deprecated_legacy_json_field_conflicts_ = false;
_impl_._has_bits_[0] &= ~0x00000010u;
}
inline bool MessageOptions::_internal_deprecated_legacy_json_field_conflicts() const {
return _impl_.deprecated_legacy_json_field_conflicts_;
}
inline bool MessageOptions::deprecated_legacy_json_field_conflicts() const {
// @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts)
return _internal_deprecated_legacy_json_field_conflicts();
}
inline void MessageOptions::_internal_set_deprecated_legacy_json_field_conflicts(bool value) {
_impl_._has_bits_[0] |= 0x00000010u;
_impl_.deprecated_legacy_json_field_conflicts_ = value;
}
inline void MessageOptions::set_deprecated_legacy_json_field_conflicts(bool value) {
_internal_set_deprecated_legacy_json_field_conflicts(value);
// @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
inline int MessageOptions::_internal_uninterpreted_option_size() const {
return _impl_.uninterpreted_option_.size();
@ -12963,6 +13012,31 @@ inline void EnumOptions::set_deprecated(bool value) {
// @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated)
}
// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
inline bool EnumOptions::has_deprecated_legacy_json_field_conflicts() const {
bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
return value;
}
inline void EnumOptions::clear_deprecated_legacy_json_field_conflicts() {
_impl_.deprecated_legacy_json_field_conflicts_ = false;
_impl_._has_bits_[0] &= ~0x00000004u;
}
inline bool EnumOptions::_internal_deprecated_legacy_json_field_conflicts() const {
return _impl_.deprecated_legacy_json_field_conflicts_;
}
inline bool EnumOptions::deprecated_legacy_json_field_conflicts() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts)
return _internal_deprecated_legacy_json_field_conflicts();
}
inline void EnumOptions::_internal_set_deprecated_legacy_json_field_conflicts(bool value) {
_impl_._has_bits_[0] |= 0x00000004u;
_impl_.deprecated_legacy_json_field_conflicts_ = value;
}
inline void EnumOptions::set_deprecated_legacy_json_field_conflicts(bool value) {
_internal_set_deprecated_legacy_json_field_conflicts(value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
inline int EnumOptions::_internal_uninterpreted_option_size() const {
return _impl_.uninterpreted_option_.size();

@ -518,6 +518,18 @@ message MessageOptions {
reserved 8; // javalite_serializable
reserved 9; // javanano_as_lite
// Enable the legacy handling of JSON field name conflicts. This lowercases
// and strips underscored from the fields before comparison in proto3 only.
// The new behavior takes `json_name` into account and applies to proto2 as
// well.
//
// This should only be used as a temporary measure against broken builds due
// to the change in behavior for JSON field name conflicts.
//
// TODO(b/261750190) This is legacy behavior we plan to remove once downstream
// teams have had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
@ -646,6 +658,14 @@ message EnumOptions {
reserved 5; // javanano_as_lite
// Enable the legacy handling of JSON field name conflicts. This lowercases
// and strips underscored from the fields before comparison in proto3 only.
// The new behavior takes `json_name` into account and applies to proto2 as
// well.
// TODO(b/261750190) Remove this legacy behavior once downstream teams have
// had time to migrate.
optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;

@ -51,7 +51,7 @@ namespace {
void RecordMessageNames(const DescriptorProto& desc_proto,
const std::string& prefix,
std::set<std::string>* output) {
GOOGLE_CHECK(desc_proto.has_name());
GOOGLE_ABSL_CHECK(desc_proto.has_name());
std::string full_name = prefix.empty()
? desc_proto.name()
: absl::StrCat(prefix, ".", desc_proto.name());
@ -81,7 +81,7 @@ bool ForAllFileProtos(DescriptorDatabase* db, Fn callback,
for (const auto& f : file_names) {
file_proto.Clear();
if (!db->FindFileByName(f, &file_proto)) {
GOOGLE_LOG(ERROR) << "File not found in database (unexpected): " << f;
GOOGLE_ABSL_LOG(ERROR) << "File not found in database (unexpected): " << f;
return false;
}
callback(file_proto, &set);
@ -120,7 +120,7 @@ template <typename Value>
bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddFile(
const FileDescriptorProto& file, Value value) {
if (!by_name_.insert({file.name(), value}).second) {
GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name();
GOOGLE_ABSL_LOG(ERROR) << "File already exists in database: " << file.name();
return false;
}
@ -204,7 +204,7 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol(
// relies on the fact that '.' sorts before all other characters that are
// valid in symbol names).
if (!ValidateSymbolName(name)) {
GOOGLE_LOG(ERROR) << "Invalid symbol name: " << name;
GOOGLE_ABSL_LOG(ERROR) << "Invalid symbol name: " << name;
return false;
}
@ -220,10 +220,10 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol(
}
if (IsSubSymbol(iter->first, name)) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << name
<< "\" conflicts with the existing "
"symbol \""
<< iter->first << "\".";
GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << name
<< "\" conflicts with the existing "
"symbol \""
<< iter->first << "\".";
return false;
}
@ -235,10 +235,10 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol(
++iter;
if (iter != by_symbol_.end() && IsSubSymbol(name, iter->first)) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << name
<< "\" conflicts with the existing "
"symbol \""
<< iter->first << "\".";
GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << name
<< "\" conflicts with the existing "
"symbol \""
<< iter->first << "\".";
return false;
}
@ -278,10 +278,11 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddExtension(
{std::make_pair(field.extendee().substr(1), field.number()),
value})
.second) {
GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: "
"extend "
<< field.extendee() << " { " << field.name() << " = "
<< field.number() << " } from:" << filename;
GOOGLE_ABSL_LOG(ERROR)
<< "Extension conflicts with extension already in database: "
"extend "
<< field.extendee() << " { " << field.name() << " = "
<< field.number() << " } from:" << filename;
return false;
}
} else {
@ -567,8 +568,8 @@ bool EncodedDescriptorDatabase::Add(const void* encoded_file_descriptor,
if (file.ParseFromArray(encoded_file_descriptor, size)) {
return index_->AddFile(file, std::make_pair(encoded_file_descriptor, size));
} else {
GOOGLE_LOG(ERROR) << "Invalid file descriptor data passed to "
"EncodedDescriptorDatabase::Add().";
GOOGLE_ABSL_LOG(ERROR) << "Invalid file descriptor data passed to "
"EncodedDescriptorDatabase::Add().";
return false;
}
}
@ -639,7 +640,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddFile(const FileProto& file,
all_values_.push_back({value.first, value.second, {}});
if (!ValidateSymbolName(file.package())) {
GOOGLE_LOG(ERROR) << "Invalid package name: " << file.package();
GOOGLE_ABSL_LOG(ERROR) << "Invalid package name: " << file.package();
return false;
}
all_values_.back().encoded_package = EncodeString(file.package());
@ -650,7 +651,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddFile(const FileProto& file,
.second ||
std::binary_search(by_name_flat_.begin(), by_name_flat_.end(),
file.name(), by_name_.key_comp())) {
GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name();
GOOGLE_ABSL_LOG(ERROR) << "File already exists in database: " << file.name();
return false;
}
@ -677,9 +678,9 @@ static bool CheckForMutualSubsymbols(absl::string_view symbol_name, Iter* iter,
Iter2 end, const Index& index) {
if (*iter != end) {
if (IsSubSymbol((*iter)->AsString(index), symbol_name)) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
<< (*iter)->AsString(index) << "\".";
GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
<< (*iter)->AsString(index) << "\".";
return false;
}
@ -691,9 +692,9 @@ static bool CheckForMutualSubsymbols(absl::string_view symbol_name, Iter* iter,
++*iter;
if (*iter != end && IsSubSymbol(symbol_name, (*iter)->AsString(index))) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
<< (*iter)->AsString(index) << "\".";
GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
<< (*iter)->AsString(index) << "\".";
return false;
}
}
@ -712,7 +713,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddSymbol(
// relies on the fact that '.' sorts before all other characters that are
// valid in symbol names).
if (!ValidateSymbolName(symbol)) {
GOOGLE_LOG(ERROR) << "Invalid symbol name: " << entry_as_string;
GOOGLE_ABSL_LOG(ERROR) << "Invalid symbol name: " << entry_as_string;
return false;
}
@ -765,10 +766,11 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddExtension(
by_extension_flat_.begin(), by_extension_flat_.end(),
std::make_pair(field.extendee().substr(1), field.number()),
by_extension_.key_comp())) {
GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: "
"extend "
<< field.extendee() << " { " << field.name() << " = "
<< field.number() << " } from:" << filename;
GOOGLE_ABSL_LOG(ERROR)
<< "Extension conflicts with extension already in database: "
"extend "
<< field.extendee() << " { " << field.name() << " = "
<< field.number() << " } from:" << filename;
return false;
}
} else {

@ -171,7 +171,7 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase {
// Adds the FileDescriptorProto to the database, making a copy. The object
// can be deleted after Add() returns. Returns false if the file conflicted
// with a file already in the database, in which case an error will have
// been written to GOOGLE_LOG(ERROR).
// been written to GOOGLE_ABSL_LOG(ERROR).
bool Add(const FileDescriptorProto& file);
// Adds the FileDescriptorProto to the database and takes ownership of it.

@ -39,7 +39,6 @@
#include <algorithm>
#include <memory>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/text_format.h"

@ -46,7 +46,6 @@
#include "google/protobuf/unittest.pb.h"
#include "google/protobuf/unittest_custom_options.pb.h"
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor_database.h"
@ -55,6 +54,8 @@
#include <gmock/gmock.h>
#include "google/protobuf/testing/googletest.h"
#include <gtest/gtest.h>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/unittest_lazy_dependencies.pb.h"
#include "google/protobuf/unittest_lazy_dependencies_custom_option.pb.h"
#include "google/protobuf/unittest_lazy_dependencies_enum.pb.h"
@ -2990,7 +2991,7 @@ class AllowUnknownDependenciesTest
return pool_->FindFileByName(proto.name());
}
}
GOOGLE_LOG(FATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(FATAL) << "Can't get here.";
return nullptr;
}
@ -3215,7 +3216,7 @@ TEST_P(AllowUnknownDependenciesTest,
const FileDescriptor* file = BuildFile(test_proto);
ASSERT_TRUE(file != nullptr);
GOOGLE_LOG(INFO) << file->DebugString();
GOOGLE_ABSL_LOG(INFO) << file->DebugString();
EXPECT_EQ(0, file->dependency_count());
ASSERT_EQ(1, file->message_type_count());
@ -6067,7 +6068,7 @@ TEST_F(ValidationErrorTest, RollbackAfterError) {
}
TEST_F(ValidationErrorTest, ErrorsReportedToLogError) {
// Test that errors are reported to GOOGLE_LOG(ERROR) if no error collector is
// Test that errors are reported to GOOGLE_ABSL_LOG(ERROR) if no error collector is
// provided.
FileDescriptorProto file_proto;
@ -7402,11 +7403,11 @@ class ExponentialErrorDatabase : public DescriptorDatabase {
absl::string_view end_with, int32_t* file_num) {
if (!absl::ConsumePrefix(&name, begin_with)) return;
if (!absl::ConsumeSuffix(&name, end_with)) return;
GOOGLE_CHECK(absl::SimpleAtoi(name, file_num));
GOOGLE_ABSL_CHECK(absl::SimpleAtoi(name, file_num));
}
bool PopulateFile(int file_num, FileDescriptorProto* output) {
GOOGLE_CHECK_GE(file_num, 0);
GOOGLE_ABSL_CHECK_GE(file_num, 0);
output->Clear();
output->set_name(absl::Substitute("file$0.proto", file_num));
// file0.proto doesn't define Message0
@ -7431,7 +7432,7 @@ TEST_F(DatabaseBackedPoolTest, DoesntReloadKnownBadFiles) {
ExponentialErrorDatabase error_database;
DescriptorPool pool(&error_database);
GOOGLE_LOG(INFO) << "A timeout in this test probably indicates a real bug.";
GOOGLE_ABSL_LOG(INFO) << "A timeout in this test probably indicates a real bug.";
EXPECT_TRUE(pool.FindFileByName("file40.proto") == nullptr);
EXPECT_TRUE(pool.FindMessageTypeByName("Message40") == nullptr);
@ -7476,8 +7477,8 @@ class AbortingErrorCollector : public DescriptorPool::ErrorCollector {
void AddError(const std::string& filename, const std::string& element_name,
const Message* message, ErrorLocation location,
const std::string& error_message) override {
GOOGLE_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " ["
<< element_name << "]: " << error_message;
GOOGLE_ABSL_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " ["
<< element_name << "]: " << error_message;
}
};

@ -178,7 +178,7 @@ int FieldSpaceUsed(const FieldDescriptor* field) {
}
}
GOOGLE_LOG(DFATAL) << "Can't get here.";
GOOGLE_ABSL_LOG(DFATAL) << "Can't get here.";
return 0;
}
@ -587,7 +587,7 @@ DynamicMessage::~DynamicMessage() {
void DynamicMessage::CrossLinkPrototypes() {
// This should only be called on the prototype message.
GOOGLE_CHECK(is_prototype());
GOOGLE_ABSL_CHECK(is_prototype());
DynamicMessageFactory* factory = type_info_->factory;
const Descriptor* descriptor = type_info_->type;

@ -163,9 +163,9 @@ class PROTOBUF_EXPORT DynamicMapSorter {
#ifndef NDEBUG
for (size_t j = 1; j < static_cast<size_t>(map_size); j++) {
if (!comparator(result[j - 1], result[j])) {
GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1])
? "internal error in map key sorting"
: "map keys are not unique");
GOOGLE_ABSL_LOG(ERROR) << (comparator(result[j], result[j - 1])
? "internal error in map key sorting"
: "map keys are not unique");
}
}
#endif
@ -212,7 +212,7 @@ class PROTOBUF_EXPORT DynamicMapSorter {
return first < second;
}
default:
GOOGLE_LOG(DFATAL) << "Invalid key for map field.";
GOOGLE_ABSL_LOG(DFATAL) << "Invalid key for map field.";
return true;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save