Sync from Piper @453701696

PROTOBUF_SYNC_PIPER
This commit is contained in:
Elliotte Rusty Harold 2022-06-08 12:49:35 -04:00
commit 3ba3c6a36f
89 changed files with 1393 additions and 979 deletions

1
.gitmodules vendored
View File

@ -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

View File

@ -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"],
)

View File

@ -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)

View File

@ -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 \

View File

@ -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

View File

@ -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(

View File

@ -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": [],
})

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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])

View File

@ -385,8 +385,7 @@ public abstract class ByteString implements Iterable<Byte>, 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.

View File

@ -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

View File

@ -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

View File

@ -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/**"
}
}

View File

@ -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/**"
}
}

View File

@ -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/**"
}
}

View File

@ -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

View File

@ -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;"
}

View File

@ -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/**"
}
}

View File

@ -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/**"
}
}

View File

@ -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/**"
}
}

View File

@ -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%

View File

@ -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%

View File

@ -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/**"
}
}

View File

@ -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

View File

@ -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/**"
}
}

View File

@ -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/**"
}
}

View File

@ -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
################################################################################

View File

@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '4.21.0rc2'
__version__ = '4.21.1'

View File

@ -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__"],
)

View File

@ -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_),
};

View File

@ -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.

View File

@ -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[] = {

View File

@ -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.

View File

@ -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
}
}

View File

@ -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__"],
)

View File

@ -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__"],
)

View File

@ -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.

View File

@ -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<Impl_::Split*>(chunk);\n"
" }\n"
"}\n");
"}\n",
DefaultInstanceName(descriptor_, options_, /*split=*/true));
}
GenerateVerify(printer);
@ -2276,7 +2276,16 @@ std::pair<size_t, size_t> 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<size_t, size_t> 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<Impl_::Split*>(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(

View File

@ -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.

View File

@ -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_)) {

View File

@ -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_);

View File

@ -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;

View File

@ -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__"],
)

View File

@ -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__"],
)

View File

@ -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__"],
)

View File

@ -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();

View File

@ -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__"],
)

View File

@ -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[] = {

View File

@ -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.

View File

@ -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__"],
)

View File

@ -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__"],
)

View File

@ -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[] = {

View File

@ -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.

View File

@ -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_),
};

View File

@ -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.

View File

@ -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));

View File

@ -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

View File

@ -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)},

View File

@ -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.

View File

@ -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) = {

View File

@ -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.

View File

@ -35,6 +35,7 @@
#include <google/protobuf/generated_message_reflection.h>
#include <algorithm>
#include <cstring>
#include <set>
#include <google/protobuf/stubs/logging.h>
@ -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 <class Type>
const Type& Reflection::GetRawNonOneof(const Message& message,
const FieldDescriptor* field) const {
if (schema_.IsSplit(field)) {
return *GetConstPointerAtOffset<Type>(
GetSplitField(&message), schema_.GetFieldOffsetNonOneof(field));
}
return GetConstRefAtOffset<Type>(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 <class Type>
Type* Reflection::MutableRawNonOneof(Message* message,
const FieldDescriptor* field) const {
if (schema_.IsSplit(field)) {
PrepareSplitMessageForWrite(message);
return GetPointerAtOffset<Type>(*MutableSplitField(message),
schema_.GetFieldOffsetNonOneof(field));
}
return GetPointerAtOffset<Type>(message,
schema_.GetFieldOffsetNonOneof(field));
}
@ -2451,6 +2479,11 @@ Type* Reflection::MutableRawNonOneof(Message* message,
template <typename Type>
Type* Reflection::MutableRaw(Message* message,
const FieldDescriptor* field) const {
if (schema_.IsSplit(field)) {
PrepareSplitMessageForWrite(message);
return GetPointerAtOffset<Type>(*MutableSplitField(message),
schema_.GetFieldOffset(field));
}
return GetPointerAtOffset<Type>(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;

View File

@ -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<uint32_t>(split_offset_);
}
uint32_t SizeofSplit() const {
GOOGLE_DCHECK(IsSplit());
return static_cast<uint32_t>(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

View File

@ -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 <bool is_split>
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 <bool is_split>
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 <bool is_split>
static const char* MpString(PROTOBUF_TC_PARAM_DECL);
static const char* MpRepeatedString(PROTOBUF_TC_PARAM_DECL);
template <bool is_split>
static const char* MpMessage(PROTOBUF_TC_PARAM_DECL);
static const char* MpRepeatedMessage(PROTOBUF_TC_PARAM_DECL);
static const char* MpMap(PROTOBUF_TC_PARAM_DECL);

View File

@ -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<false>(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<false>(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<false>(PROTOBUF_TC_PARAM_PASS);
case FieldKind::kFkMessage:
PROTOBUF_MUSTTAIL return MpMessage(PROTOBUF_TC_PARAM_PASS);
PROTOBUF_MUSTTAIL return MpMessage<false>(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<true>(PROTOBUF_TC_PARAM_PASS);
case +field_layout::kSplitMask | FieldKind::kFkFixed:
PROTOBUF_MUSTTAIL return MpFixed<true>(PROTOBUF_TC_PARAM_PASS);
case +field_layout::kSplitMask | FieldKind::kFkString:
PROTOBUF_MUSTTAIL return MpString<true>(PROTOBUF_TC_PARAM_PASS);
case +field_layout::kSplitMask | FieldKind::kFkMessage:
PROTOBUF_MUSTTAIL return MpMessage<true>(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<void*>(table->default_instance, split_offset);
void*& split = TcParser::RefAt<void*>(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 <bool is_split>
const char* TcParser::MpFixed(PROTOBUF_TC_PARAM_DECL) {
const auto& entry = RefAt<FieldEntry>(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<uint64_t>(msg, entry.offset) = UnalignedLoad<uint64_t>(ptr);
RefAt<uint64_t>(base, entry.offset) = UnalignedLoad<uint64_t>(ptr);
ptr += sizeof(uint64_t);
} else {
RefAt<uint32_t>(msg, entry.offset) = UnalignedLoad<uint32_t>(ptr);
RefAt<uint32_t>(base, entry.offset) = UnalignedLoad<uint32_t>(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 <bool is_split>
const char* TcParser::MpVarint(PROTOBUF_TC_PARAM_DECL) {
const auto& entry = RefAt<FieldEntry>(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<uint64_t>(msg, entry.offset) = tmp;
RefAt<uint64_t>(base, entry.offset) = tmp;
} else if (rep == field_layout::kRep32Bits) {
RefAt<uint32_t>(msg, entry.offset) = static_cast<uint32_t>(tmp);
RefAt<uint32_t>(base, entry.offset) = static_cast<uint32_t>(tmp);
} else {
GOOGLE_DCHECK_EQ(rep, static_cast<uint16_t>(field_layout::kRep8Bits));
RefAt<bool>(msg, entry.offset) = static_cast<bool>(tmp);
RefAt<bool>(base, entry.offset) = static_cast<bool>(tmp);
}
PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS);
@ -1705,6 +1764,7 @@ bool TcParser::MpVerifyUtf8(StringPiece wire_bytes,
return true;
}
template <bool is_split>
const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) {
const auto& entry = RefAt<FieldEntry>(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<ArenaStringPtr>(msg, entry.offset);
auto& field = RefAt<ArenaStringPtr>(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 <bool is_split>
const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) {
const auto& entry = RefAt<FieldEntry>(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<MessageLite*>(msg, entry.offset);
MessageLite*& field = RefAt<MessageLite*>(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) {

View File

@ -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);

View File

@ -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__"],
)

View File

@ -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

View File

@ -203,12 +203,12 @@ struct Metadata {
namespace internal {
template <class To>
inline To* GetPointerAtOffset(Message* message, uint32_t offset) {
inline To* GetPointerAtOffset(void* message, uint32_t offset) {
return reinterpret_cast<To*>(reinterpret_cast<char*>(message) + offset);
}
template <class To>
const To* GetConstPointerAtOffset(const Message* message, uint32_t offset) {
const To* GetConstPointerAtOffset(const void* message, uint32_t offset) {
return reinterpret_cast<const To*>(reinterpret_cast<const char*>(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<uint32_t>(field->number()));
}
const void* Reflection::GetSplitField(const Message* message) const {
GOOGLE_DCHECK(schema_.IsSplit());
return *internal::GetConstPointerAtOffset<void*>(message,
schema_.SplitOffset());
}
void** Reflection::MutableSplitField(Message* message) const {
GOOGLE_DCHECK(schema_.IsSplit());
return internal::GetPointerAtOffset<void*>(message, schema_.SplitOffset());
}
template <typename Type>
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<Type>(
GetSplitField(&message), schema_.GetFieldOffset(field));
}
return internal::GetConstRefAtOffset<Type>(message,
schema_.GetFieldOffset(field));
}

View File

@ -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.

View File

@ -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")

View File

@ -94,23 +94,6 @@ constexpr int RepeatedFieldLowerClampLimit() {
constexpr int kRepeatedFieldUpperClampLimit =
(std::numeric_limits<int>::max() / 2) + 1;
template <typename Iter>
inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) {
return static_cast<int>(std::distance(begin, end));
}
template <typename Iter>
inline int CalculateReserve(Iter /*begin*/, Iter /*end*/,
std::input_iterator_tag /*unused*/) {
return -1;
}
template <typename Iter>
inline int CalculateReserve(Iter begin, Iter end) {
typedef typename std::iterator_traits<Iter>::iterator_category Category;
return CalculateReserve(begin, end, Category());
}
// Swaps two blocks of memory of size sizeof(T).
template <typename T>
inline void SwapBlock(char* p, char* q) {
@ -722,13 +705,13 @@ inline Element* RepeatedField<Element>::Add() {
template <typename Element>
template <typename Iter>
inline void RepeatedField<Element>::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<Iter>::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<Element>::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);

View File

@ -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) = {

View File

@ -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.

View File

@ -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[] = {

View File

@ -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.

View File

@ -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__"],
)

View File

@ -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

View File

@ -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_),
};

View File

@ -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.

View File

@ -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[] = {

View File

@ -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.

View File

@ -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__"],
)

View File

@ -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"]),
)

View File

@ -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[] = {

View File

@ -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.

@ -1 +1 @@
Subproject commit 0baacde3618ca617da95375e0af13ce1baadea47
Subproject commit 5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8