diff --git a/.gitmodules b/.gitmodules index bcd125a49..666a87687 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "third_party/benchmark"] path = third_party/benchmark url = https://github.com/google/benchmark.git + ignore = dirty [submodule "third_party/googletest"] path = third_party/googletest url = https://github.com/google/googletest.git diff --git a/BUILD.bazel b/BUILD.bazel index 98584b604..96d973c0d 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "c load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library") -load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS") +load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS", "PROTOC_LINK_OPTS") load(":protobuf.bzl", "py_proto_library") licenses(["notice"]) @@ -128,13 +128,30 @@ cc_library( visibility = ["//visibility:public"], ) +# Source protos that are typically part of the protobuf runtime. +# +# DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types +# (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) +# or :descriptor_proto(_srcs) for descriptor.proto (source), or +# :compiler_plugin_proto for compiler/plugin.proto. +filegroup( + name = "well_known_protos", + srcs = [ + ":descriptor_proto_srcs", + ":well_known_type_protos", + "//src/google/protobuf/compiler:plugin.proto", + ], + deprecation = "Prefer :well_known_type_protos instead.", + visibility = ["//visibility:public"], +) + ################################################################################ # Protocol Buffers Compiler ################################################################################ cc_binary( name = "protoc", - linkopts = LINK_OPTS, + linkopts = LINK_OPTS + PROTOC_LINK_OPTS, visibility = ["//visibility:public"], deps = ["//src/google/protobuf/compiler:protoc_lib"], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd8977843..04cb3303a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,15 +162,6 @@ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) find_package(Threads REQUIRED) -# We can install dependencies from submodules if we're running -# CMake v3.13 or newer. -if(CMAKE_VERSION VERSION_LESS 3.13) - set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE OFF) -else() - set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE ON) -endif() - - set(_protobuf_FIND_ZLIB) if (protobuf_WITH_ZLIB) find_package(ZLIB) @@ -313,10 +304,6 @@ if (protobuf_UNICODE) add_definitions(-DUNICODE -D_UNICODE) endif (protobuf_UNICODE) -set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library") -set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package") - -include(${protobuf_SOURCE_DIR}/cmake/abseil-cpp.cmake) include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake) include(${protobuf_SOURCE_DIR}/cmake/libprotobuf.cmake) if (protobuf_BUILD_LIBPROTOC) diff --git a/Makefile.am b/Makefile.am index 7f064294b..9491780a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1214,7 +1214,6 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ build_files_updated_unittest.sh \ cmake/CMakeLists.txt \ cmake/README.md \ - cmake/abseil-cpp.cmake \ cmake/conformance.cmake \ cmake/examples.cmake \ cmake/extract_includes.bat.in \ diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 9d8815a8c..68571e14b 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '3.21.0-rc1' + s.version = '3.21.1' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' @@ -35,6 +35,7 @@ Pod::Spec.new do |s| # Do not let src/google/protobuf/stubs/time.h override system API 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + 'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/src"' } end diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 29a1f1256..a5d831c9a 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -59,6 +59,20 @@ config_setting( }, ) +config_setting( + name = "config_win32", + values = { + "cpu": "win32", + }, +) + +config_setting( + name = "config_win64", + values = { + "cpu": "win64", + }, +) + # Internal testing: starlark_cc_proto_library( diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl index 94966e3af..f21b861c0 100644 --- a/build_defs/cpp_opts.bzl +++ b/build_defs/cpp_opts.bzl @@ -38,3 +38,10 @@ LINK_OPTS = select({ "-lm", ], }) + +# When cross-compiling for Windows we need to statically link pthread and the C++ library. +PROTOC_LINK_OPTS = select({ + "//build_defs:config_win32": ["-static"], + "//build_defs:config_win64": ["-static"], + "//conditions:default": [], +}) diff --git a/cmake/install.cmake b/cmake/install.cmake index c1f6f4aab..825cb25fc 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -128,20 +128,24 @@ configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake if (protobuf_BUILD_PROTOC_BINARIES) export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc NAMESPACE protobuf:: - FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/protobuf/protobuf-targets.cmake + FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake ) else (protobuf_BUILD_PROTOC_BINARIES) export(TARGETS libprotobuf-lite libprotobuf NAMESPACE protobuf:: - FILE ${CMAKE_CURRENT_BINARY_DIR}/cmake/protobuf/protobuf-targets.cmake + FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake ) endif (protobuf_BUILD_PROTOC_BINARIES) install(EXPORT protobuf-targets - FILE protobuf-targets.cmake DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" NAMESPACE protobuf:: + COMPONENT protobuf-export) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT protobuf-export + PATTERN protobuf-targets.cmake EXCLUDE ) option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF) diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in index 597f58860..67b8bf00f 100644 --- a/cmake/protobuf-config.cmake.in +++ b/cmake/protobuf-config.cmake.in @@ -3,7 +3,6 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") # Depend packages @_protobuf_FIND_ZLIB@ -@_protobuf_FIND_ABSL@ # Imported targets include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") @@ -12,7 +11,7 @@ function(protobuf_generate) include(CMakeParseArguments) set(_options APPEND_PATH) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() @@ -149,7 +148,7 @@ function(protobuf_generate) OUTPUT ${_generated_srcs} COMMAND protobuf::protoc ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc + DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES} COMMENT ${_comment} VERBATIM ) endforeach() diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake index 385a7a3f3..472b6421b 100644 --- a/cmake/protoc.cmake +++ b/cmake/protoc.cmake @@ -6,7 +6,6 @@ add_executable(protoc ${protoc_files} ${protobuf_version_rc_file}) target_link_libraries(protoc libprotoc libprotobuf - ${protobuf_ABSL_USED_TARGETS} ) add_executable(protobuf::protoc ALIAS protoc) diff --git a/configure.ac b/configure.ac index 61246b27b..55e606478 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.21.0-rc-2],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.21.1],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java index 480f85fd6..f13a94523 100644 --- a/java/core/src/main/java/com/google/protobuf/ByteString.java +++ b/java/core/src/main/java/com/google/protobuf/ByteString.java @@ -385,8 +385,7 @@ public abstract class ByteString implements Iterable, Serializable { // String -> ByteString /** - * Returns a {@code ByteString} from a hexadecimal String. Alternative CharSequences should use - * {@link ByteStrings#decode(CharSequence, BaseEncoding)} + * Returns a {@code ByteString} from a hexadecimal String. * * @param hexString String of hexadecimal digits to create {@code ByteString} from. * @throws NumberFormatException if the hexString does not contain a parsable hex String. diff --git a/kokoro/release/python/linux/build_artifacts.sh b/kokoro/release/python/linux/build_artifacts.sh deleted file mode 100755 index 9a3fc5841..000000000 --- a/kokoro/release/python/linux/build_artifacts.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -set -ex - -# change to repo root -pushd $(dirname $0)/../../../.. - -# Create stage dir -ORIGINAL_DIR=`pwd` -pushd .. -cp -R $ORIGINAL_DIR stage -export STAGE_DIR="`pwd`/stage" -popd - -export REPO_DIR=protobuf -export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"` - -export BUILD_COMMIT=`git rev-parse HEAD` -export PLAT=x86_64 -export UNICODE_WIDTH=32 -export MACOSX_DEPLOYMENT_TARGET=10.9 - -rm -rf artifacts/ -rm -rf multibuild/ -mkdir artifacts -export ARTIFACT_DIR=$(pwd)/artifacts - -git clone https://github.com/matthew-brett/multibuild.git -# Pin multibuild scripts at a known commit to avoid potentially unwanted future changes from -# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180). -# IMPORTANT: always pin multibuild at the same commit for: -# - linux/build_artifacts.sh -# - linux/build_artifacts.sh -# - windows/build_artifacts.bat -(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313) -cp kokoro/release/python/linux/config.sh config.sh - -build_artifact_version() { - MB_PYTHON_VERSION=$1 - cp -R $STAGE_DIR $REPO_DIR - - source multibuild/common_utils.sh - source multibuild/travis_steps.sh - before_install - - clean_code $REPO_DIR $BUILD_COMMIT - - build_wheel $REPO_DIR/python $PLAT - - mv wheelhouse/* $ARTIFACT_DIR - - # Clean up env - rm -rf venv - sudo rm -rf $REPO_DIR -} - -build_x86_64_manylinux1_artifact_version() { - # Explicitly request building manylinux1 wheels, which is no longer the default. - # https://github.com/protocolbuffers/protobuf/issues/9180 - MB_ML_VER=1 - build_artifact_version $@ -} - -build_x86_64_manylinux2010_artifact_version() { - # Explicitly request building manylinux2010 wheels - MB_ML_VER=2010 - build_artifact_version $@ -} - -build_crosscompiled_aarch64_manylinux2014_artifact_version() { - # crosscompilation is only supported with the dockcross manylinux2014 image - DOCKER_IMAGE=dockcross/manylinux2014-aarch64:20210706-65bf2dd - MB_ML_VER=2014 - PLAT=aarch64 - - # TODO(jtatermusch): currently when crosscompiling, "auditwheel repair" will be disabled - # since auditwheel doesn't work for crosscomiled wheels. - build_artifact_version $@ -} - -build_x86_64_manylinux1_artifact_version 3.6 -build_x86_64_manylinux1_artifact_version 3.7 -build_x86_64_manylinux1_artifact_version 3.8 -build_x86_64_manylinux1_artifact_version 3.9 -build_x86_64_manylinux2010_artifact_version 3.10 - -build_crosscompiled_aarch64_manylinux2014_artifact_version 3.7 -build_crosscompiled_aarch64_manylinux2014_artifact_version 3.8 -build_crosscompiled_aarch64_manylinux2014_artifact_version 3.9 -build_crosscompiled_aarch64_manylinux2014_artifact_version 3.10 diff --git a/kokoro/release/python/linux/config.sh b/kokoro/release/python/linux/config.sh deleted file mode 100644 index 892049556..000000000 --- a/kokoro/release/python/linux/config.sh +++ /dev/null @@ -1,93 +0,0 @@ -# Define custom utilities -# Test for OSX with [ -n "$IS_OSX" ] - -function pre_build { - # Any stuff that you need to do before you start building the wheels - # Runs in the root directory of this repository. - pushd protobuf - - if [ "$PLAT" == "aarch64" ] - then - local configure_host_flag="--host=aarch64" - fi - - # Build protoc and libprotobuf - ./autogen.sh - CXXFLAGS="-fPIC -g -O2" ./configure $configure_host_flag - make -j8 - - if [ "$PLAT" == "aarch64" ] - then - # we are crosscompiling for aarch64 while running on x64 - # the simplest way for build_py command to be able to generate - # the protos is by running the protoc process under - # an emulator. That way we don't have to build a x64 version - # of protoc. The qemu-arm emulator is already included - # in the dockcross docker image. - # Running protoc under an emulator is fast as protoc doesn't - # really do much. - - # create a simple shell wrapper that runs crosscompiled protoc under qemu - echo '#!/bin/bash' >protoc_qemu_wrapper.sh - echo 'exec qemu-aarch64 "../src/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 - fi - - # Generate python dependencies. - pushd python - python setup.py build_py - popd - - popd -} - -function bdist_wheel_cmd { - # Builds wheel with bdist_wheel, puts into wheelhouse - # - # It may sometimes be useful to use bdist_wheel for the wheel building - # process. For example, versioneer has problems with versions which are - # fixed with bdist_wheel: - # https://github.com/warner/python-versioneer/issues/121 - local abs_wheelhouse=$1 - - # Modify build version - pwd - ls - - if [ "$PLAT" == "aarch64" ] - then - # 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 - local 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"))')" - fi - - python setup.py bdist_wheel --cpp_implementation --compile_static_extension $plat_name_flag - cp dist/*.whl $abs_wheelhouse -} - -function build_wheel { - build_wheel_cmd "bdist_wheel_cmd" $@ -} - -function run_tests { - # Runs tests on installed distribution from an empty directory - python --version - python -c "from google.protobuf.pyext import _message;" -} - -if [ "$PLAT" == "aarch64" ] -then - # when crosscompiling for aarch64, override the default multibuild's repair_wheelhouse logic - # since "auditwheel repair" doesn't work for crosscompiled wheels - function repair_wheelhouse { - echo "Skipping repair_wheelhouse since auditwheel requires build architecture to match wheel architecture." - } -fi diff --git a/kokoro/release/python/linux/continuous.cfg b/kokoro/release/python/linux/continuous.cfg deleted file mode 100644 index c0b9a018f..000000000 --- a/kokoro/release/python/linux/continuous.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Config file for running tests in Kokoro -build_file: "protobuf/kokoro/release/python/linux/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/linux/presubmit.cfg b/kokoro/release/python/linux/presubmit.cfg deleted file mode 100644 index c0b9a018f..000000000 --- a/kokoro/release/python/linux/presubmit.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Config file for running tests in Kokoro -build_file: "protobuf/kokoro/release/python/linux/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/linux/release.cfg b/kokoro/release/python/linux/release.cfg deleted file mode 100644 index b31b3f119..000000000 --- a/kokoro/release/python/linux/release.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Linux release builds -build_file: "protobuf/kokoro/release/python/linux/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/macos/build_artifacts.sh b/kokoro/release/python/macos/build_artifacts.sh deleted file mode 100755 index aeb4242a6..000000000 --- a/kokoro/release/python/macos/build_artifacts.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -set -ex - -# change to repo root -pushd $(dirname $0)/../../../.. - -# Create stage dir -ORIGINAL_DIR=`pwd` -pushd .. -cp -R $ORIGINAL_DIR stage -export STAGE_DIR="`pwd`/stage" -popd - -export REPO_DIR=protobuf -export BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"` -export BUILD_COMMIT=`git rev-parse HEAD` -export PLAT=x86_64 -export UNICODE_WIDTH=32 -export MACOSX_DEPLOYMENT_TARGET=10.9 -export TRAVIS_OS_NAME="osx" - -rm -rf artifacts/ -rm -rf multibuild/ -mkdir artifacts -export ARTIFACT_DIR=$(pwd)/artifacts - -git clone https://github.com/matthew-brett/multibuild.git -# Pin multibuild scripts at a known commit to avoid potentially unwanted future changes from -# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180). -# IMPORTANT: always pin multibuild at the same commit for: -# - linux/build_artifacts.sh -# - linux/build_artifacts.sh -# - windows/build_artifacts.bat -(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313) -cp kokoro/release/python/macos/config.sh config.sh - -OLD_PATH=$PATH - -build_artifact_version() { - MB_PYTHON_VERSION=$1 - - # Clean up env - rm -rf venv - sudo rm -rf $REPO_DIR - cp -R $STAGE_DIR $REPO_DIR - export PATH=$OLD_PATH - - source multibuild/common_utils.sh - source multibuild/travis_steps.sh - before_install - - clean_code $REPO_DIR $BUILD_COMMIT - - build_wheel $REPO_DIR/python $PLAT - - mv wheelhouse/* $ARTIFACT_DIR -} - -export MB_PYTHON_OSX_VER=10.9 -build_artifact_version 3.6 -build_artifact_version 3.7 -build_artifact_version 3.8 -build_artifact_version 3.9 -build_artifact_version 3.10 diff --git a/kokoro/release/python/macos/config.sh b/kokoro/release/python/macos/config.sh deleted file mode 100644 index 250c76bc0..000000000 --- a/kokoro/release/python/macos/config.sh +++ /dev/null @@ -1,68 +0,0 @@ -# Define custom utilities -# Test for OSX with [ -n "$IS_OSX" ] - -function remove_travis_ve_pip { - # Removing the system virtualenv or pip can be very problematic for - # macOS on Kokoro, so just leave them be. - :; -} - -function install_pip { - check_python - PIP_CMD="sudo $PYTHON_EXE -m pip${pip_args:+ $pip_args}" - $PIP_CMD install --upgrade pip -} - -function install_virtualenv { - check_python - check_pip - $PIP_CMD install --upgrade virtualenv - VIRTUALENV_CMD="$PYTHON_EXE -m virtualenv" -} - -function pre_build { - # Any stuff that you need to do before you start building the wheels - # Runs in the root directory of this repository. - pushd protobuf - - # Build protoc and protobuf libraries - use_bazel.sh 5.1.1 - bazel build -c opt //:protoc //pkg:protobuf //pkg:protobuf_lite - local _bazel_bin=$(bazel info -c opt bazel-bin) - export PROTOC=${_bazel_bin}/protoc - export LIBPROTOBUF=${_bazel_bin}/pkg/libprotobuf.a - - # Generate python dependencies. - pushd python - python setup.py build_py - popd - - popd -} - -function bdist_wheel_cmd { - # Builds wheel with bdist_wheel, puts into wheelhouse - # - # It may sometimes be useful to use bdist_wheel for the wheel building - # process. For example, versioneer has problems with versions which are - # fixed with bdist_wheel: - # https://github.com/warner/python-versioneer/issues/121 - local abs_wheelhouse=$1 - - # Modify build version - pwd - ls - python setup.py build_ext --cpp_implementation -O${LIBPROTOBUF} - python setup.py bdist_wheel --cpp_implementation - cp dist/*.whl $abs_wheelhouse -} - -function build_wheel { - build_wheel_cmd "bdist_wheel_cmd" $@ -} - -function run_tests { - # Runs tests on installed distribution from an empty directory - python --version - python -c "from google.protobuf.pyext import _message;" -} diff --git a/kokoro/release/python/macos/continuous.cfg b/kokoro/release/python/macos/continuous.cfg deleted file mode 100644 index 85cf81b50..000000000 --- a/kokoro/release/python/macos/continuous.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Mac OSX release builds -build_file: "protobuf/kokoro/release/python/macos/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/macos/presubmit.cfg b/kokoro/release/python/macos/presubmit.cfg deleted file mode 100644 index 85cf81b50..000000000 --- a/kokoro/release/python/macos/presubmit.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Mac OSX release builds -build_file: "protobuf/kokoro/release/python/macos/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/macos/release.cfg b/kokoro/release/python/macos/release.cfg deleted file mode 100644 index 85cf81b50..000000000 --- a/kokoro/release/python/macos/release.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Mac OSX release builds -build_file: "protobuf/kokoro/release/python/macos/build_artifacts.sh" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/windows/build_artifacts.bat b/kokoro/release/python/windows/build_artifacts.bat deleted file mode 100644 index 121283a43..000000000 --- a/kokoro/release/python/windows/build_artifacts.bat +++ /dev/null @@ -1,88 +0,0 @@ -REM Move scripts to root -set REPO_DIR_STAGE=%cd%\github\protobuf-stage -xcopy /S github\protobuf "%REPO_DIR_STAGE%\" -cd github\protobuf -copy kokoro\release\python\windows\build_single_artifact.bat build_single_artifact.bat - -REM Set environment variables -set PACKAGE_NAME=protobuf -set REPO_DIR=protobuf -set BUILD_DLL=OFF -set UNICODE=ON -set OTHER_TEST_DEP="setuptools==38.5.1" -set OLD_PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH% - -REM Fetch multibuild -git clone https://github.com/matthew-brett/multibuild.git -REM Pin multibuild scripts at a known commit to avoid potentially unwanted future changes from -REM silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180). -REM IMPORTANT: always pin multibuild at the same commit for: -REM - linux/build_artifacts.sh -REM - linux/build_artifacts.sh -REM - windows/build_artifacts.bat -cd multibuild -git checkout b89bb903e94308be79abefa4f436bf123ebb1313 -cd .. - -REM Install zlib -mkdir zlib -curl -L -o zlib.zip http://www.winimage.com/zLibDll/zlib123dll.zip -curl -L -o zlib-src.zip http://www.winimage.com/zLibDll/zlib123.zip -7z x zlib.zip -ozlib -7z x zlib-src.zip -ozlib\include -SET ZLIB_ROOT=%cd%\zlib -del /Q zlib.zip -del /Q zlib-src.zip - -REM Create directory for artifacts -SET ARTIFACT_DIR=%cd%\artifacts -mkdir %ARTIFACT_DIR% - -REM Build wheel - -SET PYTHON=C:\python37_32bit -SET PYTHON_VERSION=3.7 -SET PYTHON_ARCH=32 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python37 -SET PYTHON_VERSION=3.7 -SET PYTHON_ARCH=64 -CALL build_single_artifact.bat || goto :error - -powershell -File kokoro/release/python/windows/install_python_interpreters.ps1 - -SET PYTHON=C:\python38_32bit -SET PYTHON_VERSION=3.8 -SET PYTHON_ARCH=32 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python38 -SET PYTHON_VERSION=3.8 -SET PYTHON_ARCH=64 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python39_32bit -SET PYTHON_VERSION=3.9 -SET PYTHON_ARCH=32 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python39 -SET PYTHON_VERSION=3.9 -SET PYTHON_ARCH=64 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python310_32bit -SET PYTHON_VERSION=3.10 -SET PYTHON_ARCH=32 -CALL build_single_artifact.bat || goto :error - -SET PYTHON=C:\python310 -SET PYTHON_VERSION=3.10 -SET PYTHON_ARCH=64 -CALL build_single_artifact.bat || goto :error - -goto :EOF - -:error -exit /b %errorlevel% diff --git a/kokoro/release/python/windows/build_single_artifact.bat b/kokoro/release/python/windows/build_single_artifact.bat deleted file mode 100644 index af2d26526..000000000 --- a/kokoro/release/python/windows/build_single_artifact.bat +++ /dev/null @@ -1,78 +0,0 @@ -setlocal - -if %PYTHON%==C:\python37_32bit set generator=Visual Studio 14 -if %PYTHON%==C:\python37_32bit set vcplatform=Win32 - -if %PYTHON%==C:\python37 set generator=Visual Studio 14 Win64 -if %PYTHON%==C:\python37 set vcplatform=x64 - -if %PYTHON%==C:\python38_32bit set generator=Visual Studio 14 -if %PYTHON%==C:\python38_32bit set vcplatform=Win32 - -if %PYTHON%==C:\python38 set generator=Visual Studio 14 Win64 -if %PYTHON%==C:\python38 set vcplatform=x64 - -if %PYTHON%==C:\python39_32bit set generator=Visual Studio 14 -if %PYTHON%==C:\python39_32bit set vcplatform=Win32 - -if %PYTHON%==C:\python39 set generator=Visual Studio 14 Win64 -if %PYTHON%==C:\python39 set vcplatform=x64 - -if %PYTHON%==C:\python310_32bit set generator=Visual Studio 14 -if %PYTHON%==C:\python310_32bit set vcplatform=Win32 - -if %PYTHON%==C:\python310 set generator=Visual Studio 14 Win64 -if %PYTHON%==C:\python310 set vcplatform=x64 - -REM Prepend newly installed Python to the PATH of this build (this cannot be -REM done from inside the powershell script as it would require to restart -REM the parent CMD process). -SET PATH=C:\Program Files\CMake\bin;%PYTHON%;%PYTHON%\Scripts;%OLD_PATH% -python -m pip install -U pip -pip install wheel - -REM Check that we have the expected version and architecture for Python -python --version -python -c "import struct; print(struct.calcsize('P') * 8)" - -rmdir /s/q %REPO_DIR% -xcopy /s %REPO_DIR_STAGE% "%REPO_DIR%\" - -REM Checkout release commit -cd %REPO_DIR% - -REM ====================== -REM Build Protobuf Library -REM ====================== - -mkdir src\.libs - -mkdir vcprojects -pushd vcprojects -cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake || goto :error -msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release || goto :error -dir /s /b -popd -copy vcprojects\Release\libprotobuf.lib src\.libs\libprotobuf.a -copy vcprojects\Release\libprotobuf-lite.lib src\.libs\libprotobuf-lite.a -SET PATH=%cd%\vcprojects\Release;%PATH% -dir vcprojects\Release - -REM ====================== -REM Build python library -REM ====================== - -cd python - -REM sed -i 's/\ extra_compile_args\ =\ \[\]/\ extra_compile_args\ =\ \[\'\/MT\'\]/g' setup.py - -python setup.py bdist_wheel --cpp_implementation --compile_static_extension -dir dist -copy dist\* %ARTIFACT_DIR% -dir %ARTIFACT_DIR% -cd ..\.. - -goto :EOF - -:error -exit /b %errorlevel% diff --git a/kokoro/release/python/windows/continuous.cfg b/kokoro/release/python/windows/continuous.cfg deleted file mode 100644 index 526160647..000000000 --- a/kokoro/release/python/windows/continuous.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Windows protoc release builds -build_file: "protobuf/kokoro/release/python/windows/build_artifacts.bat" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/windows/install_python_interpreters.ps1 b/kokoro/release/python/windows/install_python_interpreters.ps1 deleted file mode 100644 index 3f8db95b7..000000000 --- a/kokoro/release/python/windows/install_python_interpreters.ps1 +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env powershell -# Install Python 3.8 for x64 and x86 in order to build wheels on Windows. -# Originally from grpc/tools/internal_ci/helper_scripts/install_python_interpreters.ps1 - -Set-StrictMode -Version 2 -$ErrorActionPreference = 'Stop' - -trap { - $ErrorActionPreference = "Continue" - Write-Error $_ - exit 1 -} - -# Avoid "Could not create SSL/TLS secure channel" -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -function Install-Python { - Param( - [string]$PythonVersion, - [string]$PythonInstaller, - [string]$PythonInstallPath, - [string]$PythonInstallerHash - ) - $PythonInstallerUrl = "https://www.python.org/ftp/python/$PythonVersion/$PythonInstaller.exe" - $PythonInstallerPath = "C:\tools\$PythonInstaller.exe" - - # Downloads installer - Write-Host "Downloading the Python installer: $PythonInstallerUrl => $PythonInstallerPath" - Invoke-WebRequest -Uri $PythonInstallerUrl -OutFile $PythonInstallerPath - - # Validates checksum - $HashFromDownload = Get-FileHash -Path $PythonInstallerPath -Algorithm MD5 - if ($HashFromDownload.Hash -ne $PythonInstallerHash) { - throw "Invalid Python installer: failed checksum!" - } - Write-Host "Python installer $PythonInstallerPath validated." - - # Installs Python - & $PythonInstallerPath /passive InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=$PythonInstallPath - if (-Not $?) { - throw "The Python installation exited with error!" - } - - # NOTE(lidiz) Even if the install command finishes in the script, that - # doesn't mean the Python installation is finished. If using "ps" to check - # for running processes, you might see ongoing installers at this point. - # So, we needs this "hack" to reliably validate that the Python binary is - # functioning properly. - - # Wait for the installer process - Wait-Process -Name $PythonInstaller -Timeout 300 - Write-Host "Installation process exits normally." - - # Validate Python binary - $PythonBinary = "$PythonInstallPath\python.exe" - & $PythonBinary -c 'print(42)' - Write-Host "Python binary works properly." - - # Installs pip - & $PythonBinary -m ensurepip --user - - Write-Host "Python $PythonVersion installed by $PythonInstaller at $PythonInstallPath." -} - -# Python 3.8 -$Python38x86Config = @{ - PythonVersion = "3.8.0" - PythonInstaller = "python-3.8.0" - PythonInstallPath = "C:\python38_32bit" - PythonInstallerHash = "412a649d36626d33b8ca5593cf18318c" -} -Install-Python @Python38x86Config - -$Python38x64Config = @{ - PythonVersion = "3.8.0" - PythonInstaller = "python-3.8.0-amd64" - PythonInstallPath = "C:\python38" - PythonInstallerHash = "29ea87f24c32f5e924b7d63f8a08ee8d" -} -Install-Python @Python38x64Config - -# Python 3.9 -$Python39x86Config = @{ - PythonVersion = "3.9.0" - PythonInstaller = "python-3.9.0" - PythonInstallPath = "C:\python39_32bit" - PythonInstallerHash = "4a2812db8ab9f2e522c96c7728cfcccb" -} -Install-Python @Python39x86Config - -$Python39x64Config = @{ - PythonVersion = "3.9.0" - PythonInstaller = "python-3.9.0-amd64" - PythonInstallPath = "C:\python39" - PythonInstallerHash = "b61a33dc28f13b561452f3089c87eb63" -} -Install-Python @Python39x64Config - -# Python 3.10 -$Python310x86Config = @{ - PythonVersion = "3.10.0" - PythonInstaller = "python-3.10.0" - PythonInstallPath = "C:\python310_32bit" - PythonInstallerHash = "133aa48145032e341ad2a000cd3bff50" -} -Install-Python @Python310x86Config - -$Python310x64Config = @{ - PythonVersion = "3.10.0" - PythonInstaller = "python-3.10.0-amd64" - PythonInstallPath = "C:\python310" - PythonInstallerHash = "c3917c08a7fe85db7203da6dcaa99a70" -} -Install-Python @Python310x64Config diff --git a/kokoro/release/python/windows/presubmit.cfg b/kokoro/release/python/windows/presubmit.cfg deleted file mode 100644 index 526160647..000000000 --- a/kokoro/release/python/windows/presubmit.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Windows protoc release builds -build_file: "protobuf/kokoro/release/python/windows/build_artifacts.bat" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/kokoro/release/python/windows/release.cfg b/kokoro/release/python/windows/release.cfg deleted file mode 100644 index 526160647..000000000 --- a/kokoro/release/python/windows/release.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# Configuration for Windows protoc release builds -build_file: "protobuf/kokoro/release/python/windows/build_artifacts.bat" - -action { - define_artifacts { - regex: "github/protobuf/artifacts/**" - } -} diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index a2663dc2b..2a310963f 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -27,7 +27,7 @@ pkg_files( pkg_files( name = "compiler_plugin_protos_files", srcs = [ - "//src/google/protobuf/compiler:compiler_plugin_protos_files", + "//src/google/protobuf/compiler:compiler_plugin_protos_files", ], prefix = "include/google/protobuf/compiler", visibility = ["//visibility:private"], @@ -304,10 +304,33 @@ gen_file_lists( testonly = 1, out_stem = "src_file_lists", src_libs = { - # source rule: name in generated file + # {[source rule]: [name in generated file]} + # Libraries: ":protobuf": "libprotobuf", - ":protoc": "libprotoc", ":protobuf_lite": "libprotobuf_lite", + ":protoc": "libprotoc", + # Protos: + "//src/google/protobuf:well_known_type_protos": "wkt_protos", + "//src/google/protobuf:descriptor_proto": "descriptor_proto", + "//src/google/protobuf/compiler:plugin_proto": "plugin_proto", + # Test libraries: + ":lite_test_util": "lite_test_util", + ":test_util": "test_util", + # Tests and test-only protos: + "//src/google/protobuf:full_test_srcs": "protobuf_test", + "//src/google/protobuf:test_protos": "protobuf_test_protos", + "//src/google/protobuf:lite_test_srcs": "protobuf_lite_test", + "//src/google/protobuf:lite_test_protos": "protobuf_lite_test_protos", + "//src/google/protobuf/compiler:test_srcs": "compiler_test", + ":compiler_annotation_test_util": "annotation_test_util", + ":compiler_mock_code_generator": "mock_code_generator", + "//src/google/protobuf/compiler:test_proto_srcs": "compiler_test_protos", + "//src/google/protobuf/compiler:test_plugin_srcs": "test_plugin", + "//src/google/protobuf/io:test_srcs": "io_test", + ":testinglib": "testing", + "//src/google/protobuf/util:test_srcs": "util_test", + "//src/google/protobuf/util:test_proto_srcs": "util_test_protos", + "//src/google/protobuf/stubs:test_srcs": "stubs_test", }, ) @@ -362,15 +385,15 @@ cc_dist_library( }), tags = ["manual"], deps = [ + "//src/google/protobuf", "//src/google/protobuf:arena", + "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", "//src/google/protobuf/io:gzip_stream", "//src/google/protobuf/io:io_win32", "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", - "//src/google/protobuf:protobuf", - "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/stubs", "//src/google/protobuf/stubs:lite", "//src/google/protobuf/util:delimited_message_util", @@ -379,6 +402,14 @@ cc_dist_library( "//src/google/protobuf/util:json_util", "//src/google/protobuf/util:time_util", "//src/google/protobuf/util:type_resolver_util", + "//src/google/protobuf/util/internal:datapiece", + "//src/google/protobuf/util/internal:default_value", + "//src/google/protobuf/util/internal:field_mask_utility", + "//src/google/protobuf/util/internal:json", + "//src/google/protobuf/util/internal:object_writer", + "//src/google/protobuf/util/internal:protostream", + "//src/google/protobuf/util/internal:type_info", + "//src/google/protobuf/util/internal:utility", ], ) @@ -398,6 +429,41 @@ cc_dist_library( ], ) +cc_dist_library( + name = "lite_test_util", + testonly = 1, + tags = ["manual"], + deps = ["//src/google/protobuf:lite_test_util"], +) + +cc_dist_library( + name = "test_util", + testonly = 1, + tags = ["manual"], + deps = ["//src/google/protobuf:test_util"], +) + +cc_dist_library( + name = "compiler_annotation_test_util", + deps = ["//src/google/protobuf/compiler:annotation_test_util"], + testonly = 1, + tags = ["manual"], +) + +cc_dist_library( + name = "compiler_mock_code_generator", + deps = ["//src/google/protobuf/compiler:mock_code_generator"], + testonly = 1, + tags = ["manual"], +) + +cc_dist_library( + name = "testinglib", + deps = ["//src/google/protobuf/testing"], + testonly = 1, + tags = ["manual"], +) + ################################################################################ # Distribution sources ################################################################################ diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index bd2faa4e5..56781369c 100644 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '4.21.0rc2' +__version__ = '4.21.1' diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index a8736c337..0f0fd4df6 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -87,6 +87,10 @@ proto_library( name = "descriptor_proto", srcs = ["descriptor.proto"], strip_import_prefix = "/src", + visibility = [ + "//:__pkg__", + "//pkg:__pkg__", + ], ) ################################################################################ @@ -146,10 +150,35 @@ cc_library( "repeated_ptr_field.cc", "wire_format_lite.cc", ], - hdrs = glob([ - "**/*.h", - "**/*.inc", - ]), + hdrs = [ + "any.h", + "arena.h", + "arena_impl.h", + "arenastring.h", + "arenaz_sampler.h", + "endian.h", + "explicitly_constructed.h", + "extension_set.h", + "extension_set_inl.h", + "generated_enum_util.h", + "generated_message_tctable_decl.h", + "generated_message_tctable_impl.h", + "generated_message_util.h", + "has_bits.h", + "implicit_weak_message.h", + "inlined_string_field.h", + "map.h", + "map_entry_lite.h", + "map_field_lite.h", + "map_type_handler.h", + "message_lite.h", + "metadata_lite.h", + "parse_context.h", + "port.h", + "repeated_field.h", + "repeated_ptr_field.h", + "wire_format_lite.h", + ], copts = COPTS + select({ "//build_defs:config_msvc": [], "//conditions:default": [ @@ -201,10 +230,38 @@ cc_library( "wire_format.cc", "wrappers.pb.cc", ], - hdrs = glob([ - "**/*.h", - "**/*.inc", - ]), + hdrs = [ + "any.pb.h", + "api.pb.h", + "descriptor.h", + "descriptor.pb.h", + "descriptor_database.h", + "duration.pb.h", + "dynamic_message.h", + "empty.pb.h", + "field_access_listener.h", + "field_mask.pb.h", + "generated_enum_reflection.h", + "generated_message_bases.h", + "generated_message_reflection.h", + "map_entry.h", + "map_field.h", + "map_field_inl.h", + "message.h", + "metadata.h", + "reflection.h", + "reflection_internal.h", + "reflection_ops.h", + "service.h", + "source_context.pb.h", + "struct.pb.h", + "text_format.h", + "timestamp.pb.h", + "type.pb.h", + "unknown_field_set.h", + "wire_format.h", + "wrappers.pb.h", + ], copts = COPTS, include_prefix = "google/protobuf", linkopts = LINK_OPTS, @@ -442,24 +499,47 @@ filegroup( ) cc_library( - name = "test_util", + name = "lite_test_util", testonly = 1, srcs = [ "arena_test_util.cc", "map_lite_test_util.cc", - "reflection_tester.cc", - "test_util.cc", "test_util_lite.cc", ], hdrs = [ "arena_test_util.h", "map_lite_test_util.h", - "map_test_util.h", "map_test_util_impl.h", - "test_util.h", - "test_util2.h", + "proto3_lite_unittest.inc", "test_util_lite.h", ], + strip_include_prefix = "/src", + visibility = ["//:__subpackages__"], + deps = [ + ":cc_lite_test_protos", + ":test_util2", + "@com_google_googletest//:gtest", + ], +) + +cc_library( + name = "test_util", + testonly = 1, + srcs = [ + "reflection_tester.cc", + "test_util.cc", + ], + hdrs = [ + "map_test.inc", + "map_test_util.h", + "map_test_util.inc", + "message_unittest.inc", + "reflection_tester.h", + "test_util.h", + "test_util.inc", + "test_util_lite.h", + "wire_format_unittest.inc", + ], copts = COPTS + select({ "//build_defs:config_msvc": [], "//conditions:default": [ @@ -467,76 +547,524 @@ cc_library( ], }), strip_include_prefix = "/src", - textual_hdrs = [ - "map_test_util.inc", - "test_util.inc", - ], visibility = ["//:__subpackages__"], deps = [ ":cc_lite_test_protos", ":cc_test_protos", + ":lite_test_util", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + ], +) + +cc_library( + name = "test_util2", + testonly = 1, + hdrs = ["test_util2.h"], + strip_include_prefix = "/src", + textual_hdrs = ["test_util.inc"], + visibility = ["//:__subpackages__"], + deps = [ + "//src/google/protobuf/io", "@com_google_googletest//:gtest", ], ) cc_test( - name = "protobuf_test", - srcs = [ - "any_test.cc", - "arena_unittest.cc", - "arenastring_unittest.cc", - "arenaz_sampler_test.cc", - "descriptor_database_unittest.cc", - "descriptor_unittest.cc", - "drop_unknown_fields_test.cc", - "dynamic_message_unittest.cc", - "extension_set_unittest.cc", - "generated_message_reflection_unittest.cc", - "generated_message_tctable_lite_test.cc", - "inlined_string_field_unittest.cc", - "map_field_test.cc", - "map_test.cc", - "map_test.inc", - "message_unittest.cc", - "message_unittest.inc", - "no_field_presence_test.cc", - "preserve_unknown_enum_test.cc", - "proto3_arena_lite_unittest.cc", - "proto3_arena_unittest.cc", - "proto3_lite_unittest.cc", - "proto3_lite_unittest.inc", - "reflection_ops_unittest.cc", - "repeated_field_reflection_unittest.cc", - "repeated_field_unittest.cc", - "text_format_unittest.cc", - "unknown_field_set_unittest.cc", - "well_known_types_unittest.cc", - "wire_format_unittest.cc", - "wire_format_unittest.inc", + name = "any_test", + srcs = ["any_test.cc"], + deps = [ + ":protobuf", + ":test_util", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], +) + +cc_test( + name = "arena_unittest", + srcs = ["arena_unittest.cc"], copts = COPTS + select({ "//build_defs:config_msvc": [], "//conditions:default": [ - "-Wno-deprecated-declarations", "-Wno-error=sign-compare", ], }), - data = [ - ":testdata", - ] + glob([ - "**/*", - ]), - linkopts = LINK_OPTS, deps = [ - ":cc_lite_test_protos", ":cc_test_protos", + ":lite_test_util", ":protobuf", ":test_util", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "arenastring_unittest", + srcs = ["arenastring_unittest.cc"], + deps = [ + ":protobuf", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "arenaz_sampler_test", + srcs = ["arenaz_sampler_test.cc"], + deps = [ + ":protobuf", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "descriptor_database_unittest", + srcs = ["descriptor_database_unittest.cc"], + deps = [ + ":protobuf", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) + +cc_test( + name = "descriptor_unittest", + srcs = ["descriptor_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + "//src/google/protobuf/compiler:importer", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "drop_unknown_fields_test", + srcs = ["drop_unknown_fields_test.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "dynamic_message_unittest", + srcs = ["dynamic_message_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "extension_set_unittest", + srcs = ["extension_set_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "generated_message_reflection_unittest", + srcs = ["generated_message_reflection_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "generated_message_tctable_lite_test", + srcs = ["generated_message_tctable_lite_test.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":protobuf_lite", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "inlined_string_field_unittest", + srcs = ["inlined_string_field_unittest.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "lite_arena_unittest", + srcs = ["lite_arena_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":lite_test_util", + ":protobuf", + ":test_util", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "lite_unittest", + srcs = ["lite_unittest.cc"], + deps = [ + ":cc_lite_test_protos", + ":lite_test_util", + ":protobuf", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "map_field_test", + srcs = ["map_field_test.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "map_test", + srcs = [ + "map_test.cc", + "map_test.inc", + ], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + data = [":testdata"], + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "message_unittest", + srcs = [ + "message_unittest.cc", + "message_unittest.inc", + ], + data = [":testdata"], + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "no_field_presence_test", + srcs = ["no_field_presence_test.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "preserve_unknown_enum_test", + srcs = ["preserve_unknown_enum_test.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "proto3_arena_lite_unittest", + srcs = ["proto3_arena_lite_unittest.cc"], + deps = [ + ":cc_test_protos", + ":protobuf", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "proto3_arena_unittest", + srcs = ["proto3_arena_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "proto3_lite_unittest", + srcs = [ + "proto3_lite_unittest.cc", + "proto3_lite_unittest.inc", + ], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + deps = [ + ":cc_test_protos", + ":lite_test_util", + ":protobuf", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "reflection_ops_unittest", + srcs = ["reflection_ops_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "repeated_field_reflection_unittest", + srcs = ["repeated_field_reflection_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/stubs", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "repeated_field_unittest", + srcs = ["repeated_field_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "text_format_unittest", + srcs = ["text_format_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + data = [":testdata"], + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "unknown_field_set_unittest", + srcs = ["unknown_field_set_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-error=sign-compare", + ], + }), + deps = [ + ":cc_lite_test_protos", + ":protobuf", + ":test_util", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "well_known_types_unittest", + srcs = ["well_known_types_unittest.cc"], + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), + deps = [ + ":cc_test_protos", + ":protobuf", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "wire_format_unittest", + srcs = [ + "wire_format_unittest.cc", + "wire_format_unittest.inc", + ], + deps = [ + ":cc_test_protos", + ":protobuf", + ":test_util", + ":test_util2", + "//src/google/protobuf/io", + "//src/google/protobuf/stubs", + "//src/google/protobuf/testing", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +# Legacy target: all test sources used to be part of this rule. It is +# still kept around for now. +cc_test( + name = "protobuf_test", + srcs = [], + deps = [ + "@com_google_googletest//:gtest_main", + ], +) + ################################################################################ # Helper targets for Kotlin tests ################################################################################ @@ -577,3 +1105,27 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "full_test_srcs", + srcs = glob( + include = [ + "*_test.cc", + "*unittest.cc", + ], + exclude = [ + "lite_unittest.cc", + "lite_arena_unittest.cc", + ], + ), + visibility = ["//pkg:__pkg__"], +) + +filegroup( + name = "lite_test_srcs", + srcs = [ + "lite_arena_unittest.cc", + "lite_unittest.cc", + ], + visibility = ["//pkg:__pkg__"], +) diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index c02f9eb7f..379991e24 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -52,6 +52,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_S ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.type_url_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.value_), }; diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index b3b4e6a16..6db2ab3d3 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 24b60497c..24e118eeb 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -85,6 +85,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_S ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.methods_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.options_), @@ -98,6 +100,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_S ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_type_url_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_streaming_), @@ -111,13 +115,15 @@ const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_S ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _impl_.root_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, - { 13, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, - { 26, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, + { 15, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, + { 30, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 2f7d90516..a06f93012 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/arenastring.cc b/src/google/protobuf/arenastring.cc index d886ddad6..4dce6df08 100644 --- a/src/google/protobuf/arenastring.cc +++ b/src/google/protobuf/arenastring.cc @@ -86,7 +86,7 @@ const std::string& LazyString::Init() const { namespace { -#if defined(NDEBUG) || !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL +#if defined(NDEBUG) || !defined(GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL) class ScopedCheckPtrInvariants { public: @@ -102,7 +102,7 @@ inline TaggedStringPtr CreateString(ConstStringParam value) { return res; } -#if !GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL +#ifndef GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL // Creates an arena allocated std::string value. TaggedStringPtr CreateArenaString(Arena& arena, ConstStringParam s) { @@ -123,7 +123,17 @@ void ArenaStringPtr::Set(ConstStringParam value, Arena* arena) { tagged_ptr_ = arena != nullptr ? CreateArenaString(*arena, value) : CreateString(value); } else { +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (arena == nullptr) { + Destroy(); + tagged_ptr_ = CreateString(value); + } else { + UnsafeMutablePointer()->assign("garbagedata"); + tagged_ptr_ = CreateArenaString(*arena, value); + } +#else // PROTOBUF_FORCE_COPY_DEFAULT_STRING UnsafeMutablePointer()->assign(value.data(), value.length()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } } diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 8da74f10a..419e8f5a1 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -16,7 +16,10 @@ load("//build_defs:cpp_opts.bzl", "COPTS") proto_library( name = "plugin_proto", srcs = ["plugin.proto"], - visibility = ["//:__pkg__"], + visibility = [ + "//:__pkg__", + "//pkg:__pkg__", + ], deps = ["//:descriptor_proto"], ) @@ -150,6 +153,11 @@ filegroup( ], ) +exports_files( + srcs = ["plugin.proto"], + visibility = ["//:__pkg__"], +) + cc_library( name = "mock_code_generator", testonly = 1, @@ -157,6 +165,7 @@ cc_library( hdrs = ["mock_code_generator.h"], copts = COPTS, strip_include_prefix = "/src", + visibility = ["//pkg:__pkg__"], deps = [ ":code_generator", "//src/google/protobuf/io", @@ -199,6 +208,7 @@ cc_test( ":mock_code_generator", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util2", "//src/google/protobuf/io", "//src/google/protobuf/stubs", "//src/google/protobuf/testing", @@ -236,6 +246,7 @@ cc_test( ":importer", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util2", "//src/google/protobuf/io", "//src/google/protobuf/stubs", "//src/google/protobuf/testing", @@ -293,3 +304,34 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]) + [ + "//src/google/protobuf/compiler/cpp:test_srcs", + "//src/google/protobuf/compiler/csharp:test_srcs", + "//src/google/protobuf/compiler/java:test_srcs", + "//src/google/protobuf/compiler/objectivec:test_srcs", + "//src/google/protobuf/compiler/php:test_srcs", + "//src/google/protobuf/compiler/python:test_srcs", + "//src/google/protobuf/compiler/ruby:test_srcs", + ], + visibility = ["//pkg:__pkg__"], +) + +filegroup( + name = "test_plugin_srcs", + srcs = ["test_plugin.cc"], + visibility = ["//pkg:__pkg__"], +) + +filegroup( + name = "test_proto_srcs", + srcs = [ + "//src/google/protobuf/compiler/cpp:test_proto_srcs", + ], + visibility = ["//pkg:__pkg__"], +) diff --git a/src/google/protobuf/compiler/cpp/BUILD.bazel b/src/google/protobuf/compiler/cpp/BUILD.bazel index b14259495..098fd63e8 100644 --- a/src/google/protobuf/compiler/cpp/BUILD.bazel +++ b/src/google/protobuf/compiler/cpp/BUILD.bazel @@ -107,6 +107,8 @@ cc_test( ":unittest_lib", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util", + "//src/google/protobuf:test_util2", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", "//src/google/protobuf/stubs", @@ -129,6 +131,7 @@ cc_test( deps = [ ":cpp", "//:protobuf", + "//src/google/protobuf:test_util2", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", "//src/google/protobuf/stubs", @@ -199,3 +202,21 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) + +filegroup( + name = "test_proto_srcs", + srcs = [ + "test_bad_identifiers.proto", + "test_large_enum_value.proto", + ], + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/cpp/field.h b/src/google/protobuf/compiler/cpp/field.h index dd2a51a2f..3fcbda371 100644 --- a/src/google/protobuf/compiler/cpp/field.h +++ b/src/google/protobuf/compiler/cpp/field.h @@ -150,9 +150,6 @@ class FieldGenerator { // method, invoked by each of the generated constructors. virtual void GenerateConstructorCode(io::Printer* printer) const = 0; - // Generate initialization code for private members in the cold struct. - virtual void GenerateCreateSplitMessageCode(io::Printer* printer) const {} - // Generate any code that needs to go in the class's SharedDtor() method, // invoked by the destructor. // Most field types don't need this, so the default implementation is empty. diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index d3190fabc..f4eb744e2 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -1986,9 +1986,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { } if (ShouldSplit(descriptor_, options_)) { - format( - "static Impl_::Split* CreateSplitMessage(" - "::$proto_ns$::Arena* arena);\n"); format("friend struct $1$;\n", DefaultInstanceType(descriptor_, options_, /*split=*/true)); } @@ -2036,7 +2033,6 @@ void MessageGenerator::GenerateSchema(io::Printer* printer, int offset, GOOGLE_DCHECK(!IsMapEntryMessage(descriptor_)); inlined_string_indices_offset = has_offset + has_bit_indices_.size(); } - format("{ $1$, $2$, $3$, sizeof($classtype$)},\n", offset, has_offset, inlined_string_indices_offset); } @@ -2199,9 +2195,13 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { format( "void $classname$::PrepareSplitMessageForWrite() {\n" " if (IsSplitMessageDefault()) {\n" - " $split$ = CreateSplitMessage(GetArenaForAllocation());\n" + " void* chunk = " + "::PROTOBUF_NAMESPACE_ID::internal::CreateSplitMessageGeneric(" + "GetArenaForAllocation(), &$1$, sizeof(Impl_::Split));\n" + " $split$ = reinterpret_cast(chunk);\n" " }\n" - "}\n"); + "}\n", + DefaultInstanceName(descriptor_, options_, /*split=*/true)); } GenerateVerify(printer); @@ -2276,7 +2276,16 @@ std::pair MessageGenerator::GenerateOffsets( } else { format("~0u, // no _inlined_string_donated_\n"); } - const int kNumGenericOffsets = 6; // the number of fixed offsets above + if (ShouldSplit(descriptor_, options_)) { + format( + "PROTOBUF_FIELD_OFFSET($classtype$, $split$),\n" + "sizeof($classtype$::Impl_::Split),\n"); + } else { + format( + "~0u, // no _split_\n" + "~0u, // no sizeof(Split)\n"); + } + const int kNumGenericOffsets = 8; // the number of fixed offsets above const size_t offsets = kNumGenericOffsets + descriptor_->field_count() + descriptor_->real_oneof_decl_count(); size_t entries = offsets; @@ -2304,12 +2313,17 @@ std::pair MessageGenerator::GenerateOffsets( // offset of the field, so that the information is available when // reflectively accessing the field at run time. // - // Embed whether the field is eagerly verified lazy or inlined string to the - // LSB of the offset. + // We embed whether the field is cold to the MSB of the offset, and whether + // the field is eagerly verified lazy or inlined string to the LSB of the + // offset. + + if (ShouldSplit(field, options_)) { + format(" | ::_pbi::kSplitFieldOffsetMask /*split*/"); + } if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) { - format(" | 0x1u // eagerly verified lazy\n"); + format(" | 0x1u /*eagerly verified lazy*/"); } else if (IsStringInlined(field, options_)) { - format(" | 0x1u // inlined\n"); + format(" | 0x1u /*inlined*/"); } format(",\n"); } @@ -2470,45 +2484,6 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { format("}\n\n"); } -void MessageGenerator::GenerateCreateSplitMessage(io::Printer* printer) { - Formatter format(printer, variables_); - format( - "$classname$::Impl_::Split* " - "$classname$::CreateSplitMessage(::$proto_ns$::Arena* arena) {\n"); - format.Indent(); - const char* field_sep = " "; - const auto put_sep = [&] { - format("\n$1$ ", field_sep); - field_sep = ","; - }; - format( - "const size_t size = sizeof(Impl_::Split);\n" - "void* chunk = (arena == nullptr) ?\n" - " ::operator new(size) :\n" - " arena->AllocateAligned(size, alignof(Impl_::Split));\n" - "Impl_::Split* ptr = reinterpret_cast(chunk);\n" - "new (ptr) Impl_::Split{"); - format.Indent(); - for (const FieldDescriptor* field : optimized_order_) { - GOOGLE_DCHECK(!IsFieldStripped(field, options_)); - if (ShouldSplit(field, options_)) { - put_sep(); - field_generators_.get(field).GenerateAggregateInitializer(printer); - } - } - format.Outdent(); - format("};\n"); - for (const FieldDescriptor* field : optimized_order_) { - GOOGLE_DCHECK(!IsFieldStripped(field, options_)); - if (ShouldSplit(field, options_)) { - field_generators_.get(field).GenerateCreateSplitMessageCode(printer); - } - } - format("return ptr;\n"); - format.Outdent(); - format("}\n"); -} - void MessageGenerator::GenerateInitDefaultSplitInstance(io::Printer* printer) { if (!ShouldSplit(descriptor_, options_)) return; @@ -2947,10 +2922,6 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { // Generate the shared constructor code. GenerateSharedConstructorCode(printer); - if (ShouldSplit(descriptor_, options_)) { - GenerateCreateSplitMessage(printer); - } - // Generate the destructor. if (!HasSimpleBaseClass(descriptor_, options_)) { format( diff --git a/src/google/protobuf/compiler/cpp/message.h b/src/google/protobuf/compiler/cpp/message.h index 5bdfcb35e..998ebdb24 100644 --- a/src/google/protobuf/compiler/cpp/message.h +++ b/src/google/protobuf/compiler/cpp/message.h @@ -119,7 +119,6 @@ class MessageGenerator { // default instance. void GenerateConstexprConstructor(io::Printer* printer); - void GenerateCreateSplitMessage(io::Printer* printer); void GenerateInitDefaultSplitInstance(io::Printer* printer); // Generate standard Message methods. diff --git a/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/src/google/protobuf/compiler/cpp/parse_function_generator.cc index 91ceeeb25..3254b3758 100644 --- a/src/google/protobuf/compiler/cpp/parse_function_generator.cc +++ b/src/google/protobuf/compiler/cpp/parse_function_generator.cc @@ -93,7 +93,7 @@ bool IsFieldEligibleForFastParsing( if (field->is_map() || field->real_containing_oneof() || field->options().weak() || IsImplicitWeakField(field, options, scc_analyzer) || - IsLazy(field, options, scc_analyzer)) { + IsLazy(field, options, scc_analyzer) || ShouldSplit(field, options)) { return false; } @@ -313,6 +313,16 @@ TailCallTableInfo::TailCallTableInfo( ", _impl_._inlined_string_donated_)}"); } + // If this message is split, store the split pointer offset in the third + // auxiliary entry. + if (ShouldSplit(descriptor, options)) { + aux_entries.resize(4); // pad if necessary + aux_entries[2] = StrCat("_fl::Offset{offsetof(", + ClassName(descriptor), ", _impl_._split_)}"); + aux_entries[3] = StrCat("_fl::Offset{sizeof(", ClassName(descriptor), + "::Impl_::Split)}"); + } + // Fill in mini table entries. for (const FieldDescriptor* field : ordered_fields) { field_entries.push_back( @@ -919,14 +929,12 @@ void ParseFunctionGenerator::GenerateFastFieldEntries(Formatter& format) { if (info.func_name.empty()) { format("{::_pbi::TcParser::MiniParse, {}},\n"); } else { - bool cold = ShouldSplit(info.field, options_); + GOOGLE_CHECK(!ShouldSplit(info.field, options_)); format( "{$1$,\n" - " {$2$, $3$, $4$, PROTOBUF_FIELD_OFFSET($classname$$5$, $6$)}},\n", + " {$2$, $3$, $4$, PROTOBUF_FIELD_OFFSET($classname$, $5$)}},\n", info.func_name, info.coded_tag, info.hasbit_idx, info.aux_idx, - cold ? "::Impl_::Split" : "", - cold ? FieldName(info.field) + "_" - : FieldMemberName(info.field, /*cold=*/false)); + FieldMemberName(info.field, /*split=*/false)); } } } @@ -1067,6 +1075,10 @@ static void FormatFieldKind(Formatter& format, } } + if (ShouldSplit(field, options)) { + format(" | ::_fl::kSplitTrue"); + } + format(")"); } @@ -1081,11 +1093,14 @@ void ParseFunctionGenerator::GenerateFieldEntries(Formatter& format) { format("/* weak */ 0, 0, 0, 0"); } else { const OneofDescriptor* oneof = field->real_containing_oneof(); - bool cold = ShouldSplit(field, options_); - format("PROTOBUF_FIELD_OFFSET($classname$$1$, $2$), ", - cold ? "::Impl_::Split" : "", - cold ? FieldName(field) + "_" - : FieldMemberName(field, /*cold=*/false)); + bool split = ShouldSplit(field, options_); + if (split) { + format("PROTOBUF_FIELD_OFFSET($classname$::Impl_::Split, $1$), ", + FieldName(field) + "_"); + } else { + format("PROTOBUF_FIELD_OFFSET($classname$, $1$), ", + FieldMemberName(field, /*cold=*/false)); + } if (oneof) { format("$1$, ", oneof->index()); } else if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { diff --git a/src/google/protobuf/compiler/cpp/string_field.cc b/src/google/protobuf/compiler/cpp/string_field.cc index 9e7c96d7c..71b9b5412 100644 --- a/src/google/protobuf/compiler/cpp/string_field.cc +++ b/src/google/protobuf/compiler/cpp/string_field.cc @@ -445,21 +445,6 @@ void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { } } -void StringFieldGenerator::GenerateCreateSplitMessageCode( - io::Printer* printer) const { - GOOGLE_CHECK(ShouldSplit(descriptor_, options_)); - GOOGLE_CHECK(!inlined_); - Formatter format(printer, variables_); - format("ptr->$name$_.InitDefault();\n"); - if (IsString(descriptor_, options_) && - descriptor_->default_value_string().empty()) { - format( - "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" - " ptr->$name$_.Set(\"\", GetArenaForAllocation());\n" - "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); - } -} - void StringFieldGenerator::GenerateCopyConstructorCode( io::Printer* printer) const { Formatter format(printer, variables_); diff --git a/src/google/protobuf/compiler/cpp/string_field.h b/src/google/protobuf/compiler/cpp/string_field.h index db5f18bfb..b1865ea67 100644 --- a/src/google/protobuf/compiler/cpp/string_field.h +++ b/src/google/protobuf/compiler/cpp/string_field.h @@ -63,7 +63,6 @@ class StringFieldGenerator : public FieldGenerator { void GenerateMergingCode(io::Printer* printer) const override; void GenerateSwappingCode(io::Printer* printer) const override; void GenerateConstructorCode(io::Printer* printer) const override; - void GenerateCreateSplitMessageCode(io::Printer* printer) const override; void GenerateCopyConstructorCode(io::Printer* printer) const override; void GenerateDestructorCode(io::Printer* printer) const override; void GenerateArenaDestructorCode(io::Printer* printer) const override; diff --git a/src/google/protobuf/compiler/csharp/BUILD.bazel b/src/google/protobuf/compiler/csharp/BUILD.bazel index 819c9dec2..ca9eb350a 100644 --- a/src/google/protobuf/compiler/csharp/BUILD.bazel +++ b/src/google/protobuf/compiler/csharp/BUILD.bazel @@ -107,3 +107,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/java/BUILD.bazel b/src/google/protobuf/compiler/java/BUILD.bazel index 66a809ec2..619d71518 100644 --- a/src/google/protobuf/compiler/java/BUILD.bazel +++ b/src/google/protobuf/compiler/java/BUILD.bazel @@ -124,3 +124,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/objectivec/BUILD.bazel b/src/google/protobuf/compiler/objectivec/BUILD.bazel index 634dda248..30b6237a4 100644 --- a/src/google/protobuf/compiler/objectivec/BUILD.bazel +++ b/src/google/protobuf/compiler/objectivec/BUILD.bazel @@ -70,3 +70,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 7f7ee34c4..1c497d805 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -112,7 +112,7 @@ class PrefixModeStorage { public: PrefixModeStorage(); - const std::string package_to_prefix_mappings_path() const { return package_to_prefix_mappings_path_; } + std::string package_to_prefix_mappings_path() const { return package_to_prefix_mappings_path_; } void set_package_to_prefix_mappings_path(const std::string& path) { package_to_prefix_mappings_path_ = path; package_to_prefix_map_.clear(); @@ -123,7 +123,7 @@ class PrefixModeStorage { bool use_package_name() const { return use_package_name_; } void set_use_package_name(bool on_or_off) { use_package_name_ = on_or_off; } - const std::string exception_path() const { return exception_path_; } + std::string exception_path() const { return exception_path_; } void set_exception_path(const std::string& path) { exception_path_ = path; exceptions_.clear(); diff --git a/src/google/protobuf/compiler/php/BUILD.bazel b/src/google/protobuf/compiler/php/BUILD.bazel index 82ba185fd..2ce166b31 100644 --- a/src/google/protobuf/compiler/php/BUILD.bazel +++ b/src/google/protobuf/compiler/php/BUILD.bazel @@ -32,3 +32,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index def353e21..32bfac19a 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -102,6 +102,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offset ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.major_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.minor_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _impl_.patch_), @@ -116,6 +118,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offset ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.file_to_generate_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.parameter_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _impl_.proto_file_), @@ -130,6 +134,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offset ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.insertion_point_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _impl_.content_), @@ -144,6 +150,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offset ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_.error_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_.supported_features_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _impl_.file_), @@ -152,10 +160,10 @@ const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offset ~0u, }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 10, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::Version)}, - { 14, 24, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, - { 28, 38, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, - { 42, 51, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, + { 0, 12, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::Version)}, + { 16, 28, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, + { 32, 44, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, + { 48, 59, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index b8829b495..1c4b0f6c0 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/compiler/python/BUILD.bazel b/src/google/protobuf/compiler/python/BUILD.bazel index 1924a9ac5..d2d0ce12f 100644 --- a/src/google/protobuf/compiler/python/BUILD.bazel +++ b/src/google/protobuf/compiler/python/BUILD.bazel @@ -54,3 +54,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/compiler/ruby/BUILD.bazel b/src/google/protobuf/compiler/ruby/BUILD.bazel index 455865322..73b0fcf96 100644 --- a/src/google/protobuf/compiler/ruby/BUILD.bazel +++ b/src/google/protobuf/compiler/ruby/BUILD.bazel @@ -59,3 +59,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 645096686..257798e4a 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -517,6 +517,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _impl_.file_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _internal_metadata_), @@ -524,6 +526,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _impl_.package_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _impl_.dependency_), @@ -554,6 +558,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _impl_.start_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _impl_.end_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _impl_.options_), @@ -566,6 +572,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _impl_.start_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _impl_.end_), 0, @@ -576,6 +584,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, _impl_.field_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, _impl_.extension_), @@ -602,6 +612,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, _impl_.uninterpreted_option_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _internal_metadata_), @@ -609,6 +621,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _impl_.number_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _impl_.label_), @@ -637,6 +651,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _impl_.options_), 0, @@ -647,6 +663,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _impl_.start_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _impl_.end_), 0, @@ -657,6 +675,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _impl_.value_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _impl_.options_), @@ -673,6 +693,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _impl_.number_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _impl_.options_), @@ -685,6 +707,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _impl_.method_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _impl_.options_), @@ -697,6 +721,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _impl_.input_type_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _impl_.output_type_), @@ -715,6 +741,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _impl_.java_package_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _impl_.java_outer_classname_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _impl_.java_multiple_files_), @@ -763,6 +791,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.message_set_wire_format_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.no_standard_descriptor_accessor_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.deprecated_), @@ -779,6 +809,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.ctype_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.packed_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.jstype_), @@ -801,6 +833,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofOptions, _impl_.uninterpreted_option_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _internal_metadata_), @@ -808,6 +842,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~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_.uninterpreted_option_), @@ -820,6 +856,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _impl_.deprecated_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _impl_.uninterpreted_option_), 0, @@ -830,6 +868,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, _impl_.deprecated_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, _impl_.uninterpreted_option_), 0, @@ -840,6 +880,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _impl_.deprecated_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _impl_.idempotency_level_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _impl_.uninterpreted_option_), @@ -852,6 +894,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _impl_.name_part_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _impl_.is_extension_), 0, @@ -862,6 +906,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, _impl_.identifier_value_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, _impl_.positive_int_value_), @@ -882,6 +928,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _impl_.path_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _impl_.span_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _impl_.leading_comments_), @@ -898,6 +946,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo, _impl_.location_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _internal_metadata_), @@ -905,6 +955,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _impl_.path_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _impl_.source_file_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _impl_.begin_), @@ -919,36 +971,38 @@ const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PRO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo, _impl_.annotation_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet)}, - { 7, 25, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto)}, - { 37, 46, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange)}, - { 49, 57, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange)}, - { 59, 75, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto)}, - { 85, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions)}, - { 92, 109, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto)}, - { 120, 128, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto)}, - { 130, 138, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange)}, - { 140, 151, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto)}, - { 156, 165, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto)}, - { 168, 177, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)}, - { 180, 192, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, - { 198, 225, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)}, - { 246, 257, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, - { 262, 276, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, - { 284, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, - { 291, 300, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, - { 303, 311, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, - { 313, 321, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, - { 323, 332, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, - { 335, 343, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, - { 345, 358, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, - { 365, 376, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, - { 381, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, - { 388, 398, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, - { 402, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, + { 9, 29, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto)}, + { 41, 52, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange)}, + { 55, 65, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange)}, + { 67, 85, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto)}, + { 95, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions)}, + { 104, 123, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto)}, + { 134, 144, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto)}, + { 146, 156, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange)}, + { 158, 171, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto)}, + { 176, 187, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto)}, + { 190, 201, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)}, + { 204, 218, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, + { 224, 253, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)}, + { 274, 287, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, + { 292, 308, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, + { 316, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, + { 325, 336, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, + { 339, 349, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, + { 351, 361, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, + { 363, 374, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, + { 377, 387, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, + { 389, 404, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, + { 411, 424, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, + { 429, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, + { 438, 450, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, + { 454, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 0a51ba353..78df1d512 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index 72766bd3b..94671ee6c 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -47,6 +47,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _impl_.nanos_), }; diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 7bdff41c5..73193eb11 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index 1c96ca208..394056458 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -808,8 +808,11 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( type_info->oneof_case_offset, type_info->size, type_info->weak_field_map_offset, - nullptr /* inlined_string_indices_ */, - 0 /* inlined_string_donated_offset_ */}; + nullptr, // inlined_string_indices_ + 0, // inlined_string_donated_offset_ + -1, // split_offset_ + -1, // sizeof_split_ + }; type_info->reflection.reset( new Reflection(type_info->type, schema, type_info->pool, this)); diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h index 6fa64259e..e318259e0 100644 --- a/src/google/protobuf/dynamic_message.h +++ b/src/google/protobuf/dynamic_message.h @@ -81,6 +81,9 @@ class DescriptorPool; // descriptor.h // encapsulates this "cache". All DynamicMessages of the same type created // from the same factory will share the same support data. Any Descriptors // used with a particular factory must outlive the factory. +// +// The thread safety for this class is subtle, see comments around GetPrototype +// for details class PROTOBUF_EXPORT DynamicMessageFactory : public MessageFactory { public: // Construct a DynamicMessageFactory that will search for extensions in diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index 3a3077638..8af459dbf 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -44,6 +44,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Empty)}, diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 70fd45e60..f5c44b831 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index 7860bfbfe..8448013e6 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -46,6 +46,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] P ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldMask, _impl_.paths_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 9022e1f31..f4f77070d 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 53ca9acd3..aefec9908 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -1114,8 +1115,14 @@ void Reflection::InternalSwap(Message* lhs, Message* rhs) const { const FieldDescriptor* field = descriptor_->field(i); if (schema_.InRealOneof(field)) continue; if (schema_.IsFieldStripped(field)) continue; + if (schema_.IsSplit(field)) { + continue; + } UnsafeShallowSwapField(lhs, rhs, field); } + if (schema_.IsSplit()) { + std::swap(*MutableSplitField(lhs), *MutableSplitField(rhs)); + } const int oneof_decl_count = descriptor_->oneof_decl_count(); for (int i = 0; i < oneof_decl_count; i++) { const OneofDescriptor* oneof = descriptor_->oneof_decl(i); @@ -2437,13 +2444,34 @@ bool Reflection::SupportsUnknownEnumValues() const { template const Type& Reflection::GetRawNonOneof(const Message& message, const FieldDescriptor* field) const { + if (schema_.IsSplit(field)) { + return *GetConstPointerAtOffset( + GetSplitField(&message), schema_.GetFieldOffsetNonOneof(field)); + } return GetConstRefAtOffset(message, schema_.GetFieldOffsetNonOneof(field)); } +void Reflection::PrepareSplitMessageForWrite(Message* message) const { + void** split = MutableSplitField(message); + const void* default_split = GetSplitField(schema_.default_instance_); + if (*split == default_split) { + uint32_t size = schema_.SizeofSplit(); + Arena* arena = message->GetArenaForAllocation(); + *split = (arena == nullptr) ? ::operator new(size) + : arena->AllocateAligned(size); + memcpy(*split, default_split, size); + } +} + template Type* Reflection::MutableRawNonOneof(Message* message, const FieldDescriptor* field) const { + if (schema_.IsSplit(field)) { + PrepareSplitMessageForWrite(message); + return GetPointerAtOffset(*MutableSplitField(message), + schema_.GetFieldOffsetNonOneof(field)); + } return GetPointerAtOffset(message, schema_.GetFieldOffsetNonOneof(field)); } @@ -2451,6 +2479,11 @@ Type* Reflection::MutableRawNonOneof(Message* message, template Type* Reflection::MutableRaw(Message* message, const FieldDescriptor* field) const { + if (schema_.IsSplit(field)) { + PrepareSplitMessageForWrite(message); + return GetPointerAtOffset(*MutableSplitField(message), + schema_.GetFieldOffset(field)); + } return GetPointerAtOffset(message, schema_.GetFieldOffset(field)); } @@ -2875,9 +2908,11 @@ ReflectionSchema MigrationToReflectionSchema( MigrationSchema migration_schema) { ReflectionSchema result; result.default_instance_ = *default_instance; - // First 7 offsets are offsets to the special fields. The following offsets + // First 9 offsets are offsets to the special fields. The following offsets // are the proto fields. - result.offsets_ = offsets + migration_schema.offsets_index + 6; + // + // TODO(congliu): Find a way to not encode sizeof_split_ in offsets. + result.offsets_ = offsets + migration_schema.offsets_index + 8; result.has_bit_indices_ = offsets + migration_schema.has_bit_indices_index; result.has_bits_offset_ = offsets[migration_schema.offsets_index + 0]; result.metadata_offset_ = offsets[migration_schema.offsets_index + 1]; @@ -2887,6 +2922,8 @@ ReflectionSchema MigrationToReflectionSchema( result.weak_field_map_offset_ = offsets[migration_schema.offsets_index + 4]; result.inlined_string_donated_offset_ = offsets[migration_schema.offsets_index + 5]; + result.split_offset_ = offsets[migration_schema.offsets_index + 6]; + result.sizeof_split_ = offsets[migration_schema.offsets_index + 7]; result.inlined_string_indices_ = offsets + migration_schema.inlined_string_indices_index; return result; diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 334b2ccf1..7d1b699d4 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -72,6 +72,19 @@ class DefaultEmptyOneof; class ExtensionSet; // extension_set.h class WeakFieldMap; // weak_field_map.h +enum { + // Tag used on offsets for fields that don't have a real offset. + // For example, weak message fields go into the WeakFieldMap and not in an + // actual field. + kInvalidFieldOffsetTag = 0x40000000u, + + // Mask used on offsets for split fields. + kSplitFieldOffsetMask = 0x80000000u, + + kLazyMask = 0x1u, + kInlinedMask = 0x1u, +}; + // This struct describes the internal layout of the message, hence this is // used to act on the message reflectively. // default_instance: The default instance of the message. This is only @@ -234,6 +247,24 @@ struct ReflectionSchema { return false; } + bool IsSplit() const { return split_offset_ != -1; } + + bool IsSplit(const FieldDescriptor* field) const { + return split_offset_ != -1 && + (offsets_[field->index()] & kSplitFieldOffsetMask) != 0; + } + + // Byte offset of _split_. + uint32_t SplitOffset() const { + GOOGLE_DCHECK(IsSplit()); + return static_cast(split_offset_); + } + + uint32_t SizeofSplit() const { + GOOGLE_DCHECK(IsSplit()); + return static_cast(sizeof_split_); + } + bool HasWeakFields() const { return weak_field_map_offset_ > 0; } @@ -254,6 +285,8 @@ struct ReflectionSchema { int weak_field_map_offset_; const uint32_t* inlined_string_indices_; int inlined_string_donated_offset_; + int split_offset_; + int sizeof_split_; // We tag offset values to provide additional data about fields (such as // "unused" or "lazy" or "inlined"). @@ -261,15 +294,15 @@ struct ReflectionSchema { if (type == FieldDescriptor::TYPE_MESSAGE || type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { - return v & 0xFFFFFFFEu; + return v & (~kSplitFieldOffsetMask) & (~kInlinedMask) & (~kLazyMask); } - return v; + return v & (~kSplitFieldOffsetMask); } static bool Inlined(uint32_t v, FieldDescriptor::Type type) { if (type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { - return (v & 1u) != 0u; + return (v & kInlinedMask) != 0u; } else { // Non string/byte fields are not inlined. return false; @@ -312,13 +345,6 @@ struct PROTOBUF_EXPORT DescriptorTable { const ServiceDescriptor** file_level_service_descriptors; }; -enum { - // Tag used on offsets for fields that don't have a real offset. - // For example, weak message fields go into the WeakFieldMap and not in an - // actual field. - kInvalidFieldOffsetTag = 0x40000000u, -}; - // AssignDescriptors() pulls the compiled FileDescriptor from the DescriptorPool // and uses it to populate all of the global variables which store pointers to // the descriptor objects. It also constructs the reflection objects. It is diff --git a/src/google/protobuf/generated_message_tctable_impl.h b/src/google/protobuf/generated_message_tctable_impl.h index 53bdc76da..1ea1250f8 100644 --- a/src/google/protobuf/generated_message_tctable_impl.h +++ b/src/google/protobuf/generated_message_tctable_impl.h @@ -64,10 +64,11 @@ namespace internal { // |15 .. 8|7 .. 0| // +-----------------------+-----------------------+ // : . : . : . : . : . : . : 3|========| [3] FieldType -// : : : : : : 5|=====| : : [2] FieldCardinality -// : . : . : . : . 8|========| : . : . : [3] FieldRep -// : : : 10|=====| : : : : [2] TransformValidation -// : . : .12|=====| . : . : . : . : . : [2] FormatDiscriminator +// : : : : : : . 4|==| : : [1] FieldSplit +// : : : : : 6|=====| . : : [2] FieldCardinality +// : . : . : . : 9|========| . : . : . : [3] FieldRep +// : : :11|=====| : : : : : [2] TransformValidation +// : . :13|=====| : . : . : . : . : . : [2] FormatDiscriminator // +-----------------------+-----------------------+ // |15 .. 8|7 .. 0| // +-----------------------+-----------------------+ @@ -95,11 +96,21 @@ enum FieldKind : uint16_t { static_assert(kFkMap < (1 << kFkBits), "too many types"); +// Split (1 bit): +enum FieldSplit : uint16_t { + kSplitShift = kFkShift+ kFkBits, + kSplitBits = 1, + kSplitMask = ((1 << kSplitBits) - 1) << kSplitShift, + + kSplitFalse = 0, + kSplitTrue = 1 << kSplitShift, +}; + // Cardinality (2 bits): // These values determine how many values a field can have and its presence. // Packed fields are represented in FieldType. enum Cardinality : uint16_t { - kFcShift = kFkShift + kFkBits, + kFcShift = kSplitShift+ kSplitBits, kFcBits = 2, kFcMask = ((1 << kFcBits) - 1) << kFcShift, @@ -179,7 +190,7 @@ enum FormatDiscriminator : uint16_t { }; // Update this assertion (and comments above) when adding or removing bits: -static_assert(kFmtShift + kFmtBits == 12, "number of bits changed"); +static_assert(kFmtShift + kFmtBits == 13, "number of bits changed"); // This assertion should not change unless the storage width changes: static_assert(kFmtShift + kFmtBits <= 16, "too many bits"); @@ -549,14 +560,18 @@ class PROTOBUF_EXPORT TcParser final { static constexpr const uint32_t kMtSmallScanSize = 4; // Mini parsing: + template static const char* MpVarint(PROTOBUF_TC_PARAM_DECL); static const char* MpRepeatedVarint(PROTOBUF_TC_PARAM_DECL); static const char* MpPackedVarint(PROTOBUF_TC_PARAM_DECL); + template static const char* MpFixed(PROTOBUF_TC_PARAM_DECL); static const char* MpRepeatedFixed(PROTOBUF_TC_PARAM_DECL); static const char* MpPackedFixed(PROTOBUF_TC_PARAM_DECL); + template static const char* MpString(PROTOBUF_TC_PARAM_DECL); static const char* MpRepeatedString(PROTOBUF_TC_PARAM_DECL); + template static const char* MpMessage(PROTOBUF_TC_PARAM_DECL); static const char* MpRepeatedMessage(PROTOBUF_TC_PARAM_DECL); static const char* MpMap(PROTOBUF_TC_PARAM_DECL); diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index 519b10776..1f13e83cc 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -315,24 +315,43 @@ const char* TcParser::MiniParse(PROTOBUF_TC_PARAM_DECL) { data.data = entry_offset << 32 | tag; using field_layout::FieldKind; - auto field_type = entry->type_card & FieldKind::kFkMask; + auto field_type = + entry->type_card & (+field_layout::kSplitMask | FieldKind::kFkMask); switch (field_type) { case FieldKind::kFkNone: PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkVarint: - PROTOBUF_MUSTTAIL return MpVarint(PROTOBUF_TC_PARAM_PASS); + PROTOBUF_MUSTTAIL return MpVarint(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkPackedVarint: PROTOBUF_MUSTTAIL return MpPackedVarint(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkFixed: - PROTOBUF_MUSTTAIL return MpFixed(PROTOBUF_TC_PARAM_PASS); + PROTOBUF_MUSTTAIL return MpFixed(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkPackedFixed: PROTOBUF_MUSTTAIL return MpPackedFixed(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkString: - PROTOBUF_MUSTTAIL return MpString(PROTOBUF_TC_PARAM_PASS); + PROTOBUF_MUSTTAIL return MpString(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkMessage: - PROTOBUF_MUSTTAIL return MpMessage(PROTOBUF_TC_PARAM_PASS); + PROTOBUF_MUSTTAIL return MpMessage(PROTOBUF_TC_PARAM_PASS); case FieldKind::kFkMap: PROTOBUF_MUSTTAIL return MpMap(PROTOBUF_TC_PARAM_PASS); + + case +field_layout::kSplitMask | FieldKind::kFkNone: + PROTOBUF_FALLTHROUGH_INTENDED; + case +field_layout::kSplitMask | FieldKind::kFkPackedVarint: + PROTOBUF_FALLTHROUGH_INTENDED; + case +field_layout::kSplitMask | FieldKind::kFkPackedFixed: + PROTOBUF_FALLTHROUGH_INTENDED; + case +field_layout::kSplitMask | FieldKind::kFkMap: + return Error(PROTOBUF_TC_PARAM_PASS); + + case +field_layout::kSplitMask | FieldKind::kFkVarint: + PROTOBUF_MUSTTAIL return MpVarint(PROTOBUF_TC_PARAM_PASS); + case +field_layout::kSplitMask | FieldKind::kFkFixed: + PROTOBUF_MUSTTAIL return MpFixed(PROTOBUF_TC_PARAM_PASS); + case +field_layout::kSplitMask | FieldKind::kFkString: + PROTOBUF_MUSTTAIL return MpString(PROTOBUF_TC_PARAM_PASS); + case +field_layout::kSplitMask | FieldKind::kFkMessage: + PROTOBUF_MUSTTAIL return MpMessage(PROTOBUF_TC_PARAM_PASS); default: return Error(PROTOBUF_TC_PARAM_PASS); } @@ -1392,6 +1411,43 @@ bool TcParser::ChangeOneof(const TcParseTableBase* table, return true; } +namespace { +enum { + kSplitOffsetIdx = 2, + kSplitSizeIdx = 3, +}; +uint32_t GetSplitOffset(const TcParseTableBase* table) { + return table->field_aux(kSplitOffsetIdx)->offset; +} + +uint32_t GetSizeofSplit(const TcParseTableBase* table) { + return table->field_aux(kSplitSizeIdx)->offset; +} + +void* MaybeGetSplitBase(MessageLite* msg, const bool is_split, + const TcParseTableBase* table, + ::google::protobuf::internal::ParseContext* ctx) { + void* out = msg; + if (is_split) { + const uint32_t split_offset = GetSplitOffset(table); + void* default_split = + TcParser::RefAt(table->default_instance, split_offset); + void*& split = TcParser::RefAt(msg, split_offset); + if (split == default_split) { + // Allocate split instance when needed. + uint32_t size = GetSizeofSplit(table); + Arena* arena = ctx->data().arena; + split = (arena == nullptr) ? ::operator new(size) + : arena->AllocateAligned(size); + memcpy(split, default_split, size); + } + out = split; + } + return out; +} +} // namespace + +template const char* TcParser::MpFixed(PROTOBUF_TC_PARAM_DECL) { const auto& entry = RefAt(table, data.entry_offset()); const uint16_t type_card = entry.type_card; @@ -1420,12 +1476,13 @@ const char* TcParser::MpFixed(PROTOBUF_TC_PARAM_DECL) { } else if (card == field_layout::kFcOneof) { ChangeOneof(table, entry, data.tag() >> 3, ctx, msg); } + void* const base = MaybeGetSplitBase(msg, is_split, table, ctx); // Copy the value: if (rep == field_layout::kRep64Bits) { - RefAt(msg, entry.offset) = UnalignedLoad(ptr); + RefAt(base, entry.offset) = UnalignedLoad(ptr); ptr += sizeof(uint64_t); } else { - RefAt(msg, entry.offset) = UnalignedLoad(ptr); + RefAt(base, entry.offset) = UnalignedLoad(ptr); ptr += sizeof(uint32_t); } PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS); @@ -1510,6 +1567,7 @@ const char* TcParser::MpPackedFixed(PROTOBUF_TC_PARAM_DECL) { PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS); } +template const char* TcParser::MpVarint(PROTOBUF_TC_PARAM_DECL) { const auto& entry = RefAt(table, data.entry_offset()); const uint16_t type_card = entry.type_card; @@ -1558,13 +1616,14 @@ const char* TcParser::MpVarint(PROTOBUF_TC_PARAM_DECL) { ChangeOneof(table, entry, data.tag() >> 3, ctx, msg); } + void* const base = MaybeGetSplitBase(msg, is_split, table, ctx); if (rep == field_layout::kRep64Bits) { - RefAt(msg, entry.offset) = tmp; + RefAt(base, entry.offset) = tmp; } else if (rep == field_layout::kRep32Bits) { - RefAt(msg, entry.offset) = static_cast(tmp); + RefAt(base, entry.offset) = static_cast(tmp); } else { GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); - RefAt(msg, entry.offset) = static_cast(tmp); + RefAt(base, entry.offset) = static_cast(tmp); } PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS); @@ -1705,6 +1764,7 @@ bool TcParser::MpVerifyUtf8(StringPiece wire_bytes, return true; } +template const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) { const auto& entry = RefAt(table, data.entry_offset()); const uint16_t type_card = entry.type_card; @@ -1735,9 +1795,10 @@ const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) { bool is_valid = false; Arena* arena = ctx->data().arena; + void* const base = MaybeGetSplitBase(msg, is_split, table, ctx); switch (rep) { case field_layout::kRepAString: { - auto& field = RefAt(msg, entry.offset); + auto& field = RefAt(base, entry.offset); if (need_init) field.InitDefault(); if (arena) { ptr = ctx->ReadArenaString(ptr, &field, arena); @@ -1803,6 +1864,7 @@ const char* TcParser::MpRepeatedString(PROTOBUF_TC_PARAM_DECL) { return ToParseLoop(PROTOBUF_TC_PARAM_PASS); } +template const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { const auto& entry = RefAt(table, data.entry_offset()); const uint16_t type_card = entry.type_card; @@ -1845,8 +1907,10 @@ const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { } else if (is_oneof) { need_init = ChangeOneof(table, entry, data.tag() >> 3, ctx, msg); } + + void* const base = MaybeGetSplitBase(msg, is_split, table, ctx); SyncHasbits(msg, hasbits, table); - MessageLite*& field = RefAt(msg, entry.offset); + MessageLite*& field = RefAt(base, entry.offset); if ((type_card & field_layout::kTvMask) == field_layout::kTvTable) { auto* inner_table = table->field_aux(&entry)->table; if (need_init || field == nullptr) { diff --git a/src/google/protobuf/inlined_string_field.h b/src/google/protobuf/inlined_string_field.h index 79e37d414..71bd6a7eb 100644 --- a/src/google/protobuf/inlined_string_field.h +++ b/src/google/protobuf/inlined_string_field.h @@ -427,7 +427,7 @@ inline PROTOBUF_NDEBUG_INLINE void InlinedStringField::InternalSwap( MessageLite* lhs_msg, // InlinedStringField* rhs, Arena* rhs_arena, bool rhs_arena_dtor_registered, MessageLite* rhs_msg) { -#if GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE +#ifdef GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE lhs->get_mutable()->swap(*rhs->get_mutable()); if (!lhs_arena_dtor_registered && rhs_arena_dtor_registered) { lhs_msg->OnDemandRegisterArenaDtor(lhs_arena); diff --git a/src/google/protobuf/io/BUILD.bazel b/src/google/protobuf/io/BUILD.bazel index 7582f78bc..bf0d87cbd 100644 --- a/src/google/protobuf/io/BUILD.bazel +++ b/src/google/protobuf/io/BUILD.bazel @@ -114,6 +114,7 @@ cc_test( ":gzip_stream", ":io", "//:protobuf", + "//src/google/protobuf:test_util2", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", @@ -144,3 +145,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//pkg:__pkg__"], +) diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index 6cdc6c839..3e044f742 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -213,6 +213,16 @@ uint64_t Message::GetInvariantPerBuild(uint64_t salt) { return salt; } +namespace internal { +void* CreateSplitMessageGeneric(Arena* arena, void* default_split, + size_t size) { + void* split = + (arena == nullptr) ? ::operator new(size) : arena->AllocateAligned(size); + memcpy(split, default_split, size); + return split; +} +} // namespace internal + // ============================================================================= // MessageFactory diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index d20963bc6..82873885b 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -203,12 +203,12 @@ struct Metadata { namespace internal { template -inline To* GetPointerAtOffset(Message* message, uint32_t offset) { +inline To* GetPointerAtOffset(void* message, uint32_t offset) { return reinterpret_cast(reinterpret_cast(message) + offset); } template -const To* GetConstPointerAtOffset(const Message* message, uint32_t offset) { +const To* GetConstPointerAtOffset(const void* message, uint32_t offset) { return reinterpret_cast(reinterpret_cast(message) + offset); } @@ -406,6 +406,9 @@ class PROTOBUF_EXPORT Message : public MessageLite { }; namespace internal { +// Creates and returns an allocation for a split message. +void* CreateSplitMessageGeneric(Arena* arena, void* default_split, size_t size); + // Forward-declare interfaces used to implement RepeatedFieldRef. // These are protobuf internals that users shouldn't care about. class RepeatedFieldAccessor; @@ -1029,6 +1032,10 @@ class PROTOBUF_EXPORT Reflection final { bool IsLazilyVerifiedLazyField(const FieldDescriptor* field) const; bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const; + bool IsSplit(const FieldDescriptor* field) const { + return schema_.IsSplit(field); + } + friend class FastReflectionMessageMutator; friend bool internal::IsDescendant(Message& root, const Message& message); @@ -1174,6 +1181,14 @@ class PROTOBUF_EXPORT Reflection final { inline void SwapInlinedStringDonated(Message* lhs, Message* rhs, const FieldDescriptor* field) const; + // Returns the `_split_` pointer. Requires: IsSplit() == true. + inline const void* GetSplitField(const Message* message) const; + // Returns the address of the `_split_` pointer. Requires: IsSplit() == true. + inline void** MutableSplitField(Message* message) const; + + // Allocate the split instance if needed. + void PrepareSplitMessageForWrite(Message* message) const; + // Shallow-swap fields listed in fields vector of two messages. It is the // caller's responsibility to make sure shallow swap is safe. void UnsafeShallowSwapFields( @@ -1267,6 +1282,9 @@ class PROTOBUF_EXPORT Reflection final { }; // Abstract interface for a factory for message objects. +// +// The thread safety for this class is implementation dependent, see comments +// around GetPrototype for details class PROTOBUF_EXPORT MessageFactory { public: inline MessageFactory() {} @@ -1483,11 +1501,26 @@ bool Reflection::HasOneofField(const Message& message, static_cast(field->number())); } +const void* Reflection::GetSplitField(const Message* message) const { + GOOGLE_DCHECK(schema_.IsSplit()); + return *internal::GetConstPointerAtOffset(message, + schema_.SplitOffset()); +} + +void** Reflection::MutableSplitField(Message* message) const { + GOOGLE_DCHECK(schema_.IsSplit()); + return internal::GetPointerAtOffset(message, schema_.SplitOffset()); +} + template const Type& Reflection::GetRaw(const Message& message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) << "Field = " << field->full_name(); + if (schema_.IsSplit(field)) { + return *internal::GetConstPointerAtOffset( + GetSplitField(&message), schema_.GetFieldOffset(field)); + } return internal::GetConstRefAtOffset(message, schema_.GetFieldOffset(field)); } diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 38779a347..0b463b8c6 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -178,7 +178,7 @@ #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 3021000 +#define PROTOBUF_VERSION 3021001 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined @@ -193,7 +193,7 @@ #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "-rc2" +#define PROTOBUF_VERSION_SUFFIX "" #if defined(PROTOBUF_NAMESPACE) || defined(PROTOBUF_NAMESPACE_ID) #error PROTOBUF_NAMESPACE or PROTOBUF_NAMESPACE_ID was previously defined @@ -798,7 +798,7 @@ // Windows declares several inconvenient macro names. We #undef them and then // restore them in port_undef.inc. -#ifdef _MSC_VER +#ifdef _WIN32 #pragma push_macro("CREATE_NEW") #undef CREATE_NEW #pragma push_macro("DELETE") @@ -851,7 +851,7 @@ #undef STRICT #pragma push_macro("timezone") #undef timezone -#endif // _MSC_VER +#endif // _WIN32 #ifdef __APPLE__ // Inconvenient macro names from usr/include/math.h in some macOS SDKs. diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc index f8968d9a8..44663219f 100644 --- a/src/google/protobuf/port_undef.inc +++ b/src/google/protobuf/port_undef.inc @@ -110,7 +110,7 @@ #endif // Restore macro that may have been #undef'd in port_def.inc. -#ifdef _MSC_VER +#ifdef _WIN32 #pragma pop_macro("CREATE_NEW") #pragma pop_macro("DELETE") #pragma pop_macro("DOUBLE_CLICK") diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index a74832f78..06b3353cc 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -94,23 +94,6 @@ constexpr int RepeatedFieldLowerClampLimit() { constexpr int kRepeatedFieldUpperClampLimit = (std::numeric_limits::max() / 2) + 1; -template -inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) { - return static_cast(std::distance(begin, end)); -} - -template -inline int CalculateReserve(Iter /*begin*/, Iter /*end*/, - std::input_iterator_tag /*unused*/) { - return -1; -} - -template -inline int CalculateReserve(Iter begin, Iter end) { - typedef typename std::iterator_traits::iterator_category Category; - return CalculateReserve(begin, end, Category()); -} - // Swaps two blocks of memory of size sizeof(T). template inline void SwapBlock(char* p, char* q) { @@ -722,13 +705,13 @@ inline Element* RepeatedField::Add() { template template inline void RepeatedField::Add(Iter begin, Iter end) { - int reserve = internal::CalculateReserve(begin, end); - if (reserve != -1) { - if (reserve == 0) { - return; - } + if (std::is_base_of< + std::forward_iterator_tag, + typename std::iterator_traits::iterator_category>::value) { + int additional = std::distance(begin, end); + if (additional == 0) return; - Reserve(reserve + size()); + Reserve(size() + additional); // TODO(ckennelly): The compiler loses track of the buffer freshly // allocated by Reserve() by the time we call elements, so it cannot // guarantee that elements does not alias [begin(), end()). @@ -736,7 +719,7 @@ inline void RepeatedField::Add(Iter begin, Iter end) { // If restrict is available, annotating the pointer obtained from elements() // causes this to lower to memcpy instead of memmove. std::copy(begin, end, elements() + size()); - current_size_ = reserve + size(); + current_size_ = size() + additional; } else { FastAdder fast_adder(this); for (; begin != end; ++begin) fast_adder.Add(*begin); diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index e7525e99c..89118797b 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -46,6 +46,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceContext, _impl_.file_name_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 3625ece1f..63204f789 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 87c72d4aa..43c1eae0a 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -84,6 +84,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBU ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, key_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, value_), 0, @@ -94,6 +96,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBU ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct, _impl_.fields_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Value, _internal_metadata_), @@ -101,6 +105,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBU PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Value, _impl_._oneof_case_[0]), ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) ::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag, @@ -114,13 +120,15 @@ const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBU ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ListValue, _impl_.values_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 8, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse)}, - { 10, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct)}, - { 17, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Value)}, - { 30, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ListValue)}, + { 0, 10, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse)}, + { 12, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct)}, + { 21, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Value)}, + { 36, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ListValue)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index a8019f86b..137227176 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/stubs/BUILD.bazel b/src/google/protobuf/stubs/BUILD.bazel index 2446352ec..73def31f5 100644 --- a/src/google/protobuf/stubs/BUILD.bazel +++ b/src/google/protobuf/stubs/BUILD.bazel @@ -136,3 +136,12 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]), + visibility = ["//pkg:__pkg__"], +) diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 36a4b08e4..81fb42718 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -82,10 +82,10 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3021000 +#define GOOGLE_PROTOBUF_VERSION 3021001 // A suffix string for alpha, beta or rc releases. Empty for stable releases. -#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc2" +#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 728a00438..09b1b176d 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -47,6 +47,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROT ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _impl_.nanos_), }; diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 01c8c8500..7c074c4f0 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index e29bbb83a..4f76508f7 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -119,6 +119,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.fields_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _impl_.oneofs_), @@ -131,6 +133,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.kind_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.cardinality_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _impl_.number_), @@ -147,6 +151,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.enumvalue_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _impl_.options_), @@ -158,6 +164,8 @@ const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.number_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _impl_.options_), @@ -167,15 +175,17 @@ const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _impl_.name_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _impl_.value_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Type)}, - { 12, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Field)}, - { 28, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Enum)}, - { 39, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValue)}, - { 48, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Option)}, + { 14, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Field)}, + { 32, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Enum)}, + { 45, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValue)}, + { 56, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Option)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index ecdb9d9ed..83439e999 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/util/BUILD.bazel b/src/google/protobuf/util/BUILD.bazel index 4fb8319d2..0443c52f6 100644 --- a/src/google/protobuf/util/BUILD.bazel +++ b/src/google/protobuf/util/BUILD.bazel @@ -27,6 +27,7 @@ cc_test( deps = [ ":delimited_message_util", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", @@ -217,8 +218,13 @@ filegroup( srcs = [ "json_format.proto", "json_format_proto3.proto", + "message_differencer_unittest.proto", + "//src/google/protobuf/util/internal:test_proto_srcs", + ], + visibility = [ + "//pkg:__pkg__", + "//python:__pkg__", ], - visibility = ["//python:__pkg__"], ) proto_library( @@ -280,3 +286,14 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]) + [ + "//src/google/protobuf/util/internal:test_srcs", + ], + visibility = ["//pkg:__pkg__"], +) diff --git a/src/google/protobuf/util/internal/BUILD.bazel b/src/google/protobuf/util/internal/BUILD.bazel index d42ecad51..b1cdc6990 100644 --- a/src/google/protobuf/util/internal/BUILD.bazel +++ b/src/google/protobuf/util/internal/BUILD.bazel @@ -8,7 +8,10 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("//build_defs:cpp_opts.bzl", "COPTS") package( - default_visibility = ["//src/google/protobuf/util:__pkg__"], + default_visibility = [ + "//src/google/protobuf/util:__pkg__", + "//pkg:__pkg__", + ], ) cc_library( @@ -448,3 +451,18 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//src:__pkg__"], ) + +filegroup( + name = "test_srcs", + srcs = glob([ + "*_test.cc", + "*unittest.cc", + ]) + [ + "type_info_test_helper.cc", + ], +) + +filegroup( + name = "test_proto_srcs", + srcs = glob(["testdata/*.proto"]), +) diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 40ba60a49..7f78690e6 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -150,6 +150,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FloatValue, _internal_metadata_), @@ -157,6 +159,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FloatValue, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int64Value, _internal_metadata_), @@ -164,6 +168,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int64Value, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt64Value, _internal_metadata_), @@ -171,6 +177,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt64Value, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int32Value, _internal_metadata_), @@ -178,6 +186,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int32Value, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt32Value, _internal_metadata_), @@ -185,6 +195,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt32Value, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BoolValue, _internal_metadata_), @@ -192,6 +204,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BoolValue, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::StringValue, _internal_metadata_), @@ -199,6 +213,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::StringValue, _impl_.value_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BytesValue, _internal_metadata_), @@ -206,18 +222,20 @@ const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTO ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BytesValue, _impl_.value_), }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DoubleValue)}, - { 7, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FloatValue)}, - { 14, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int64Value)}, - { 21, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt64Value)}, - { 28, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int32Value)}, - { 35, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt32Value)}, - { 42, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BoolValue)}, - { 49, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::StringValue)}, - { 56, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BytesValue)}, + { 9, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FloatValue)}, + { 18, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int64Value)}, + { 27, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt64Value)}, + { 36, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int32Value)}, + { 45, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt32Value)}, + { 54, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BoolValue)}, + { 63, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::StringValue)}, + { 72, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BytesValue)}, }; static const ::_pb::Message* const file_default_instances[] = { diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 538dba60e..6f549dd97 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3021000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3021001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/third_party/benchmark b/third_party/benchmark index 0baacde36..5b7683f49 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit 0baacde3618ca617da95375e0af13ce1baadea47 +Subproject commit 5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8