diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..5eab70363 --- /dev/null +++ b/.clang-format @@ -0,0 +1,390 @@ +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2.0, as +# published by the Free Software Foundation. +# +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. +# +# Without limiting anything contained in the foregoing, this file, +# which is part of Connector/C++, is also subject to the +# Universal FOSS Exception, version 1.0, a copy of which can be found at +# https://oss.oracle.com/licenses/universal-foss-exception. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License, version 2.0, for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# We currently use clang-format version 10. +# +# This is the output of +# +# $ clang-format-10 --style=google --dump-config +# +# for C++ files except for changes mentioned below. +# +# For JavaScript files the output is generated by: +# +# $ clang-format-10 --assume-filename=format.js \ +# --style=google --dump-config +# +# We lock the style so that any newer version of clang-format will give +# the same result; as time goes, we may update this list, requiring +# newer versions of clang-format. + +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + - Regex: '.*' + Priority: 3 + SortPriority: 0 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: true +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + CanonicalDelimiter: '' + BasedOnStyle: google +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Auto +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never + +# We declare one specific pointer style since right alignment is dominant in +# the MySQL code base (default --style=google has DerivePointerAlignment true). +DerivePointerAlignment: false +PointerAlignment: Right + +# MySQL source code is allowed to use C++11 (and C++14) features. +Standard: Cpp11 + +# MySQL includes frequently are not order-independent (e.g. my_config.h needs +# to go on top). This is unfortunate, but not something we can change easily, +# so we keep the clang-format 8 behavior of preserving blocks. +IncludeBlocks: Preserve +--- +Language: JavaScript +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: false +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '(taze:|^/[ ]*<|@see)' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + - Regex: '.*' + Priority: 3 + SortPriority: 0 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: true +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 3 +NamespaceIndentation: All +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + CanonicalDelimiter: '' + BasedOnStyle: google +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Auto +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never diff --git a/.gitignore b/.gitignore index 30c6ad467..59cf60a56 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /CMakeSettings.json .vs out +CMakeUserPresets.json +.vscode diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8bdfff144..000000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "jdbc"] - path = jdbc - url = ../mysql-connector-cpp.git - branch = jdbc diff --git a/CMakeLists.txt b/CMakeLists.txt index e7347146f..3abc8ce7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,10 +24,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) +CMAKE_MINIMUM_REQUIRED(VERSION 3.8) CMAKE_POLICY(VERSION 3.1) cmake_policy(SET CMP0022 NEW) @@ -81,6 +81,7 @@ include(platform) include(dependency) # find_dependency() include(config_options) # add_config_option() include(libutils) # merge_libraries() +include(version_info) # set_version_info() # # Detect if we are configured as stand-alone project, or sub-project. @@ -149,7 +150,7 @@ add_config_option(BUNDLE_DEPENDENCIES BOOL ADVANCED DEFAULT OFF # enable_pic() -enable_cxx11() +enable_cxx17() # # Configure static runtime library on Windows if requested @@ -250,11 +251,10 @@ else() ) #add_compile_options($<$>:-DCONCPP_BUILD_SHARED>) - # Hide all symbols that are not explicitly exported. - - set_visibility(hidden) + endif() -endif() +# Hide all symbols that are not explicitly exported. +set_visibility(hidden) add_config_option(THROW_AS_ASSERT BOOL ADVANCED DEFAULT OFF @@ -271,22 +271,50 @@ endif() # TODO: Fix these warnings. # -if(MSVC) +# TODO: Also cover linker warnings + +add_config_option(WERROR BOOL ADVANCED DEFAULT OFF + "Turn compile warnings into errors" +) + +# +# Note: If WERROR is enabled we change its value to be the actual compiler +# option to be used on the current platform. That is used for easier +# propagation to external builds. +# +# Note: In more recent cmake there is CMAKE_COMPILE_WARNING_AS_ERROR variable +# but at the moment we can't ensure using that recent cmake. +# + +if(WERROR) + set(WERROR -Werror) +endif() + +if(MSVC OR TOOLSET_MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) - # Disable MSVC unreachable code warnings unless requested. - add_compile_options(/wd4702) + if(CXX_FRONTEND_MSVC) - # Disable MSVC warning C4297 as it seems to be buggy. - # Seehttps://connect.microsoft.com/VisualStudio/feedback/details/897611/incorrect-warning-of-c4297-for-destructor-with-try-catch-statement + if(WERROR) + set(WERROR /WX) # MSVC equivalent of -Werror + endif() - add_compile_options(/wd4297) + # Disable MSVC unreachable code warnings unless requested. + add_compile_options(/wd4702) -endif() + # Disable MSVC warning C4297 as it seems to be buggy. + # Seehttps://connect.microsoft.com/VisualStudio/feedback/details/897611/incorrect-warning-of-c4297-for-destructor-with-try-catch-statement + add_compile_options(/wd4297) -if(SUNPRO) + endif() + +elseif(SUNPRO) + + # Note: For simplicity we do not handle WERROR on SunOS + + set(WERROR) add_compile_options( -errtags=yes -erroff=hidevf,wvarhidemem @@ -294,6 +322,34 @@ if(SUNPRO) endif() +if(NOT WERROR) + # clear if WERROR was set to something like OFF or FALSE + # message(STATUS "WERROR: cleared") + unset(WERROR CACHE) +else() + # overwrite cache entry with changed value + set(WERROR "${WERROR}" CACHE INTERNAL "WERROR flags" FORCE) +endif() + +# message(STATUS "WERROR: ${WERROR}") +add_compile_options(${WERROR}) + + +if (GCC AND GCC VERSION_GREATER 11) + # Silence a warning produced by a regression in GCC 12.0 and newer + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106199 + # Note: The stringop-overflow warnings are shown also during linking phase + # (observed with GCC 14.2) + add_compile_options(-Wno-stringop-overflow) + add_link_options(-Wno-stringop-overflow) +endif() + + +# Note: Find OpenSSL early because it is needed by both CDK and JDBC (in case +# of static linking with the client library) + +find_dependency(SSL) + # # Testing framework @@ -342,9 +398,9 @@ if(WITH_JDBC) # we use a copy of them placed inside the build tree. target_include_directories(connector-jdbc - PUBLIC "${PROJECT_BINARY_DIR}/jdbc/cppconn" + PUBLIC "${PROJECT_BINARY_DIR}/include/jdbc" + PUBLIC "${PROJECT_BINARY_DIR}/include/jdbc/cppconn" PUBLIC "${PROJECT_SOURCE_DIR}/include" - PUBLIC "${PROJECT_BINARY_DIR}/jdbc/include/jdbc" ) endif() @@ -366,7 +422,8 @@ if(MAINTAINER_MODE) # (and this is the case for MSVC 2015). # See: http://en.cppreference.com/w/cpp/language/copy_assignment - add_compile_options(/W4 /wd4512 /wd4127) + set_warnings_level(4) + add_compile_options(/wd4512 /wd4127) elseif(SUNPRO) else() @@ -397,7 +454,17 @@ add_subdirectory(devapi) # Generate the main connector library. merge_libraries(connector xapi devapi) -target_include_directories(connector PUBLIC "${PROJECT_SOURCE_DIR}/include") +add_version_info(connector + "MySQL Connector/C++ XDevAPI library." + "Implements MySQL Connector/C++ XDevAPI." +) + +target_include_directories(connector PUBLIC + "${PROJECT_SOURCE_DIR}/include" + # Note: This is needed when using connector directly from the build tree to + # find headers generated by the build process. + $ +) # @@ -432,18 +499,58 @@ if(0) # Add command to show rpath information # -if(APPLE) - set(list_rpath_cmd otool -l $ "|" grep RPATH -A2) -elseif(NOT WIN32) - set(list_rpath_cmd objdump -x $ "|" grep RPATH -A2) + if(APPLE) + set(list_rpath_cmd otool -l $ "|" grep RPATH -A2) + elseif(NOT WIN32) + set(list_rpath_cmd objdump -x $ "|" grep RPATH -A2) + endif() + + add_custom_command(TARGET connector POST_BUILD + COMMAND ${list_rpath_cmd} + COMMENT "RPATH setting for: $" + ) endif() -add_custom_command(TARGET connector POST_BUILD - COMMAND ${list_rpath_cmd} - COMMENT "RPATH setting for: $" -) + +# To be able to use connector library from its build location on Windows we +# need to make OpenSSL DLLs available to it (in case they are not installed +# system-wide). Here we arrange for the OpenSSL DLLs to be copied to the build +# location of the connector library after building it. + +if(WIN32 AND OPENSSL_LIB_DIR) + + # Note: For simplicity we just copy any DLLs we can find at the given + # OpenSSL location. + + file(GLOB glob1 + "${OPENSSL_LIB_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) + + file(GLOB glob2 + "${OPENSSL_LIB_DIR}/../bin/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) + + if(NOT glob1 AND NOT glob2) + + message( + "Warning: Not copying OpenSSL DLLs in a POST_BUILD event" + " of connector target -- they were not found at: ${path}" + " (OPENSSL_LIB_DIR: ${OPENSSL_LIB_DIR})" + ) + + else() + + add_custom_command(TARGET connector POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${glob1} ${glob2} $ + COMMENT "# Copy OpenSSL dependency of connector library." + ) + + endif() + endif() + # # Stop here if this is a sub-project of a bigger project. # @@ -459,7 +566,6 @@ endif() # Note: Locations and names are configured in install_layout.cmake # - set_property(TARGET connector PROPERTY OUTPUT_NAME ${LIB_NAME}) message("Connector library name: ${LIB_NAME}") @@ -482,9 +588,9 @@ install(TARGETS connector install(TARGETS connector CONFIGURATIONS Debug - ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}/debug" COMPONENT XDevAPIDev - RUNTIME DESTINATION "${INSTALL_LIB_DIR}/debug" COMPONENT XDevAPIDll - LIBRARY DESTINATION "${INSTALL_LIB_DIR}/debug" COMPONENT XDevAPIDll + ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC_DEBUG}" COMPONENT XDevAPIDev + RUNTIME DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT XDevAPIDll + LIBRARY DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT XDevAPIDll ) if(MSVC AND NOT BUILD_STATIC) @@ -497,7 +603,7 @@ if(MSVC AND NOT BUILD_STATIC) install(FILES $ CONFIGURATIONS Debug - DESTINATION "${INSTALL_LIB_DIR}/debug" + DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT Debuginfo ) @@ -581,7 +687,7 @@ include(testing/tests.cmake) # -# Create the INFO_SRC and INFO_BIN files +# Create the INFO_SRC, INFO_BIN and other supplementary files # ========================= # diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbd708ecc..1f6990ba2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,33 +9,31 @@ Before reporting a new bug, please check first to see if a similar bug [exists]( Bug reports should be as complete as possible. Please try and include the following: * complete steps to reproduce the issue -* any information about platform and environment that could be specific to the bug +* any information about platform and environment that could be specific to + the bug * Specific version of the product you are using * Specific version of the server being used * C++ code to help reproduce the issue if possible +Please do NOT raise a GitHub Issue to report a security vulnerability. +See SECURITY.md for additional information. + ## Contributing Code -Contributing to this project is easy. You just need to follow these steps. +You need to follow these steps. -* Sign the Oracle Contributor Agreement. You can find instructions for doing that at [OCA Page](https://www.oracle.com/technetwork/community/oca-486395.html) +* Make sure you have a user account at bugs.mysql.com. You'll need to reference + this user account when you submit your OCA (Oracle Contributor Agreement). +* Sign the Oracle Contributor Agreement. You can find instructions for doing + that at [OCA Page](https://oca.opensource.oracle.com/) * Develop your pull request - * Make sure you are aware of the requirements for the project (i.e. don't require C++17 if we are supporting C++11 and higher) -* Validate your pull request by including tests that sufficiently cover the functionality -* Verify that the entire test suite passes with your code applied +* Make sure you are aware of the requirements for the project (i.e. don't + require C++20 if we are supporting C++17 and higher) +* Validate your pull request by including tests that sufficiently cover + the functionality * Submit your pull request +* It is also possible to upload your changes using the 'contribution' tab to + a bug record in https://bugs.mysql.com. -## Running Tests - -Any contributed code should pass our unit tests. -To run the unit tests you need to perform the following steps: - -* Build the Connector/C++ with the cmake option enabling unit tests (-DWITH_TESTS=1) -* Run MySQL Server -* Set the following environment variables: - * XPLUGIN_PORT = - * XLPIGIN_USER = - * XPLUGIN_PASSWORD = -* In the OS command line enter the Connector/C++ build directory and run `ctest` utility - -At the end of `ctest` run the result should indicate 100% tests passed. +Only pull requests from committers that can be verified as having signed the OCA +can be accepted. diff --git a/LICENSE.txt b/LICENSE.txt index aeeaae0bb..8256a84c6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Licensing Information User Manual -MySQL Connector/C++ 8.0 +MySQL Connector/C++ 9.3.0 Community __________________________________________________________________ Introduction @@ -8,24 +8,25 @@ Introduction This License Information User Manual contains Oracle's product license and other licensing information, including licensing information for third-party software which may be included in this distribution of - MySQL Connector/C++ 8.0. + MySQL Connector/C++ 9.3.0 Community. - Last updated: March 2022 + Last updated: March 2025 Licensing Information - This is a release of MySQL Connector/C++ 8.0, brought to you by the - MySQL team at Oracle. This software is released under version 2 of the - GNU General Public License (GPLv2), as set forth below, with the + This release of MySQL Connector/C++ 9.3.0 Community is brought to you + by the MySQL team at Oracle. This software is released under version 2 + of the GNU General Public License (GPLv2), as set forth below, with the following additional permissions: - This distribution of MySQL Connector/C++ 8.0 is distributed with - certain software (including but not limited to OpenSSL) that is - licensed under separate terms, as designated in a particular file or + This distribution of MySQL Connector/C++ 9.3.0 Community is designed to + work with certain software (including but not limited to OpenSSL) that + is licensed under separate terms, as designated in a particular file or component or in the license documentation. Without limiting your rights under the GPLv2, the authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the - separately licensed software that they have included with the program. + separately licensed software that they have either included with the + program or referenced in the documentation. Without limiting the foregoing grant of rights under the GPLv2 and additional permission as to separately licensed software, this @@ -33,7 +34,7 @@ Licensing Information a copy of which is reproduced below and can also be found along with its FAQ at http://oss.oracle.com/licenses/universal-foss-exception. - Copyright (c) 2008, 2022, Oracle and/or its affiliates. + Copyright (c) 2008, 2025, Oracle and/or its affiliates. Election of GPLv2 @@ -457,7 +458,9 @@ The Universal FOSS Exception, Version 1.0 together with Other FOSS after enabling interoperability using the Interfaces of one or both, and distributing the resulting combination under different licenses for the respective portions - thereof. For avoidance of doubt, a license which is OSI-approved or + thereof. + + For avoidance of doubt, a license which is OSI-approved or categorized by the FSF as free, includes, for the purpose of this permission, such licenses with additional permissions, and any license that has previously been so approved or categorized as @@ -480,51 +483,102 @@ Licenses for Third-Party Components Cyrus SASL - Cyrus SASL - -* Copyright (c) 1994-2012 Carnegie Mellon University. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* -* 3. The name "Carnegie Mellon University" must not be used to -* endorse or promote products derived from this software without -* prior written permission. For permission or any legal -* details, please contact -* Office of Technology Transfer -* Carnegie Mellon University -* 5000 Forbes Avenue -* Pittsburgh, PA 15213-3890 -* (412) 268-4387, fax: (412) 268-7395 + * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The name "Carnegie Mellon University" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For permission or any other legal + * details, please contact + * Office of Technology Transfer + * Carnegie Mellon University + * 5000 Forbes Avenue + * Pittsburgh, PA 15213-3890 + * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@andrew.cmu.edu -* -* 4. Redistributions of any form whatsoever must retain the following -* acknowledgment: -* "This product includes software developed by Computing Services -* at Carnegie Mellon University (http://www.cmu.edu/computing/)." -* -* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO -* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE -* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * 4. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by Computing Services + * at Carnegie Mellon University (http://www.cmu.edu/computing/)." + * + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +The following files + +./lib + saslint.h auxprop.c canonusr.c checkpw.c client.c common.c config.c + external.c saslutil.c server.c seterror.c dlopen.c +./plugins + scram.c gssapi.c +./common + plugin_common.c + +have a license header similar to the above with the following copyright: +/* + * Copyright (c) 1998-2016 Carnegie Mellon University. All rights reserved. + * + +./lib/md5.c includes the following license header: +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm +*/ + +/* Function names changed to avoid namespace collisions: Rob Siemborski */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. +*/ ====================================================================== ====================================================================== Google Protocol Buffers +You may be receiving a copy of abseil-cpp as part of this product in object code + form. +The terms of the Oracle license do NOT apply to abseil-cpp. +abseil-cpp is licensed under the Apache 2.0 license, separate from the Oracle pr +oduct. +If you do not wish to install this library, you may remove it, but the Oracle pr +ogram +might not operate properly or at all without it. + Copyright 2008 Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -558,12 +612,48 @@ of the input file used when generating it. This code is not standalone and requires a support library to be linked with it. This support library is itself covered by the above license. +4th party - abseil-cpp +---------------------- + +=== Header in source files: +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// This header file contains C++11 versions of standard header +// abstractions available within C++14 and C++17, and are designed to be +// drop-in replacement for code compliant with C++14 and C++17. + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +A copy of the Apache License v2.0, January 2004 license can be found +in the 'Standard Licenses' section. + ====================================================================== ====================================================================== Kerberos5 -Kerberos5 +You may be receiving a copy of the kerberos documentation as part of this +product. The terms of the Oracle license do NOT apply to Kerberos documentation. + +Kerberos documentation is licensed under the CC-BY-SA 3.0 license, separate from + +the Oracle product. +If you do not wish to install this library, you may remove it, but +the Oracle program might not operate properly or at all without it. Copyright (C) 1985-2019 by the Massachusetts Institute of Technology. @@ -1885,6 +1975,105 @@ The following notice applies to ====================================================================== ====================================================================== +LibFIDO + +Copyright (c) 2018-2021 Yubico AB. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +4th Party +========= + +libcbor +------- + +MIT License + +Copyright (c) 2014-2017 Pavel Kalvoda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +------------------------------------------------------------------------------ +---- +zlib +---- + +Copyright notice: + + (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but +without warranty of any kind. The library has been entirely written by +Jean-loup Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. + +------------------------------------------------------------------------------ +OpenSSL (See its own license section) +------------------------------------------------------------------------------ + + ====================================================================== + ====================================================================== + LZ4 LZ4 Library @@ -1915,142 +2104,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ====================================================================== ====================================================================== -OpenSSL 1.x - - You are receiving a copy of OpenSSL as part of this product in object - code form. The terms of the Oracle license do NOT apply to OpenSSL. - OpenSSL is licensed under a double license, of the OpenSSL License and - the original SSLeay license, separate from the Oracle product. If you - do not wish to install this library, you may remove it, but the Oracle - program might not operate properly or at all without it. - - LICENSE ISSUES - ============== - - The OpenSSL toolkit stays under a double license, i.e. both the conditions of - the OpenSSL License and the original SSLeay license apply to the toolkit. - See below for the actual license texts. - - OpenSSL License - --------------- - -/* ==================================================================== - * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - Original SSLeay License - ----------------------- - -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - - ====================================================================== - ====================================================================== - OpenSSL 3.0 You may be receiving a copy of OpenSSL 3.0 as part of this product in @@ -2070,12 +2123,174 @@ the Oracle program might not operate properly or at all without it. * https://www.openssl.org/source/license.html */ -See Apache License Version 2.0, January 2004 in the +See Apache License v2.0, January 2004 in the 'Standard Licenses' section. ====================================================================== ====================================================================== +OpenTelemetry C++ + +You may be receiving a copy of the opentelemetry-cpp library with +this MySQL product. The terms of the Oracle license do NOT apply +to the opentelemetry-cpp library; it is licensed under the following +license, separately from the Oracle programs you receive. +If you do not wish to install this program, you may delete its files +but the Oracle program might not operate properly or at all without it. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +LICENSE: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +A copy of the Apache License v2.0, January 2004 license can be found +in the 'Standard Licenses' section. + + +4th Party Dependencies +====================== +opentelemetry-proto +------------------- +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +Some files include +// Copyright 2020, OpenTelemetry Authors +(same license header) + +A copy of the Apache License v2.0, January 2004 license can be found +in the 'Standard Licenses' section. + +================================================================================ +== + +protobuf +-------- +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2024, Daniel Stenberg, , and many +contributors, see the THANKS file. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. + +Protobuf dependency - abseil-cpp +-------------------------------- +=== Header in source files: +// Copyright 2017 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// This header file contains C++11 versions of standard header +// abstractions available within C++14 and C++17, and are designed to be drop-in +// replacement for code compliant with C++14 and C++17. + +=== License File + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +A copy of the Apache License v2.0, January 2004 license can be found +in the 'Standard Licenses' section. +================================================================================ +== + +json (nlohmann) +---- + +MIT License + +Copyright (c) 2013-2022 Niels Lohmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +================================================================================ +== + +curl +---- +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2024, Daniel Stenberg, , and many +contributors, see the THANKS file. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. + + ====================================================================== + ====================================================================== + RapidJSON v1.1.0 Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All @@ -2186,9 +2401,46 @@ SOFTWARE. ====================================================================== ====================================================================== -ZSTD +zlib + +Oracle gratefully acknowledges the contributions of Jean-loup Gailly +and Mark Adler in creating the zlib general purpose compression +library which is used in this product. + +Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. + + ====================================================================== + ====================================================================== - Zstandard +ZSTD (Zstandard) Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING). @@ -2585,7 +2837,7 @@ Public License instead of this License. Standard Licenses -Apache License Version 2.0, January 2004 +Apache License v2.0, January 2004 The following applies to all products licensed under the Apache 2.0 License: You may not use the identified files except in compliance diff --git a/README.txt b/README.txt index 2cf0c7e49..d8d6abc47 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008, 2022, Oracle and/or its affiliates. +Copyright (c) 2008, 2025, Oracle and/or its affiliates. This is a release of MySQL Connector/C++, the C++ interface for communicating with MySQL servers. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..5066c11c7 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,29 @@ +# Reporting security vulnerabilities + +Oracle values the independent security research community and believes that +responsible disclosure of security vulnerabilities helps us ensure the security +and privacy of all our users. + +Please do NOT raise a GitHub Issue to report a security vulnerability. If you +believe you have found a security vulnerability, please submit a report to +secalert_us@oracle.com preferably with a proof of concept. Please review +some [additional information](https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html) +on how to report security vulnerabilities to Oracle. We encourage people who +contact Oracle Security to use email encryption using our [encryption key](https://www.oracle.com/security-alerts/encryptionkey.html). + +We ask that you do not use other channels or contact the project maintainers +directly. + +## Security updates, alerts and bulletins + +Security updates will be released on a regular cadence. Many of our projects +will typically release security fixes in conjunction with the Oracle Critical Patch +Update program. Additional information, including past advisories, is available +on our [security alerts page](https://www.oracle.com/security-alerts/). + +## Security-related information + +We will provide security related information such as a threat model, considerations +for secure use, or any known security issues in our documentation. Please note +that labs and sample code are intended to demonstrate a concept and may not be +sufficiently hardened for production use. diff --git a/buildinfo.cmake b/buildinfo.cmake index 98d6cf5d9..7a791671f 100644 --- a/buildinfo.cmake +++ b/buildinfo.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2018, 2020, Oracle and/or its affiliates. +# Copyright (c) 2018, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/ODBC, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,6 +28,32 @@ ########################################################################## +include(version.cmake) + + +function(generate_cmake_config) + + foreach(suffix "-config" "-config-version") + + configure_file( + mysql-concpp${suffix}.cmake.in + "${CMAKE_BINARY_DIR}/mysql-concpp${suffix}.cmake" + @ONLY + ) + + install( + FILES + "${CMAKE_BINARY_DIR}/mysql-concpp${suffix}.cmake" + DESTINATION . + COMPONENT DevCommon + ) + + endforeach() + +endfunction(generate_cmake_config) + + + FUNCTION(GENERATE_INFO_BIN) IF(DEFINED ENV{PRODUCT_ID} AND "$ENV{PRODUCT_ID}" MATCHES "source-dist") @@ -94,7 +120,6 @@ FUNCTION(GENERATE_INFO_BIN) ENDFUNCTION() -include(version.cmake) FUNCTION(GENERATE_INFO_SRC) MESSAGE("Generating INFO_SRC") @@ -169,11 +194,11 @@ FUNCTION(GENERATE_INFO_SRC) ENDIF() ENDIF() - CONFIGURE_FILE(INFO_SRC.in "${CMAKE_SOURCE_DIR}/INFO_SRC") + CONFIGURE_FILE(INFO_SRC.in "${CMAKE_BINARY_DIR}/INFO_SRC") ENDIF() install( - FILES "${CMAKE_SOURCE_DIR}/INFO_SRC" + FILES "${CMAKE_BINARY_DIR}/INFO_SRC" DESTINATION ${INSTALL_DOC_DIR} COMPONENT Readme ) @@ -182,3 +207,4 @@ ENDFUNCTION() GENERATE_INFO_SRC() GENERATE_INFO_BIN() +generate_cmake_config() \ No newline at end of file diff --git a/cdk/CMakeLists.txt b/cdk/CMakeLists.txt index 07da2836d..1e0fb41a7 100644 --- a/cdk/CMakeLists.txt +++ b/cdk/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,13 +24,13 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.15) -cmake_policy(VERSION 3.0) +cmake_policy(VERSION 3.15) if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) # consistently use INTERFACE_LINK_LIBRARIES property @@ -81,7 +81,7 @@ endif() # enable_pic() -enable_cxx11() +enable_cxx17() # ??? -mt set(HAVE_MOVE_SEMANTICS 1) @@ -150,7 +150,7 @@ IF(MSVC) # TODO: move to /Wall when code base is ready for this - add_compile_options(/W4) + set_warnings_level(4) # Note: We disable warnings related to C++11 language because we want this # to be pure C++ code. @@ -187,7 +187,7 @@ IF(MSVC) # Note: 4520 only present on Visual Studio 12 if (MSVC_VERSION LESS 1800) - add_compile_options( + add_flags( /wd4127 # conditional expression is constant (needed for do {...} while(false)) /wd4512 # assignment operator could not be generated /wd4100 # unreferenced formal parameter @@ -208,9 +208,10 @@ ELSE() if(SUNPRO) # TODO: Enable -Wall after fixing warnings - add_compile_options(-errtags=yes -erroff=hidevf) + add_flags(-errtags=yes -erroff=hidevf) else() add_compile_options(-Wall) + add_flags(CXX -Wall) endif() ENDIF() @@ -272,6 +273,7 @@ ADD_SUBDIRECTORY(protocol) ADD_SUBDIRECTORY(mysqlx) ADD_SUBDIRECTORY(core) + # # Write configuration with detected settings. # diff --git a/cdk/CTestConfig.cmake b/cdk/CTestConfig.cmake index 14c95ab28..19b7ed6fa 100644 --- a/cdk/CTestConfig.cmake +++ b/cdk/CTestConfig.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## This file should be placed in the root directory of your project. ## Then modify the CMakeLists.txt file in the root directory of your diff --git a/cdk/cmake/DepFindCompression.cmake b/cdk/cmake/DepFindCompression.cmake index 2ab41f2d5..68f8e1063 100644 --- a/cdk/cmake/DepFindCompression.cmake +++ b/cdk/cmake/DepFindCompression.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,9 +24,9 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -############################################################################## +# ############################################################################# # # Targets: # @@ -34,27 +34,42 @@ # # Imported/alias targets: # -# ext::zlib +# ext::z # ext::lz4 # ext::zstd # -# TODO: -# - allow use of external, dynamic libraries instead of static linking -# -if(TARGET ext::zlib) +if(TARGET ext::z) return() endif() message(STATUS "Setting up compression libraries.") -# Use external builds from the bundled sources +####### +# ZLIB +# +add_ext(zlib zlib.h z ext_zlib) +if(NOT ZLIB_FOUND) + message(FATAL_ERROR "Can't build without zlib support") +endif() + -add_ext(zlib) -add_ext_targets(zlib zlib ext_zlib) +####### +# LZ4 +# +add_ext(lz4 lz4frame.h lz4 ext_lz4) -add_ext(lz4) -add_ext_targets(lz4 lz4 ext_lz4) +if(NOT LZ4_FOUND) + message(FATAL_ERROR "Can't build without lz4 support") +endif() + + +####### +# ZSTD +# +add_ext(zstd zstd.h zstd ext_zstd) + +if(NOT LZ4_FOUND) + message(FATAL_ERROR "Can't build without zstd support") +endif() -add_ext(zstd) -add_ext_targets(zstd zstd ext_zstd) diff --git a/cdk/cmake/DepFindCoverage.cmake b/cdk/cmake/DepFindCoverage.cmake index 6320c6bcb..e2a8d1725 100644 --- a/cdk/cmake/DepFindCoverage.cmake +++ b/cdk/cmake/DepFindCoverage.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA if(COMMAND add_coverage) diff --git a/cdk/cmake/DepFindProtobuf.cmake b/cdk/cmake/DepFindProtobuf.cmake index 414716c3a..6e020fc87 100644 --- a/cdk/cmake/DepFindProtobuf.cmake +++ b/cdk/cmake/DepFindProtobuf.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,9 +24,9 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -############################################################################## +# ############################################################################# # # Targets: # @@ -42,12 +42,8 @@ # # mysqlx_protobuf_generate_cpp() # -# TODO: -# - Allow using external install of protobuf instead of building it from -# bundled sources # - if(TARGET ext::protobuf) return() endif() @@ -55,23 +51,23 @@ endif() message(STATUS "Setting up Protobuf.") # Setup extrnal project that builds protobuf from bundled sources +add_ext(protobuf google/protobuf/api.pb.h) -add_ext(protobuf) +if(NOT PROTOBUF_FOUND) + message(FATAL_ERROR "Can't build without protobuf support") +endif() -# import targets from the external project +# import targets from the external project # Note: The pb_ targets are created by protobuf/exports.cmake - add_ext_targets(protobuf - pb-lite pb_libprotobuf-lite - pb-full pb_libprotobuf - protoc pb_protoc + LIBRARY protobuf-lite pb_libprotobuf-lite + LIBRARY protobuf pb_libprotobuf + EXECUTABLE protoc pb_protoc ) # Standard PROTOBUF_GENERATE_CPP modified to our usage - function(mysqlx_protobuf_generate_cpp SRCS HDRS) - IF(NOT ARGN) MESSAGE(SEND_ERROR "Error: MYSQLX_PROTOBUF_GENERATE_CPP() called without any proto files") @@ -82,7 +78,6 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS) SET(hdrs) FOREACH(FIL ${ARGN}) - GET_FILENAME_COMPONENT(ABS_FIL ${FIL} ABSOLUTE) GET_FILENAME_COMPONENT(FIL_WE ${FIL} NAME_WE) GET_FILENAME_COMPONENT(ABS_PATH ${ABS_FIL} PATH) @@ -92,18 +87,18 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS) ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protobuf/${FIL_WE}.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/protobuf/${FIL_WE}.pb.h" + "${CMAKE_CURRENT_BINARY_DIR}/protobuf/${FIL_WE}.pb.h" COMMAND ${CMAKE_COMMAND} - -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/protobuf" + -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/protobuf" COMMAND ext::protoc ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/protobuf" - -I ${ABS_PATH} ${ABS_FIL} - #--proto_path=${PROTOBUF_INCLUDE_DIR} + -I ${ABS_PATH} ${ABS_FIL} + + # --proto_path=${PROTOBUF_INCLUDE_DIR} DEPENDS ${ABS_FIL} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM ) - ENDFOREACH() SET_SOURCE_FILES_PROPERTIES( @@ -113,7 +108,6 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS) # # Disable compile warnings in code generated by Protobuf # - IF(UNIX) set_source_files_properties(${srcs} APPEND_STRING PROPERTY COMPILE_FLAGS "-w" @@ -121,12 +115,10 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS) ELSEIF(MSVC) set_source_files_properties(${srcs} APPEND_STRING PROPERTY COMPILE_FLAGS - "/W1 /wd4018 /wd4996 /wd4244 /wd4267" + "/wd4018 /wd4996 /wd4244 /wd4267" ) ENDIF() - SET(${SRCS} ${srcs} PARENT_SCOPE) SET(${HDRS} ${hdrs} PARENT_SCOPE) - endfunction(mysqlx_protobuf_generate_cpp) diff --git a/cdk/cmake/DepFindRapidJSON.cmake b/cdk/cmake/DepFindRapidJSON.cmake index 949f1dac4..24f2c486c 100644 --- a/cdk/cmake/DepFindRapidJSON.cmake +++ b/cdk/cmake/DepFindRapidJSON.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ############################################################################## # diff --git a/cdk/cmake/DepFindSSL.cmake b/cdk/cmake/DepFindSSL.cmake index 4ec374aa7..11065ae52 100644 --- a/cdk/cmake/DepFindSSL.cmake +++ b/cdk/cmake/DepFindSSL.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,19 +24,27 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ############################################################################## # # Targets: -# SSL::ssl - main library -# SSL::crypto - crypto library (automatically linked in when needed) +# OpenSSL::SSL - main library (includes crypto library) +# OpenSSL::Crypto - crypto library +# +# Output variables: +# OPENSSL_INCLUDE_DIR +# OPENSSL_LIB_DIR +# OPENSSL_VERSION +# OPENSSL_VERSION_MAJOR +# OPENSSL_LIBRARIES # -if(TARGET SSL::ssl) +if(TARGET OpenSSL::SSL) return() endif() +include(config_header) # add_config() include(CheckSymbolExists) add_config_option(WITH_SSL STRING DEFAULT system @@ -55,26 +63,15 @@ function(main) set(OPENSSL_ROOT_DIR "${WITH_SSL}") endif() - endif() - - - # TODO: Is it needed for anything? - #IF(STATIC_MSVCRT) - # SET(OPENSSL_MSVC_STATIC_RT ON) - #ENDIF() - + if(NOT DEFINED OpenSSL_DIR) + set(OpenSSL_DIR "${WITH_SSL}") + endif() - # - # Note: FindOpenSSL is broken on earlier versions of cmake. We use - # our simplified replacement in that case. - # - # Note: I got strange results on Win even with cmake 3.8 - # + endif() find_openssl() - #find_package(OpenSSL) - if(NOT TARGET SSL::ssl) + if(NOT TARGET OpenSSL::SSL) message(SEND_ERROR "Cannot find appropriate system libraries for SSL. " @@ -88,11 +85,7 @@ function(main) set(OPENSSL_LIB_DIR "${OPENSSL_LIB_DIR}" CACHE INTERNAL "") - if(NOT OPENSSL_VERSION_MAJOR EQUAL 1) - message(SEND_ERROR "OpenSSL version 1.x is required but version ${OPENSSL_VERSION} was found") - else() - message(STATUS "Using OpenSSL version: ${OPENSSL_VERSION}") - endif() + message(STATUS "Using OpenSSL version: ${OPENSSL_VERSION}") set(OPENSSL_VERSION_GLOBAL ${OPENSSL_VERSION} CACHE INTERNAL "OpenSSL Version") #message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") @@ -111,20 +104,6 @@ function(main) check_x509_functions() - if(WIN32 AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/applink.c") - - #message("-- Handling applink.c") - - add_library(openssl-applink STATIC "${OPENSSL_INCLUDE_DIR}/openssl/applink.c") - target_link_libraries(SSL::ssl INTERFACE openssl-applink) - - set_target_properties(openssl-applink PROPERTIES FOLDER "Misc") - # Remove warnings from openssl applink.c - target_compile_options(openssl-applink PRIVATE /wd4152 /wd4996) - - endif() - - if(BUNDLE_DEPENDENCIES) bundle_ssl_libs() endif() @@ -133,7 +112,7 @@ endfunction(main) function(check_x509_functions) - SET(CMAKE_REQUIRED_LIBRARIES SSL::ssl) + SET(CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL) CHECK_SYMBOL_EXISTS(X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS "openssl/x509v3.h" HAVE_X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS) @@ -155,16 +134,76 @@ endfunction(check_x509_functions) # -# output: -# OPENSSL_INCLUDE_DIR -# OPENSSL_LIB_DIR -# OPENSSL_VERSION -# OPENSSL_VERSION_MAJOR +# Find libraries, create import targets and set output variables. # function(find_openssl) - set(hints) + # Note: FindOpenSSL seems to be broken on earlier versions of cmake. + + if(CMAKE_VERSION VERSION_GREATER "3.8" OR USE_CMAKE_FIND_OPENSSL) + + # message(STATUS "Using cmake OpenSSL module") + find_package(OpenSSL) + + set(OPENSSL_LIBRARY "${OPENSSL_SSL_LIBRARY}") + + else() + + # Use our simplified replacement for broken FindOpenSSL + + find_openssl_fix() + + endif() + + # Set OPENSSL_LIB_DIR from the library path if it was not yet defined. + + if(NOT OPENSSL_LIB_DIR) + + # OPENSSL_LIBRARY can be a list containing optimized and debug variants: + # + # optimized;/path/to/optimized/lib;debug;/path/to/debug/lib + # + # In that case we extract path from the optimized library. + + list(FIND OPENSSL_LIBRARY "optimized" pos) + + if(pos LESS 0) + + # If "optimized" entry was not found we assume that OPENSSL_LIBRARY is a single path + + set(lib_path "${OPENSSL_LIBRARY}") + + else() + + # Otherwise read the path after the "optimized" entry + + math(EXPR pos "${pos}+1") + list(GET OPENSSL_LIBRARY ${pos} lib_path) + + endif() + + get_filename_component(OPENSSL_LIB_DIR "${lib_path}" PATH CACHE) + + endif() + + # Set output variables + + set(OPENSSL_FOUND "${OPENSSL_FOUND}" PARENT_SCOPE) + set(OPENSSL_VERSION "${OPENSSL_VERSION}" PARENT_SCOPE) + set(OPENSSL_VERSION_MAJOR "${OPENSSL_VERSION_MAJOR}" PARENT_SCOPE) + set(OPENSSL_INCLUDE_DIR "${OPENSSL_INCLUDE_DIR}" PARENT_SCOPE) + set(OPENSSL_LIB_DIR "${OPENSSL_LIB_DIR}" PARENT_SCOPE) + set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES}" PARENT_SCOPE) + +endfunction(find_openssl) + + +macro(find_openssl_fix) + + set(add_applink true) + unset(hints) + if(OPENSSL_ROOT_DIR) set(hints HINTS ${OPENSSL_ROOT_DIR} NO_DEFAULT_PATH) endif() @@ -179,10 +218,8 @@ function(find_openssl) return() endif() - set(OPENSSL_INCLUDE_DIR "${OPENSSL_INCLUDE_DIR}" PARENT_SCOPE) message("-- found OpenSSL headers at: ${OPENSSL_INCLUDE_DIR}") - # Verify version number. Version information looks like: # #define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1a 20 Nov 2018" @@ -211,13 +248,9 @@ function(find_openssl) list(GET version_list 3 OPENSSL_VERSION_PATCH) - - set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH}" - PARENT_SCOPE ) - set(OPENSSL_VERSION_MAJOR ${OPENSSL_VERSION_MAJOR} PARENT_SCOPE) find_library(OPENSSL_LIBRARY @@ -242,29 +275,44 @@ function(find_openssl) # Note: apparently UNKNOWN library type does not work # https://stackoverflow.com/questions/39346679/cmake-imported-unknown-global-target - add_library(SSL::ssl SHARED IMPORTED GLOBAL) - set_target_properties(SSL::ssl PROPERTIES + add_library(OpenSSL::SSL SHARED IMPORTED GLOBAL) + set_target_properties(OpenSSL::SSL PROPERTIES IMPORTED_LOCATION "${OPENSSL_LIBRARY}" IMPORTED_IMPLIB "${OPENSSL_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}" ) - add_library(SSL::crypto SHARED IMPORTED GLOBAL) - set_target_properties(SSL::crypto PROPERTIES + add_library(OpenSSL::Crypto SHARED IMPORTED GLOBAL) + set_target_properties(OpenSSL::Crypto PROPERTIES IMPORTED_LOCATION "${CRYPTO_LIBRARY}" IMPORTED_IMPLIB "${CRYPTO_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}" ) - set_property(TARGET SSL::ssl PROPERTY - INTERFACE_LINK_LIBRARIES SSL::crypto + set_property(TARGET OpenSSL::SSL PROPERTY + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto ) - get_filename_component(OPENSSL_LIB_DIR "${OPENSSL_LIBRARY}" PATH CACHE) + #TODO: Is it needed also when OpenSSL is found via cmake module? - set(OPENSSL_FOUND TRUE PARENT_SCOPE) + if(WIN32 AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/applink.c") -endfunction(find_openssl) + #message("-- Handling applink.c") + + add_library(openssl-applink STATIC "${OPENSSL_INCLUDE_DIR}/openssl/applink.c") + target_link_libraries(OpenSSL::SSL INTERFACE openssl-applink) + + set_target_properties(openssl-applink PROPERTIES FOLDER "Misc") + # Remove warnings from openssl applink.c + if(CXX_FRONTEND_MSVC) + target_compile_options(openssl-applink PRIVATE /wd4152 /wd4996) + endif() + + endif() + + set(OPENSSL_FOUND true) + +endmacro(find_openssl_fix) # @@ -279,16 +327,20 @@ function(bundle_ssl_libs) endif() - if(NOT WIN32 AND EXISTS ${OPENSSL_LIBRARY} AND EXISTS ${CRYPTO_LIBRARY}) + if(NOT WIN32) # Note: On U**ix systems the files we link to are symlinks to # the actual shared libs, so we read these symlinks here and # bundle their targets as well. - foreach(lib ${OPENSSL_LIBRARY} ${CRYPTO_LIBRARY}) + foreach(lib ${OPENSSL_LIBRARIES}) + + if(NOT EXISTS "${lib}") + continue() + endif() - get_filename_component(path ${lib} REALPATH) - list(APPEND glob1 ${lib} ${path}) + get_filename_component(path "${lib}" REALPATH) + list(APPEND glob1 "${lib}" "${path}") endforeach() @@ -309,16 +361,21 @@ function(bundle_ssl_libs) endif() foreach(lib ${glob1} ${glob2}) + # Copy SSL libs to binary dir as below we will modify them (change the path to + # libcrypto dependency). + file(COPY ${lib} DESTINATION ${CMAKE_BINARY_DIR}/SSL) message("-- bundling OpenSSL library: ${lib}") + get_filename_component(lib_filename ${lib} NAME) + if(WIN32 OR APPLE) - install(FILES ${lib} + install(FILES ${CMAKE_BINARY_DIR}/SSL/${lib_filename} DESTINATION "${INSTALL_LIB_DIR}" COMPONENT OpenSSLDll ) else() - install(FILES ${lib} + install(FILES ${CMAKE_BINARY_DIR}/SSL/${lib_filename} DESTINATION "${INSTALL_LIB_DIR}/private" COMPONENT OpenSSLDll ) @@ -348,6 +405,72 @@ function(bundle_ssl_libs) endif() + if(APPLE) + + # Edit the main OpenSSL library to not include full path to the crypto + # dependency. Instead use path relative to the location of the main library. + # Dependency information is changed from something + # like this: + # + # $ otool -L SSL/libssl.dylib + # SSL/libssl.dylib: + # /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0) + # + # to something like this: + # + # $ otool -L SSL/libssl.dylib + # SSL/libssl.dylib: + # @loader_path/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0) + + # Read original dependencies using otool (only for the main library) + + set(lib_ssl ${OPENSSL_LIBRARIES}) + list(FILTER lib_ssl INCLUDE REGEX "libssl\.dylib$") + + execute_process( + COMMAND otool -L ${lib_ssl} + OUTPUT_VARIABLE OTOOL_OPENSSL_DEPS + ) + + # Parse output of otool to extract full paths and library names + # with versions. + + string(REPLACE "\n" ";" DEPS_LIST ${OTOOL_OPENSSL_DEPS}) + + foreach(line ${DEPS_LIST}) + foreach(lib ssl crypto) + + if(line MATCHES "(/.*lib${lib}.*${CMAKE_SHARED_LIBRARY_SUFFIX}).*compatibility version") + + if(CMAKE_MATCH_1) + set(lib_${lib}_path "${CMAKE_MATCH_1}") + get_filename_component(lib_${lib}_name "${lib_${lib}_path}" NAME) + endif() + + endif() + + endforeach(lib) + endforeach(line) + + + if(NOT lib_ssl_path OR NOT lib_crypto_path) + message("Warning: Failed to edit OpenSSL library dependencies") + return() + endif() + + # Use install_name_tool to replace full path with @loader_path: + # $ install_name_tool -change old new file + + execute_process( + COMMAND chmod +w ${lib_ssl_name} ${lib_crypto_name} + COMMAND install_name_tool + -change "${lib_crypto_path}" "@loader_path/${lib_crypto_name}" + "${lib_ssl_name}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/SSL" + ) + + endif(APPLE) + endfunction(bundle_ssl_libs) diff --git a/cdk/cmake/FindSphinx.cmake b/cdk/cmake/FindSphinx.cmake index 5cba55af3..9b88185bc 100644 --- a/cdk/cmake/FindSphinx.cmake +++ b/cdk/cmake/FindSphinx.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # - Find sphynx executable diff --git a/cdk/cmake/bootstrap.cmake b/cdk/cmake/bootstrap.cmake index 502865be1..dd597dd63 100644 --- a/cdk/cmake/bootstrap.cmake +++ b/cdk/cmake/bootstrap.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2021, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ########################################################################### # @@ -81,6 +81,16 @@ function(bootstrap) list(APPEND cmake_opts "-D" "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") endif() + if(CMAKE_C_COMPILER) + message("-- C compiler: ${CMAKE_C_COMPILER}") + list(APPEND cmake_opts "-D" "CMAKE_C_COMPILER=${CMAKE_C_COMPILER}") + endif() + + if(CMAKE_CXX_COMPILER) + message("-- C++ compiler: ${CMAKE_CXX_COMPILER}") + list(APPEND cmake_opts "-D" "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}") + endif() + message("-- ----") execute_process( diff --git a/cdk/cmake/bootstrap/CMakeLists.txt b/cdk/cmake/bootstrap/CMakeLists.txt index 6a877b271..b487b4ee9 100644 --- a/cdk/cmake/bootstrap/CMakeLists.txt +++ b/cdk/cmake/bootstrap/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2021, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,14 +24,14 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # This is a helper file to generate cmake build configuration cache. # See bootstrap.cmake. # -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.8) project(Bootstrap C CXX) include(TestBigEndian) test_big_endian(big_endian) diff --git a/cdk/cmake/compiler/CLANG.cmake b/cdk/cmake/compiler/CLANG.cmake index 63cdd9a94..fa6ef6f98 100644 --- a/cdk/cmake/compiler/CLANG.cmake +++ b/cdk/cmake/compiler/CLANG.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,12 +24,33 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# TOOLSET and CXX_FRONTEND +# +if(WIN32) + set(TOOLSET "MSVC" CACHE INTERNAL "") + set(TOOLSET_MSVC "1" CACHE INTERNAL "") + if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + set(CXX_FRONTEND "MSVC" CACHE INTERNAL "") + set(CXX_FRONTEND_MSVC "1" CACHE INTERNAL "") + # clang-cl behaves has MSVC + set(MSVC ${compiler_version} CACHE INTERNAL "") + else() + set(CXX_FRONTEND "GCC" CACHE INTERNAL "") + set(CXX_FRONTEND_GCC "1" CACHE INTERNAL "") + endif() +else() + set(TOOLSET "GCC" CACHE INTERNAL "") + set(CXX_FRONTEND "GCC" CACHE INTERNAL "") + set(TOOLSET_GCC "1" CACHE INTERNAL "") + set(CXX_FRONTEND_GCC "1" CACHE INTERNAL "") +endif() -function(enable_cxx11) +function(enable_cxx17) - add_flags(CXX -std=c++11) + add_flags(CXX -std=c++17) # # If Clang is used on macOS and deployment target is not specified @@ -37,7 +58,7 @@ function(enable_cxx11) # sure that clang's native implementation of C++ std # libarary (libc++) is used. Otherwise clang defaults to # GNU version (libstdc++) which is outdated and does - # not handle C++11 well. + # not handle C++17 well. # # TODO: Add option to use the default runtime if user wishes # so. @@ -49,6 +70,11 @@ function(enable_cxx11) endfunction() +function(enable_pic) + if(TOOLSET_GCC) + add_compile_options(-fPIC) + endif() +endfunction() function(set_visibility) add_compile_options(-fvisibility-ms-compat) diff --git a/cdk/cmake/compiler/GCC.cmake b/cdk/cmake/compiler/GCC.cmake index b9801151b..e676dab16 100644 --- a/cdk/cmake/compiler/GCC.cmake +++ b/cdk/cmake/compiler/GCC.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,10 +24,18 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ########################################################################## +# +# TOOLSET and CXX_FRONTEND +# +set(TOOLSET "GCC" CACHE INTERNAL "") +set(CXX_FRONTEND "GCC" CACHE INTERNAL "") +set(TOOLSET_GCC "1" CACHE INTERNAL "") +set(CXX_FRONTEND_GCC "1" CACHE INTERNAL "") + # # Ensure relative source locations in debug entries # diff --git a/cdk/cmake/compiler/MSVC.cmake b/cdk/cmake/compiler/MSVC.cmake index b6e18cb02..71e8e10c6 100644 --- a/cdk/cmake/compiler/MSVC.cmake +++ b/cdk/cmake/compiler/MSVC.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ########################################################################## # @@ -33,6 +33,14 @@ set(ARCH ${MSVC_CXX_ARCHITECTURE_ID} CACHE INTERNAL "architecture id") +# +# If clang-cl is used, we should still set CLANG variable +# + +if(compiler_id MATCHES "Clang") + set(CLANG ${compiler_version} CACHE INTERNAL "") +endif() + # # Set VS and VS_VER (MSVC toolset version) # @@ -51,10 +59,18 @@ else() endif() #message("-- vs: ${VS}") - set(VS_VER ${VS} CACHE INTERNAL "") set(VS "vs${VS}" CACHE INTERNAL "") +# +# TOOLSET and CXX_FRONTEND +# +set(TOOLSET "MSVC" CACHE INTERNAL "") +set(CXX_FRONTEND "MSVC" CACHE INTERNAL "") +set(TOOLSET_MSVC "1" CACHE INTERNAL "") +set(CXX_FRONTEND_MSVC "1" CACHE INTERNAL "") + + # # Commands for global compiler options. # @@ -62,9 +78,8 @@ set(VS "vs${VS}" CACHE INTERNAL "") function(enable_pic) endfunction() -# C++11 is enabled by default for compilers that we support. - -function(enable_cxx11) +function(enable_cxx17) + add_flags(CXX /std:c++17) endfunction() # Note: Needs to be implemented if we ever want to change the default @@ -74,6 +89,16 @@ function(set_visibility) endfunction() +function(set_warnings_level N) + + # Note: The /Wn flag must be set only once, otherwise msvc shows warnings + + string(REGEX REPLACE "/W[123456789]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W${N}") + +endfunction() + + function(set_msvcrt TYPE) if(TYPE MATCHES "^(STATIC|Static|static)$") diff --git a/cdk/cmake/compiler/SUNPRO.cmake b/cdk/cmake/compiler/SUNPRO.cmake index 0486983b7..263fff918 100644 --- a/cdk/cmake/compiler/SUNPRO.cmake +++ b/cdk/cmake/compiler/SUNPRO.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2019, 2020, Oracle and/or its affiliates. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA function(set_defaults) @@ -53,15 +53,15 @@ endfunction() # ----------------------------------------------------------------- -function(enable_cxx11) +function(enable_cxx17) - # Note: calling _enable_cxx11() did not work on Solaris + # Note: calling _enable_cxx17() did not work on Solaris # # With SunPro use GNU libstdc++ implementation of c++ std library. This - # is the default for -std=c++11, but we set it explicitly to be on the safe + # is the default for -std=c++17, but we set it explicitly to be on the safe # side. # - add_flags(CXX -std=c++11 -library=stdcpp) + add_flags(CXX -std=c++17 -library=stdcpp) endfunction() diff --git a/cdk/cmake/config_header.cmake b/cdk/cmake/config_header.cmake index 5b855022e..9492a4b63 100644 --- a/cdk/cmake/config_header.cmake +++ b/cdk/cmake/config_header.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # # Infrastructure for generating configuration header @@ -41,6 +42,10 @@ # the variable is set to the given value. # +if(COMMAND ADD_CONFIG) + return() +endif() + set(CONFIG_VARS "" CACHE INTERNAL "configuration settings" FORCE) set(CONFIG_VARS_VAL "" CACHE INTERNAL "configuration settings" FORCE) diff --git a/cdk/cmake/config_options.cmake b/cdk/cmake/config_options.cmake index 4bc0e457f..c4a46795c 100644 --- a/cdk/cmake/config_options.cmake +++ b/cdk/cmake/config_options.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2008, 2020, Oracle and/or its affiliates. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ########################################################################## # @@ -100,6 +100,11 @@ function(add_config_option OPT TYPE) set(${OPT} $ENV{${OPT}}) endif() + if(DEFINED ${OPT} AND NOT "${${OPT}}" STREQUAL "${default_value}") + # message(STATUS "Option ${OPT} set explictily to: ${${OPT}}") + set(${OPT}_SET true CACHE INTERNAL "") + endif() + if(NOT DEFINED ${OPT} AND DEFINED default_value) set(${OPT} ${default_value}) endif() @@ -134,7 +139,7 @@ function(show_config_options) foreach(opt ${CONFIG_OPTIONS}) - if(NOT "${${opt}_ADVANCED}") + if(${opt}_SET OR NOT "${${opt}_ADVANCED}") message(": ${opt}: ${${opt}}") message("${${opt}_DOC}\n") endif() diff --git a/cdk/cmake/dependency.cmake b/cdk/cmake/dependency.cmake index a1775daf3..1f4410329 100644 --- a/cdk/cmake/dependency.cmake +++ b/cdk/cmake/dependency.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,10 +24,12 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + #include(CMakeParseArguments) include(ProcessorCount) +include(config_options) ########################################################################## # @@ -57,6 +59,8 @@ set(EXT_FWD CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR CMAKE_C_COMPILER CMAKE_CXX_COMPILER + MSVC + WERROR ) set(EXT_DIR ${CMAKE_CURRENT_LIST_DIR}/ext CACHE INTERNAL "external project utils location") @@ -64,17 +68,202 @@ set(EXT_DIR ${CMAKE_CURRENT_LIST_DIR}/ext CACHE INTERNAL "external project utils ########################################################################## # -# add_ext(name) +# add_ext(name header [tgt_name tgt]) +# +# Add an external dependency (such as a 3rd party library) with name `name`. +# There are two cases (where NNN is the specified name) : +# +# 1. Either location of the dependency is given using WTTH_NNN or related +# options (see below), or +# +# 2. Dependency is built from bundled sources located at extra/NNN in the source +# tree if no options are specified. +# +# In case 1 parameter `header` names a file to be located at the specified +# dependency location. In case 2 the `header` parameter is not used. Instead +# targets NNN-build/-rebuild are created that will be used to build the bundled +# sources before the dependency can be used. Invoking these (re)build targets +# is arranged later when `add_ext_targets()` is called (see below). # -# Add external cmake project with sources at extra/name. -# Adds targets (re)build-name that build or re-build this -# external project. +# Variable `NNN_FOUND` is set to true/false to indicate if dependency was +# correctly located/configurred. # -# Note: add_ext_targets() can be used to import targets from such external -# project +# To use the dependency in the project some targets need to be created for it +# using `add_ext_targets()`. # +# If `tgt_name` and `tgt` parameters are given then it is assumed that the +# dependency is a single library and the target is created for it already here +# by a call to `add_ext_targets(name LIBRARY tgt_name tgt)`. +# + +function(add_ext NAME HEADER) + + string(TOUPPER ${NAME} EXT_LIB) + + # TODO: resolve WITH_X in case it is a path + + add_config_option(WITH_${EXT_LIB} STRING "Enable, disable or point to ${EXT_LIB} installation.") + + # TODO: use option aliases for WITH_X (need to port it from CDK) + + add_config_option(${EXT_LIB}_DIR PATH ADVANCED + "Path to ${EXT_LIB} instalation dir." + ) + + add_config_option(${EXT_LIB}_ROOT_DIR PATH ADVANCED + "Path to ${EXT_LIB} instalation dir." + ) + + add_config_option(${EXT_LIB}_INCLUDE_DIR PATH ADVANCED + "Path to ${EXT_LIB} include directory." + ) + + add_config_option(${EXT_LIB}_LIB_DIR PATH ADVANCED + "Path to ${EXT_LIB} lib directory." + ) + + add_config_option(${EXT_LIB}_BIN_DIR PATH ADVANCED + "Path to ${EXT_LIB} bin directory." + ) + + add_config_option(${EXT_LIB}_LIBRARY STRING ADVANCED + "${EXT_LIB} library name" + ) + + + #show_config_options() + + # Handle non-path value of WITH_X option + + if(DEFINED WITH_${EXT_LIB}) + + string(TOUPPER "${WITH_${EXT_LIB}}" with_val) + + if(with_val MATCHES "^SYSTEM$") + set(use_system 1) + elseif(with_val MATCHES "^(YES|ON|1|TRUE)$") + set(use_bundled 1) + elseif(with_val MATCHES "^(NO|OFF|0|FALSE)") + message(FATAL_ERROR "Dependency ${EXT_LIB} is required.") + endif() + + endif() + + # Set X_ROOT_DIR if specified (monolithic install) + + if(DEFINED WITH_${EXT_LIB}) + + if(DEFINED ${EXT_LIB}_ROOT_DIR) + message(FATAL_ERROR "Can't specify both WITH_${EXT_LIB} and ${EXT_LIB}_ROOT_DIR") + endif() + + if(NOT use_system AND NOT use_bundled) + set(${EXT_LIB}_ROOT_DIR "${WITH_${EXT_LIB}}") + endif() + + elseif(DEFINED ${EXT_LIB}_DIR) + + if(DEFINED ${EXT_LIB}_ROOT_DIR) + message(FATAL_ERROR "Can't specify both ${NAME}_DIR and ${NAME}_ROOT_DIR") + endif() + + set(${EXT_LIB}_ROOT_DIR "${${EXT_LIB}_DIR}") + + endif() + + + if(DEFINED ${EXT_LIB}_ROOT_DIR) + + set(${EXT_LIB}_ROOT_DIR "${${EXT_LIB}_ROOT_DIR}" PARENT_SCOPE) + #message(STATUS "!!! _ROOT_DIR: ${${EXT_LIB}_ROOT_DIR}") + + if( + DEFINED ${EXT_LIB}_INCLUDE_DIR OR + DEFINED ${EXT_LIB}_LIB_DIR OR + DEFINED ${EXT_LIB}_LIBRARY + ) + message(FATAL_ERROR "Can't specify both ${EXT_LIB} root dir and include/libs parameters") + endif() + + endif() + + set(${EXT_LIB}_FOUND "0" PARENT_SCOPE) + + + if( + use_bundled OR NOT( + use_system OR + DEFINED ${EXT_LIB}_ROOT_DIR OR + DEFINED ${EXT_LIB}_INCLUDE_DIR OR + DEFINED ${EXT_LIB}_LIB_DIR OR + DEFINED ${EXT_LIB}_LIBRARY + ) + ) + + # Use the bundled sources. + + add_ext_build_targets("${NAME}") + set(${EXT_LIB}_FOUND "1" PARENT_SCOPE) + + else() + + # Use external third party dependency + + # if(DEFINED WITH_${EXT_LIB} AND NOT WITH_${EXT_LIB}) + # return() + # endif() + + # Let's find the header + + if(DEFINED ${EXT_LIB}_ROOT_DIR) + + set(find_opts PATHS ${${EXT_LIB}_ROOT_DIR} + PATH_SUFFIXES include + NO_DEFAULT_PATH + ) + + elseif(DEFINED ${EXT_LIB}_INCLUDE_DIR) + + set(find_opts PATHS ${${EXT_LIB}_INCLUDE_DIR} + NO_DEFAULT_PATH + ) + + endif() + + unset(${EXT_LIB}_INCLUDE_DIR CACHE) + + message(STATUS "Looking for header using options: ${find_opts}") + + find_path(${EXT_LIB}_INCLUDE_DIR + NAMES ${HEADER} + ${find_opts} + REQUIRED + ) + + message(STATUS "${EXT_LIB} INCLUDES : ${${EXT_LIB}_INCLUDE_DIR}") + + if(${EXT_LIB}_INCLUDE_DIR) + set(${EXT_LIB}_FOUND "1" PARENT_SCOPE) + endif() + + endif() + + + if(DEFINED ${EXT_LIB}_LIBRARY AND NOT ${ARGC} GREATER 2) + # FIXME: Why this limitation? + message(FATAL_ERROR + "${EXT_LIB}_LIB_DIR can't be used on ${EXT_LIB} since it has multiple libs" + ) + endif() -function(add_ext NAME) + if(${ARGC} GREATER 2) + add_ext_targets(${NAME} LIBRARY ${ARGN}) + endif() + +endfunction(add_ext) + + +function(add_ext_build_targets NAME) set(src_dir ${PROJECT_SOURCE_DIR}/extra/${NAME}) set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${NAME}) @@ -103,7 +292,6 @@ function(add_ext NAME) # these options are passed. if(NOT COMMAND init_ext_build) - if(CMAKE_GENERATOR_TOOLSET) message("-- toolset: ${CMAKE_GENERATOR_TOOLSET}") list(APPEND cmake_opts "-T ${CMAKE_GENERATOR_TOOLSET}") @@ -118,17 +306,18 @@ function(add_ext NAME) foreach(var ${EXT_FWD}) if(${var}) - message("-- option ${var}: ${${var}}") - list(APPEND cmake_opts -D${var}=${${var}}) + message("-- option ${var}: ${${var}}") + list(APPEND cmake_opts -D${var}=${${var}}) endif() endforeach() + message("-- ----") execute_process( COMMAND ${CMAKE_COMMAND} - -G ${CMAKE_GENERATOR} ${cmake_opts} - -Wno-dev --no-warn-unused-cli - ${src_dir} + -G ${CMAKE_GENERATOR} ${cmake_opts} + -Wno-dev --no-warn-unused-cli + ${src_dir} WORKING_DIRECTORY ${bin_dir} RESULT_VARIABLE res ) @@ -143,19 +332,20 @@ function(add_ext NAME) # Option to use parallel builds (much faster!) # Note: ninja does that by default - set(build_opt) ProcessorCount(prc_cnt) + if(prc_cnt AND NOT CMAKE_VERSION VERSION_LESS 3.12) list(APPEND build_opt --parallel ${prc_cnt}) endif() add_custom_target(${NAME}-build COMMAND ${CMAKE_COMMAND} - -DBIN_DIR=${bin_dir} - -DCONFIG=$ - -DOPTS=${build_opt} - -P ${EXT_DIR}/ext-build.cmake + -DBIN_DIR=${bin_dir} + -DCONFIG=$ + -DOPTS=${build_opt} + -P ${EXT_DIR}/ext-build.cmake + #COMMAND ${CMAKE_COMMAND} --build . --config $ ${build_opt} #COMMAND ${CMAKE_COMMAND} -E touch ${bin_dir}/build.$.stamp #COMMENT "building ${NAME}" @@ -175,7 +365,8 @@ function(add_ext NAME) add_dependencies(rebuild-ext ${NAME}-rebuild) -endfunction(add_ext) +endfunction() + if(NOT TARGET rebuild-ext) add_custom_target(rebuild-ext) @@ -185,88 +376,198 @@ endif() ########################################################################## # -# add_ext_targets(ext name1 tgt1 name2 tgt2 ...) +# add_ext_targets(ext type1 name1 tgt1 type2 name2 tgt2 ...) # -# Defines targets ext::nameK that refer to targets tgtK exported from the -# external project ext. +# Definestargets `ext::nameK` for an external dependency `ext` that was created +# with `add_ext(ext ...) `. The target can refer to a LIBRARY or EXECUTABLE, +# as given by the `typeK` parameter. # -# The external build targets should be exported to file exports.cmake in the -# external build location. Alternatively they can be defined as imported -# targets prior to calling add_ext_targets() (in which case ext is ignored -# but still build-ext will be invoked if it is defined). +# If the external dependency is at locations specified using the corresponding +# WITH_X(or alternative) options then it refers to a library/executable with the +# name `nameK` found in these locations(and `tgtK` argument is ignored). For +# example `add_ext_targets(zlib LIBRARY z ...) ` will create target `ext::z` +# referring to library `libz` found in the external locations specified using +# WITH_ZLIB. # -# The ext::XXX targets will trigger build-ext target when used (if it is -# defined) so that external build is performed before the imported libraries -# are used. +# If the dependency is built from bundled sources, then created target +# `ext::nameK` refers to the build target `tgtK` that should be exported to file +# `exports.cmake` by the bundled dependency build system. In the example of +# `add_ext_targets(zlib LIBRARY z ext_zlib) `, in case zlib is built from +# bundled sources the created `ext::z` target will correspond to the target +# `ext_zlib` exported by the bundled zlib build system. # +# In the case of dependency built from bundled sources the `ext::nameK` target +# will trigger `build-ext` target when used (if it is defined) so that external +# build is performed before the imported libraries are used. function(add_ext_targets EXT) + string(TOUPPER ${EXT} EXT_LIB) set(ext_dir ${CMAKE_CURRENT_BINARY_DIR}/${EXT}) while(ARGN) + list(GET ARGN 0 type) + list(GET ARGN 1 name) + list(GET ARGN 2 tgt) + list(REMOVE_AT ARGN 0 1 2) - list(GET ARGN 0 name) - list(GET ARGN 1 tgt) - list(REMOVE_AT ARGN 0 1) - - if(NOT TARGET ${tgt} AND EXISTS ${ext_dir}/exports.cmake) - include(${ext_dir}/exports.cmake) - endif() - - if(NOT TARGET ${tgt}) - message(FATAL_ERROR "Could not import target ${tgt}") - endif() + # If defined, will use external third party dependencies + if(NOT TARGET ${EXT}-build) + set(target ${name}) - get_target_property(configs ${tgt} IMPORTED_CONFIGURATIONS) - get_target_property(type ${tgt} TYPE) + if(DEFINED ${EXT_LIB}_LIBRARY) + set(name ${${EXT_LIB}_LIBRARY}) + endif() - if(type MATCHES "LIBRARY") - #message("importing library ${tgt} as ext::${name}") + if(type STREQUAL "LIBRARY") + add_ext_lib(${EXT_LIB} ${target} ${name}) + elseif(type STREQUAL "EXECUTABLE") + add_ext_exec(${EXT_LIB} ${target} ${name}) + endif() - add_library(ext::${name} INTERFACE IMPORTED GLOBAL) - target_link_libraries(ext::${name} INTERFACE ${tgt}) + else() - if(TARGET ${EXT}-build) - add_dependencies(ext::${name} ${EXT}-build) + # otherwise, will use bundled code + if(NOT TARGET ${tgt} AND EXISTS ${ext_dir}/exports.cmake) + include(${ext_dir}/exports.cmake) endif() - # Touch imported locations which do not exist before external project - # is built. This is needed for ninja ... - - if(CMAKE_GENERATOR MATCHES "Ninja") - foreach(conf ${configs}) - get_target_property(loc ${tgt} IMPORTED_LOCATION_${conf}) - if(loc) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${loc}) - endif() - endforeach(conf) + if(NOT TARGET ${tgt}) + message(FATAL_ERROR "Could not import target ${tgt}") endif() - endif() + get_target_property(configs ${tgt} IMPORTED_CONFIGURATIONS) + get_target_property(type ${tgt} TYPE) - if(type MATCHES "EXECUTABLE") - #message("importing executable ${tgt} as ext::${name}") + if(type MATCHES "LIBRARY") + # message("importing library ${tgt} as ext::${name}") + add_library(ext::${name} INTERFACE IMPORTED GLOBAL) + target_link_libraries(ext::${name} INTERFACE ${tgt}) - add_executable(ext::${name} IMPORTED GLOBAL) + if(TARGET ${EXT}-build) + add_dependencies(ext::${name} ${EXT}-build) + endif() + + # Touch imported locations which do not exist before external project + # is built. This is needed for ninja ... + if(CMAKE_GENERATOR MATCHES "Ninja") + foreach(conf ${configs}) + get_target_property(loc ${tgt} IMPORTED_LOCATION_${conf}) - if(TARGET ${EXT}-build) - add_dependencies(ext::${name} ${EXT}-build) + if(loc) + execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${loc}) + endif() + endforeach(conf) + endif() endif() - foreach(conf ${configs}) + if(type MATCHES "EXECUTABLE") + # message("importing executable ${tgt} as ext::${name}") + add_executable(ext::${name} IMPORTED GLOBAL) - get_target_property(loc ${tgt} IMPORTED_LOCATION_${conf}) - if(loc) - set_target_properties(ext::${name} - PROPERTIES IMPORTED_LOCATION_${conf} ${loc} - ) + if(TARGET ${EXT}-build) + add_dependencies(ext::${name} ${EXT}-build) endif() - endforeach(conf) + foreach(conf ${configs}) + get_target_property(loc ${tgt} IMPORTED_LOCATION_${conf}) + if(loc) + set_target_properties(ext::${name} + PROPERTIES IMPORTED_LOCATION_${conf} ${loc} + ) + endif() + endforeach(conf) + endif() endif() - endwhile(ARGN) endfunction(add_ext_targets) + + +########################################################################## +# +# add_ext_lib(EXT target name) +# +# Expects include defined on ${EXT}-include and creates target ext::{target} +# pointing to library with ${name} and located on ${EXT}_ROOT_DIR (suffixes: lib +# lib64 dll) or ${${EXT}_LIB_DIR}. +# + +function(add_ext_lib EXT target name) + # Search for the library + if(DEFINED ${EXT}_ROOT_DIR) + set(suffix PATHS ${${EXT}_ROOT_DIR} + PATH_SUFFIXES lib lib64 dll + NO_DEFAULT_PATH + ) + elseif(DEFINED ${EXT}_LIB_DIR) + set(suffix + PATHS ${${EXT}_LIB_DIR} + NO_DEFAULT_PATH + ) + endif() + + unset(library CACHE) + + find_library(library + NAMES ${name} lib${name} + ${suffix} + REQUIRED + ) + + message(STATUS "${EXT} LIBRARY : ${library}") + + # if(NOT EXISTS ${${EXT}_include} OR NOT EXISTS ${library}) + # message(FATAL_ERROR "Couldn't find ${EXT} library.") + # endif() + + add_library(ext::${target} SHARED IMPORTED GLOBAL) + + set_target_properties(ext::${target} PROPERTIES + IMPORTED_LOCATION ${library} + IMPORTED_IMPLIB ${library} + INTERFACE_INCLUDE_DIRECTORIES ${${EXT}_INCLUDE_DIR} + ) + +endfunction(add_ext_lib) + + +########################################################################## +# +# add_ext_exec(EXT target name) +# Creates target ext::{target} pointing to executable with ${name} and located +# on ${EXT}_ROOT_DIR (suffixes: bin) or ${${EXT}_BIN_DIR}. +# + +function(add_ext_exec EXT target name) + # Search for the library + if(DEFINED ${EXT}_ROOT_DIR) + set(suffix PATHS ${${EXT}_ROOT_DIR} + PATH_SUFFIXES bin + NO_DEFAULT_PATH + ) + + elseif(DEFINED ${EXT}_BIN_DIR) + set(suffix PATHS ${${EXT_LIB}_BIN_DIR} + PATH_SUFFIXES bin + NO_DEFAULT_PATH + ) + endif() + + find_program(executable + NAMES ${name} + ${suffix} + NO_CACHE + ) + + if(NOT executable) + message(FATAL_ERROR "Couldn't find ${name} executable.") + endif() + + message(STATUS "${EXT} BINARY: ${executable}") + + add_executable(ext::${target} IMPORTED GLOBAL) + set_target_properties(ext::${target} PROPERTIES + IMPORTED_LOCATION ${executable}) +endfunction(add_ext_exec) diff --git a/cdk/cmake/ext/ext-build.cmake b/cdk/cmake/ext/ext-build.cmake index 3acd7ebc6..70503d0b1 100644 --- a/cdk/cmake/ext/ext-build.cmake +++ b/cdk/cmake/ext/ext-build.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2021, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # This is a cmake script that drives external builds configured using diff --git a/cdk/cmake/gtest.cmake b/cdk/cmake/gtest.cmake index f2a41289f..3e53ba29a 100644 --- a/cdk/cmake/gtest.cmake +++ b/cdk/cmake/gtest.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,16 +24,14 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # # Set up gtest for use by targets in given folder and its sub-folders. # MACRO(SETUP_GTEST) - IF (WITH_GTEST) - INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS}) - ENDIF (WITH_GTEST) ENDMACRO(SETUP_GTEST) @@ -134,6 +132,14 @@ MESSAGE("gtest_main location: ${gtest_main_location}") add_library(gtest STATIC IMPORTED) add_library(gtest_main STATIC IMPORTED) +target_include_directories(gtest INTERFACE ${GTEST_INCLUDE_DIRS}) + +# See: https://stackoverflow.com/questions/42847103/stdtr1-with-visual-studio-2017 + +target_compile_definitions(gtest INTERFACE + -DGTEST_LANG_CXX11=1 +) + set_target_properties(gtest PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION "${gtest_location}" diff --git a/cdk/cmake/headers.cmake b/cdk/cmake/headers.cmake index c0cda7c70..d909f5d8c 100644 --- a/cdk/cmake/headers.cmake +++ b/cdk/cmake/headers.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # # Infrastructure for managing public headers of the project diff --git a/cdk/cmake/headers/check.cmake.in b/cdk/cmake/headers/check.cmake.in index 9ed2b6e6b..884c6b3cd 100644 --- a/cdk/cmake/headers/check.cmake.in +++ b/cdk/cmake/headers/check.cmake.in @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,21 +24,21 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Auto generated file for compiling public header tests # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 3.8) PROJECT(Headers_check) add_compile_options(/wd4251) # FIXME: DLL warning add_compile_options(/wd4521) # multiple copy ctors if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options("-std=c++11") + add_compile_options("-std=c++17") endif() INCLUDE_DIRECTORIES(@hdr_include_dir@) diff --git a/cdk/cmake/headers/check.source.in b/cdk/cmake/headers/check.source.in index c393b1bd4..dece3f9b7 100644 --- a/cdk/cmake/headers/check.source.in +++ b/cdk/cmake/headers/check.source.in @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "@HEADER@" diff --git a/cdk/cmake/platform.cmake b/cdk/cmake/platform.cmake index 9d66fb894..fc3fe6c00 100644 --- a/cdk/cmake/platform.cmake +++ b/cdk/cmake/platform.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ########################################################################## # @@ -38,10 +38,20 @@ # MSVC/GCC/CLANG/SUNPRO - if defined, set to compiler version # SPARC # +# Variables used to define TOOLSET used to build connector +# TOOLSET - currently GCC OR MSVC +# TOOLSET_GCC - defined if TOOLSET = GCC +# TOOLSET_MSVC - defined if TOOLSET = MSVC + +# Variables used to define compiler frontend (command-line interface) +# CXX_FRONTEND - currently GCC OR MSVC +# CXX_FRONTEND_GCC - defined if CXX_FRONTEND = GCC +# CXX_FRONTEND_MSVC - defined if CXX_FRONTEND = MSVC +# # Defines the following commands: # # enable_pic() -# enable_cxx11() +# enable_cxx17() # set_arch(A) # set_visibility() # @@ -73,6 +83,9 @@ if(APPLE) set(MACOS ${CMAKE_SYSTEM_VERSION}) endif() +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(LINUX TRUE CACHE INTERNAL "") +endif() if(CMAKE_SYSTEM_NAME MATCHES "SunOS") set(SUNOS ${CMAKE_SYSTEM_VERSION}) @@ -86,6 +99,9 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") set(SPARC TRUE CACHE INTERNAL "") endif() +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$") + set(ARM_CPU TRUE CACHE INTERNAL "") +endif() ######################################################################## # @@ -99,21 +115,32 @@ macro(add_flags LANG) set(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}" PARENT_SCOPE) endmacro() +include(CheckCXXCompilerFlag) + +# Set single compiler flag only if it is supported, ignore otherwise + +macro(set_compiler_flag FLAG) + unset(flag_supported CACHE) + CHECK_CXX_COMPILER_FLAG(${FLAG} flag_supported) + if(flag_supported) + add_compile_options(${FLAG}) + endif() +endmacro() # ----------------------------------------------------------------- -if(CMAKE_VERSION VERSION_LESS "3.1.3") +if(CMAKE_VERSION VERSION_LESS "3.8.0") -function(enable_cxx11) - add_flags(CXX -std=c++11) +function(enable_cxx17) + add_flags(CXX -std=c++17) endfunction() else() -function(enable_cxx11) +function(enable_cxx17) set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE) - set(CMAKE_CXX_STANDARD 11 PARENT_SCOPE) + set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE) set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE) endfunction() @@ -195,7 +222,6 @@ else() endif() - ######################################################################## function(platform_detection_completed) diff --git a/cdk/cmake/setup.cmake b/cdk/cmake/setup.cmake index d59950129..c32684af6 100644 --- a/cdk/cmake/setup.cmake +++ b/cdk/cmake/setup.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" ${CMAKE_MODULE_PATH}) diff --git a/cdk/cmake/testing.cmake b/cdk/cmake/testing.cmake index 7c8c7cafe..662fba98d 100644 --- a/cdk/cmake/testing.cmake +++ b/cdk/cmake/testing.cmake @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # # Infrastructure for defining unit tests for the project @@ -143,6 +144,7 @@ IF(WITH_TESTS) set_global(test_tests ${test_tests}) add_library(${TEST} OBJECT ${ARGN}) + target_link_libraries(${TEST} gtest) set_target_properties(${TEST} PROPERTIES FOLDER "Tests") target_include_directories(${TEST} PRIVATE ${test_includes}) @@ -152,12 +154,11 @@ IF(WITH_TESTS) if (MSVC) target_compile_definitions(${TEST} PRIVATE + -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS - -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING ) target_compile_options(${TEST} PRIVATE - /W3 /wd4244 /wd4267 /wd4701 @@ -180,16 +181,20 @@ IF(WITH_TESTS) -Wno-unused-value ) - elseif((CMAKE_C_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - target_compile_options(${TEST} PRIVATE - -Wno-unused-value - ) else() #target_compile_options(${TEST} PRIVATE -Wno-unused-result) endif() + if(CLANG) + + #TODO: Remove -Wno-delete-non-abstract-non-virtual-dtor when bumping ABI and + # adding virtual destructor for DbDoc, Value and Column_detail + target_compile_options(${TEST} PRIVATE + -Wno-unused-value -Wno-delete-non-abstract-non-virtual-dtor + ) +endif() if(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") add_definitions( -D_POSIX_PTHREAD_SEMANTICS @@ -288,10 +293,7 @@ IF(WITH_TESTS) if (MSVC) - target_compile_definitions(${target_run_unit_tests} PRIVATE - -D_SCL_SECURE_NO_WARNINGS - -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING - ) + set_warnings_level(3) target_compile_options(${target_run_unit_tests} PRIVATE /wd4244 @@ -318,10 +320,9 @@ IF(WITH_TESTS) ) elseif((CMAKE_C_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - - target_compile_options(${target_run_unit_tests} PRIVATE - -Wno-unused-value - ) + target_compile_options(${target_run_unit_tests} PRIVATE + -Wno-unused-value -Wno-delete-non-abstract-non-virtual-dtor + ) else() #target_compile_options(${target_run_unit_tests} PRIVATE -Wno-unused-result) @@ -338,7 +339,7 @@ IF(WITH_TESTS) # Add ctest definitions for each gtest group # - SET(test_group_defs ${CMAKE_CURRENT_BINARY_DIR}/TestGroups.cmake) + SET(test_group_defs ${PROJECT_BINARY_DIR}/TestGroups.cmake) set(TEST_ENV ${test_environment}) @@ -349,12 +350,21 @@ IF(WITH_TESTS) INCLUDE(${test_group_defs}) ADD_CUSTOM_TARGET(${cdk_target_prefix}update_test_groups - run_unit_tests --generate_test_groups=${test_group_defs} - SOURCES ${tests_dir}/test_main.in + COMMAND $ + "--generate_test_groups=${test_group_defs}" + SOURCES ${tests_dir}/test_main.in + COMMENT "# Generating test group definitons." ) set_target_properties(${cdk_target_prefix}update_test_groups PROPERTIES FOLDER "Tests") + add_custom_command(TARGET ${target_run_unit_tests} POST_BUILD + COMMAND $ + "--generate_test_groups=${test_group_defs}" + # BYPRODUCTS ${test_group_defs} + COMMENT "# Generating test group definitons." + ) + ENDIF() ENDMACRO(ADD_TEST_TARGET) diff --git a/cdk/cmake/testing/test_main.in b/cdk/cmake/testing/test_main.in index 64a811269..e569dbc8a 100644 --- a/cdk/cmake/testing/test_main.in +++ b/cdk/cmake/testing/test_main.in @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* diff --git a/cdk/cmake/utils.cmake b/cdk/cmake/utils.cmake new file mode 100644 index 000000000..3761fb4a3 --- /dev/null +++ b/cdk/cmake/utils.cmake @@ -0,0 +1,162 @@ +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2.0, as +# published by the Free Software Foundation. +# +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. +# +# Without limiting anything contained in the foregoing, this file, +# which is part of Connector/C++, is also subject to the +# Universal FOSS Exception, version 1.0, a copy of which can be found at +# https://oss.oracle.com/licenses/universal-foss-exception. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License, version 2.0, for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +if(COMMAND abort) + return() +endif() + + +function(abort) + message(FATAL_ERROR "!!! " ${ARGN}) +endfunction(abort) + + +# Check that given variables are defined + +macro(check_vars) + foreach(var ${ARGN}) + if(NOT DEFINED ${var}) + abort("Required variable not defined: ${var}") + endif() + endforeach(var ${ARGN}) +endmacro() + + +# +# Add test fixture named NAME defined by tests NAME_setup/cleanup (if they +# exists). Additional setup/cleanup tests with names of the form NAME_foo can +# be added by listing additional test name suffixes. For example the following +# will add fixture `FIX` with setup tests FIX_setup (if exists) FIX_foo +# FIX_bar and cleanup tests FIX_cleanup (if exists) FIX_baz. +# +# add_fixture(FIX foo bar CLEANUP baz) +# + +function(add_fixture NAME) + + set(setup_tests) + set(cleanup_tests) + + if(TEST "${NAME}_setup") + list(APPEND setup_tests "${NAME}_setup") + endif() + + if(TEST "${NAME}_cleanup") + list(APPEND cleanup_tests "${NAME}_cleanup") + endif() + + while(ARGN) + list(POP_FRONT ARGN test) + if(test STREQUAL "SETUP") + continue() + endif() + if(test STREQUAL "CLEANUP") + break() + endif() + list(APPEND setup_tests "${NAME}_${test}") + endwhile() + + while(ARGN) + list(POP_FRONT ARGN test) + list(APPEND cleanup_tests "${NAME}_${test}") + endwhile() + + message(STATUS "Adding fixture ${NAME}: ${setup_tests} / ${cleanup_tests}") + + if(setup_tests) + set_property(TEST ${setup_tests} PROPERTY FIXTURES_SETUP ${NAME}) + endif() + if(cleanup_tests) + set_property(TEST ${cleanup_tests} PROPERTY FIXTURES_CLEANUP ${NAME}) + endif() + +endfunction() + + +# +# Compatibility layer for OS operations +# + +function(check_execute MSG) + + execute_process( + COMMAND ${ARGN} + RESULT_VARIABLE res + ) + + if(res) + message(FATAL_ERROR "!!! ${MSG}") + endif() + +endfunction() + +# Note: Relative to the binary dir! + +function(get_path VAR PATH) + + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) + file(REAL_PATH "${PATH}" path BASE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + else() + # TODO: remove this when we can work with at least cmake 3.19 + get_filename_component(path + "${PATH}" + ABSOLUTE + BASE_DIR ${CMAKE_CURRENT_BINARY_DIR} + ) + endif() + + set(${VAR} "${path}" PARENT_SCOPE) + +endfunction() + + +function(make_dir DIR) + get_path(DIR "${DIR}") + dir_remove("${DIR}") + file(MAKE_DIRECTORY ${DIR}) +endfunction() + +function(make_symlink OLD NEW) + # TODO: use file(CREATE_LINK ...) for cmake version 3.14+ + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${OLD} ${NEW} + ) +endfunction() + +function(file_copy SRC DEST) + configure_file(${SRC} ${DEST} COPYONLY) +endfunction() + +function(dir_copy SRC DST) + file(COPY ${SRC}/ DESTINATION ${DST}) +endfunction() + +function(dir_remove DIR) + #message(STATUS "removing dir: ${DIR}") + file(REMOVE_RECURSE ${DIR}) +endfunction() diff --git a/cdk/config.h.in b/cdk/config.h.in index 458f1bc72..2d2d96414 100644 --- a/cdk/config.h.in +++ b/cdk/config.h.in @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef CDK_CONFIG_H diff --git a/cdk/core/CMakeLists.txt b/cdk/core/CMakeLists.txt index 10cae339c..ba7ee3e0b 100644 --- a/cdk/core/CMakeLists.txt +++ b/cdk/core/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,10 +24,10 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.8) # TODO: Why it is not enough to set it in the top-level CMakeLists.txt? #cmake_policy(SET CMP0023 OLD) @@ -45,7 +45,7 @@ add_library(cdk STATIC ${cdk_sources} ${HEADERS}) target_link_libraries(cdk PUBLIC cdk_mysqlx cdk_parser - PRIVATE ext::pb-lite # required by codecc.cc + PRIVATE ext::protobuf-lite # required by codecc.cc ) add_coverage(cdk) diff --git a/cdk/core/codec.cc b/cdk/core/codec.cc index 3dd2bf99d..bc8a1271d 100644 --- a/cdk/core/codec.cc +++ b/cdk/core/codec.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -117,7 +117,7 @@ foundation::api::String_codec* Format::codec() const switch (charset()) { - case Charset::utf8: + case Charset::utf8mb3: case Charset::utf8mb4: return (foundation::api::String_codec*)&utf8; case Charset::ucs2: diff --git a/cdk/core/session.cc b/cdk/core/session.cc index bd78e4244..feb642e8e 100644 --- a/cdk/core/session.cc +++ b/cdk/core/session.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -53,7 +53,7 @@ struct Session_builder struct ReportStatus { - //False if not able to connect, true if all is good. + // False if not able to connect, true if all is good. option_t m_status = false; Session_builder::ep_filter_t m_filter; size_t m_id; @@ -63,6 +63,12 @@ struct Session_builder , m_id(id) {} + /* + Note: The only reason for ReportStatus object is to use RAII to invoke + m_filter() on destruction to report session creation status. So this + is part of logic of methods that use such object and as such is allowed + to throw errors from the dtor. + */ ~ReportStatus() { @@ -481,7 +487,7 @@ Session::Session(ds::Unix_socket &ds, const ds::Unix_socket::Options &options) #endif //#ifndef WIN32 -Session::~Session() +Session::~Session() NOEXCEPT { delete m_session; delete m_connection; diff --git a/cdk/core/tests/CMakeLists.txt b/cdk/core/tests/CMakeLists.txt index 682015696..960493145 100644 --- a/cdk/core/tests/CMakeLists.txt +++ b/cdk/core/tests/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA IF (WITH_TESTS) diff --git a/cdk/core/tests/expr.h b/cdk/core/tests/expr.h index a292f4adb..a6902af4c 100644 --- a/cdk/core/tests/expr.h +++ b/cdk/core/tests/expr.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_CDK_CORE_TESTS_EXPR_H diff --git a/cdk/core/tests/result-t.cc b/cdk/core/tests/result-t.cc index 4253de95b..3e44902be 100644 --- a/cdk/core/tests/result-t.cc +++ b/cdk/core/tests/result-t.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "test.h" diff --git a/cdk/core/tests/session-t.cc b/cdk/core/tests/session-t.cc index 8141b02ef..6d6fa2108 100644 --- a/cdk/core/tests/session-t.cc +++ b/cdk/core/tests/session-t.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -920,7 +920,7 @@ struct Doc_list uint32_t count() const { return N; } - boost::scoped_ptr m_doc; + std::unique_ptr m_doc; Doc& get_doc(uint32_t pos) const { diff --git a/cdk/core/tests/session_crud-t.cc b/cdk/core/tests/session_crud-t.cc index 87e2b8b80..d32aa9fcc 100644 --- a/cdk/core/tests/session_crud-t.cc +++ b/cdk/core/tests/session_crud-t.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/cdk/core/tests/test.h b/cdk/core/tests/test.h index 75a1c7a28..1d1e5c236 100644 --- a/cdk/core/tests/test.h +++ b/cdk/core/tests/test.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MYSQL_CDK_CORE_TESTS_TEST_H diff --git a/cdk/doc/CMakeLists.txt b/cdk/doc/CMakeLists.txt index 7ce71adea..c8f2751d7 100644 --- a/cdk/doc/CMakeLists.txt +++ b/cdk/doc/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Generate project documentation using Sphinx system. diff --git a/cdk/doc/usage.rst b/cdk/doc/usage.rst index 640f01f19..bdc9d87d5 100644 --- a/cdk/doc/usage.rst +++ b/cdk/doc/usage.rst @@ -17,9 +17,9 @@ project's root folder. CDK should be included from project's main ADD_SUBDIRECTORY(cdk) -CDK requires boost and protobuf to be built. If these libraries can not -be found automatically, locations should be specified using ``WITH_BOOST`` -and ``WITH_PROTOBUF`` configuration options. +CDK requires protobuf to be built. If protobuf can not +be found automatically, locations should be specified using ``WITH_PROTOBUF`` +configuration option. To build a library target ``foo`` which uses CDK one should declare it as follows in ``CMakeLists.txt``:: @@ -92,7 +92,7 @@ with build configuration options: (see below). :WITH_CDK_DOC: - Build CDK documetation using Sphinx. + Build CDK documetation using Sphinx. :WITH_NGS_MOCKUP: Build NGS mockup server which can be used for testing client-side code. @@ -548,7 +548,7 @@ and one has to wait for it to complete, before connection can be used. Reporting bugs ============== -Please report bugs in Jira project +Please report bugs in Jira project `MySQLng Connector/C `_ as issues of type ``Defect`` with "Component" set to ``CDK``. diff --git a/cdk/extra/CMakeLists.txt b/cdk/extra/CMakeLists.txt index e6845269c..de4e522a2 100644 --- a/cdk/extra/CMakeLists.txt +++ b/cdk/extra/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA if(WITH_TESTS) diff --git a/cdk/extra/common/exception.cc b/cdk/extra/common/exception.cc index 5e40bfcad..f0c5ceb9b 100644 --- a/cdk/extra/common/exception.cc +++ b/cdk/extra/common/exception.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "exception.h" diff --git a/cdk/extra/common/exception.h b/cdk/extra/common/exception.h index 3ca9d27cb..67f655e5b 100644 --- a/cdk/extra/common/exception.h +++ b/cdk/extra/common/exception.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _EXCEPTION_H_ diff --git a/cdk/extra/lz4/CMakeLists.txt b/cdk/extra/lz4/CMakeLists.txt index 4c3aab0b2..ebcf76173 100644 --- a/cdk/extra/lz4/CMakeLists.txt +++ b/cdk/extra/lz4/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2021, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA cmake_minimum_required(VERSION 3.0) PROJECT(zstd C) @@ -34,13 +34,17 @@ include(platform) enable_pic() +if(WERROR) + add_compile_options(${WERROR}) +endif() + add_library(lz4 STATIC - lz4.c - lz4frame.c - lz4hc.c - xxhash.c + lib/lz4.c + lib/lz4frame.c + lib/lz4hc.c + lib/xxhash.c ) -target_include_directories(lz4 PUBLIC ${PROJECT_SOURCE_DIR}) +target_include_directories(lz4 PUBLIC ${PROJECT_SOURCE_DIR}/lib) export(TARGETS lz4 NAMESPACE ext_ FILE ${PROJECT_BINARY_DIR}/exports.cmake) diff --git a/cdk/extra/lz4/LICENSE b/cdk/extra/lz4/LICENSE index 74c2cdd7d..1b84cc30f 100644 --- a/cdk/extra/lz4/LICENSE +++ b/cdk/extra/lz4/LICENSE @@ -1,24 +1,12 @@ -LZ4 Library -Copyright (c) 2011-2016, Yann Collet -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +This repository uses 2 different licenses : +- all files in the `lib` directory use a BSD 2-Clause license +- all other files use a GPLv2 license, unless explicitly stated otherwise + +Relevant license is reminded at the top of each source file, +and with presence of COPYING or LICENSE file in associated directories. + +This model is selected to emphasize that +files in the `lib` directory are designed to be included into 3rd party applications, +while all other files, in `programs`, `tests` or `examples`, +are intended to be used "as is", as part of their intended scenarios, +with no intention to support 3rd party integration use cases. diff --git a/cdk/extra/lz4/lz4.c b/cdk/extra/lz4/lib/lz4.c similarity index 58% rename from cdk/extra/lz4/lz4.c rename to cdk/extra/lz4/lib/lz4.c index a3825df30..654bfdf32 100644 --- a/cdk/extra/lz4/lz4.c +++ b/cdk/extra/lz4/lib/lz4.c @@ -1,6 +1,6 @@ /* LZ4 - Fast LZ compression algorithm - Copyright (C) 2011-present, Yann Collet. + Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) @@ -32,14 +32,6 @@ - LZ4 source repository : https://github.com/lz4/lz4 */ -/* - * LZ4_SRC_INCLUDED: - * Amalgamation flag, whether lz4.c is included - */ -#ifndef LZ4_SRC_INCLUDED -# define LZ4_SRC_INCLUDED 1 -#endif - /*-************************************ * Tuning parameters **************************************/ @@ -53,10 +45,16 @@ #endif /* - * ACCELERATION_DEFAULT : + * LZ4_ACCELERATION_DEFAULT : * Select "acceleration" for LZ4_compress_fast() when parameter value <= 0 */ -#define ACCELERATION_DEFAULT 1 +#define LZ4_ACCELERATION_DEFAULT 1 +/* + * LZ4_ACCELERATION_MAX : + * Any "acceleration" value higher than this threshold + * get treated as LZ4_ACCELERATION_MAX instead (fix #876) + */ +#define LZ4_ACCELERATION_MAX 65537 /*-************************************ @@ -90,6 +88,7 @@ * Define this parameter if your target system or compiler does not support hardware bit count */ #if defined(_MSC_VER) && defined(_WIN32_WCE) /* Visual Studio for WinCE doesn't support Hardware bit count */ +# undef LZ4_FORCE_SW_BITCOUNT /* avoid double def */ # define LZ4_FORCE_SW_BITCOUNT #endif @@ -98,8 +97,23 @@ /*-************************************ * Dependency **************************************/ +/* + * LZ4_SRC_INCLUDED: + * Amalgamation flag, whether lz4.c is included + */ +#ifndef LZ4_SRC_INCLUDED +# define LZ4_SRC_INCLUDED 1 +#endif + +#ifndef LZ4_STATIC_LINKING_ONLY #define LZ4_STATIC_LINKING_ONLY +#endif + +#ifndef LZ4_DISABLE_DEPRECATE_WARNINGS #define LZ4_DISABLE_DEPRECATE_WARNINGS /* due to LZ4_decompress_safe_withPrefix64k */ +#endif + +#define LZ4_STATIC_LINKING_ONLY /* LZ4_DISTANCE_MAX */ #include "lz4.h" /* see also "memory routines" below */ @@ -107,10 +121,10 @@ /*-************************************ * Compiler Options **************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# include -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Visual Studio 2005+ */ +# include /* only present in VS2005+ */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +# pragma warning(disable : 6237) /* disable: C6237: conditional expression is always 0 */ #endif /* _MSC_VER */ #ifndef LZ4_FORCE_INLINE @@ -129,8 +143,8 @@ # endif /* _MSC_VER */ #endif /* LZ4_FORCE_INLINE */ -/* LZ4_FORCE_O2_GCC_PPC64LE and LZ4_FORCE_O2_INLINE_GCC_PPC64LE - * Gcc on ppc64le generates an unrolled SIMDized loop for LZ4_wildCopy, +/* LZ4_FORCE_O2 and LZ4_FORCE_INLINE + * gcc on ppc64le generates an unrolled SIMDized loop for LZ4_wildCopy8, * together with a simple 8-byte copy loop as a fall-back path. * However, this optimization hurts the decompression speed by >30%, * because the execution does not go to the optimized loop @@ -138,17 +152,17 @@ * before going to the fall-back path become useless overhead. * This optimization happens only with the -O3 flag, and -O2 generates * a simple 8-byte copy loop. - * With gcc on ppc64le, all of the LZ4_decompress_* and LZ4_wildCopy + * With gcc on ppc64le, all of the LZ4_decompress_* and LZ4_wildCopy8 * functions are annotated with __attribute__((optimize("O2"))), - * and also LZ4_wildCopy is forcibly inlined, so that the O2 attribute - * of LZ4_wildCopy does not affect the compression speed. + * and also LZ4_wildCopy8 is forcibly inlined, so that the O2 attribute + * of LZ4_wildCopy8 does not affect the compression speed. */ #if defined(__PPC64__) && defined(__LITTLE_ENDIAN__) && defined(__GNUC__) && !defined(__clang__) -# define LZ4_FORCE_O2_GCC_PPC64LE __attribute__((optimize("O2"))) -# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE __attribute__((optimize("O2"))) LZ4_FORCE_INLINE +# define LZ4_FORCE_O2 __attribute__((optimize("O2"))) +# undef LZ4_FORCE_INLINE +# define LZ4_FORCE_INLINE static __inline __attribute__((optimize("O2"),always_inline)) #else -# define LZ4_FORCE_O2_GCC_PPC64LE -# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE static +# define LZ4_FORCE_O2 #endif #if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__) @@ -164,21 +178,125 @@ #define unlikely(expr) expect((expr) != 0, 0) #endif +/* Should the alignment test prove unreliable, for some reason, + * it can be disabled by setting LZ4_ALIGN_TEST to 0 */ +#ifndef LZ4_ALIGN_TEST /* can be externally provided */ +# define LZ4_ALIGN_TEST 1 +#endif + /*-************************************ * Memory routines **************************************/ -#include /* malloc, calloc, free */ -#define ALLOC(s) malloc(s) -#define ALLOC_AND_ZERO(s) calloc(1,s) -#define FREEMEM(p) free(p) -#include /* memset, memcpy */ -#define MEM_INIT(p,v,s) memset((p),(v),(s)) + +/*! LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION : + * Disable relatively high-level LZ4/HC functions that use dynamic memory + * allocation functions (malloc(), calloc(), free()). + * + * Note that this is a compile-time switch. And since it disables + * public/stable LZ4 v1 API functions, we don't recommend using this + * symbol to generate a library for distribution. + * + * The following public functions are removed when this symbol is defined. + * - lz4 : LZ4_createStream, LZ4_freeStream, + * LZ4_createStreamDecode, LZ4_freeStreamDecode, LZ4_create (deprecated) + * - lz4hc : LZ4_createStreamHC, LZ4_freeStreamHC, + * LZ4_createHC (deprecated), LZ4_freeHC (deprecated) + * - lz4frame, lz4file : All LZ4F_* functions + */ +#if defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) +# define ALLOC(s) lz4_error_memory_allocation_is_disabled +# define ALLOC_AND_ZERO(s) lz4_error_memory_allocation_is_disabled +# define FREEMEM(p) lz4_error_memory_allocation_is_disabled +#elif defined(LZ4_USER_MEMORY_FUNCTIONS) +/* memory management functions can be customized by user project. + * Below functions must exist somewhere in the Project + * and be available at link time */ +void* LZ4_malloc(size_t s); +void* LZ4_calloc(size_t n, size_t s); +void LZ4_free(void* p); +# define ALLOC(s) LZ4_malloc(s) +# define ALLOC_AND_ZERO(s) LZ4_calloc(1,s) +# define FREEMEM(p) LZ4_free(p) +#else +# include /* malloc, calloc, free */ +# define ALLOC(s) malloc(s) +# define ALLOC_AND_ZERO(s) calloc(1,s) +# define FREEMEM(p) free(p) +#endif + +#if ! LZ4_FREESTANDING +# include /* memset, memcpy */ +#endif +#if !defined(LZ4_memset) +# define LZ4_memset(p,v,s) memset((p),(v),(s)) +#endif +#define MEM_INIT(p,v,s) LZ4_memset((p),(v),(s)) + + +/*-************************************ +* Common Constants +**************************************/ +#define MINMATCH 4 + +#define WILDCOPYLENGTH 8 +#define LASTLITERALS 5 /* see ../doc/lz4_Block_format.md#parsing-restrictions */ +#define MFLIMIT 12 /* see ../doc/lz4_Block_format.md#parsing-restrictions */ +#define MATCH_SAFEGUARD_DISTANCE ((2*WILDCOPYLENGTH) - MINMATCH) /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */ +#define FASTLOOP_SAFE_DISTANCE 64 +static const int LZ4_minLength = (MFLIMIT+1); + +#define KB *(1 <<10) +#define MB *(1 <<20) +#define GB *(1U<<30) + +#define LZ4_DISTANCE_ABSOLUTE_MAX 65535 +#if (LZ4_DISTANCE_MAX > LZ4_DISTANCE_ABSOLUTE_MAX) /* max supported by LZ4 format */ +# error "LZ4_DISTANCE_MAX is too big : must be <= 65535" +#endif + +#define ML_BITS 4 +#define ML_MASK ((1U<=1) +# include +#else +# ifndef assert +# define assert(condition) ((void)0) +# endif +#endif + +#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use after variable declarations */ + +#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2) +# include + static int g_debuglog_enable = 1; +# define DEBUGLOG(l, ...) { \ + if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) { \ + fprintf(stderr, __FILE__ ": "); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " \n"); \ + } } +#else +# define DEBUGLOG(l, ...) {} /* disabled */ +#endif + +static int LZ4_isAligned(const void* ptr, size_t alignment) +{ + return ((size_t)ptr & (alignment -1)) == 0; +} /*-************************************ -* Basic Types +* Types **************************************/ +#include #if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) # include typedef uint8_t BYTE; @@ -188,6 +306,9 @@ typedef uint64_t U64; typedef uintptr_t uptrval; #else +# if UINT_MAX != 4294967295UL +# error "LZ4 code (when not C++ or C99) assumes that sizeof(int) == 4" +# endif typedef unsigned char BYTE; typedef unsigned short U16; typedef unsigned int U32; @@ -202,9 +323,41 @@ typedef size_t reg_t; /* 32-bits in x32 mode */ #endif +typedef enum { + notLimited = 0, + limitedOutput = 1, + fillOutput = 2 +} limitedOutput_directive; + + /*-************************************ * Reading and writing into memory **************************************/ + +/** + * LZ4 relies on memcpy with a constant size being inlined. In freestanding + * environments, the compiler can't assume the implementation of memcpy() is + * standard compliant, so it can't apply its specialized memcpy() inlining + * logic. When possible, use __builtin_memcpy() to tell the compiler to analyze + * memcpy() as if it were standard compliant, so it can inline it in freestanding + * environments. This is needed when decompressing the Linux Kernel, for example. + */ +#if !defined(LZ4_memcpy) +# if defined(__GNUC__) && (__GNUC__ >= 4) +# define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size) +# else +# define LZ4_memcpy(dst, src, size) memcpy(dst, src, size) +# endif +#endif + +#if !defined(LZ4_memmove) +# if defined(__GNUC__) && (__GNUC__ >= 4) +# define LZ4_memmove __builtin_memmove +# else +# define LZ4_memmove memmove +# endif +#endif + static unsigned LZ4_isLittleEndian(void) { const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ @@ -226,40 +379,40 @@ static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } /* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ /* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign; +typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) LZ4_unalign; -static U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; } +static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign*)ptr)->u16; } +static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign*)ptr)->u32; } +static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalign*)ptr)->uArch; } -static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } -static void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; } +static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign*)memPtr)->u16 = value; } +static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign*)memPtr)->u32 = value; } -#else /* safe and portable access through memcpy() */ +#else /* safe and portable access using memcpy() */ static U16 LZ4_read16(const void* memPtr) { - U16 val; memcpy(&val, memPtr, sizeof(val)); return val; + U16 val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val; } static U32 LZ4_read32(const void* memPtr) { - U32 val; memcpy(&val, memPtr, sizeof(val)); return val; + U32 val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val; } static reg_t LZ4_read_ARCH(const void* memPtr) { - reg_t val; memcpy(&val, memPtr, sizeof(val)); return val; + reg_t val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val; } static void LZ4_write16(void* memPtr, U16 value) { - memcpy(memPtr, &value, sizeof(value)); + LZ4_memcpy(memPtr, &value, sizeof(value)); } static void LZ4_write32(void* memPtr, U32 value) { - memcpy(memPtr, &value, sizeof(value)); + LZ4_memcpy(memPtr, &value, sizeof(value)); } #endif /* LZ4_FORCE_MEMORY_ACCESS */ @@ -287,136 +440,116 @@ static void LZ4_writeLE16(void* memPtr, U16 value) } /* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */ -LZ4_FORCE_O2_INLINE_GCC_PPC64LE -void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd) +LZ4_FORCE_INLINE +void LZ4_wildCopy8(void* dstPtr, const void* srcPtr, void* dstEnd) { BYTE* d = (BYTE*)dstPtr; const BYTE* s = (const BYTE*)srcPtr; BYTE* const e = (BYTE*)dstEnd; - do { memcpy(d,s,8); d+=8; s+=8; } while (d= 16. */ +LZ4_FORCE_INLINE void +LZ4_wildCopy32(void* dstPtr, const void* srcPtr, void* dstEnd) { BYTE* d = (BYTE*)dstPtr; const BYTE* s = (const BYTE*)srcPtr; BYTE* const e = (BYTE*)dstEnd; - do { memcpy(d,s,16); memcpy(d+16,s+16,16); d+=32; s+=32; } while (d= dstPtr + MINMATCH + * - there is at least 8 bytes available to write after dstEnd */ +LZ4_FORCE_INLINE void +LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const size_t offset) +{ BYTE v[8]; + + assert(dstEnd >= dstPtr + MINMATCH); + switch(offset) { case 1: - memset(v, *srcPtr, 8); - goto copy_loop; + MEM_INIT(v, *srcPtr, 8); + break; case 2: - memcpy(v, srcPtr, 2); - memcpy(&v[2], srcPtr, 2); - memcpy(&v[4], &v[0], 4); - goto copy_loop; + LZ4_memcpy(v, srcPtr, 2); + LZ4_memcpy(&v[2], srcPtr, 2); +#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */ +# pragma warning(push) +# pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */ +#endif + LZ4_memcpy(&v[4], v, 4); +#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */ +# pragma warning(pop) +#endif + break; case 4: - memcpy(v, srcPtr, 4); - memcpy(&v[4], srcPtr, 4); - goto copy_loop; - case 3: - case 5: - case 6: - case 7: - case 8: + LZ4_memcpy(v, srcPtr, 4); + LZ4_memcpy(&v[4], srcPtr, 4); + break; default: LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset); return; } - copy_loop: - memcpy(dstPtr, v, 8); + LZ4_memcpy(dstPtr, v, 8); dstPtr += 8; while (dstPtr < dstEnd) { - memcpy(dstPtr, v, 8); + LZ4_memcpy(dstPtr, v, 8); dstPtr += 8; } } #endif -/*-************************************ -* Common Constants -**************************************/ -#define MINMATCH 4 - -#define WILDCOPYLENGTH 8 -#define LASTLITERALS 5 /* see ../doc/lz4_Block_format.md#parsing-restrictions */ -#define MFLIMIT 12 /* see ../doc/lz4_Block_format.md#parsing-restrictions */ -#define MATCH_SAFEGUARD_DISTANCE ((2*WILDCOPYLENGTH) - MINMATCH) /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */ -#define FASTLOOP_SAFE_DISTANCE 64 -static const int LZ4_minLength = (MFLIMIT+1); - -#define KB *(1 <<10) -#define MB *(1 <<20) -#define GB *(1U<<30) - -#define MAXD_LOG 16 -#define MAX_DISTANCE ((1 << MAXD_LOG) - 1) - -#define ML_BITS 4 -#define ML_MASK ((1U<=1) -# include -#else -# ifndef assert -# define assert(condition) ((void)0) -# endif -#endif - -#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use after variable declarations */ - -#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2) -# include -static int g_debuglog_enable = 1; -# define DEBUGLOG(l, ...) { \ - if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) { \ - fprintf(stderr, __FILE__ ": "); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, " \n"); \ - } } -#else -# define DEBUGLOG(l, ...) {} /* disabled */ -#endif /*-************************************ @@ -424,75 +557,103 @@ static int g_debuglog_enable = 1; **************************************/ static unsigned LZ4_NbCommonBytes (reg_t val) { + assert(val != 0); if (LZ4_isLittleEndian()) { - if (sizeof(val)==8) { -# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) + if (sizeof(val) == 8) { +# if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT) +/*-************************************************************************************************* +* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11. +* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics +* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC. +****************************************************************************************************/ +# if defined(__clang__) && (__clang_major__ < 10) + /* Avoid undefined clang-cl intrinsics issue. + * See https://github.com/lz4/lz4/pull/1017 for details. */ + return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3; +# else + /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */ + return (unsigned)_tzcnt_u64(val) >> 3; +# endif +# elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; - _BitScanForward64( &r, (U64)val ); - return (int)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctzll((U64)val) >> 3); + _BitScanForward64(&r, (U64)val); + return (unsigned)r >> 3; +# elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \ + ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \ + !defined(LZ4_FORCE_SW_BITCOUNT) + return (unsigned)__builtin_ctzll((U64)val) >> 3; # else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, - 0, 3, 1, 3, 1, 4, 2, 7, - 0, 2, 3, 6, 1, 5, 3, 5, - 1, 3, 4, 4, 2, 5, 6, 7, - 7, 0, 1, 2, 3, 3, 4, 6, - 2, 6, 5, 5, 3, 4, 5, 6, - 7, 1, 2, 4, 6, 4, 4, 5, - 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; + const U64 m = 0x0101010101010101ULL; + val ^= val - 1; + return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56); # endif } else /* 32 bits */ { -# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) +# if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r; - _BitScanForward( &r, (U32)val ); - return (int)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctz((U32)val) >> 3); + _BitScanForward(&r, (U32)val); + return (unsigned)r >> 3; +# elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \ + ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \ + !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT) + return (unsigned)__builtin_ctz((U32)val) >> 3; # else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, - 3, 2, 2, 1, 3, 2, 0, 1, - 3, 3, 1, 2, 2, 2, 2, 0, - 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; + const U32 m = 0x01010101; + return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24; # endif } } else /* Big Endian CPU */ { - if (sizeof(val)==8) { /* 64-bits */ -# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse64( &r, val ); - return (unsigned)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clzll((U64)val) >> 3); + if (sizeof(val)==8) { +# if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \ + ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \ + !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT) + return (unsigned)__builtin_clzll((U64)val) >> 3; # else +#if 1 + /* this method is probably faster, + * but adds a 128 bytes lookup table */ + static const unsigned char ctz7_tab[128] = { + 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + }; + U64 const mask = 0x0101010101010101ULL; + U64 const t = (((val >> 8) - mask) | val) & mask; + return ctz7_tab[(t * 0x0080402010080402ULL) >> 57]; +#else + /* this method doesn't consume memory space like the previous one, + * but it contains several branches, + * that may end up slowing execution */ static const U32 by32 = sizeof(val)*4; /* 32 on 64 bits (goal), 16 on 32 bits. - Just to avoid some static analyzer complaining about shift by 32 on 32-bits target. - Note that this code path is never triggered in 32-bits mode. */ + Just to avoid some static analyzer complaining about shift by 32 on 32-bits target. + Note that this code path is never triggered in 32-bits mode. */ unsigned r; if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; } if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } r += (!val); return r; +#endif # endif } else /* 32 bits */ { -# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse( &r, (unsigned long)val ); - return (unsigned)(r>>3); -# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clz((U32)val) >> 3); +# if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \ + ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \ + !defined(LZ4_FORCE_SW_BITCOUNT) + return (unsigned)__builtin_clz((U32)val) >> 3; # else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; + val >>= 8; + val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) | + (val + 0x00FF0000)) >> 24; + return (unsigned)val ^ 3; # endif } } } + #define STEPSIZE sizeof(reg_t) LZ4_FORCE_INLINE unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit) @@ -532,13 +693,6 @@ static const U32 LZ4_skipTrigger = 6; /* Increase this value ==> compression ru /*-************************************ * Local Structures and types **************************************/ -typedef enum { - noLimit = 0, - notLimited = 1, - limitedOutput = 2, - fillOutput = 3, - limitedDestSize = 4 -} limitedOutput_directive; typedef enum { clearedTable = 0, byPtr, byU32, byU16 } tableType_t; /** @@ -554,10 +708,10 @@ typedef enum { clearedTable = 0, byPtr, byU32, byU16 } tableType_t; * - usingExtDict : Like withPrefix64k, but the preceding content is somewhere * else in memory, starting at ctx->dictionary with length * ctx->dictSize. - * - usingDictCtx : Like usingExtDict, but everything concerning the preceding - * content is in a separate context, pointed to by - * ctx->dictCtx. ctx->dictionary, ctx->dictSize, and table - * entries in the current context that refer to positions + * - usingDictCtx : Everything concerning the preceding content is + * in a separate context, pointed to by ctx->dictCtx. + * ctx->dictionary, ctx->dictSize, and table entries + * in the current context that refer to positions * preceding the beginning of the current compression are * ignored. Instead, ctx->dictCtx->dictionary and ctx->dictCtx * ->dictSize describe the location and size of the preceding @@ -574,20 +728,24 @@ typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive; int LZ4_versionNumber (void) { return LZ4_VERSION_NUMBER; } const char* LZ4_versionString(void) { return LZ4_VERSION_STRING; } int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); } -int LZ4_sizeofState() { return LZ4_STREAMSIZE; } +int LZ4_sizeofState(void) { return sizeof(LZ4_stream_t); } -/*-************************************ -* Internal Definitions used in Tests -**************************************/ +/*-**************************************** +* Internal Definitions, used only in Tests +*******************************************/ #if defined (__cplusplus) extern "C" { #endif -int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize); - -int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize, const void* dict, size_t dictSize); +int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* dest, int srcSize); +int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, + int compressedSize, int maxOutputSize, + const void* dictStart, size_t dictSize); +int LZ4_decompress_safe_partial_forceExtDict(const char* source, char* dest, + int compressedSize, int targetOutputSize, int dstCapacity, + const void* dictStart, size_t dictSize); #if defined (__cplusplus) } #endif @@ -595,7 +753,7 @@ int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int /*-****************************** * Compression functions ********************************/ -static U32 LZ4_hash4(U32 sequence, tableType_t const tableType) +LZ4_FORCE_INLINE U32 LZ4_hash4(U32 sequence, tableType_t const tableType) { if (tableType == byU16) return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1))); @@ -603,7 +761,7 @@ static U32 LZ4_hash4(U32 sequence, tableType_t const tableType) return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG)); } -static U32 LZ4_hash5(U64 sequence, tableType_t const tableType) +LZ4_FORCE_INLINE U32 LZ4_hash5(U64 sequence, tableType_t const tableType) { const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG; if (LZ4_isLittleEndian()) { @@ -621,7 +779,19 @@ LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tab return LZ4_hash4(LZ4_read32(p), tableType); } -static void LZ4_putIndexOnHash(U32 idx, U32 h, void* tableBase, tableType_t const tableType) +LZ4_FORCE_INLINE void LZ4_clearHash(U32 h, void* tableBase, tableType_t const tableType) +{ + switch (tableType) + { + default: /* fallthrough */ + case clearedTable: { /* illegal! */ assert(0); return; } + case byPtr: { const BYTE** hashTable = (const BYTE**)tableBase; hashTable[h] = NULL; return; } + case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = 0; return; } + case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = 0; return; } + } +} + +LZ4_FORCE_INLINE void LZ4_putIndexOnHash(U32 idx, U32 h, void* tableBase, tableType_t const tableType) { switch (tableType) { @@ -633,7 +803,7 @@ static void LZ4_putIndexOnHash(U32 idx, U32 h, void* tableBase, tableType_t cons } } -static void LZ4_putPositionOnHash(const BYTE* p, U32 h, +LZ4_FORCE_INLINE void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t const tableType, const BYTE* srcBase) { @@ -658,7 +828,7 @@ LZ4_FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_ * Assumption 1 : only valid if tableType == byU32 or byU16. * Assumption 2 : h is presumed valid (within limits of hash table) */ -static U32 LZ4_getIndexOnHash(U32 h, const void* tableBase, tableType_t tableType) +LZ4_FORCE_INLINE U32 LZ4_getIndexOnHash(U32 h, const void* tableBase, tableType_t tableType) { LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2); if (tableType == byU32) { @@ -681,50 +851,44 @@ static const BYTE* LZ4_getPositionOnHash(U32 h, const void* tableBase, tableType { const U16* const hashTable = (const U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */ } -LZ4_FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, - const void* tableBase, tableType_t tableType, - const BYTE* srcBase) +LZ4_FORCE_INLINE const BYTE* +LZ4_getPosition(const BYTE* p, + const void* tableBase, tableType_t tableType, + const BYTE* srcBase) { U32 const h = LZ4_hashPosition(p, tableType); return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase); } -LZ4_FORCE_INLINE void LZ4_prepareTable( - LZ4_stream_t_internal* const cctx, - const int inputSize, - const tableType_t tableType) { - /* If compression failed during the previous step, then the context - * is marked as dirty, therefore, it has to be fully reset. - */ - if (cctx->dirty) { - DEBUGLOG(5, "LZ4_prepareTable: Full reset for %p", cctx); - MEM_INIT(cctx, 0, sizeof(LZ4_stream_t_internal)); - return; - } - +LZ4_FORCE_INLINE void +LZ4_prepareTable(LZ4_stream_t_internal* const cctx, + const int inputSize, + const tableType_t tableType) { /* If the table hasn't been used, it's guaranteed to be zeroed out, and is * therefore safe to use no matter what mode we're in. Otherwise, we figure * out if it's safe to leave as is or whether it needs to be reset. */ - if (cctx->tableType != clearedTable) { - if (cctx->tableType != tableType - || (tableType == byU16 && cctx->currentOffset + inputSize >= 0xFFFFU) - || (tableType == byU32 && cctx->currentOffset > 1 GB) + if ((tableType_t)cctx->tableType != clearedTable) { + assert(inputSize >= 0); + if ((tableType_t)cctx->tableType != tableType + || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU) + || ((tableType == byU32) && cctx->currentOffset > 1 GB) || tableType == byPtr || inputSize >= 4 KB) { DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", cctx); MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE); cctx->currentOffset = 0; - cctx->tableType = clearedTable; + cctx->tableType = (U32)clearedTable; } else { DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)"); } } - /* Adding a gap, so all previous entries are > MAX_DISTANCE back, is faster - * than compressing without a gap. However, compressing with - * currentOffset == 0 is faster still, so we preserve that case. + /* Adding a gap, so all previous entries are > LZ4_DISTANCE_MAX back, + * is faster than compressing without a gap. + * However, compressing with currentOffset == 0 is faster still, + * so we preserve that case. */ if (cctx->currentOffset != 0 && tableType == byU32) { DEBUGLOG(5, "LZ4_prepareTable: adding 64KB to currentOffset"); @@ -738,19 +902,23 @@ LZ4_FORCE_INLINE void LZ4_prepareTable( } /** LZ4_compress_generic() : - inlined, to ensure branches are decided at compilation time */ -LZ4_FORCE_INLINE int LZ4_compress_generic( + * inlined, to ensure branches are decided at compilation time. + * Presumed already validated at this stage: + * - source != NULL + * - inputSize > 0 + */ +LZ4_FORCE_INLINE int LZ4_compress_generic_validated( LZ4_stream_t_internal* const cctx, const char* const source, char* const dest, const int inputSize, - int *inputConsumed, /* only written when outputLimited == fillOutput */ + int* inputConsumed, /* only written when outputDirective == fillOutput */ const int maxOutputSize, - const limitedOutput_directive outputLimited, + const limitedOutput_directive outputDirective, const tableType_t tableType, const dict_directive dictDirective, const dictIssue_directive dictIssue, - const U32 acceleration) + const int acceleration) { int result; const BYTE* ip = (const BYTE*) source; @@ -768,7 +936,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx); U32 const prefixIdxLimit = startIndex - dictSize; /* used when dictDirective == dictSmall */ - const BYTE* const dictEnd = dictionary + dictSize; + const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary; const BYTE* anchor = (const BYTE*) source; const BYTE* const iend = ip + inputSize; const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1; @@ -776,7 +944,8 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( /* the dictCtx currentOffset is indexed on the start of the dictionary, * while a dictionary in the current context precedes the currentOffset */ - const BYTE* dictBase = (dictDirective == usingDictCtx) ? + const BYTE* dictBase = (dictionary == NULL) ? NULL : + (dictDirective == usingDictCtx) ? dictionary + dictSize - dictCtx->currentOffset : dictionary + dictSize - startIndex; @@ -786,12 +955,12 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( U32 offset = 0; U32 forwardH; - DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, tableType=%u", inputSize, tableType); + DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType); + assert(ip != NULL); /* If init conditions are not met, we don't have to mark stream * as having dirty context, since no action was taken yet */ - if (outputLimited == fillOutput && maxOutputSize < 1) return 0; /* Impossible to store anything */ - if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */ - if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ + if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */ + if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) { return 0; } /* Size too large (not within 64K limit) */ if (tableType==byPtr) assert(dictDirective==noDict); /* only supported use case with byPtr */ assert(acceleration >= 1); @@ -807,7 +976,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( cctx->dictSize += (U32)inputSize; } cctx->currentOffset += (U32)inputSize; - cctx->tableType = (U16)tableType; + cctx->tableType = (U32)tableType; if (inputSizehashTable, tableType, base); - } while ( (match+MAX_DISTANCE < ip) + } while ( (match+LZ4_DISTANCE_MAX < ip) || (LZ4_read32(match) != LZ4_read32(ip)) ); } else { /* byU32, byU16 */ const BYTE* forwardIp = ip; - unsigned step = 1; - unsigned searchMatchNb = acceleration << LZ4_skipTrigger; + int step = 1; + int searchMatchNb = acceleration << LZ4_skipTrigger; do { U32 const h = forwardH; U32 const current = (U32)(forwardIp - base); @@ -871,10 +1041,11 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( match = base + matchIndex; lowLimit = (const BYTE*)source; } - } else if (dictDirective==usingExtDict) { + } else if (dictDirective == usingExtDict) { if (matchIndex < startIndex) { DEBUGLOG(7, "extDict candidate: matchIndex=%5u < startIndex=%5u", matchIndex, startIndex); assert(startIndex - matchIndex >= MINMATCH); + assert(dictBase); match = dictBase + matchIndex; lowLimit = dictionary; } else { @@ -887,10 +1058,14 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( forwardH = LZ4_hashPosition(forwardIp, tableType); LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType); - if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) continue; /* match outside of valid area */ + DEBUGLOG(7, "candidate at pos=%u (offset=%u \n", matchIndex, current - matchIndex); + if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; } /* match outside of valid area */ assert(matchIndex < current); - if ((tableType != byU16) && (matchIndex+MAX_DISTANCE < current)) continue; /* too far */ - if (tableType == byU16) assert((current - matchIndex) <= MAX_DISTANCE); /* too_far presumed impossible with byU16 */ + if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX)) + && (matchIndex+LZ4_DISTANCE_MAX < current)) { + continue; + } /* too far */ + assert((current - matchIndex) <= LZ4_DISTANCE_MAX); /* match now expected within distance */ if (LZ4_read32(match) == LZ4_read32(ip)) { if (maybe_extMem) offset = current - matchIndex; @@ -901,22 +1076,23 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( } /* Catch up */ + filledIp = ip; while (((ip>anchor) & (match > lowLimit)) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; } /* Encode Literals */ { unsigned const litLength = (unsigned)(ip - anchor); token = op++; - if ((outputLimited == limitedOutput) && /* Check output buffer overflow */ - (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit))) - goto _failure; - - if ((outputLimited == fillOutput) && + if ((outputDirective == limitedOutput) && /* Check output buffer overflow */ + (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) { + return 0; /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */ + } + if ((outputDirective == fillOutput) && (unlikely(op + (litLength+240)/255 /* litlen */ + litLength /* literals */ + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit))) { op--; goto _last_literals; } if (litLength >= RUN_MASK) { - int len = (int)litLength-RUN_MASK; + int len = (int)(litLength - RUN_MASK); *token = (RUN_MASK<= 255 ; len-=255) *op++ = 255; *op++ = (BYTE)len; @@ -924,7 +1100,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( else *token = (BYTE)(litLength< olimit)) { /* the match was too close to the end, rewind and go to last literals */ op = token; @@ -949,11 +1125,11 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( /* Encode Offset */ if (maybe_extMem) { /* static test */ DEBUGLOG(6, " with offset=%u (ext if > %i)", offset, (int)(ip - (const BYTE*)source)); - assert(offset <= MAX_DISTANCE && offset > 0); + assert(offset <= LZ4_DISTANCE_MAX && offset > 0); LZ4_writeLE16(op, (U16)offset); op+=2; } else { DEBUGLOG(6, " with offset=%u (same segment)", (U32)(ip - match)); - assert(ip-match <= MAX_DISTANCE); + assert(ip-match <= LZ4_DISTANCE_MAX); LZ4_writeLE16(op, (U16)(ip - match)); op+=2; } @@ -966,7 +1142,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( assert(dictEnd > match); if (limit > matchlimit) limit = matchlimit; matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit); - ip += MINMATCH + matchCode; + ip += (size_t)matchCode + MINMATCH; if (ip==limit) { unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit); matchCode += more; @@ -975,19 +1151,34 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( DEBUGLOG(6, " with matchLength=%u starting in extDict", matchCode+MINMATCH); } else { matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit); - ip += MINMATCH + matchCode; + ip += (size_t)matchCode + MINMATCH; DEBUGLOG(6, " with matchLength=%u", matchCode+MINMATCH); } - if ((outputLimited) && /* Check output buffer overflow */ - (unlikely(op + (1 + LASTLITERALS) + (matchCode>>8) > olimit)) ) { - if (outputLimited == limitedOutput) - goto _failure; - if (outputLimited == fillOutput) { + if ((outputDirective) && /* Check output buffer overflow */ + (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) { + if (outputDirective == fillOutput) { /* Match description too long : reduce it */ - U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 2 - 1 - LASTLITERALS) * 255; + U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255; ip -= matchCode - newMatchCode; + assert(newMatchCode < matchCode); matchCode = newMatchCode; + if (unlikely(ip <= filledIp)) { + /* We have already filled up to filledIp so if ip ends up less than filledIp + * we have positions in the hash table beyond the current position. This is + * a problem if we reuse the hash table. So we have to remove these positions + * from the hash table. + */ + const BYTE* ptr; + DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip)); + for (ptr = ip; ptr <= filledIp; ++ptr) { + U32 const h = LZ4_hashPosition(ptr, tableType); + LZ4_clearHash(h, cctx->hashTable, tableType); + } + } + } else { + assert(outputDirective == limitedOutput); + return 0; /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */ } } if (matchCode >= ML_MASK) { @@ -1004,6 +1195,8 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( } else *token += (BYTE)(matchCode); } + /* Ensure we have enough space for the last literals. */ + assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit)); anchor = ip; @@ -1018,7 +1211,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( match = LZ4_getPosition(ip, cctx->hashTable, tableType, base); LZ4_putPosition(ip, cctx->hashTable, tableType, base); - if ( (match+MAX_DISTANCE >= ip) + if ( (match+LZ4_DISTANCE_MAX >= ip) && (LZ4_read32(match) == LZ4_read32(ip)) ) { token=op++; *token=0; goto _next_match; } @@ -1041,6 +1234,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( } } else if (dictDirective==usingExtDict) { if (matchIndex < startIndex) { + assert(dictBase); match = dictBase + matchIndex; lowLimit = dictionary; /* required for match length counter */ } else { @@ -1053,7 +1247,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType); assert(matchIndex < current); if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1) - && ((tableType==byU16) ? 1 : (matchIndex+MAX_DISTANCE >= current)) + && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current)) && (LZ4_read32(match) == LZ4_read32(ip)) ) { token=op++; *token=0; @@ -1072,16 +1266,19 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( _last_literals: /* Encode Last Literals */ { size_t lastRun = (size_t)(iend - anchor); - if ( (outputLimited) && /* Check output buffer overflow */ + if ( (outputDirective) && /* Check output buffer overflow */ (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) { - if (outputLimited == fillOutput) { + if (outputDirective == fillOutput) { /* adapt lastRun to fill 'dst' */ - lastRun = (olimit-op) - 1; - lastRun -= (lastRun+240)/255; + assert(olimit >= op); + lastRun = (size_t)(olimit-op) - 1/*token*/; + lastRun -= (lastRun + 256 - RUN_MASK) / 256; /*additional length tokens*/ + } else { + assert(outputDirective == limitedOutput); + return 0; /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */ } - if (outputLimited == limitedOutput) - goto _failure; } + DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun); if (lastRun >= RUN_MASK) { size_t accumulator = lastRun - RUN_MASK; *op++ = RUN_MASK << ML_BITS; @@ -1090,43 +1287,80 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( } else { *op++ = (BYTE)(lastRun< 0); + DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result); return result; +} -_failure: - /* Mark stream as having dirty context, so, it has to be fully reset */ - cctx->dirty = 1; - return 0; +/** LZ4_compress_generic() : + * inlined, to ensure branches are decided at compilation time; + * takes care of src == (NULL, 0) + * and forward the rest to LZ4_compress_generic_validated */ +LZ4_FORCE_INLINE int LZ4_compress_generic( + LZ4_stream_t_internal* const cctx, + const char* const src, + char* const dst, + const int srcSize, + int *inputConsumed, /* only written when outputDirective == fillOutput */ + const int dstCapacity, + const limitedOutput_directive outputDirective, + const tableType_t tableType, + const dict_directive dictDirective, + const dictIssue_directive dictIssue, + const int acceleration) +{ + DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i", + srcSize, dstCapacity); + + if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; } /* Unsupported srcSize, too large (or negative) */ + if (srcSize == 0) { /* src == NULL supported if srcSize == 0 */ + if (outputDirective != notLimited && dstCapacity <= 0) return 0; /* no output, can't write anything */ + DEBUGLOG(5, "Generating an empty block"); + assert(outputDirective == notLimited || dstCapacity >= 1); + assert(dst != NULL); + dst[0] = 0; + if (outputDirective == fillOutput) { + assert (inputConsumed != NULL); + *inputConsumed = 0; + } + return 1; + } + assert(src != NULL); + + return LZ4_compress_generic_validated(cctx, src, dst, srcSize, + inputConsumed, /* only written into if outputDirective == fillOutput */ + dstCapacity, outputDirective, + tableType, dictDirective, dictIssue, acceleration); } int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) { - LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)state)->internal_donotuse; - if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; - LZ4_resetStream((LZ4_stream_t*)state); + LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse; + assert(ctx != NULL); + if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT; + if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX; if (maxOutputSize >= LZ4_compressBound(inputSize)) { if (inputSize < LZ4_64Klimit) { return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration); } else { - const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > MAX_DISTANCE)) ? byPtr : byU32; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32; return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } } else { - if (inputSize < LZ4_64Klimit) {; + if (inputSize < LZ4_64Klimit) { return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); } else { - const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > MAX_DISTANCE)) ? byPtr : byU32; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32; return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration); } } @@ -1144,7 +1378,8 @@ int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration) { LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)state)->internal_donotuse; - if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; + if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT; + if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX; if (dstCapacity >= LZ4_compressBound(srcSize)) { if (srcSize < LZ4_64Klimit) { @@ -1156,7 +1391,7 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } } else { - const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > MAX_DISTANCE)) ? byPtr : byU32; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32; LZ4_prepareTable(ctx, srcSize, tableType); return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } @@ -1170,7 +1405,7 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration); } } else { - const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > MAX_DISTANCE)) ? byPtr : byU32; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32; LZ4_prepareTable(ctx, srcSize, tableType); return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration); } @@ -1182,7 +1417,7 @@ int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutp { int result; #if (LZ4_HEAPMODE) - LZ4_stream_t* ctxPtr = ALLOC(sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ + LZ4_stream_t* ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ if (ctxPtr == NULL) return 0; #else LZ4_stream_t ctx; @@ -1203,28 +1438,13 @@ int LZ4_compress_default(const char* src, char* dst, int srcSize, int maxOutputS } -/* hidden debug function */ -/* strangely enough, gcc generates faster code when this function is uncommented, even if unused */ -int LZ4_compress_fast_force(const char* src, char* dst, int srcSize, int dstCapacity, int acceleration) -{ - LZ4_stream_t ctx; - LZ4_resetStream(&ctx); - - if (srcSize < LZ4_64Klimit) { - return LZ4_compress_generic(&ctx.internal_donotuse, src, dst, srcSize, NULL, dstCapacity, limitedOutput, byU16, noDict, noDictIssue, acceleration); - } else { - tableType_t const addrMode = (sizeof(void*) > 4) ? byU32 : byPtr; - return LZ4_compress_generic(&ctx.internal_donotuse, src, dst, srcSize, NULL, dstCapacity, limitedOutput, addrMode, noDict, noDictIssue, acceleration); - } -} - - /* Note!: This function leaves the stream in an unclean/broken state! * It is not safe to subsequently use the same state with a _fastReset() or * _continue() call without resetting it. */ static int LZ4_compress_destSize_extState (LZ4_stream_t* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize) { - LZ4_resetStream(state); + void* const s = LZ4_initStream(state, sizeof (*state)); + assert(s != NULL); (void)s; if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) { /* compression success is guaranteed */ return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1); @@ -1232,7 +1452,7 @@ static int LZ4_compress_destSize_extState (LZ4_stream_t* state, const char* src, if (*srcSizePtr < LZ4_64Klimit) { return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, 1); } else { - tableType_t const addrMode = ((sizeof(void*)==4) && ((uptrval)src > MAX_DISTANCE)) ? byPtr : byU32; + tableType_t const addrMode = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32; return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, addrMode, noDict, noDictIssue, 1); } } } @@ -1262,26 +1482,51 @@ int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targe * Streaming functions ********************************/ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) LZ4_stream_t* LZ4_createStream(void) { LZ4_stream_t* const lz4s = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t)); - LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */ + LZ4_STATIC_ASSERT(sizeof(LZ4_stream_t) >= sizeof(LZ4_stream_t_internal)); DEBUGLOG(4, "LZ4_createStream %p", lz4s); if (lz4s == NULL) return NULL; - LZ4_resetStream(lz4s); + LZ4_initStream(lz4s, sizeof(*lz4s)); return lz4s; } +#endif + +static size_t LZ4_stream_t_alignment(void) +{ +#if LZ4_ALIGN_TEST + typedef struct { char c; LZ4_stream_t t; } t_a; + return sizeof(t_a) - sizeof(LZ4_stream_t); +#else + return 1; /* effectively disabled */ +#endif +} + +LZ4_stream_t* LZ4_initStream (void* buffer, size_t size) +{ + DEBUGLOG(5, "LZ4_initStream"); + if (buffer == NULL) { return NULL; } + if (size < sizeof(LZ4_stream_t)) { return NULL; } + if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL; + MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal)); + return (LZ4_stream_t*)buffer; +} +/* resetStream is now deprecated, + * prefer initStream() which is more general */ void LZ4_resetStream (LZ4_stream_t* LZ4_stream) { DEBUGLOG(5, "LZ4_resetStream (ctx:%p)", LZ4_stream); - MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t)); + MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t_internal)); } void LZ4_resetStream_fast(LZ4_stream_t* ctx) { LZ4_prepareTable(&(ctx->internal_donotuse), 0, byU32); } +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) int LZ4_freeStream (LZ4_stream_t* LZ4_stream) { if (!LZ4_stream) return 0; /* support free on NULL */ @@ -1289,6 +1534,7 @@ int LZ4_freeStream (LZ4_stream_t* LZ4_stream) FREEMEM(LZ4_stream); return (0); } +#endif #define HASH_UNIT sizeof(reg_t) @@ -1314,52 +1560,59 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) * there are only valid offsets in the window, which allows an optimization * in LZ4_compress_fast_continue() where it uses noDictIssue even when the * dictionary isn't a full 64k. */ - - if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB; - base = dictEnd - 64 KB - dict->currentOffset; - dict->dictionary = p; - dict->dictSize = (U32)(dictEnd - p); dict->currentOffset += 64 KB; - dict->tableType = tableType; if (dictSize < (int)HASH_UNIT) { return 0; } + if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB; + base = dictEnd - dict->currentOffset; + dict->dictionary = p; + dict->dictSize = (U32)(dictEnd - p); + dict->tableType = (U32)tableType; + while (p <= dictEnd-HASH_UNIT) { LZ4_putPosition(p, dict->hashTable, tableType, base); p+=3; } - return dict->dictSize; + return (int)dict->dictSize; } -void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream) { - /* Calling LZ4_resetStream_fast() here makes sure that changes will not be - * erased by subsequent calls to LZ4_resetStream_fast() in case stream was - * marked as having dirty context, e.g. requiring full reset. - */ - LZ4_resetStream_fast(working_stream); +void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const LZ4_stream_t* dictionaryStream) +{ + const LZ4_stream_t_internal* dictCtx = (dictionaryStream == NULL) ? NULL : + &(dictionaryStream->internal_donotuse); + + DEBUGLOG(4, "LZ4_attach_dictionary (%p, %p, size %u)", + workingStream, dictionaryStream, + dictCtx != NULL ? dictCtx->dictSize : 0); - if (dictionary_stream != NULL) { + if (dictCtx != NULL) { /* If the current offset is zero, we will never look in the * external dictionary context, since there is no value a table * entry can take that indicate a miss. In that case, we need * to bump the offset to something non-zero. */ - if (working_stream->internal_donotuse.currentOffset == 0) { - working_stream->internal_donotuse.currentOffset = 64 KB; + if (workingStream->internal_donotuse.currentOffset == 0) { + workingStream->internal_donotuse.currentOffset = 64 KB; + } + + /* Don't actually attach an empty dictionary. + */ + if (dictCtx->dictSize == 0) { + dictCtx = NULL; } - working_stream->internal_donotuse.dictCtx = &(dictionary_stream->internal_donotuse); - } else { - working_stream->internal_donotuse.dictCtx = NULL; } + workingStream->internal_donotuse.dictCtx = dictCtx; } static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, int nextSize) { - if (LZ4_dict->currentOffset + nextSize > 0x80000000) { /* potential ptrdiff_t overflow (32-bits mode) */ + assert(nextSize >= 0); + if (LZ4_dict->currentOffset + (unsigned)nextSize > 0x80000000) { /* potential ptrdiff_t overflow (32-bits mode) */ /* rescale hash table */ U32 const delta = LZ4_dict->currentOffset - 64 KB; const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize; @@ -1376,39 +1629,46 @@ static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, int nextSize) } -int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) +int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, + const char* source, char* dest, + int inputSize, int maxOutputSize, + int acceleration) { const tableType_t tableType = byU32; - LZ4_stream_t_internal* streamPtr = &LZ4_stream->internal_donotuse; - const BYTE* dictEnd = streamPtr->dictionary + streamPtr->dictSize; + LZ4_stream_t_internal* const streamPtr = &LZ4_stream->internal_donotuse; + const char* dictEnd = streamPtr->dictSize ? (const char*)streamPtr->dictionary + streamPtr->dictSize : NULL; - DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i)", inputSize); + DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i, dictSize=%u)", inputSize, streamPtr->dictSize); - if (streamPtr->dirty) return 0; /* Uninitialized structure detected */ - LZ4_renormDictT(streamPtr, inputSize); /* avoid index overflow */ - if (acceleration < 1) acceleration = ACCELERATION_DEFAULT; + LZ4_renormDictT(streamPtr, inputSize); /* fix index overflow */ + if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT; + if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX; /* invalidate tiny dictionaries */ - if ( (streamPtr->dictSize-1 < 4-1) /* intentional underflow */ - && (dictEnd != (const BYTE*)source) ) { + if ( (streamPtr->dictSize < 4) /* tiny dictionary : not enough for a hash */ + && (dictEnd != source) /* prefix mode */ + && (inputSize > 0) /* tolerance : don't lose history, in case next invocation would use prefix mode */ + && (streamPtr->dictCtx == NULL) /* usingDictCtx */ + ) { DEBUGLOG(5, "LZ4_compress_fast_continue: dictSize(%u) at addr:%p is too small", streamPtr->dictSize, streamPtr->dictionary); + /* remove dictionary existence from history, to employ faster prefix mode */ streamPtr->dictSize = 0; streamPtr->dictionary = (const BYTE*)source; - dictEnd = (const BYTE*)source; + dictEnd = source; } /* Check overlapping input/dictionary space */ - { const BYTE* sourceEnd = (const BYTE*) source + inputSize; - if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd)) { + { const char* const sourceEnd = source + inputSize; + if ((sourceEnd > (const char*)streamPtr->dictionary) && (sourceEnd < dictEnd)) { streamPtr->dictSize = (U32)(dictEnd - sourceEnd); if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB; if (streamPtr->dictSize < 4) streamPtr->dictSize = 0; - streamPtr->dictionary = dictEnd - streamPtr->dictSize; + streamPtr->dictionary = (const BYTE*)dictEnd - streamPtr->dictSize; } } /* prefix mode : source data follows dictionary */ - if (dictEnd == (const BYTE*)source) { + if (dictEnd == source) { if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, dictSmall, acceleration); else @@ -1429,12 +1689,12 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, ch * cost to copy the dictionary's tables into the active context, * so that the compression loop is only looking into one table. */ - memcpy(streamPtr, streamPtr->dictCtx, sizeof(LZ4_stream_t)); + LZ4_memcpy(streamPtr, streamPtr->dictCtx, sizeof(*streamPtr)); result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration); } else { result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingDictCtx, noDictIssue, acceleration); } - } else { + } else { /* small data <= 4 KB */ if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) { result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, dictSmall, acceleration); } else { @@ -1472,19 +1732,25 @@ int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* /*! LZ4_saveDict() : * If previously compressed data block is not guaranteed to remain available at its memory location, * save it into a safer place (char* safeBuffer). - * Note : you don't need to call LZ4_loadDict() afterwards, - * dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue(). - * Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error. + * Note : no need to call LZ4_loadDict() afterwards, dictionary is immediately usable, + * one can therefore call LZ4_compress_fast_continue() right after. + * @return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error. */ int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize) { LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse; - const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize; - if ((U32)dictSize > 64 KB) dictSize = 64 KB; /* useless to define a dictionary > 64 KB */ - if ((U32)dictSize > dict->dictSize) dictSize = dict->dictSize; + DEBUGLOG(5, "LZ4_saveDict : dictSize=%i, safeBuffer=%p", dictSize, safeBuffer); - memmove(safeBuffer, previousDictEnd - dictSize, dictSize); + if ((U32)dictSize > 64 KB) { dictSize = 64 KB; } /* useless to define a dictionary > 64 KB */ + if ((U32)dictSize > dict->dictSize) { dictSize = (int)dict->dictSize; } + + if (safeBuffer == NULL) assert(dictSize == 0); + if (dictSize > 0) { + const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize; + assert(dict->dictionary); + LZ4_memmove(safeBuffer, previousDictEnd - dictSize, (size_t)dictSize); + } dict->dictionary = (const BYTE*)safeBuffer; dict->dictSize = (U32)dictSize; @@ -1498,39 +1764,167 @@ int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize) * Decompression functions ********************************/ -typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive; typedef enum { decode_full_block = 0, partial_decode = 1 } earlyEnd_directive; #undef MIN #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) + +/* variant for decompress_unsafe() + * does not know end of input + * presumes input is well formed + * note : will consume at least one byte */ +size_t read_long_length_no_check(const BYTE** pp) +{ + size_t b, l = 0; + do { b = **pp; (*pp)++; l += b; } while (b==255); + DEBUGLOG(6, "read_long_length_no_check: +length=%zu using %zu input bytes", l, l/255 + 1) + return l; +} + +/* core decoder variant for LZ4_decompress_fast*() + * for legacy support only : these entry points are deprecated. + * - Presumes input is correctly formed (no defense vs malformed inputs) + * - Does not know input size (presume input buffer is "large enough") + * - Decompress a full block (only) + * @return : nb of bytes read from input. + * Note : this variant is not optimized for speed, just for maintenance. + * the goal is to remove support of decompress_fast*() variants by v2.0 +**/ +LZ4_FORCE_INLINE int +LZ4_decompress_unsafe_generic( + const BYTE* const istart, + BYTE* const ostart, + int decompressedSize, + + size_t prefixSize, + const BYTE* const dictStart, /* only if dict==usingExtDict */ + const size_t dictSize /* note: =0 if dictStart==NULL */ + ) +{ + const BYTE* ip = istart; + BYTE* op = (BYTE*)ostart; + BYTE* const oend = ostart + decompressedSize; + const BYTE* const prefixStart = ostart - prefixSize; + + DEBUGLOG(5, "LZ4_decompress_unsafe_generic"); + if (dictStart == NULL) assert(dictSize == 0); + + while (1) { + /* start new sequence */ + unsigned token = *ip++; + + /* literals */ + { size_t ll = token >> ML_BITS; + if (ll==15) { + /* long literal length */ + ll += read_long_length_no_check(&ip); + } + if ((size_t)(oend-op) < ll) return -1; /* output buffer overflow */ + LZ4_memmove(op, ip, ll); /* support in-place decompression */ + op += ll; + ip += ll; + if ((size_t)(oend-op) < MFLIMIT) { + if (op==oend) break; /* end of block */ + DEBUGLOG(5, "invalid: literals end at distance %zi from end of block", oend-op); + /* incorrect end of block : + * last match must start at least MFLIMIT==12 bytes before end of output block */ + return -1; + } } + + /* match */ + { size_t ml = token & 15; + size_t const offset = LZ4_readLE16(ip); + ip+=2; + + if (ml==15) { + /* long literal length */ + ml += read_long_length_no_check(&ip); + } + ml += MINMATCH; + + if ((size_t)(oend-op) < ml) return -1; /* output buffer overflow */ + + { const BYTE* match = op - offset; + + /* out of range */ + if (offset > (size_t)(op - prefixStart) + dictSize) { + DEBUGLOG(6, "offset out of range"); + return -1; + } + + /* check special case : extDict */ + if (offset > (size_t)(op - prefixStart)) { + /* extDict scenario */ + const BYTE* const dictEnd = dictStart + dictSize; + const BYTE* extMatch = dictEnd - (offset - (size_t)(op-prefixStart)); + size_t const extml = (size_t)(dictEnd - extMatch); + if (extml > ml) { + /* match entirely within extDict */ + LZ4_memmove(op, extMatch, ml); + op += ml; + ml = 0; + } else { + /* match split between extDict & prefix */ + LZ4_memmove(op, extMatch, extml); + op += extml; + ml -= extml; + } + match = prefixStart; + } + + /* match copy - slow variant, supporting overlap copy */ + { size_t u; + for (u=0; u= lencheck. - * loop_check - check ip >= lencheck in body of loop. Returns loop_error if so. - * initial_check - check ip >= lencheck before start of loop. Returns initial_error if so. - * error (output) - error code. Should be set to 0 before call. - */ -typedef enum { loop_error = -2, initial_error = -1, ok = 0} variable_length_error; -LZ4_FORCE_INLINE unsigned read_variable_length(const BYTE**ip, const BYTE* lencheck, int loop_check, int initial_check, variable_length_error* error) { - unsigned length = 0; - unsigned s; - if (initial_check && unlikely((*ip) >= lencheck)) { /* overflow detection */ - *error = initial_error; - return length; - } - do { - s = **ip; - (*ip)++; - length += s; - if (loop_check && unlikely((*ip) >= lencheck)) { /* overflow detection */ - *error = loop_error; - return length; + * @ip : input pointer + * @ilimit : position after which if length is not decoded, the input is necessarily corrupted. + * @initial_check - check ip >= ipmax before start of loop. Returns initial_error if so. + * @error (output) - error code. Must be set to 0 before call. +**/ +typedef size_t Rvl_t; +static const Rvl_t rvl_error = (Rvl_t)(-1); +LZ4_FORCE_INLINE Rvl_t +read_variable_length(const BYTE** ip, const BYTE* ilimit, + int initial_check) +{ + Rvl_t s, length = 0; + assert(ip != NULL); + assert(*ip != NULL); + assert(ilimit != NULL); + if (initial_check && unlikely((*ip) >= ilimit)) { /* read limit reached */ + return rvl_error; } - } while (s==255); + do { + s = **ip; + (*ip)++; + length += s; + if (unlikely((*ip) > ilimit)) { /* read limit reached */ + return rvl_error; + } + /* accumulator overflow detection (32-bit mode only) */ + if ((sizeof(length)<8) && unlikely(length > ((Rvl_t)(-1)/2)) ) { + return rvl_error; + } + } while (s==255); - return length; + return length; } /*! LZ4_decompress_generic() : @@ -1546,7 +1940,6 @@ LZ4_decompress_generic( int srcSize, int outputSize, /* If endOnInput==endOnInputSize, this value is `dstCapacity` */ - endCondition_directive endOnInput, /* endOnOutputSize, endOnInputSize */ earlyEnd_directive partialDecoding, /* full, partial */ dict_directive dict, /* noDict, withPrefix64k, usingExtDict */ const BYTE* const lowPrefix, /* always <= dst, == dst when no prefix */ @@ -1554,7 +1947,7 @@ LZ4_decompress_generic( const size_t dictSize /* note : = 0 if noDict */ ) { - if (src == NULL) return -1; + if ((src == NULL) || (outputSize < 0)) { return -1; } { const BYTE* ip = (const BYTE*) src; const BYTE* const iend = ip + srcSize; @@ -1565,13 +1958,12 @@ LZ4_decompress_generic( const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize; - const int safeDecode = (endOnInput==endOnInputSize); - const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB))); + const int checkOffset = (dictSize < (int)(64 KB)); /* Set up the "end" pointers for the shortcut. */ - const BYTE* const shortiend = iend - (endOnInput ? 14 : 8) /*maxLL*/ - 2 /*offset*/; - const BYTE* const shortoend = oend - (endOnInput ? 14 : 8) /*maxLL*/ - 18 /*maxML*/; + const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/; + const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/; const BYTE* match; size_t offset; @@ -1583,70 +1975,70 @@ LZ4_decompress_generic( /* Special cases */ assert(lowPrefix <= op); - if ((endOnInput) && (unlikely(outputSize==0))) return ((srcSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */ - if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0 ? 1 : -1); - if ((endOnInput) && unlikely(srcSize==0)) return -1; - - /* Currently the fast loop shows a regression on qualcomm arm chips. */ -#if defined(__i386__) || defined(__x86_64__) - if ((oend - op) < FASTLOOP_SAFE_DISTANCE) + if (unlikely(outputSize==0)) { + /* Empty output buffer */ + if (partialDecoding) return 0; + return ((srcSize==1) && (*ip==0)) ? 0 : -1; + } + if (unlikely(srcSize==0)) { return -1; } + + /* LZ4_FAST_DEC_LOOP: + * designed for modern OoO performance cpus, + * where copying reliably 32-bytes is preferable to an unpredictable branch. + * note : fast loop may show a regression for some client arm chips. */ +#if LZ4_FAST_DEC_LOOP + if ((oend - op) < FASTLOOP_SAFE_DISTANCE) { + DEBUGLOG(6, "skip fast decode loop"); goto safe_decode; + } - /* Fast loop : decode sequences as long as output < iend-FASTLOOP_SAFE_DISTANCE */ + /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */ while (1) { /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */ assert(oend - op >= FASTLOOP_SAFE_DISTANCE); - + assert(ip < iend); token = *ip++; length = token >> ML_BITS; /* literal length */ - assert(!endOnInput || ip <= iend); /* ip < iend before the increment */ - /* decode literal length */ if (length == RUN_MASK) { - variable_length_error error = ok; - length += read_variable_length(&ip, iend-RUN_MASK, endOnInput, endOnInput, &error); - if (error == initial_error) goto _output_error; - if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)(op))) goto _output_error; /* overflow detection */ - if ((safeDecode) && unlikely((uptrval)(ip)+length<(uptrval)(ip))) goto _output_error; /* overflow detection */ + size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1); + if (addl == rvl_error) { goto _output_error; } + length += addl; + if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */ + if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */ /* copy literals */ cpy = op+length; LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH); - if ( ((endOnInput) && ((cpy>oend-FASTLOOP_SAFE_DISTANCE) || (ip+length>iend-(2+1+LASTLITERALS))) ) - || ((!endOnInput) && (cpy>oend-FASTLOOP_SAFE_DISTANCE)) ) - { - goto safe_literal_copy; - } + if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; } LZ4_wildCopy32(op, ip, cpy); ip += length; op = cpy; } else { cpy = op+length; + DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length); /* We don't need to check oend, since we check it once for each loop below */ - if ( ((endOnInput) && (ip+16>iend-(2+1+LASTLITERALS)))) - { - goto safe_literal_copy; - } - /* Literals can only be 14, but hope compilers optimize if we copy by a register size */ - memcpy(op, ip, 16); + if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy; } + /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */ + LZ4_memcpy(op, ip, 16); ip += length; op = cpy; } /* get offset */ offset = LZ4_readLE16(ip); ip+=2; match = op - offset; + assert(match <= op); /* overflow check */ /* get matchlength */ length = token & ML_MASK; - if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */ - if (length == ML_MASK) { - variable_length_error error = ok; - length += read_variable_length(&ip, iend - LASTLITERALS + 1, endOnInput, 0, &error); - if (error != ok) goto _output_error; - if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */ + size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0); + if (addl == rvl_error) { goto _output_error; } + length += addl; length += MINMATCH; + if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */ + if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */ if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) { goto safe_match_copy; } @@ -1656,41 +2048,48 @@ LZ4_decompress_generic( goto safe_match_copy; } - /* Fastpath check: Avoids a branch in LZ4_wildCopy32 if true */ - if (!(dict == usingExtDict) || (match >= lowPrefix)) { + /* Fastpath check: skip LZ4_wildCopy32 when true */ + if ((dict == withPrefix64k) || (match >= lowPrefix)) { if (offset >= 8) { - memcpy(op, match, 8); - memcpy(op+8, match+8, 8); - memcpy(op+16, match+16, 2); + assert(match >= lowPrefix); + assert(match <= op); + assert(op + 18 <= oend); + + LZ4_memcpy(op, match, 8); + LZ4_memcpy(op+8, match+8, 8); + LZ4_memcpy(op+16, match+16, 2); op += length; continue; - } - } - } + } } } + if (checkOffset && (unlikely(match + dictSize < lowPrefix))) { goto _output_error; } /* Error : offset outside buffers */ /* match starting within external dictionary */ if ((dict==usingExtDict) && (match < lowPrefix)) { + assert(dictEnd != NULL); if (unlikely(op+length > oend-LASTLITERALS)) { - if (partialDecoding) length = MIN(length, (size_t)(oend-op)); - else goto _output_error; /* doesn't respect parsing restriction */ - } + if (partialDecoding) { + DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd"); + length = MIN(length, (size_t)(oend-op)); + } else { + goto _output_error; /* end-of-block condition violated */ + } } if (length <= (size_t)(lowPrefix-match)) { /* match fits entirely within external dictionary : just copy */ - memmove(op, dictEnd - (lowPrefix-match), length); + LZ4_memmove(op, dictEnd - (lowPrefix-match), length); op += length; } else { /* match stretches into both external dictionary and current block */ size_t const copySize = (size_t)(lowPrefix - match); size_t const restSize = length - copySize; - memcpy(op, dictEnd - copySize, copySize); + LZ4_memcpy(op, dictEnd - copySize, copySize); op += copySize; if (restSize > (size_t)(op - lowPrefix)) { /* overlap copy */ BYTE* const endOfMatch = op + restSize; const BYTE* copyFrom = lowPrefix; - while (op < endOfMatch) *op++ = *copyFrom++; + while (op < endOfMatch) { *op++ = *copyFrom++; } } else { - memcpy(op, lowPrefix, restSize); + LZ4_memcpy(op, lowPrefix, restSize); op += restSize; } } continue; @@ -1699,8 +2098,7 @@ LZ4_decompress_generic( /* copy match within block */ cpy = op + length; - /* partialDecoding : may not respect endBlock parsing restrictions */ - assert(op<=oend); + assert((op <= oend) && (oend-op >= 32)); if (unlikely(offset<16)) { LZ4_memcpy_using_offset(op, match, cpy, offset); } else { @@ -1714,11 +2112,10 @@ LZ4_decompress_generic( /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */ while (1) { + assert(ip < iend); token = *ip++; length = token >> ML_BITS; /* literal length */ - assert(!endOnInput || ip <= iend); /* ip < iend before the increment */ - /* A two-stage shortcut for the most common case: * 1) If the literal length is 0..14, and there is enough space, * enter the shortcut and copy 16 bytes on behalf of the literals @@ -1728,11 +2125,11 @@ LZ4_decompress_generic( * those 18 bytes earlier, upon entering the shortcut (in other words, * there is a combined check for both stages). */ - if ( (endOnInput ? length != RUN_MASK : length <= 8) + if ( (length != RUN_MASK) /* strictly "less than" on input, to re-enter the loop with at least one byte */ - && likely((endOnInput ? ip < shortiend : 1) & (op <= shortoend)) ) { + && likely((ip < shortiend) & (op <= shortoend)) ) { /* Copy the literals */ - memcpy(op, ip, endOnInput ? 16 : 8); + LZ4_memcpy(op, ip, 16); op += length; ip += length; /* The second stage: prepare for match copying, decode full info. @@ -1747,9 +2144,9 @@ LZ4_decompress_generic( && (offset >= 8) && (dict==withPrefix64k || match >= lowPrefix) ) { /* Copy the match. */ - memcpy(op + 0, match + 0, 8); - memcpy(op + 8, match + 8, 8); - memcpy(op +16, match +16, 2); + LZ4_memcpy(op + 0, match + 0, 8); + LZ4_memcpy(op + 8, match + 8, 8); + LZ4_memcpy(op +16, match +16, 2); op += length + MINMATCH; /* Both stages worked, load the next token. */ continue; @@ -1762,39 +2159,72 @@ LZ4_decompress_generic( /* decode literal length */ if (length == RUN_MASK) { - variable_length_error error = ok; - length += read_variable_length(&ip, iend-RUN_MASK, endOnInput, endOnInput, &error); - if (error == initial_error) goto _output_error; - if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)(op))) goto _output_error; /* overflow detection */ - if ((safeDecode) && unlikely((uptrval)(ip)+length<(uptrval)(ip))) goto _output_error; /* overflow detection */ + size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1); + if (addl == rvl_error) { goto _output_error; } + length += addl; + if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */ + if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */ } /* copy literals */ cpy = op+length; -#if defined(__i386__) || defined(__x86_64__) +#if LZ4_FAST_DEC_LOOP safe_literal_copy: #endif LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH); - if ( ((endOnInput) && ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) ) - || ((!endOnInput) && (cpy>oend-WILDCOPYLENGTH)) ) - { + if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) { + /* We've either hit the input parsing restriction or the output parsing restriction. + * In the normal scenario, decoding a full block, it must be the last sequence, + * otherwise it's an error (invalid input or dimensions). + * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow. + */ if (partialDecoding) { - if (cpy > oend) { cpy = oend; length = oend-op; } /* Partial decoding : stop in the middle of literal segment */ - if ((endOnInput) && (ip+length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */ + /* Since we are partial decoding we may be in this block because of the output parsing + * restriction, which is not valid since the output buffer is allowed to be undersized. + */ + DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end") + DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length); + DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op)); + DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip)); + /* Finishing in the middle of a literals segment, + * due to lack of input. + */ + if (ip+length > iend) { + length = (size_t)(iend-ip); + cpy = op + length; + } + /* Finishing in the middle of a literals segment, + * due to lack of output space. + */ + if (cpy > oend) { + cpy = oend; + assert(op<=oend); + length = (size_t)(oend-op); + } } else { - if ((!endOnInput) && (cpy != oend)) goto _output_error; /* Error : block decoding must stop exactly there */ - if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error; /* Error : input must be consumed */ + /* We must be on the last sequence (or invalid) because of the parsing limitations + * so check that we exactly consume the input and don't overrun the output buffer. + */ + if ((ip+length != iend) || (cpy > oend)) { + DEBUGLOG(6, "should have been last run of literals") + DEBUGLOG(6, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend); + DEBUGLOG(6, "or cpy(%p) > oend(%p)", cpy, oend); + goto _output_error; + } } - memcpy(op, ip, length); + LZ4_memmove(op, ip, length); /* supports overlapping memory regions, for in-place decompression scenarios */ ip += length; op += length; - if (!partialDecoding || (cpy == oend)) { - /* Necessarily EOF, due to parsing restrictions */ + /* Necessarily EOF when !partialDecoding. + * When partialDecoding, it is EOF if we've either + * filled the output buffer or + * can't proceed with reading an offset for following match. + */ + if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) { break; } - } else { - LZ4_wildCopy(op, ip, cpy); /* may overwrite up to WILDCOPYLENGTH beyond cpy */ + LZ4_wildCopy8(op, ip, cpy); /* can overwrite up to 8 bytes beyond cpy */ ip += length; op = cpy; } @@ -1806,26 +2236,21 @@ LZ4_decompress_generic( length = token & ML_MASK; _copy_match: - if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */ - if (!partialDecoding) { - assert(oend > op); - assert(oend - op >= 4); - LZ4_write32(op, 0); /* silence an msan warning when offset==0; costs <1%; */ - } /* note : when partialDecoding, there is no guarantee that at least 4 bytes remain available in output buffer */ - if (length == ML_MASK) { - variable_length_error error = ok; - length += read_variable_length(&ip, iend - LASTLITERALS + 1, endOnInput, 0, &error); - if (error != ok) goto _output_error; - if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */ + size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0); + if (addl == rvl_error) { goto _output_error; } + length += addl; + if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */ } length += MINMATCH; -#if defined(__i386__) || defined(__x86_64__) +#if LZ4_FAST_DEC_LOOP safe_match_copy: #endif + if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error; /* Error : offset outside buffers */ /* match starting within external dictionary */ if ((dict==usingExtDict) && (match < lowPrefix)) { + assert(dictEnd != NULL); if (unlikely(op+length > oend-LASTLITERALS)) { if (partialDecoding) length = MIN(length, (size_t)(oend-op)); else goto _output_error; /* doesn't respect parsing restriction */ @@ -1833,79 +2258,79 @@ LZ4_decompress_generic( if (length <= (size_t)(lowPrefix-match)) { /* match fits entirely within external dictionary : just copy */ - memmove(op, dictEnd - (lowPrefix-match), length); + LZ4_memmove(op, dictEnd - (lowPrefix-match), length); op += length; } else { /* match stretches into both external dictionary and current block */ size_t const copySize = (size_t)(lowPrefix - match); size_t const restSize = length - copySize; - memcpy(op, dictEnd - copySize, copySize); + LZ4_memcpy(op, dictEnd - copySize, copySize); op += copySize; if (restSize > (size_t)(op - lowPrefix)) { /* overlap copy */ BYTE* const endOfMatch = op + restSize; const BYTE* copyFrom = lowPrefix; while (op < endOfMatch) *op++ = *copyFrom++; } else { - memcpy(op, lowPrefix, restSize); + LZ4_memcpy(op, lowPrefix, restSize); op += restSize; } } continue; } + assert(match >= lowPrefix); /* copy match within block */ cpy = op + length; - /* partialDecoding : may not respect endBlock parsing restrictions */ + /* partialDecoding : may end anywhere within the block */ assert(op<=oend); if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) { size_t const mlen = MIN(length, (size_t)(oend-op)); const BYTE* const matchEnd = match + mlen; BYTE* const copyEnd = op + mlen; if (matchEnd > op) { /* overlap copy */ - while (op < copyEnd) *op++ = *match++; + while (op < copyEnd) { *op++ = *match++; } } else { - memcpy(op, match, mlen); + LZ4_memcpy(op, match, mlen); } op = copyEnd; - if (op==oend) break; + if (op == oend) { break; } continue; } if (unlikely(offset<8)) { + LZ4_write32(op, 0); /* silence msan warning when offset==0 */ op[0] = match[0]; op[1] = match[1]; op[2] = match[2]; op[3] = match[3]; match += inc32table[offset]; - memcpy(op+4, match, 4); + LZ4_memcpy(op+4, match, 4); match -= dec64table[offset]; } else { - memcpy(op, match, 8); + LZ4_memcpy(op, match, 8); match += 8; } op += 8; if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) { BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1); - if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last LASTLITERALS bytes must be literals (uncompressed) */ + if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */ if (op < oCopyLimit) { - LZ4_wildCopy(op, match, oCopyLimit); + LZ4_wildCopy8(op, match, oCopyLimit); match += oCopyLimit - op; op = oCopyLimit; } - while (op < cpy) *op++ = *match++; + while (op < cpy) { *op++ = *match++; } } else { - memcpy(op, match, 8); - if (length > 16) LZ4_wildCopy(op+8, match+8, cpy); + LZ4_memcpy(op, match, 8); + if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); } } op = cpy; /* wildcopy correction */ } /* end of decoding */ - if (endOnInput) - return (int) (((char*)op)-dst); /* Nb of output bytes decoded */ - else - return (int) (((const char*)ip)-src); /* Nb of input bytes read */ + DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst)); + return (int) (((char*)op)-dst); /* Nb of output bytes decoded */ /* Overflow error detected */ _output_error: @@ -1916,75 +2341,106 @@ LZ4_decompress_generic( /*===== Instantiate the API decoding functions. =====*/ -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxDecompressedSize) { return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, - endOnInputSize, decode_full_block, noDict, + decode_full_block, noDict, (BYTE*)dest, NULL, 0); } -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 int LZ4_decompress_safe_partial(const char* src, char* dst, int compressedSize, int targetOutputSize, int dstCapacity) { dstCapacity = MIN(targetOutputSize, dstCapacity); return LZ4_decompress_generic(src, dst, compressedSize, dstCapacity, - endOnInputSize, partial_decode, + partial_decode, noDict, (BYTE*)dst, NULL, 0); } -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 int LZ4_decompress_fast(const char* source, char* dest, int originalSize) { - return LZ4_decompress_generic(source, dest, 0, originalSize, - endOnOutputSize, decode_full_block, withPrefix64k, - (BYTE*)dest - 64 KB, NULL, 0); + DEBUGLOG(5, "LZ4_decompress_fast"); + return LZ4_decompress_unsafe_generic( + (const BYTE*)source, (BYTE*)dest, originalSize, + 0, NULL, 0); } /*===== Instantiate a few more decoding cases, used more than once. =====*/ -LZ4_FORCE_O2_GCC_PPC64LE /* Exported, an obsolete API function. */ +LZ4_FORCE_O2 /* Exported, an obsolete API function. */ int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize) { return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, decode_full_block, withPrefix64k, + decode_full_block, withPrefix64k, + (BYTE*)dest - 64 KB, NULL, 0); +} + +LZ4_FORCE_O2 +static int LZ4_decompress_safe_partial_withPrefix64k(const char* source, char* dest, int compressedSize, int targetOutputSize, int dstCapacity) +{ + dstCapacity = MIN(targetOutputSize, dstCapacity); + return LZ4_decompress_generic(source, dest, compressedSize, dstCapacity, + partial_decode, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 0); } /* Another obsolete API function, paired with the previous one. */ int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int originalSize) { - /* LZ4_decompress_fast doesn't validate match offsets, - * and thus serves well with any prefixed dictionary. */ - return LZ4_decompress_fast(source, dest, originalSize); + return LZ4_decompress_unsafe_generic( + (const BYTE*)source, (BYTE*)dest, originalSize, + 64 KB, NULL, 0); } -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 static int LZ4_decompress_safe_withSmallPrefix(const char* source, char* dest, int compressedSize, int maxOutputSize, size_t prefixSize) { return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, decode_full_block, noDict, + decode_full_block, noDict, (BYTE*)dest-prefixSize, NULL, 0); } -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 +static int LZ4_decompress_safe_partial_withSmallPrefix(const char* source, char* dest, int compressedSize, int targetOutputSize, int dstCapacity, + size_t prefixSize) +{ + dstCapacity = MIN(targetOutputSize, dstCapacity); + return LZ4_decompress_generic(source, dest, compressedSize, dstCapacity, + partial_decode, noDict, + (BYTE*)dest-prefixSize, NULL, 0); +} + +LZ4_FORCE_O2 int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const void* dictStart, size_t dictSize) { return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, decode_full_block, usingExtDict, + decode_full_block, usingExtDict, + (BYTE*)dest, (const BYTE*)dictStart, dictSize); +} + +LZ4_FORCE_O2 +int LZ4_decompress_safe_partial_forceExtDict(const char* source, char* dest, + int compressedSize, int targetOutputSize, int dstCapacity, + const void* dictStart, size_t dictSize) +{ + dstCapacity = MIN(targetOutputSize, dstCapacity); + return LZ4_decompress_generic(source, dest, compressedSize, dstCapacity, + partial_decode, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize); } -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 static int LZ4_decompress_fast_extDict(const char* source, char* dest, int originalSize, const void* dictStart, size_t dictSize) { - return LZ4_decompress_generic(source, dest, 0, originalSize, - endOnOutputSize, decode_full_block, usingExtDict, - (BYTE*)dest, (const BYTE*)dictStart, dictSize); + return LZ4_decompress_unsafe_generic( + (const BYTE*)source, (BYTE*)dest, originalSize, + 0, (const BYTE*)dictStart, dictSize); } /* The "double dictionary" mode, for use with e.g. ring buffers: the first part @@ -1996,34 +2452,26 @@ int LZ4_decompress_safe_doubleDict(const char* source, char* dest, int compresse size_t prefixSize, const void* dictStart, size_t dictSize) { return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, - endOnInputSize, decode_full_block, usingExtDict, - (BYTE*)dest-prefixSize, (const BYTE*)dictStart, dictSize); -} - -LZ4_FORCE_INLINE -int LZ4_decompress_fast_doubleDict(const char* source, char* dest, int originalSize, - size_t prefixSize, const void* dictStart, size_t dictSize) -{ - return LZ4_decompress_generic(source, dest, 0, originalSize, - endOnOutputSize, decode_full_block, usingExtDict, + decode_full_block, usingExtDict, (BYTE*)dest-prefixSize, (const BYTE*)dictStart, dictSize); } /*===== streaming decompression functions =====*/ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) LZ4_streamDecode_t* LZ4_createStreamDecode(void) { - LZ4_streamDecode_t* lz4s = (LZ4_streamDecode_t*) ALLOC_AND_ZERO(sizeof(LZ4_streamDecode_t)); - LZ4_STATIC_ASSERT(LZ4_STREAMDECODESIZE >= sizeof(LZ4_streamDecode_t_internal)); /* A compilation error here means LZ4_STREAMDECODESIZE is not large enough */ - return lz4s; + LZ4_STATIC_ASSERT(sizeof(LZ4_streamDecode_t) >= sizeof(LZ4_streamDecode_t_internal)); + return (LZ4_streamDecode_t*) ALLOC_AND_ZERO(sizeof(LZ4_streamDecode_t)); } int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream) { - if (LZ4_stream == NULL) return 0; /* support free on NULL */ + if (LZ4_stream == NULL) { return 0; } /* support free on NULL */ FREEMEM(LZ4_stream); return 0; } +#endif /*! LZ4_setStreamDecode() : * Use this function to instruct where to find the dictionary. @@ -2034,8 +2482,13 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream) int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize) { LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; - lz4sd->prefixSize = (size_t) dictSize; - lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize; + lz4sd->prefixSize = (size_t)dictSize; + if (dictSize) { + assert(dictionary != NULL); + lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize; + } else { + lz4sd->prefixEnd = (const BYTE*) dictionary; + } lz4sd->externalDict = NULL; lz4sd->extDictSize = 0; return 1; @@ -2067,7 +2520,7 @@ int LZ4_decoderRingBufferSize(int maxBlockSize) If it's not possible, save the relevant part of decoded data into a safe buffer, and indicate where it stands using LZ4_setStreamDecode() */ -LZ4_FORCE_O2_GCC_PPC64LE +LZ4_FORCE_O2 int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize) { LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; @@ -2078,7 +2531,7 @@ int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const ch assert(lz4sd->extDictSize == 0); result = LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize); if (result <= 0) return result; - lz4sd->prefixSize = result; + lz4sd->prefixSize = (size_t)result; lz4sd->prefixEnd = (BYTE*)dest + result; } else if (lz4sd->prefixEnd == (BYTE*)dest) { /* They're rolling the current segment. */ @@ -2091,7 +2544,7 @@ int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const ch result = LZ4_decompress_safe_doubleDict(source, dest, compressedSize, maxOutputSize, lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; - lz4sd->prefixSize += result; + lz4sd->prefixSize += (size_t)result; lz4sd->prefixEnd += result; } else { /* The buffer wraps around, or they're switching to another buffer. */ @@ -2100,41 +2553,48 @@ int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const ch result = LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; - lz4sd->prefixSize = result; + lz4sd->prefixSize = (size_t)result; lz4sd->prefixEnd = (BYTE*)dest + result; } return result; } -LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize) +LZ4_FORCE_O2 int +LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, + const char* source, char* dest, int originalSize) { - LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse; + LZ4_streamDecode_t_internal* const lz4sd = + (assert(LZ4_streamDecode!=NULL), &LZ4_streamDecode->internal_donotuse); int result; + DEBUGLOG(5, "LZ4_decompress_fast_continue (toDecodeSize=%i)", originalSize); + assert(originalSize >= 0); + if (lz4sd->prefixSize == 0) { + DEBUGLOG(5, "first invocation : no prefix nor extDict"); assert(lz4sd->extDictSize == 0); result = LZ4_decompress_fast(source, dest, originalSize); if (result <= 0) return result; - lz4sd->prefixSize = originalSize; + lz4sd->prefixSize = (size_t)originalSize; lz4sd->prefixEnd = (BYTE*)dest + originalSize; } else if (lz4sd->prefixEnd == (BYTE*)dest) { - if (lz4sd->prefixSize >= 64 KB - 1 || lz4sd->extDictSize == 0) - result = LZ4_decompress_fast(source, dest, originalSize); - else - result = LZ4_decompress_fast_doubleDict(source, dest, originalSize, - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); + DEBUGLOG(5, "continue using existing prefix"); + result = LZ4_decompress_unsafe_generic( + (const BYTE*)source, (BYTE*)dest, originalSize, + lz4sd->prefixSize, + lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; - lz4sd->prefixSize += originalSize; + lz4sd->prefixSize += (size_t)originalSize; lz4sd->prefixEnd += originalSize; } else { + DEBUGLOG(5, "prefix becomes extDict"); lz4sd->extDictSize = lz4sd->prefixSize; lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; result = LZ4_decompress_fast_extDict(source, dest, originalSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; - lz4sd->prefixSize = originalSize; + lz4sd->prefixSize = (size_t)originalSize; lz4sd->prefixEnd = (BYTE*)dest + originalSize; } @@ -2154,18 +2614,39 @@ int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressed if (dictSize==0) return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize); if (dictStart+dictSize == dest) { - if (dictSize >= 64 KB - 1) + if (dictSize >= 64 KB - 1) { return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize); - return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, dictSize); + } + assert(dictSize >= 0); + return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize); + } + assert(dictSize >= 0); + return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize); +} + +int LZ4_decompress_safe_partial_usingDict(const char* source, char* dest, int compressedSize, int targetOutputSize, int dstCapacity, const char* dictStart, int dictSize) +{ + if (dictSize==0) + return LZ4_decompress_safe_partial(source, dest, compressedSize, targetOutputSize, dstCapacity); + if (dictStart+dictSize == dest) { + if (dictSize >= 64 KB - 1) { + return LZ4_decompress_safe_partial_withPrefix64k(source, dest, compressedSize, targetOutputSize, dstCapacity); + } + assert(dictSize >= 0); + return LZ4_decompress_safe_partial_withSmallPrefix(source, dest, compressedSize, targetOutputSize, dstCapacity, (size_t)dictSize); } - return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, dictSize); + assert(dictSize >= 0); + return LZ4_decompress_safe_partial_forceExtDict(source, dest, compressedSize, targetOutputSize, dstCapacity, dictStart, (size_t)dictSize); } int LZ4_decompress_fast_usingDict(const char* source, char* dest, int originalSize, const char* dictStart, int dictSize) { if (dictSize==0 || dictStart+dictSize == dest) - return LZ4_decompress_fast(source, dest, originalSize); - return LZ4_decompress_fast_extDict(source, dest, originalSize, dictStart, dictSize); + return LZ4_decompress_unsafe_generic( + (const BYTE*)source, (BYTE*)dest, originalSize, + (size_t)dictSize, NULL, 0); + assert(dictSize >= 0); + return LZ4_decompress_fast_extDict(source, dest, originalSize, dictStart, (size_t)dictSize); } @@ -2177,9 +2658,9 @@ int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, in { return LZ4_compress_default(source, dest, inputSize, maxOutputSize); } -int LZ4_compress(const char* source, char* dest, int inputSize) +int LZ4_compress(const char* src, char* dest, int srcSize) { - return LZ4_compress_default(source, dest, inputSize, LZ4_compressBound(inputSize)); + return LZ4_compress_default(src, dest, srcSize, LZ4_compressBound(srcSize)); } int LZ4_compress_limitedOutput_withState (void* state, const char* src, char* dst, int srcSize, int dstSize) { @@ -2215,7 +2696,7 @@ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, /* Obsolete Streaming functions */ -int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; } +int LZ4_sizeofStreamState(void) { return sizeof(LZ4_stream_t); } int LZ4_resetStreamState(void* state, char* inputBuffer) { @@ -2224,11 +2705,13 @@ int LZ4_resetStreamState(void* state, char* inputBuffer) return 0; } +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) void* LZ4_create (char* inputBuffer) { (void)inputBuffer; return LZ4_createStream(); } +#endif char* LZ4_slideInputBuffer (void* state) { diff --git a/cdk/extra/lz4/lz4.h b/cdk/extra/lz4/lib/lz4.h similarity index 54% rename from cdk/extra/lz4/lz4.h rename to cdk/extra/lz4/lib/lz4.h index c78f12381..491c6087c 100644 --- a/cdk/extra/lz4/lz4.h +++ b/cdk/extra/lz4/lib/lz4.h @@ -1,7 +1,7 @@ /* * LZ4 - Fast LZ compression algorithm * Header File - * Copyright (C) 2011-present, Yann Collet. + * Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) @@ -46,24 +46,31 @@ extern "C" { /** Introduction - LZ4 is lossless compression algorithm, providing compression speed at 500 MB/s per core, + LZ4 is lossless compression algorithm, providing compression speed >500 MB/s per core, scalable with multi-cores CPU. It features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems. The LZ4 compression library provides in-memory compression and decompression functions. + It gives full buffer control to user. Compression can be done in: - a single step (described as Simple Functions) - a single step, reusing a context (described in Advanced Functions) - unbounded multiple steps (described as Streaming compression) - lz4.h provides block compression functions. It gives full buffer control to user. - Decompressing an lz4-compressed block also requires metadata (such as compressed size). - Each application is free to encode such metadata in whichever way it wants. + lz4.h generates and decodes LZ4-compressed blocks (doc/lz4_Block_format.md). + Decompressing such a compressed block requires additional metadata. + Exact metadata depends on exact decompression function. + For the typical case of LZ4_decompress_safe(), + metadata includes block's compressed size, and maximum bound of decompressed size. + Each application is free to encode and pass such metadata in whichever way it wants. - An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md), - take care of encoding standard metadata alongside LZ4-compressed blocks. - Frame format is required for interoperability. - It is delivered through a companion API, declared in lz4frame.h. + lz4.h only handle blocks, it can not generate Frames. + + Blocks are different from Frames (doc/lz4_Frame_format.md). + Frames bundle both blocks and metadata in a specified manner. + Embedding metadata is required for compressed data to be self-contained and portable. + Frame format is delivered through a companion API, declared in lz4frame.h. + The `lz4` CLI can only manage frames. */ /*^*************************************************************** @@ -90,64 +97,111 @@ extern "C" { # define LZ4LIB_API LZ4LIB_VISIBILITY #endif +/*! LZ4_FREESTANDING : + * When this macro is set to 1, it enables "freestanding mode" that is + * suitable for typical freestanding environment which doesn't support + * standard C library. + * + * - LZ4_FREESTANDING is a compile-time switch. + * - It requires the following macros to be defined: + * LZ4_memcpy, LZ4_memmove, LZ4_memset. + * - It only enables LZ4/HC functions which don't use heap. + * All LZ4F_* functions are not supported. + * - See tests/freestanding.c to check its basic setup. + */ +#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1) +# define LZ4_HEAPMODE 0 +# define LZ4HC_HEAPMODE 0 +# define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1 +# if !defined(LZ4_memcpy) +# error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'." +# endif +# if !defined(LZ4_memset) +# error "LZ4_FREESTANDING requires macro 'LZ4_memset'." +# endif +# if !defined(LZ4_memmove) +# error "LZ4_FREESTANDING requires macro 'LZ4_memmove'." +# endif +#elif ! defined(LZ4_FREESTANDING) +# define LZ4_FREESTANDING 0 +#endif + + /*------ Version ------*/ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ -#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */ -#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ +#define LZ4_VERSION_MINOR 9 /* for new (non-breaking) interface capabilities */ +#define LZ4_VERSION_RELEASE 4 /* for tweaks, bug-fixes, or development */ #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) #define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE #define LZ4_QUOTE(str) #str #define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str) -#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) +#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) /* requires v1.7.3+ */ -LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */ -LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version */ +LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version; requires v1.3.0+ */ +LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version; requires v1.7.5+ */ /*-************************************ * Tuning parameter **************************************/ +#define LZ4_MEMORY_USAGE_MIN 10 +#define LZ4_MEMORY_USAGE_DEFAULT 14 +#define LZ4_MEMORY_USAGE_MAX 20 + /*! * LZ4_MEMORY_USAGE : - * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) - * Increasing memory usage improves compression ratio. - * Reduced memory usage may improve speed, thanks to better cache locality. + * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; ) + * Increasing memory usage improves compression ratio, at the cost of speed. + * Reduced memory usage may improve speed at the cost of ratio, thanks to better cache locality. * Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ #ifndef LZ4_MEMORY_USAGE -# define LZ4_MEMORY_USAGE 14 +# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT +#endif + +#if (LZ4_MEMORY_USAGE < LZ4_MEMORY_USAGE_MIN) +# error "LZ4_MEMORY_USAGE is too small !" #endif +#if (LZ4_MEMORY_USAGE > LZ4_MEMORY_USAGE_MAX) +# error "LZ4_MEMORY_USAGE is too large !" +#endif /*-************************************ * Simple Functions **************************************/ /*! LZ4_compress_default() : - Compresses 'srcSize' bytes from buffer 'src' - into already allocated 'dst' buffer of size 'dstCapacity'. - Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). - It also runs faster, so it's a recommended setting. - If the function cannot compress 'src' into a more limited 'dst' budget, - compression stops *immediately*, and the function result is zero. - In which case, 'dst' content is undefined (invalid). - srcSize : max supported value is LZ4_MAX_INPUT_SIZE. - dstCapacity : size of buffer 'dst' (which must be already allocated) - @return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) - or 0 if compression fails - Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer). -*/ + * Compresses 'srcSize' bytes from buffer 'src' + * into already allocated 'dst' buffer of size 'dstCapacity'. + * Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). + * It also runs faster, so it's a recommended setting. + * If the function cannot compress 'src' into a more limited 'dst' budget, + * compression stops *immediately*, and the function result is zero. + * In which case, 'dst' content is undefined (invalid). + * srcSize : max supported value is LZ4_MAX_INPUT_SIZE. + * dstCapacity : size of buffer 'dst' (which must be already allocated) + * @return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) + * or 0 if compression fails + * Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer). + */ LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity); /*! LZ4_decompress_safe() : - compressedSize : is the exact complete size of the compressed block. - dstCapacity : is the size of destination buffer, which must be already allocated. - @return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) - If destination buffer is not large enough, decoding will stop and output an error code (negative value). - If the source stream is detected malformed, the function will stop decoding and return a negative result. - Note : This function is protected against malicious data packets (never writes outside 'dst' buffer, nor read outside 'source' buffer). -*/ + * compressedSize : is the exact complete size of the compressed block. + * dstCapacity : is the size of destination buffer (which must be already allocated), presumed an upper bound of decompressed size. + * @return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) + * If destination buffer is not large enough, decoding will stop and output an error code (negative value). + * If the source stream is detected malformed, the function will stop decoding and return a negative result. + * Note 1 : This function is protected against malicious data packets : + * it will never writes outside 'dst' buffer, nor read outside 'source' buffer, + * even if the compressed block is maliciously modified to order the decoder to do these actions. + * In such case, the decoder stops immediately, and considers the compressed block malformed. + * Note 2 : compressedSize and dstCapacity must be provided to the function, the compressed block does not contain them. + * The implementation is free to send / store / derive this information in whichever way is most beneficial. + * If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead. + */ LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity); @@ -173,7 +227,8 @@ LZ4LIB_API int LZ4_compressBound(int inputSize); The larger the acceleration value, the faster the algorithm, but also the lesser the compression. It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. An acceleration value of "1" is the same as regular LZ4_compress_default() - Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c). + Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c). + Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c). */ LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); @@ -199,54 +254,54 @@ LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* d * New value is necessarily <= input value. * @return : Nb bytes written into 'dst' (necessarily <= targetDestSize) * or 0 if compression fails. -*/ -LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); - - -/*! LZ4_decompress_fast() : **unsafe!** - * This function used to be a bit faster than LZ4_decompress_safe(), - * though situation has changed in recent versions, - * and now `LZ4_decompress_safe()` can be as fast and sometimes faster than `LZ4_decompress_fast()`. - * Moreover, LZ4_decompress_fast() is not protected vs malformed input, as it doesn't perform full validation of compressed data. - * As a consequence, this function is no longer recommended, and may be deprecated in future versions. - * It's last remaining specificity is that it can decompress data without knowing its compressed size. * - * originalSize : is the uncompressed size to regenerate. - * `dst` must be already allocated, its size must be >= 'originalSize' bytes. - * @return : number of bytes read from source buffer (== compressed size). - * If the source stream is detected malformed, the function stops decoding and returns a negative result. - * note : This function requires uncompressed originalSize to be known in advance. - * The function never writes past the output buffer. - * However, since it doesn't know its 'src' size, it may read past the intended input. - * Also, because match offsets are not validated during decoding, - * reads from 'src' may underflow. - * Use this function in trusted environment **only**. + * Note : from v1.8.2 to v1.9.1, this function had a bug (fixed un v1.9.2+): + * the produced compressed content could, in specific circumstances, + * require to be decompressed into a destination buffer larger + * by at least 1 byte than the content to decompress. + * If an application uses `LZ4_compress_destSize()`, + * it's highly recommended to update liblz4 to v1.9.2 or better. + * If this can't be done or ensured, + * the receiving decompression function should provide + * a dstCapacity which is > decompressedSize, by at least 1 byte. + * See https://github.com/lz4/lz4/issues/859 for details */ -LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize); +LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); + /*! LZ4_decompress_safe_partial() : * Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', * into destination buffer 'dst' of size 'dstCapacity'. * Up to 'targetOutputSize' bytes will be decoded. - * The function stops decoding on reaching this objective, - * which can boost performance when only the beginning of a block is required. + * The function stops decoding on reaching this objective. + * This can be useful to boost performance + * whenever only the beginning of a block is required. * - * @return : the number of bytes decoded in `dst` (necessarily <= dstCapacity) + * @return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize) * If source stream is detected malformed, function returns a negative result. * - * Note : @return can be < targetOutputSize, if compressed block contains less data. + * Note 1 : @return can be < targetOutputSize, if compressed block contains less data. * - * Note 2 : this function features 2 parameters, targetOutputSize and dstCapacity, - * and expects targetOutputSize <= dstCapacity. - * It effectively stops decoding on reaching targetOutputSize, + * Note 2 : targetOutputSize must be <= dstCapacity + * + * Note 3 : this function effectively stops decoding on reaching targetOutputSize, * so dstCapacity is kind of redundant. - * This is because in a previous version of this function, - * decoding operation would not "break" a sequence in the middle. - * As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize, + * This is because in older versions of this function, + * decoding operation would still write complete sequences. + * Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize, * it could write more bytes, though only up to dstCapacity. * Some "margin" used to be required for this operation to work properly. - * This is no longer necessary. - * The function nonetheless keeps its signature, in an effort to not break API. + * Thankfully, this is no longer necessary. + * The function nonetheless keeps the same signature, in an effort to preserve API compatibility. + * + * Note 4 : If srcSize is the exact size of the block, + * then targetOutputSize can be any value, + * including larger than the block's decompressed size. + * The function will, at most, generate block's decompressed size. + * + * Note 5 : If srcSize is _larger_ than block's compressed size, + * then targetOutputSize **MUST** be <= block's decompressed size. + * Otherwise, *silent corruption will occur*. */ LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity); @@ -256,20 +311,60 @@ LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcS ***********************************************/ typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */ +/** + Note about RC_INVOKED + + - RC_INVOKED is predefined symbol of rc.exe (the resource compiler which is part of MSVC/Visual Studio). + https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros + + - Since rc.exe is a legacy compiler, it truncates long symbol (> 30 chars) + and reports warning "RC4011: identifier truncated". + + - To eliminate the warning, we surround long preprocessor symbol with + "#if !defined(RC_INVOKED) ... #endif" block that means + "skip this block when rc.exe is trying to read it". +*/ +#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) LZ4LIB_API LZ4_stream_t* LZ4_createStream(void); LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr); +#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */ +#endif -/*! LZ4_resetStream() : - * An LZ4_stream_t structure can be allocated once and re-used multiple times. - * Use this function to start compressing a new stream. +/*! LZ4_resetStream_fast() : v1.9.0+ + * Use this to prepare an LZ4_stream_t for a new chain of dependent blocks + * (e.g., LZ4_compress_fast_continue()). + * + * An LZ4_stream_t must be initialized once before usage. + * This is automatically done when created by LZ4_createStream(). + * However, should the LZ4_stream_t be simply declared on stack (for example), + * it's necessary to initialize it first, using LZ4_initStream(). + * + * After init, start any new stream with LZ4_resetStream_fast(). + * A same LZ4_stream_t can be re-used multiple times consecutively + * and compress multiple streams, + * provided that it starts each new stream with LZ4_resetStream_fast(). + * + * LZ4_resetStream_fast() is much faster than LZ4_initStream(), + * but is not compatible with memory regions containing garbage data. + * + * Note: it's only useful to call LZ4_resetStream_fast() + * in the context of streaming compression. + * The *extState* functions perform their own resets. + * Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive. */ -LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); +LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr); /*! LZ4_loadDict() : - * Use this function to load a static dictionary into LZ4_stream_t. - * Any previous data will be forgotten, only 'dictionary' will remain in memory. + * Use this function to reference a static dictionary into LZ4_stream_t. + * The dictionary must remain available during compression. + * LZ4_loadDict() triggers a reset, so any previous data will be forgotten. + * The same dictionary will have to be loaded on decompression side for successful decoding. + * Dictionary are useful for better compression of small data (KB range). + * While LZ4 accept any input as dictionary, + * results are generally better when using Zstandard's Dictionary Builder. * Loading a size of 0 is allowed, and is the same as reset. - * @return : dictionary size, in bytes (necessarily <= 64 KB) + * @return : loaded dictionary size, in bytes (necessarily <= 64 KB) */ LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize); @@ -318,8 +413,12 @@ typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */ * creation / destruction of streaming decompression tracking context. * A tracking context can be re-used multiple times. */ +#if !defined(RC_INVOKED) /* https://docs.microsoft.com/en-us/windows/win32/menurc/predefined-macros */ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void); LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); +#endif /* !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) */ +#endif /*! LZ4_setStreamDecode() : * An LZ4_streamDecode_t context can be allocated once and re-used multiple times. @@ -369,8 +468,10 @@ LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize); * save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression, * then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block. */ -LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity); -LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); +LZ4LIB_API int +LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, + const char* src, char* dst, + int srcSize, int dstCapacity); /*! LZ4_decompress_*_usingDict() : @@ -381,8 +482,18 @@ LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecod * Performance tip : Decompression speed can be substantially increased * when dst == dictStart + dictSize. */ -LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize); -LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); +LZ4LIB_API int +LZ4_decompress_safe_usingDict(const char* src, char* dst, + int srcSize, int dstCapacity, + const char* dictStart, int dictSize); + +LZ4LIB_API int +LZ4_decompress_safe_partial_usingDict(const char* src, char* dst, + int compressedSize, + int targetOutputSize, int maxOutputSize, + const char* dictStart, int dictSize); + +#endif /* LZ4_H_2983827168210 */ /*^************************************* @@ -390,66 +501,36 @@ LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int or ***************************************/ /*-**************************************************************************** + * Experimental section + * * Symbols declared in this section must be considered unstable. Their * signatures or semantics may change, or they may be removed altogether in the * future. They are therefore only safe to depend on when the caller is * statically linked against the library. * - * To protect against unsafe usage, not only are the declarations guarded, the - * definitions are hidden by default when building LZ4 as a shared/dynamic - * library. + * To protect against unsafe usage, not only are the declarations guarded, + * the definitions are hidden by default + * when building LZ4 as a shared/dynamic library. * - * In order to access these declarations, define LZ4_STATIC_LINKING_ONLY in - * your application before including LZ4's headers. + * In order to access these declarations, + * define LZ4_STATIC_LINKING_ONLY in your application + * before including LZ4's headers. * * In order to make their implementations accessible dynamically, you must * define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library. ******************************************************************************/ +#ifdef LZ4_STATIC_LINKING_ONLY + +#ifndef LZ4_STATIC_3504398509 +#define LZ4_STATIC_3504398509 + #ifdef LZ4_PUBLISH_STATIC_FUNCTIONS #define LZ4LIB_STATIC_API LZ4LIB_API #else #define LZ4LIB_STATIC_API #endif -#ifdef LZ4_STATIC_LINKING_ONLY - -/*! LZ4_resetStream_fast() : - * Use this to prepare a context for a new chain of calls to a streaming API - * (e.g., LZ4_compress_fast_continue()). - * - * Note: - * To stay on the safe side, when LZ4_stream_t is used for the first time, - * it should be either created using LZ4_createStream() or - * initialized using LZ4_resetStream(). - * - * Note: - * Using this in advance of a non-streaming-compression function is redundant, - * since they all perform their own custom reset internally. - * - * Differences from LZ4_resetStream(): - * When an LZ4_stream_t is known to be in an internally coherent state, - * it will be prepared for a new compression with almost no work. - * Otherwise, it will fall back to the full, expensive reset. - * - * LZ4_streams are guaranteed to be in a valid state when: - * - returned from LZ4_createStream() - * - reset by LZ4_resetStream() - * - memset(stream, 0, sizeof(LZ4_stream_t)), though this is discouraged - * - the stream was in a valid state and was reset by LZ4_resetStream_fast() - * - the stream was in a valid state and was then used in any compression call - * that returned success - * - the stream was in an indeterminate state and was used in a compression - * call that fully reset the state (e.g., LZ4_compress_fast_extState()) and - * that returned success - * - * Note: - * A stream that was used in a compression call that did not return success - * (e.g., LZ4_compress_fast_continue()), can still be passed to this function, - * however, it's history is not preserved because of previous compression - * failure. - */ -LZ4LIB_STATIC_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr); /*! LZ4_compress_fast_extState_fastReset() : * A variant of LZ4_compress_fast_extState(). @@ -489,136 +570,211 @@ LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset (void* state, const c * stream (and source buffer) must remain in-place / accessible / unchanged * through the completion of the first compression call on the stream. */ -LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const LZ4_stream_t* dictionaryStream); +LZ4LIB_STATIC_API void +LZ4_attach_dictionary(LZ4_stream_t* workingStream, + const LZ4_stream_t* dictionaryStream); + + +/*! In-place compression and decompression + * + * It's possible to have input and output sharing the same buffer, + * for highly constrained memory environments. + * In both cases, it requires input to lay at the end of the buffer, + * and decompression to start at beginning of the buffer. + * Buffer size must feature some margin, hence be larger than final size. + * + * |<------------------------buffer--------------------------------->| + * |<-----------compressed data--------->| + * |<-----------decompressed size------------------>| + * |<----margin---->| + * + * This technique is more useful for decompression, + * since decompressed size is typically larger, + * and margin is short. + * + * In-place decompression will work inside any buffer + * which size is >= LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize). + * This presumes that decompressedSize > compressedSize. + * Otherwise, it means compression actually expanded data, + * and it would be more efficient to store such data with a flag indicating it's not compressed. + * This can happen when data is not compressible (already compressed, or encrypted). + * + * For in-place compression, margin is larger, as it must be able to cope with both + * history preservation, requiring input data to remain unmodified up to LZ4_DISTANCE_MAX, + * and data expansion, which can happen when input is not compressible. + * As a consequence, buffer size requirements are much higher, + * and memory savings offered by in-place compression are more limited. + * + * There are ways to limit this cost for compression : + * - Reduce history size, by modifying LZ4_DISTANCE_MAX. + * Note that it is a compile-time constant, so all compressions will apply this limit. + * Lower values will reduce compression ratio, except when input_size < LZ4_DISTANCE_MAX, + * so it's a reasonable trick when inputs are known to be small. + * - Require the compressor to deliver a "maximum compressed size". + * This is the `dstCapacity` parameter in `LZ4_compress*()`. + * When this size is < LZ4_COMPRESSBOUND(inputSize), then compression can fail, + * in which case, the return code will be 0 (zero). + * The caller must be ready for these cases to happen, + * and typically design a backup scheme to send data uncompressed. + * The combination of both techniques can significantly reduce + * the amount of margin required for in-place compression. + * + * In-place compression can work in any buffer + * which size is >= (maxCompressedSize) + * with maxCompressedSize == LZ4_COMPRESSBOUND(srcSize) for guaranteed compression success. + * LZ4_COMPRESS_INPLACE_BUFFER_SIZE() depends on both maxCompressedSize and LZ4_DISTANCE_MAX, + * so it's possible to reduce memory requirements by playing with them. + */ + +#define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) (((compressedSize) >> 8) + 32) +#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ((decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize)) /**< note: presumes that compressedSize < decompressedSize. note2: margin is overestimated a bit, since it could use compressedSize instead */ +#ifndef LZ4_DISTANCE_MAX /* history window size; can be user-defined at compile time */ +# define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ #endif +#define LZ4_COMPRESS_INPLACE_MARGIN (LZ4_DISTANCE_MAX + 32) /* LZ4_DISTANCE_MAX can be safely replaced by srcSize when it's smaller */ +#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) ((maxCompressedSize) + LZ4_COMPRESS_INPLACE_MARGIN) /**< maxCompressedSize is generally LZ4_COMPRESSBOUND(inputSize), but can be set to any lower value, with the risk that compression can fail (return code 0(zero)) */ + +#endif /* LZ4_STATIC_3504398509 */ +#endif /* LZ4_STATIC_LINKING_ONLY */ + + + +#ifndef LZ4_H_98237428734687 +#define LZ4_H_98237428734687 /*-************************************************************ - * PRIVATE DEFINITIONS + * Private Definitions ************************************************************** * Do not use these definitions directly. * They are only exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`. - * Accessing members will expose code to API and/or ABI break in future versions of the library. + * Accessing members will expose user code to API and/or ABI break in future versions of the library. **************************************************************/ #define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2) #define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE) #define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */ #if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -#include +# include + typedef int8_t LZ4_i8; + typedef uint8_t LZ4_byte; + typedef uint16_t LZ4_u16; + typedef uint32_t LZ4_u32; +#else + typedef signed char LZ4_i8; + typedef unsigned char LZ4_byte; + typedef unsigned short LZ4_u16; + typedef unsigned int LZ4_u32; +#endif + +/*! LZ4_stream_t : + * Never ever use below internal definitions directly ! + * These definitions are not API/ABI safe, and may change in future versions. + * If you need static allocation, declare or allocate an LZ4_stream_t object. +**/ typedef struct LZ4_stream_t_internal LZ4_stream_t_internal; struct LZ4_stream_t_internal { - uint32_t hashTable[LZ4_HASH_SIZE_U32]; - uint32_t currentOffset; - uint16_t dirty; - uint16_t tableType; - const uint8_t* dictionary; + LZ4_u32 hashTable[LZ4_HASH_SIZE_U32]; + const LZ4_byte* dictionary; const LZ4_stream_t_internal* dictCtx; - uint32_t dictSize; + LZ4_u32 currentOffset; + LZ4_u32 tableType; + LZ4_u32 dictSize; + /* Implicit padding to ensure structure is aligned */ }; -typedef struct { - const uint8_t* externalDict; - size_t extDictSize; - const uint8_t* prefixEnd; - size_t prefixSize; -} LZ4_streamDecode_t_internal; +#define LZ4_STREAM_MINSIZE ((1UL << LZ4_MEMORY_USAGE) + 32) /* static size, for inter-version compatibility */ +union LZ4_stream_u { + char minStateSize[LZ4_STREAM_MINSIZE]; + LZ4_stream_t_internal internal_donotuse; +}; /* previously typedef'd to LZ4_stream_t */ -#else -typedef struct LZ4_stream_t_internal LZ4_stream_t_internal; -struct LZ4_stream_t_internal { - unsigned int hashTable[LZ4_HASH_SIZE_U32]; - unsigned int currentOffset; - unsigned short dirty; - unsigned short tableType; - const unsigned char* dictionary; - const LZ4_stream_t_internal* dictCtx; - unsigned int dictSize; -}; +/*! LZ4_initStream() : v1.9.0+ + * An LZ4_stream_t structure must be initialized at least once. + * This is automatically done when invoking LZ4_createStream(), + * but it's not when the structure is simply declared on stack (for example). + * + * Use LZ4_initStream() to properly initialize a newly declared LZ4_stream_t. + * It can also initialize any arbitrary buffer of sufficient size, + * and will @return a pointer of proper type upon initialization. + * + * Note : initialization fails if size and alignment conditions are not respected. + * In which case, the function will @return NULL. + * Note2: An LZ4_stream_t structure guarantees correct alignment and size. + * Note3: Before v1.9.0, use LZ4_resetStream() instead +**/ +LZ4LIB_API LZ4_stream_t* LZ4_initStream (void* buffer, size_t size); + +/*! LZ4_streamDecode_t : + * Never ever use below internal definitions directly ! + * These definitions are not API/ABI safe, and may change in future versions. + * If you need static allocation, declare or allocate an LZ4_streamDecode_t object. +**/ typedef struct { - const unsigned char* externalDict; - const unsigned char* prefixEnd; + const LZ4_byte* externalDict; + const LZ4_byte* prefixEnd; size_t extDictSize; size_t prefixSize; } LZ4_streamDecode_t_internal; -#endif - -/*! LZ4_stream_t : - * information structure to track an LZ4 stream. - * init this structure with LZ4_resetStream() before first use. - * note : only use in association with static linking ! - * this definition is not API/ABI safe, - * it may change in a future version ! - */ -#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4 + ((sizeof(void*)==16) ? 4 : 0) /*AS-400*/ ) -#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long)) -union LZ4_stream_u { - unsigned long long table[LZ4_STREAMSIZE_U64]; - LZ4_stream_t_internal internal_donotuse; -} ; /* previously typedef'd to LZ4_stream_t */ - - -/*! LZ4_streamDecode_t : - * information structure to track an LZ4 stream during decompression. - * init this structure using LZ4_setStreamDecode() before first use. - * note : only use in association with static linking ! - * this definition is not API/ABI safe, - * and may change in a future version ! - */ -#define LZ4_STREAMDECODESIZE_U64 (4 + ((sizeof(void*)==16) ? 2 : 0) /*AS-400*/ ) -#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long)) +#define LZ4_STREAMDECODE_MINSIZE 32 union LZ4_streamDecode_u { - unsigned long long table[LZ4_STREAMDECODESIZE_U64]; + char minStateSize[LZ4_STREAMDECODE_MINSIZE]; LZ4_streamDecode_t_internal internal_donotuse; } ; /* previously typedef'd to LZ4_streamDecode_t */ + /*-************************************ * Obsolete Functions **************************************/ /*! Deprecation warnings - * Should deprecation warnings be a problem, - * it is generally possible to disable them, + * + * Deprecated functions make the compiler generate a warning when invoked. + * This is meant to invite users to update their source code. + * Should deprecation warnings be a problem, it is generally possible to disable them, * typically with -Wno-deprecated-declarations for gcc * or _CRT_SECURE_NO_WARNINGS in Visual. - * Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */ + * + * Another method is to define LZ4_DISABLE_DEPRECATE_WARNINGS + * before including the header file. + */ #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS # define LZ4_DEPRECATED(message) /* disable deprecation warnings */ #else -# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) # if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ # define LZ4_DEPRECATED(message) [[deprecated(message)]] -# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__) -# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) -# elif (LZ4_GCC_VERSION >= 301) -# define LZ4_DEPRECATED(message) __attribute__((deprecated)) # elif defined(_MSC_VER) # define LZ4_DEPRECATED(message) __declspec(deprecated(message)) +# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45)) +# define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) +# elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31) +# define LZ4_DEPRECATED(message) __attribute__((deprecated)) # else -# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler") -# define LZ4_DEPRECATED(message) +# pragma message("WARNING: LZ4_DEPRECATED needs custom implementation for this compiler") +# define LZ4_DEPRECATED(message) /* disabled */ # endif #endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */ -/* Obsolete compression functions */ -LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* source, char* dest, int sourceSize); -LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize); +/*! Obsolete compression functions (since v1.7.3) */ +LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* src, char* dest, int srcSize); +LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* src, char* dest, int srcSize, int maxOutputSize); LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); -/* Obsolete decompression functions */ +/*! Obsolete decompression functions (since v1.8.0) */ LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize); LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); -/* Obsolete streaming functions; degraded functionality; do not use! +/* Obsolete streaming functions (since v1.7.0) + * degraded functionality; do not use! * * In order to perform streaming compression, these functions depended on data * that is no longer tracked in the state. They have been preserved as well as @@ -632,11 +788,53 @@ LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStre LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer); LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state); -/* Obsolete streaming decoding functions */ +/*! Obsolete streaming decoding functions (since v1.7.0) */ LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize); LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize); -#endif /* LZ4_H_2983827168210 */ +/*! Obsolete LZ4_decompress_fast variants (since v1.9.0) : + * These functions used to be faster than LZ4_decompress_safe(), + * but this is no longer the case. They are now slower. + * This is because LZ4_decompress_fast() doesn't know the input size, + * and therefore must progress more cautiously into the input buffer to not read beyond the end of block. + * On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability. + * As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated. + * + * The last remaining LZ4_decompress_fast() specificity is that + * it can decompress a block without knowing its compressed size. + * Such functionality can be achieved in a more secure manner + * by employing LZ4_decompress_safe_partial(). + * + * Parameters: + * originalSize : is the uncompressed size to regenerate. + * `dst` must be already allocated, its size must be >= 'originalSize' bytes. + * @return : number of bytes read from source buffer (== compressed size). + * The function expects to finish at block's end exactly. + * If the source stream is detected malformed, the function stops decoding and returns a negative result. + * note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. + * However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. + * Also, since match offsets are not validated, match reads from 'src' may underflow too. + * These issues never happen if input (compressed) data is correct. + * But they may happen if input data is invalid (error or intentional tampering). + * As a consequence, use these functions in trusted environments with trusted data **only**. + */ +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead") +LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize); +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_continue() instead") +LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize); +LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_usingDict() instead") +LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); + +/*! LZ4_resetStream() : + * An LZ4_stream_t structure must be initialized at least once. + * This is done with LZ4_initStream(), or LZ4_resetStream(). + * Consider switching to LZ4_initStream(), + * invoking LZ4_resetStream() will trigger deprecation warnings in the future. + */ +LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); + + +#endif /* LZ4_H_98237428734687 */ #if defined (__cplusplus) diff --git a/cdk/extra/lz4/lib/lz4file.c b/cdk/extra/lz4/lib/lz4file.c new file mode 100644 index 000000000..eaf9b1704 --- /dev/null +++ b/cdk/extra/lz4/lib/lz4file.c @@ -0,0 +1,311 @@ +/* + * LZ4 file library + * Copyright (C) 2022, Xiaomi Inc. + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://www.lz4.org + * - LZ4 source repository : https://github.com/lz4/lz4 + */ +#include +#include +#include "lz4.h" +#include "lz4file.h" + +struct LZ4_readFile_s { + LZ4F_dctx* dctxPtr; + FILE* fp; + LZ4_byte* srcBuf; + size_t srcBufNext; + size_t srcBufSize; + size_t srcBufMaxSize; +}; + +struct LZ4_writeFile_s { + LZ4F_cctx* cctxPtr; + FILE* fp; + LZ4_byte* dstBuf; + size_t maxWriteSize; + size_t dstBufMaxSize; + LZ4F_errorCode_t errCode; +}; + +LZ4F_errorCode_t LZ4F_readOpen(LZ4_readFile_t** lz4fRead, FILE* fp) +{ + char buf[LZ4F_HEADER_SIZE_MAX]; + size_t consumedSize; + LZ4F_errorCode_t ret; + LZ4F_frameInfo_t info; + + if (fp == NULL || lz4fRead == NULL) { + return -LZ4F_ERROR_GENERIC; + } + + *lz4fRead = (LZ4_readFile_t*)calloc(1, sizeof(LZ4_readFile_t)); + if (*lz4fRead == NULL) { + return -LZ4F_ERROR_allocation_failed; + } + + ret = LZ4F_createDecompressionContext(&(*lz4fRead)->dctxPtr, LZ4F_getVersion()); + if (LZ4F_isError(ret)) { + free(*lz4fRead); + return ret; + } + + (*lz4fRead)->fp = fp; + consumedSize = fread(buf, 1, sizeof(buf), (*lz4fRead)->fp); + if (consumedSize != sizeof(buf)) { + free(*lz4fRead); + return -LZ4F_ERROR_GENERIC; + } + + ret = LZ4F_getFrameInfo((*lz4fRead)->dctxPtr, &info, buf, &consumedSize); + if (LZ4F_isError(ret)) { + LZ4F_freeDecompressionContext((*lz4fRead)->dctxPtr); + free(*lz4fRead); + return ret; + } + + switch (info.blockSizeID) { + case LZ4F_default : + case LZ4F_max64KB : + (*lz4fRead)->srcBufMaxSize = 64 * 1024; + break; + case LZ4F_max256KB: + (*lz4fRead)->srcBufMaxSize = 256 * 1024; + break; + case LZ4F_max1MB: + (*lz4fRead)->srcBufMaxSize = 1 * 1024 * 1024; + break; + case LZ4F_max4MB: + (*lz4fRead)->srcBufMaxSize = 4 * 1024 * 1024; + break; + default: + LZ4F_freeDecompressionContext((*lz4fRead)->dctxPtr); + free(*lz4fRead); + return -LZ4F_ERROR_maxBlockSize_invalid; + } + + (*lz4fRead)->srcBuf = (LZ4_byte*)malloc((*lz4fRead)->srcBufMaxSize); + if ((*lz4fRead)->srcBuf == NULL) { + LZ4F_freeDecompressionContext((*lz4fRead)->dctxPtr); + free(lz4fRead); + return -LZ4F_ERROR_allocation_failed; + } + + (*lz4fRead)->srcBufSize = sizeof(buf) - consumedSize; + memcpy((*lz4fRead)->srcBuf, buf + consumedSize, (*lz4fRead)->srcBufSize); + + return ret; +} + +size_t LZ4F_read(LZ4_readFile_t* lz4fRead, void* buf, size_t size) +{ + LZ4_byte* p = (LZ4_byte*)buf; + size_t next = 0; + + if (lz4fRead == NULL || buf == NULL) + return -LZ4F_ERROR_GENERIC; + + while (next < size) { + size_t srcsize = lz4fRead->srcBufSize - lz4fRead->srcBufNext; + size_t dstsize = size - next; + size_t ret; + + if (srcsize == 0) { + ret = fread(lz4fRead->srcBuf, 1, lz4fRead->srcBufMaxSize, lz4fRead->fp); + if (ret > 0) { + lz4fRead->srcBufSize = ret; + srcsize = lz4fRead->srcBufSize; + lz4fRead->srcBufNext = 0; + } + else if (ret == 0) { + break; + } + else { + return -LZ4F_ERROR_GENERIC; + } + } + + ret = LZ4F_decompress(lz4fRead->dctxPtr, + p, &dstsize, + lz4fRead->srcBuf + lz4fRead->srcBufNext, + &srcsize, + NULL); + if (LZ4F_isError(ret)) { + return ret; + } + + lz4fRead->srcBufNext += srcsize; + next += dstsize; + p += dstsize; + } + + return next; +} + +LZ4F_errorCode_t LZ4F_readClose(LZ4_readFile_t* lz4fRead) +{ + if (lz4fRead == NULL) + return -LZ4F_ERROR_GENERIC; + LZ4F_freeDecompressionContext(lz4fRead->dctxPtr); + free(lz4fRead->srcBuf); + free(lz4fRead); + return LZ4F_OK_NoError; +} + +LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4F_preferences_t* prefsPtr) +{ + LZ4_byte buf[LZ4F_HEADER_SIZE_MAX]; + size_t ret; + + if (fp == NULL || lz4fWrite == NULL) + return -LZ4F_ERROR_GENERIC; + + *lz4fWrite = (LZ4_writeFile_t*)malloc(sizeof(LZ4_writeFile_t)); + if (*lz4fWrite == NULL) { + return -LZ4F_ERROR_allocation_failed; + } + if (prefsPtr != NULL) { + switch (prefsPtr->frameInfo.blockSizeID) { + case LZ4F_default : + case LZ4F_max64KB : + (*lz4fWrite)->maxWriteSize = 64 * 1024; + break; + case LZ4F_max256KB: + (*lz4fWrite)->maxWriteSize = 256 * 1024; + break; + case LZ4F_max1MB: + (*lz4fWrite)->maxWriteSize = 1 * 1024 * 1024; + break; + case LZ4F_max4MB: + (*lz4fWrite)->maxWriteSize = 4 * 1024 * 1024; + break; + default: + free(lz4fWrite); + return -LZ4F_ERROR_maxBlockSize_invalid; + } + } else { + (*lz4fWrite)->maxWriteSize = 64 * 1024; + } + + (*lz4fWrite)->dstBufMaxSize = LZ4F_compressBound((*lz4fWrite)->maxWriteSize, prefsPtr); + (*lz4fWrite)->dstBuf = (LZ4_byte*)malloc((*lz4fWrite)->dstBufMaxSize); + if ((*lz4fWrite)->dstBuf == NULL) { + free(*lz4fWrite); + return -LZ4F_ERROR_allocation_failed; + } + + ret = LZ4F_createCompressionContext(&(*lz4fWrite)->cctxPtr, LZ4F_getVersion()); + if (LZ4F_isError(ret)) { + free((*lz4fWrite)->dstBuf); + free(*lz4fWrite); + return ret; + } + + ret = LZ4F_compressBegin((*lz4fWrite)->cctxPtr, buf, LZ4F_HEADER_SIZE_MAX, prefsPtr); + if (LZ4F_isError(ret)) { + LZ4F_freeCompressionContext((*lz4fWrite)->cctxPtr); + free((*lz4fWrite)->dstBuf); + free(*lz4fWrite); + return ret; + } + + if (ret != fwrite(buf, 1, ret, fp)) { + LZ4F_freeCompressionContext((*lz4fWrite)->cctxPtr); + free((*lz4fWrite)->dstBuf); + free(*lz4fWrite); + return -LZ4F_ERROR_GENERIC; + } + + (*lz4fWrite)->fp = fp; + (*lz4fWrite)->errCode = LZ4F_OK_NoError; + return LZ4F_OK_NoError; +} + +size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size) +{ + LZ4_byte* p = (LZ4_byte*)buf; + size_t remain = size; + size_t chunk; + size_t ret; + + if (lz4fWrite == NULL || buf == NULL) + return -LZ4F_ERROR_GENERIC; + while (remain) { + if (remain > lz4fWrite->maxWriteSize) + chunk = lz4fWrite->maxWriteSize; + else + chunk = remain; + + ret = LZ4F_compressUpdate(lz4fWrite->cctxPtr, + lz4fWrite->dstBuf, lz4fWrite->dstBufMaxSize, + p, chunk, + NULL); + if (LZ4F_isError(ret)) { + lz4fWrite->errCode = ret; + return ret; + } + + if(ret != fwrite(lz4fWrite->dstBuf, 1, ret, lz4fWrite->fp)) { + lz4fWrite->errCode = -LZ4F_ERROR_GENERIC; + return -LZ4F_ERROR_GENERIC; + } + + p += chunk; + remain -= chunk; + } + + return size; +} + +LZ4F_errorCode_t LZ4F_writeClose(LZ4_writeFile_t* lz4fWrite) +{ + LZ4F_errorCode_t ret = LZ4F_OK_NoError; + + if (lz4fWrite == NULL) + return -LZ4F_ERROR_GENERIC; + + if (lz4fWrite->errCode == LZ4F_OK_NoError) { + ret = LZ4F_compressEnd(lz4fWrite->cctxPtr, + lz4fWrite->dstBuf, lz4fWrite->dstBufMaxSize, + NULL); + if (LZ4F_isError(ret)) { + goto out; + } + + if (ret != fwrite(lz4fWrite->dstBuf, 1, ret, lz4fWrite->fp)) { + ret = -LZ4F_ERROR_GENERIC; + } + } + +out: + LZ4F_freeCompressionContext(lz4fWrite->cctxPtr); + free(lz4fWrite->dstBuf); + free(lz4fWrite); + return ret; +} diff --git a/cdk/extra/lz4/lib/lz4file.h b/cdk/extra/lz4/lib/lz4file.h new file mode 100644 index 000000000..552713072 --- /dev/null +++ b/cdk/extra/lz4/lib/lz4file.h @@ -0,0 +1,93 @@ +/* + LZ4 file library + Header File + Copyright (C) 2022, Xiaomi Inc. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - LZ4 source repository : https://github.com/lz4/lz4 + - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c +*/ +#if defined (__cplusplus) +extern "C" { +#endif + +#ifndef LZ4FILE_H +#define LZ4FILE_H + +#include +#include "lz4frame_static.h" + +typedef struct LZ4_readFile_s LZ4_readFile_t; +typedef struct LZ4_writeFile_s LZ4_writeFile_t; + +/*! LZ4F_readOpen() : + * Set read lz4file handle. + * `lz4f` will set a lz4file handle. + * `fp` must be the return value of the lz4 file opened by fopen. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readOpen(LZ4_readFile_t** lz4fRead, FILE* fp); + +/*! LZ4F_read() : + * Read lz4file content to buffer. + * `lz4f` must use LZ4_readOpen to set first. + * `buf` read data buffer. + * `size` read data buffer size. + */ +LZ4FLIB_STATIC_API size_t LZ4F_read(LZ4_readFile_t* lz4fRead, void* buf, size_t size); + +/*! LZ4F_readClose() : + * Close lz4file handle. + * `lz4f` must use LZ4_readOpen to set first. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readClose(LZ4_readFile_t* lz4fRead); + +/*! LZ4F_writeOpen() : + * Set write lz4file handle. + * `lz4f` will set a lz4file handle. + * `fp` must be the return value of the lz4 file opened by fopen. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4F_preferences_t* prefsPtr); + +/*! LZ4F_write() : + * Write buffer to lz4file. + * `lz4f` must use LZ4F_writeOpen to set first. + * `buf` write data buffer. + * `size` write data buffer size. + */ +LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size); + +/*! LZ4F_writeClose() : + * Close lz4file handle. + * `lz4f` must use LZ4F_writeOpen to set first. + */ +LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeClose(LZ4_writeFile_t* lz4fWrite); + +#endif /* LZ4FILE_H */ + +#if defined (__cplusplus) +} +#endif diff --git a/cdk/extra/lz4/lz4frame.c b/cdk/extra/lz4/lib/lz4frame.c similarity index 62% rename from cdk/extra/lz4/lz4frame.c rename to cdk/extra/lz4/lib/lz4frame.c index 3f81ef00a..174f9ae4f 100644 --- a/cdk/extra/lz4/lz4frame.c +++ b/cdk/extra/lz4/lib/lz4frame.c @@ -1,48 +1,51 @@ /* -LZ4 auto-framing library -Copyright (C) 2011-2016, Yann Collet. - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -You can contact the author at : -- LZ4 homepage : http://www.lz4.org -- LZ4 source repository : https://github.com/lz4/lz4 -*/ + * LZ4 auto-framing library + * Copyright (C) 2011-2016, Yann Collet. + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://www.lz4.org + * - LZ4 source repository : https://github.com/lz4/lz4 + */ /* LZ4F is a stand-alone API to create LZ4-compressed Frames -* in full conformance with specification v1.6.1 . -* This library rely upon memory management capabilities. -* */ + * in full conformance with specification v1.6.1 . + * This library rely upon memory management capabilities (malloc, free) + * provided either by , + * or redirected towards another library of user's choice + * (see Memory Routines below). + */ /*-************************************ * Compiler Options **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ #endif @@ -60,23 +63,7 @@ You can contact the author at : /*-************************************ -* Memory routines -**************************************/ -#include /* malloc, calloc, free */ -#define ALLOC(s) malloc(s) -#ifndef LZ4_SRC_INCLUDED -#define ALLOC_AND_ZERO(s) calloc(1,(s)) -#endif -#define FREEMEM(p) free(p) -#include /* memset, memcpy, memmove */ -#ifndef LZ4_SRC_INCLUDED -#define MEM_INIT memset -#endif - - - -/*-************************************ -* Includes +* Library declarations **************************************/ #define LZ4F_STATIC_LINKING_ONLY #include "lz4frame.h" @@ -88,6 +75,66 @@ You can contact the author at : #include "xxhash.h" +/*-************************************ +* Memory routines +**************************************/ +/* + * User may redirect invocations of + * malloc(), calloc() and free() + * towards another library or solution of their choice + * by modifying below section. +**/ + +#include /* memset, memcpy, memmove */ +#ifndef LZ4_SRC_INCLUDED /* avoid redefinition when sources are coalesced */ +# define MEM_INIT(p,v,s) memset((p),(v),(s)) +#endif + +#ifndef LZ4_SRC_INCLUDED /* avoid redefinition when sources are coalesced */ +# include /* malloc, calloc, free */ +# define ALLOC(s) malloc(s) +# define ALLOC_AND_ZERO(s) calloc(1,(s)) +# define FREEMEM(p) free(p) +#endif + +static void* LZ4F_calloc(size_t s, LZ4F_CustomMem cmem) +{ + /* custom calloc defined : use it */ + if (cmem.customCalloc != NULL) { + return cmem.customCalloc(cmem.opaqueState, s); + } + /* nothing defined : use default 's calloc() */ + if (cmem.customAlloc == NULL) { + return ALLOC_AND_ZERO(s); + } + /* only custom alloc defined : use it, and combine it with memset() */ + { void* const p = cmem.customAlloc(cmem.opaqueState, s); + if (p != NULL) MEM_INIT(p, 0, s); + return p; +} } + +static void* LZ4F_malloc(size_t s, LZ4F_CustomMem cmem) +{ + /* custom malloc defined : use it */ + if (cmem.customAlloc != NULL) { + return cmem.customAlloc(cmem.opaqueState, s); + } + /* nothing defined : use default 's malloc() */ + return ALLOC(s); +} + +static void LZ4F_free(void* p, LZ4F_CustomMem cmem) +{ + /* custom malloc defined : use it */ + if (cmem.customFree != NULL) { + cmem.customFree(cmem.opaqueState, p); + return; + } + /* nothing defined : use default 's free() */ + FREEMEM(p); +} + + /*-************************************ * Debug **************************************/ @@ -134,13 +181,13 @@ static int g_debuglog_enable = 1; #endif -/* unoptimized version; solves endianess & alignment issues */ +/* unoptimized version; solves endianness & alignment issues */ static U32 LZ4F_readLE32 (const void* src) { const BYTE* const srcPtr = (const BYTE*)src; U32 value32 = srcPtr[0]; - value32 += (srcPtr[1]<<8); - value32 += (srcPtr[2]<<16); + value32 += ((U32)srcPtr[1])<< 8; + value32 += ((U32)srcPtr[2])<<16; value32 += ((U32)srcPtr[3])<<24; return value32; } @@ -185,10 +232,10 @@ static void LZ4F_writeLE64 (void* dst, U64 value64) /*-************************************ * Constants **************************************/ -#ifndef LZ4_SRC_INCLUDED -#define KB *(1<<10) -#define MB *(1<<20) -#define GB *(1<<30) +#ifndef LZ4_SRC_INCLUDED /* avoid double definition */ +# define KB *(1<<10) +# define MB *(1<<20) +# define GB *(1<<30) #endif #define _1BIT 0x01 @@ -197,35 +244,39 @@ static void LZ4F_writeLE64 (void* dst, U64 value64) #define _4BITS 0x0F #define _8BITS 0xFF -#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U -#define LZ4F_MAGICNUMBER 0x184D2204U #define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U #define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB -static const size_t minFHSize = 7; +static const size_t minFHSize = LZ4F_HEADER_SIZE_MIN; /* 7 */ static const size_t maxFHSize = LZ4F_HEADER_SIZE_MAX; /* 19 */ -static const size_t BHSize = 4; +static const size_t BHSize = LZ4F_BLOCK_HEADER_SIZE; /* block header : size, and compress flag */ +static const size_t BFSize = LZ4F_BLOCK_CHECKSUM_SIZE; /* block footer : checksum (optional) */ /*-************************************ * Structures and local types **************************************/ + +typedef enum { LZ4B_COMPRESSED, LZ4B_UNCOMPRESSED} LZ4F_blockCompression_t; + typedef struct LZ4F_cctx_s { + LZ4F_CustomMem cmem; LZ4F_preferences_t prefs; U32 version; U32 cStage; const LZ4F_CDict* cdict; size_t maxBlockSize; size_t maxBufferSize; - BYTE* tmpBuff; - BYTE* tmpIn; - size_t tmpInSize; + BYTE* tmpBuff; /* internal buffer, for streaming */ + BYTE* tmpIn; /* starting position of data compress within internal buffer (>= tmpBuff) */ + size_t tmpInSize; /* amount of data to compress after tmpIn */ U64 totalInSize; XXH32_state_t xxh; void* lz4CtxPtr; U16 lz4CtxAlloc; /* sized for: 0 = none, 1 = lz4 ctx, 2 = lz4hc ctx */ U16 lz4CtxState; /* in use as: 0 = none, 1 = lz4 ctx, 2 = lz4hc ctx */ + LZ4F_blockCompression_t blockCompression; } LZ4F_cctx_t; @@ -254,26 +305,33 @@ LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult) return (LZ4F_errorCodes)(-(ptrdiff_t)functionResult); } -static LZ4F_errorCode_t err0r(LZ4F_errorCodes code) +static LZ4F_errorCode_t LZ4F_returnErrorCode(LZ4F_errorCodes code) { /* A compilation error here means sizeof(ptrdiff_t) is not large enough */ LZ4F_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t)); return (LZ4F_errorCode_t)-(ptrdiff_t)code; } +#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e) + +#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e) + +#define FORWARD_IF_ERROR(r) if (LZ4F_isError(r)) return (r) + unsigned LZ4F_getVersion(void) { return LZ4F_VERSION; } int LZ4F_compressionLevel_max(void) { return LZ4HC_CLEVEL_MAX; } -size_t LZ4F_getBlockSize(unsigned blockSizeID) +size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID) { static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB }; if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT; - if (blockSizeID < 4 || blockSizeID > 7) return err0r(LZ4F_ERROR_maxBlockSize_invalid); - blockSizeID -= 4; - return blockSizes[blockSizeID]; -} + if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB) + RETURN_ERROR(maxBlockSize_invalid); + { int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB; + return blockSizes[blockSizeIdx]; +} } /*-************************************ * Private functions @@ -314,9 +372,9 @@ static size_t LZ4F_compressBound_internal(size_t srcSize, const LZ4F_preferences_t* preferencesPtr, size_t alreadyBuffered) { - LZ4F_preferences_t prefsNull; - MEM_INIT(&prefsNull, 0, sizeof(prefsNull)); + LZ4F_preferences_t prefsNull = LZ4F_INIT_PREFERENCES; prefsNull.frameInfo.contentChecksumFlag = LZ4F_contentChecksumEnabled; /* worst case */ + prefsNull.frameInfo.blockChecksumFlag = LZ4F_blockChecksumEnabled; /* worst case */ { const LZ4F_preferences_t* const prefsPtr = (preferencesPtr==NULL) ? &prefsNull : preferencesPtr; U32 const flush = prefsPtr->autoFlush | (srcSize==0); LZ4F_blockSizeID_t const blockID = prefsPtr->frameInfo.blockSizeID; @@ -329,11 +387,10 @@ static size_t LZ4F_compressBound_internal(size_t srcSize, size_t const lastBlockSize = flush ? partialBlockSize : 0; unsigned const nbBlocks = nbFullBlocks + (lastBlockSize>0); - size_t const blockHeaderSize = 4; - size_t const blockCRCSize = 4 * prefsPtr->frameInfo.blockChecksumFlag; - size_t const frameEnd = 4 + (prefsPtr->frameInfo.contentChecksumFlag*4); + size_t const blockCRCSize = BFSize * prefsPtr->frameInfo.blockChecksumFlag; + size_t const frameEnd = BHSize + (prefsPtr->frameInfo.contentChecksumFlag*BFSize); - return ((blockHeaderSize + blockCRCSize) * nbBlocks) + + return ((BHSize + blockCRCSize) * nbBlocks) + (blockSize * nbFullBlocks) + lastBlockSize + frameEnd; } } @@ -387,22 +444,24 @@ size_t LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx, MEM_INIT(&options, 0, sizeof(options)); options.stableSrc = 1; - if (dstCapacity < LZ4F_compressFrameBound(srcSize, &prefs)) /* condition to guarantee success */ - return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); + RETURN_ERROR_IF(dstCapacity < LZ4F_compressFrameBound(srcSize, &prefs), dstMaxSize_tooSmall); { size_t const headerSize = LZ4F_compressBegin_usingCDict(cctx, dstBuffer, dstCapacity, cdict, &prefs); /* write header */ - if (LZ4F_isError(headerSize)) return headerSize; + FORWARD_IF_ERROR(headerSize); dstPtr += headerSize; /* header size */ } - { size_t const cSize = LZ4F_compressUpdate(cctx, dstPtr, dstEnd-dstPtr, srcBuffer, srcSize, &options); - if (LZ4F_isError(cSize)) return cSize; + assert(dstEnd >= dstPtr); + { size_t const cSize = LZ4F_compressUpdate(cctx, dstPtr, (size_t)(dstEnd-dstPtr), srcBuffer, srcSize, &options); + FORWARD_IF_ERROR(cSize); dstPtr += cSize; } - { size_t const tailSize = LZ4F_compressEnd(cctx, dstPtr, dstEnd-dstPtr, &options); /* flush last block, and generate suffix */ - if (LZ4F_isError(tailSize)) return tailSize; + assert(dstEnd >= dstPtr); + { size_t const tailSize = LZ4F_compressEnd(cctx, dstPtr, (size_t)(dstEnd-dstPtr), &options); /* flush last block, and generate suffix */ + FORWARD_IF_ERROR(tailSize); dstPtr += tailSize; } - return (dstPtr - dstStart); + assert(dstEnd >= dstStart); + return (size_t)(dstPtr - dstStart); } @@ -419,27 +478,26 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, { size_t result; #if (LZ4F_HEAPMODE) - LZ4F_cctx_t *cctxPtr; + LZ4F_cctx_t* cctxPtr; result = LZ4F_createCompressionContext(&cctxPtr, LZ4F_VERSION); - if (LZ4F_isError(result)) return result; + FORWARD_IF_ERROR(result); #else LZ4F_cctx_t cctx; LZ4_stream_t lz4ctx; - LZ4F_cctx_t *cctxPtr = &cctx; + LZ4F_cctx_t* const cctxPtr = &cctx; - DEBUGLOG(4, "LZ4F_compressFrame"); MEM_INIT(&cctx, 0, sizeof(cctx)); cctx.version = LZ4F_VERSION; cctx.maxBufferSize = 5 MB; /* mess with real buffer size to prevent dynamic allocation; works only because autoflush==1 & stableSrc==1 */ - if (preferencesPtr == NULL || - preferencesPtr->compressionLevel < LZ4HC_CLEVEL_MIN) - { - LZ4_resetStream(&lz4ctx); + if ( preferencesPtr == NULL + || preferencesPtr->compressionLevel < LZ4HC_CLEVEL_MIN ) { + LZ4_initStream(&lz4ctx, sizeof(lz4ctx)); cctxPtr->lz4CtxPtr = &lz4ctx; cctxPtr->lz4CtxAlloc = 1; cctxPtr->lz4CtxState = 1; } #endif + DEBUGLOG(4, "LZ4F_compressFrame"); result = LZ4F_compressFrame_usingCDict(cctxPtr, dstBuffer, dstCapacity, srcBuffer, srcSize, @@ -448,10 +506,9 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, #if (LZ4F_HEAPMODE) LZ4F_freeCompressionContext(cctxPtr); #else - if (preferencesPtr != NULL && - preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN) - { - FREEMEM(cctxPtr->lz4CtxPtr); + if ( preferencesPtr != NULL + && preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN ) { + LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem); } #endif return result; @@ -463,30 +520,31 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, *****************************************************/ struct LZ4F_CDict_s { + LZ4F_CustomMem cmem; void* dictContent; LZ4_stream_t* fastCtx; LZ4_streamHC_t* HCCtx; }; /* typedef'd to LZ4F_CDict within lz4frame_static.h */ -/*! LZ4F_createCDict() : - * When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. - * LZ4F_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. - * LZ4F_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. - * `dictBuffer` can be released after LZ4F_CDict creation, since its content is copied within CDict - * @return : digested dictionary for compression, or NULL if failed */ -LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize) +LZ4F_CDict* +LZ4F_createCDict_advanced(LZ4F_CustomMem cmem, const void* dictBuffer, size_t dictSize) { const char* dictStart = (const char*)dictBuffer; - LZ4F_CDict* cdict = (LZ4F_CDict*) ALLOC(sizeof(*cdict)); - DEBUGLOG(4, "LZ4F_createCDict"); + LZ4F_CDict* const cdict = (LZ4F_CDict*)LZ4F_malloc(sizeof(*cdict), cmem); + DEBUGLOG(4, "LZ4F_createCDict_advanced"); if (!cdict) return NULL; + cdict->cmem = cmem; if (dictSize > 64 KB) { dictStart += dictSize - 64 KB; dictSize = 64 KB; } - cdict->dictContent = ALLOC(dictSize); - cdict->fastCtx = LZ4_createStream(); - cdict->HCCtx = LZ4_createStreamHC(); + cdict->dictContent = LZ4F_malloc(dictSize, cmem); + cdict->fastCtx = (LZ4_stream_t*)LZ4F_malloc(sizeof(LZ4_stream_t), cmem); + if (cdict->fastCtx) + LZ4_initStream(cdict->fastCtx, sizeof(LZ4_stream_t)); + cdict->HCCtx = (LZ4_streamHC_t*)LZ4F_malloc(sizeof(LZ4_streamHC_t), cmem); + if (cdict->HCCtx) + LZ4_initStream(cdict->HCCtx, sizeof(LZ4_streamHC_t)); if (!cdict->dictContent || !cdict->fastCtx || !cdict->HCCtx) { LZ4F_freeCDict(cdict); return NULL; @@ -498,13 +556,25 @@ LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize) return cdict; } +/*! LZ4F_createCDict() : + * When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. + * LZ4F_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. + * LZ4F_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. + * @dictBuffer can be released after LZ4F_CDict creation, since its content is copied within CDict + * @return : digested dictionary for compression, or NULL if failed */ +LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize) +{ + DEBUGLOG(4, "LZ4F_createCDict"); + return LZ4F_createCDict_advanced(LZ4F_defaultCMem, dictBuffer, dictSize); +} + void LZ4F_freeCDict(LZ4F_CDict* cdict) { if (cdict==NULL) return; /* support free on NULL */ - FREEMEM(cdict->dictContent); - LZ4_freeStream(cdict->fastCtx); - LZ4_freeStreamHC(cdict->HCCtx); - FREEMEM(cdict); + LZ4F_free(cdict->dictContent, cdict->cmem); + LZ4F_free(cdict->fastCtx, cdict->cmem); + LZ4F_free(cdict->HCCtx, cdict->cmem); + LZ4F_free(cdict, cdict->cmem); } @@ -512,6 +582,20 @@ void LZ4F_freeCDict(LZ4F_CDict* cdict) * Advanced compression functions ***********************************/ +LZ4F_cctx* +LZ4F_createCompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version) +{ + LZ4F_cctx* const cctxPtr = + (LZ4F_cctx*)LZ4F_calloc(sizeof(LZ4F_cctx), customMem); + if (cctxPtr==NULL) return NULL; + + cctxPtr->cmem = customMem; + cctxPtr->version = version; + cctxPtr->cStage = 0; /* Uninitialized. Next stage : init cctx */ + + return cctxPtr; +} + /*! LZ4F_createCompressionContext() : * The first thing to do is to create a compressionContext object, which will be used in all compression operations. * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version and an LZ4F_preferences_t structure. @@ -519,31 +603,27 @@ void LZ4F_freeCDict(LZ4F_CDict* cdict) * The function will provide a pointer to an allocated LZ4F_compressionContext_t object. * If the result LZ4F_errorCode_t is not OK_NoError, there was an error during context creation. * Object can release its memory using LZ4F_freeCompressionContext(); - */ -LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_compressionContext_t* LZ4F_compressionContextPtr, unsigned version) +**/ +LZ4F_errorCode_t +LZ4F_createCompressionContext(LZ4F_cctx** LZ4F_compressionContextPtr, unsigned version) { - LZ4F_cctx_t* const cctxPtr = (LZ4F_cctx_t*)ALLOC_AND_ZERO(sizeof(LZ4F_cctx_t)); - if (cctxPtr==NULL) return err0r(LZ4F_ERROR_allocation_failed); - - cctxPtr->version = version; - cctxPtr->cStage = 0; /* Next stage : init stream */ - - *LZ4F_compressionContextPtr = (LZ4F_compressionContext_t)cctxPtr; + assert(LZ4F_compressionContextPtr != NULL); /* considered a violation of narrow contract */ + /* in case it nonetheless happen in production */ + RETURN_ERROR_IF(LZ4F_compressionContextPtr == NULL, parameter_null); + *LZ4F_compressionContextPtr = LZ4F_createCompressionContext_advanced(LZ4F_defaultCMem, version); + RETURN_ERROR_IF(*LZ4F_compressionContextPtr==NULL, allocation_failed); return LZ4F_OK_NoError; } -LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_compressionContext_t LZ4F_compressionContext) +LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctxPtr) { - LZ4F_cctx_t* const cctxPtr = (LZ4F_cctx_t*)LZ4F_compressionContext; - if (cctxPtr != NULL) { /* support free on NULL */ - FREEMEM(cctxPtr->lz4CtxPtr); /* works because LZ4_streamHC_t and LZ4_stream_t are simple POD types */ - FREEMEM(cctxPtr->tmpBuff); - FREEMEM(LZ4F_compressionContext); + LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem); /* note: LZ4_streamHC_t and LZ4_stream_t are simple POD types */ + LZ4F_free(cctxPtr->tmpBuff, cctxPtr->cmem); + LZ4F_free(cctxPtr, cctxPtr->cmem); } - return LZ4F_OK_NoError; } @@ -577,11 +657,21 @@ static void LZ4F_initStream(void* ctx, } } +static int ctxTypeID_to_size(int ctxTypeID) { + switch(ctxTypeID) { + case 1: + return LZ4_sizeofState(); + case 2: + return LZ4_sizeofStateHC(); + default: + return 0; + } +} /*! LZ4F_compressBegin_usingCDict() : - * init streaming compression and writes frame header into dstBuffer. - * dstBuffer must be >= LZ4F_HEADER_SIZE_MAX bytes. - * @return : number of bytes written into dstBuffer for the header + * init streaming compression AND writes frame header into @dstBuffer. + * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. + * @return : number of bytes written into @dstBuffer for the header * or an error code (can be tested using LZ4F_isError()) */ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr, @@ -589,39 +679,46 @@ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr, const LZ4F_CDict* cdict, const LZ4F_preferences_t* preferencesPtr) { - LZ4F_preferences_t prefNull; + LZ4F_preferences_t const prefNull = LZ4F_INIT_PREFERENCES; BYTE* const dstStart = (BYTE*)dstBuffer; BYTE* dstPtr = dstStart; - BYTE* headerStart; - if (dstCapacity < maxFHSize) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); - MEM_INIT(&prefNull, 0, sizeof(prefNull)); + RETURN_ERROR_IF(dstCapacity < maxFHSize, dstMaxSize_tooSmall); if (preferencesPtr == NULL) preferencesPtr = &prefNull; cctxPtr->prefs = *preferencesPtr; - /* Ctx Management */ + /* cctx Management */ { U16 const ctxTypeID = (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) ? 1 : 2; - if (cctxPtr->lz4CtxAlloc < ctxTypeID) { - FREEMEM(cctxPtr->lz4CtxPtr); + int requiredSize = ctxTypeID_to_size(ctxTypeID); + int allocatedSize = ctxTypeID_to_size(cctxPtr->lz4CtxAlloc); + if (allocatedSize < requiredSize) { + /* not enough space allocated */ + LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem); if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { - cctxPtr->lz4CtxPtr = (void*)LZ4_createStream(); + /* must take ownership of memory allocation, + * in order to respect custom allocator contract */ + cctxPtr->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_stream_t), cctxPtr->cmem); + if (cctxPtr->lz4CtxPtr) + LZ4_initStream(cctxPtr->lz4CtxPtr, sizeof(LZ4_stream_t)); } else { - cctxPtr->lz4CtxPtr = (void*)LZ4_createStreamHC(); + cctxPtr->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_streamHC_t), cctxPtr->cmem); + if (cctxPtr->lz4CtxPtr) + LZ4_initStreamHC(cctxPtr->lz4CtxPtr, sizeof(LZ4_streamHC_t)); } - if (cctxPtr->lz4CtxPtr == NULL) return err0r(LZ4F_ERROR_allocation_failed); + RETURN_ERROR_IF(cctxPtr->lz4CtxPtr == NULL, allocation_failed); cctxPtr->lz4CtxAlloc = ctxTypeID; cctxPtr->lz4CtxState = ctxTypeID; } else if (cctxPtr->lz4CtxState != ctxTypeID) { - /* otherwise, a sufficient buffer is allocated, but we need to - * reset it to the correct context type */ + /* otherwise, a sufficient buffer is already allocated, + * but we need to reset it to the correct context type */ if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { - LZ4_resetStream((LZ4_stream_t *) cctxPtr->lz4CtxPtr); + LZ4_initStream((LZ4_stream_t*)cctxPtr->lz4CtxPtr, sizeof(LZ4_stream_t)); } else { - LZ4_resetStreamHC((LZ4_streamHC_t *) cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel); + LZ4_initStreamHC((LZ4_streamHC_t*)cctxPtr->lz4CtxPtr, sizeof(LZ4_streamHC_t)); + LZ4_setCompressionLevel((LZ4_streamHC_t*)cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel); } cctxPtr->lz4CtxState = ctxTypeID; - } - } + } } /* Buffer Management */ if (cctxPtr->prefs.frameInfo.blockSizeID == 0) @@ -629,14 +726,14 @@ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr, cctxPtr->maxBlockSize = LZ4F_getBlockSize(cctxPtr->prefs.frameInfo.blockSizeID); { size_t const requiredBuffSize = preferencesPtr->autoFlush ? - (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) * 64 KB : /* only needs windows size */ - cctxPtr->maxBlockSize + ((cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) * 128 KB); + ((cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 64 KB : 0) : /* only needs past data up to window size */ + cctxPtr->maxBlockSize + ((cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 128 KB : 0); if (cctxPtr->maxBufferSize < requiredBuffSize) { cctxPtr->maxBufferSize = 0; - FREEMEM(cctxPtr->tmpBuff); - cctxPtr->tmpBuff = (BYTE*)ALLOC_AND_ZERO(requiredBuffSize); - if (cctxPtr->tmpBuff == NULL) return err0r(LZ4F_ERROR_allocation_failed); + LZ4F_free(cctxPtr->tmpBuff, cctxPtr->cmem); + cctxPtr->tmpBuff = (BYTE*)LZ4F_calloc(requiredBuffSize, cctxPtr->cmem); + RETURN_ERROR_IF(cctxPtr->tmpBuff == NULL, allocation_failed); cctxPtr->maxBufferSize = requiredBuffSize; } } cctxPtr->tmpIn = cctxPtr->tmpBuff; @@ -656,41 +753,42 @@ size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctxPtr, /* Magic Number */ LZ4F_writeLE32(dstPtr, LZ4F_MAGICNUMBER); dstPtr += 4; - headerStart = dstPtr; - - /* FLG Byte */ - *dstPtr++ = (BYTE)(((1 & _2BITS) << 6) /* Version('01') */ - + ((cctxPtr->prefs.frameInfo.blockMode & _1BIT ) << 5) - + ((cctxPtr->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4) - + ((cctxPtr->prefs.frameInfo.contentSize > 0) << 3) - + ((cctxPtr->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2) - + (cctxPtr->prefs.frameInfo.dictID > 0) ); - /* BD Byte */ - *dstPtr++ = (BYTE)((cctxPtr->prefs.frameInfo.blockSizeID & _3BITS) << 4); - /* Optional Frame content size field */ - if (cctxPtr->prefs.frameInfo.contentSize) { - LZ4F_writeLE64(dstPtr, cctxPtr->prefs.frameInfo.contentSize); - dstPtr += 8; - cctxPtr->totalInSize = 0; - } - /* Optional dictionary ID field */ - if (cctxPtr->prefs.frameInfo.dictID) { - LZ4F_writeLE32(dstPtr, cctxPtr->prefs.frameInfo.dictID); - dstPtr += 4; + { BYTE* const headerStart = dstPtr; + + /* FLG Byte */ + *dstPtr++ = (BYTE)(((1 & _2BITS) << 6) /* Version('01') */ + + ((cctxPtr->prefs.frameInfo.blockMode & _1BIT ) << 5) + + ((cctxPtr->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4) + + ((unsigned)(cctxPtr->prefs.frameInfo.contentSize > 0) << 3) + + ((cctxPtr->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2) + + (cctxPtr->prefs.frameInfo.dictID > 0) ); + /* BD Byte */ + *dstPtr++ = (BYTE)((cctxPtr->prefs.frameInfo.blockSizeID & _3BITS) << 4); + /* Optional Frame content size field */ + if (cctxPtr->prefs.frameInfo.contentSize) { + LZ4F_writeLE64(dstPtr, cctxPtr->prefs.frameInfo.contentSize); + dstPtr += 8; + cctxPtr->totalInSize = 0; + } + /* Optional dictionary ID field */ + if (cctxPtr->prefs.frameInfo.dictID) { + LZ4F_writeLE32(dstPtr, cctxPtr->prefs.frameInfo.dictID); + dstPtr += 4; + } + /* Header CRC Byte */ + *dstPtr = LZ4F_headerChecksum(headerStart, (size_t)(dstPtr - headerStart)); + dstPtr++; } - /* Header CRC Byte */ - *dstPtr = LZ4F_headerChecksum(headerStart, dstPtr - headerStart); - dstPtr++; cctxPtr->cStage = 1; /* header written, now request input data block */ - return (dstPtr - dstStart); + return (size_t)(dstPtr - dstStart); } /*! LZ4F_compressBegin() : - * init streaming compression and writes frame header into dstBuffer. - * dstBuffer must be >= LZ4F_HEADER_SIZE_MAX bytes. - * preferencesPtr can be NULL, in which case default parameters are selected. + * init streaming compression AND writes frame header into @dstBuffer. + * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. + * @preferencesPtr can be NULL, in which case default parameters are selected. * @return : number of bytes written into dstBuffer for the header * or an error code (can be tested using LZ4F_isError()) */ @@ -710,6 +808,9 @@ size_t LZ4F_compressBegin(LZ4F_cctx* cctxPtr, */ size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr) { + if (preferencesPtr && preferencesPtr->autoFlush) { + return LZ4F_compressBound_internal(srcSize, preferencesPtr, 0); + } return LZ4F_compressBound_internal(srcSize, preferencesPtr, (size_t)-1); } @@ -718,33 +819,41 @@ typedef int (*compressFunc_t)(void* ctx, const char* src, char* dst, int srcSize /*! LZ4F_makeBlock(): - * compress a single block, add header and checksum - * assumption : dst buffer capacity is >= srcSize */ -static size_t LZ4F_makeBlock(void* dst, const void* src, size_t srcSize, + * compress a single block, add header and optional checksum. + * assumption : dst buffer capacity is >= BHSize + srcSize + crcSize + */ +static size_t LZ4F_makeBlock(void* dst, + const void* src, size_t srcSize, compressFunc_t compress, void* lz4ctx, int level, - const LZ4F_CDict* cdict, LZ4F_blockChecksum_t crcFlag) + const LZ4F_CDict* cdict, + LZ4F_blockChecksum_t crcFlag) { BYTE* const cSizePtr = (BYTE*)dst; - U32 cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+4), - (int)(srcSize), (int)(srcSize-1), - level, cdict); - LZ4F_writeLE32(cSizePtr, cSize); - if (cSize == 0) { /* compression failed */ + U32 cSize; + assert(compress != NULL); + cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+BHSize), + (int)(srcSize), (int)(srcSize-1), + level, cdict); + + if (cSize == 0 || cSize >= srcSize) { cSize = (U32)srcSize; LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG); - memcpy(cSizePtr+4, src, srcSize); + memcpy(cSizePtr+BHSize, src, srcSize); + } else { + LZ4F_writeLE32(cSizePtr, cSize); } if (crcFlag) { - U32 const crc32 = XXH32(cSizePtr+4, cSize, 0); /* checksum of compressed data */ - LZ4F_writeLE32(cSizePtr+4+cSize, crc32); + U32 const crc32 = XXH32(cSizePtr+BHSize, cSize, 0); /* checksum of compressed data */ + LZ4F_writeLE32(cSizePtr+BHSize+cSize, crc32); } - return 4 + cSize + ((U32)crcFlag)*4; + return BHSize + cSize + ((U32)crcFlag)*BFSize; } static int LZ4F_compressBlock(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict) { int const acceleration = (level < 0) ? -level + 1 : 1; + DEBUGLOG(5, "LZ4F_compressBlock (srcSize=%i)", srcSize); LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent); if (cdict) { return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration); @@ -757,6 +866,7 @@ static int LZ4F_compressBlock_continue(void* ctx, const char* src, char* dst, in { int const acceleration = (level < 0) ? -level + 1 : 1; (void)cdict; /* init once at beginning of frame */ + DEBUGLOG(5, "LZ4F_compressBlock_continue (srcSize=%i)", srcSize); return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration); } @@ -775,8 +885,15 @@ static int LZ4F_compressBlockHC_continue(void* ctx, const char* src, char* dst, return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity); } -static compressFunc_t LZ4F_selectCompression(LZ4F_blockMode_t blockMode, int level) +static int LZ4F_doNotCompressBlock(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict) +{ + (void)ctx; (void)src; (void)dst; (void)srcSize; (void)dstCapacity; (void)level; (void)cdict; + return 0; +} + +static compressFunc_t LZ4F_selectCompression(LZ4F_blockMode_t blockMode, int level, LZ4F_blockCompression_t compressMode) { + if (compressMode == LZ4B_UNCOMPRESSED) return LZ4F_doNotCompressBlock; if (level < LZ4HC_CLEVEL_MIN) { if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlock; return LZ4F_compressBlock_continue; @@ -785,6 +902,7 @@ static compressFunc_t LZ4F_selectCompression(LZ4F_blockMode_t blockMode, int lev return LZ4F_compressBlockHC_continue; } +/* Save history (up to 64KB) into @tmpBuff */ static int LZ4F_localSaveDict(LZ4F_cctx_t* cctxPtr) { if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) @@ -794,38 +912,57 @@ static int LZ4F_localSaveDict(LZ4F_cctx_t* cctxPtr) typedef enum { notDone, fromTmpBuffer, fromSrcBuffer } LZ4F_lastBlockStatus; -/*! LZ4F_compressUpdate() : +static const LZ4F_compressOptions_t k_cOptionsNull = { 0, { 0, 0, 0 } }; + + + /*! LZ4F_compressUpdateImpl() : * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. - * dstBuffer MUST be >= LZ4F_compressBound(srcSize, preferencesPtr). - * LZ4F_compressOptions_t structure is optional : you can provide NULL as argument. + * When successful, the function always entirely consumes @srcBuffer. + * src data is either buffered or compressed into @dstBuffer. + * If the block compression does not match the compression of the previous block, the old data is flushed + * and operations continue with the new compression mode. + * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr) when block compression is turned on. + * @compressOptionsPtr is optional : provide NULL to mean "default". * @return : the number of bytes written into dstBuffer. It can be zero, meaning input data was just buffered. * or an error code if it fails (which can be tested using LZ4F_isError()) + * After an error, the state is left in a UB state, and must be re-initialized. */ -size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, - void* dstBuffer, size_t dstCapacity, +static size_t LZ4F_compressUpdateImpl(LZ4F_cctx* cctxPtr, + void* dstBuffer, size_t dstCapacity, const void* srcBuffer, size_t srcSize, - const LZ4F_compressOptions_t* compressOptionsPtr) -{ - LZ4F_compressOptions_t cOptionsNull; + const LZ4F_compressOptions_t* compressOptionsPtr, + LZ4F_blockCompression_t blockCompression) + { size_t const blockSize = cctxPtr->maxBlockSize; const BYTE* srcPtr = (const BYTE*)srcBuffer; const BYTE* const srcEnd = srcPtr + srcSize; BYTE* const dstStart = (BYTE*)dstBuffer; BYTE* dstPtr = dstStart; LZ4F_lastBlockStatus lastBlockCompressed = notDone; - compressFunc_t const compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel); - + compressFunc_t const compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, blockCompression); + size_t bytesWritten; DEBUGLOG(4, "LZ4F_compressUpdate (srcSize=%zu)", srcSize); - if (cctxPtr->cStage != 1) return err0r(LZ4F_ERROR_GENERIC); + RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized); /* state must be initialized and waiting for next block */ if (dstCapacity < LZ4F_compressBound_internal(srcSize, &(cctxPtr->prefs), cctxPtr->tmpInSize)) - return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); - MEM_INIT(&cOptionsNull, 0, sizeof(cOptionsNull)); - if (compressOptionsPtr == NULL) compressOptionsPtr = &cOptionsNull; + RETURN_ERROR(dstMaxSize_tooSmall); + + if (blockCompression == LZ4B_UNCOMPRESSED && dstCapacity < srcSize) + RETURN_ERROR(dstMaxSize_tooSmall); + + /* flush currently written block, to continue with new block compression */ + if (cctxPtr->blockCompression != blockCompression) { + bytesWritten = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr); + dstPtr += bytesWritten; + cctxPtr->blockCompression = blockCompression; + } + + if (compressOptionsPtr == NULL) compressOptionsPtr = &k_cOptionsNull; /* complete tmp buffer */ if (cctxPtr->tmpInSize > 0) { /* some data already within tmp buffer */ size_t const sizeToCopy = blockSize - cctxPtr->tmpInSize; + assert(blockSize > cctxPtr->tmpInSize); if (sizeToCopy > srcSize) { /* add src to tmpIn buffer */ memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, srcSize); @@ -838,56 +975,65 @@ size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, sizeToCopy); srcPtr += sizeToCopy; - dstPtr += LZ4F_makeBlock(dstPtr, cctxPtr->tmpIn, blockSize, + dstPtr += LZ4F_makeBlock(dstPtr, + cctxPtr->tmpIn, blockSize, compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel, - cctxPtr->cdict, cctxPtr->prefs.frameInfo.blockChecksumFlag); - + cctxPtr->cdict, + cctxPtr->prefs.frameInfo.blockChecksumFlag); if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += blockSize; cctxPtr->tmpInSize = 0; - } - } + } } while ((size_t)(srcEnd - srcPtr) >= blockSize) { /* compress full blocks */ lastBlockCompressed = fromSrcBuffer; - dstPtr += LZ4F_makeBlock(dstPtr, srcPtr, blockSize, + dstPtr += LZ4F_makeBlock(dstPtr, + srcPtr, blockSize, compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel, - cctxPtr->cdict, cctxPtr->prefs.frameInfo.blockChecksumFlag); + cctxPtr->cdict, + cctxPtr->prefs.frameInfo.blockChecksumFlag); srcPtr += blockSize; } if ((cctxPtr->prefs.autoFlush) && (srcPtr < srcEnd)) { - /* compress remaining input < blockSize */ + /* autoFlush : remaining input (< blockSize) is compressed */ lastBlockCompressed = fromSrcBuffer; - dstPtr += LZ4F_makeBlock(dstPtr, srcPtr, srcEnd - srcPtr, + dstPtr += LZ4F_makeBlock(dstPtr, + srcPtr, (size_t)(srcEnd - srcPtr), compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel, - cctxPtr->cdict, cctxPtr->prefs.frameInfo.blockChecksumFlag); - srcPtr = srcEnd; + cctxPtr->cdict, + cctxPtr->prefs.frameInfo.blockChecksumFlag); + srcPtr = srcEnd; } - /* preserve dictionary if necessary */ + /* preserve dictionary within @tmpBuff whenever necessary */ if ((cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) && (lastBlockCompressed==fromSrcBuffer)) { + /* linked blocks are only supported in compressed mode, see LZ4F_uncompressedUpdate */ + assert(blockCompression == LZ4B_COMPRESSED); if (compressOptionsPtr->stableSrc) { - cctxPtr->tmpIn = cctxPtr->tmpBuff; + cctxPtr->tmpIn = cctxPtr->tmpBuff; /* src is stable : dictionary remains in src across invocations */ } else { int const realDictSize = LZ4F_localSaveDict(cctxPtr); - if (realDictSize==0) return err0r(LZ4F_ERROR_GENERIC); + assert(0 <= realDictSize && realDictSize <= 64 KB); cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize; } } /* keep tmpIn within limits */ - if ((cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) /* necessarily LZ4F_blockLinked && lastBlockCompressed==fromTmpBuffer */ - && !(cctxPtr->prefs.autoFlush)) + if (!(cctxPtr->prefs.autoFlush) /* no autoflush : there may be some data left within internal buffer */ + && (cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) ) /* not enough room to store next block */ { + /* only preserve 64KB within internal buffer. Ensures there is enough room for next block. + * note: this situation necessarily implies lastBlockCompressed==fromTmpBuffer */ int const realDictSize = LZ4F_localSaveDict(cctxPtr); cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize; + assert((cctxPtr->tmpIn + blockSize) <= (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)); } /* some input data left, necessarily < blockSize */ if (srcPtr < srcEnd) { /* fill tmp buffer */ - size_t const sizeToCopy = srcEnd - srcPtr; + size_t const sizeToCopy = (size_t)(srcEnd - srcPtr); memcpy(cctxPtr->tmpIn, srcPtr, sizeToCopy); cctxPtr->tmpInSize = sizeToCopy; } @@ -896,46 +1042,100 @@ size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, (void)XXH32_update(&(cctxPtr->xxh), srcBuffer, srcSize); cctxPtr->totalInSize += srcSize; - return dstPtr - dstStart; + return (size_t)(dstPtr - dstStart); +} + +/*! LZ4F_compressUpdate() : + * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. + * When successful, the function always entirely consumes @srcBuffer. + * src data is either buffered or compressed into @dstBuffer. + * If previously an uncompressed block was written, buffered data is flushed + * before appending compressed data is continued. + * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr). + * @compressOptionsPtr is optional : provide NULL to mean "default". + * @return : the number of bytes written into dstBuffer. It can be zero, meaning input data was just buffered. + * or an error code if it fails (which can be tested using LZ4F_isError()) + * After an error, the state is left in a UB state, and must be re-initialized. + */ +size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* compressOptionsPtr) +{ + return LZ4F_compressUpdateImpl(cctxPtr, + dstBuffer, dstCapacity, + srcBuffer, srcSize, + compressOptionsPtr, LZ4B_COMPRESSED); +} + +/*! LZ4F_compressUpdate() : + * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. + * When successful, the function always entirely consumes @srcBuffer. + * src data is either buffered or compressed into @dstBuffer. + * If previously an uncompressed block was written, buffered data is flushed + * before appending compressed data is continued. + * This is only supported when LZ4F_blockIndependent is used + * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr). + * @compressOptionsPtr is optional : provide NULL to mean "default". + * @return : the number of bytes written into dstBuffer. It can be zero, meaning input data was just buffered. + * or an error code if it fails (which can be tested using LZ4F_isError()) + * After an error, the state is left in a UB state, and must be re-initialized. + */ +size_t LZ4F_uncompressedUpdate(LZ4F_cctx* cctxPtr, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* compressOptionsPtr) { + RETURN_ERROR_IF(cctxPtr->prefs.frameInfo.blockMode != LZ4F_blockIndependent, blockMode_invalid); + return LZ4F_compressUpdateImpl(cctxPtr, + dstBuffer, dstCapacity, + srcBuffer, srcSize, + compressOptionsPtr, LZ4B_UNCOMPRESSED); } /*! LZ4F_flush() : - * Should you need to create compressed data immediately, without waiting for a block to be filled, - * you can call LZ4_flush(), which will immediately compress any remaining data stored within compressionContext. - * The result of the function is the number of bytes written into dstBuffer - * (it can be zero, this means there was no data left within compressionContext) + * When compressed data must be sent immediately, without waiting for a block to be filled, + * invoke LZ4_flush(), which will immediately compress any remaining data stored within LZ4F_cctx. + * The result of the function is the number of bytes written into dstBuffer. + * It can be zero, this means there was no data left within LZ4F_cctx. * The function outputs an error code if it fails (can be tested using LZ4F_isError()) - * The LZ4F_compressOptions_t structure is optional : you can provide NULL as argument. + * LZ4F_compressOptions_t* is optional. NULL is a valid argument. */ -size_t LZ4F_flush(LZ4F_cctx* cctxPtr, void* dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t* compressOptionsPtr) +size_t LZ4F_flush(LZ4F_cctx* cctxPtr, + void* dstBuffer, size_t dstCapacity, + const LZ4F_compressOptions_t* compressOptionsPtr) { BYTE* const dstStart = (BYTE*)dstBuffer; BYTE* dstPtr = dstStart; compressFunc_t compress; if (cctxPtr->tmpInSize == 0) return 0; /* nothing to flush */ - if (cctxPtr->cStage != 1) return err0r(LZ4F_ERROR_GENERIC); - if (dstCapacity < (cctxPtr->tmpInSize + 4)) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); /* +4 : block header(4) */ - (void)compressOptionsPtr; /* not yet useful */ + RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized); + RETURN_ERROR_IF(dstCapacity < (cctxPtr->tmpInSize + BHSize + BFSize), dstMaxSize_tooSmall); + (void)compressOptionsPtr; /* not useful (yet) */ /* select compression function */ - compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel); + compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, cctxPtr->blockCompression); /* compress tmp buffer */ - dstPtr += LZ4F_makeBlock(dstPtr, cctxPtr->tmpIn, cctxPtr->tmpInSize, + dstPtr += LZ4F_makeBlock(dstPtr, + cctxPtr->tmpIn, cctxPtr->tmpInSize, compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel, - cctxPtr->cdict, cctxPtr->prefs.frameInfo.blockChecksumFlag); - if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += cctxPtr->tmpInSize; + cctxPtr->cdict, + cctxPtr->prefs.frameInfo.blockChecksumFlag); + assert(((void)"flush overflows dstBuffer!", (size_t)(dstPtr - dstStart) <= dstCapacity)); + + if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) + cctxPtr->tmpIn += cctxPtr->tmpInSize; cctxPtr->tmpInSize = 0; /* keep tmpIn within limits */ if ((cctxPtr->tmpIn + cctxPtr->maxBlockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)) { /* necessarily LZ4F_blockLinked */ - int realDictSize = LZ4F_localSaveDict(cctxPtr); + int const realDictSize = LZ4F_localSaveDict(cctxPtr); cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize; } - return dstPtr - dstStart; + return (size_t)(dstPtr - dstStart); } @@ -956,19 +1156,21 @@ size_t LZ4F_compressEnd(LZ4F_cctx* cctxPtr, BYTE* dstPtr = dstStart; size_t const flushSize = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr); - if (LZ4F_isError(flushSize)) return flushSize; + DEBUGLOG(5,"LZ4F_compressEnd: dstCapacity=%u", (unsigned)dstCapacity); + FORWARD_IF_ERROR(flushSize); dstPtr += flushSize; assert(flushSize <= dstCapacity); dstCapacity -= flushSize; - if (dstCapacity < 4) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); + RETURN_ERROR_IF(dstCapacity < 4, dstMaxSize_tooSmall); LZ4F_writeLE32(dstPtr, 0); dstPtr += 4; /* endMark */ if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) { U32 const xxh = XXH32_digest(&(cctxPtr->xxh)); - if (dstCapacity < 8) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); + RETURN_ERROR_IF(dstCapacity < 8, dstMaxSize_tooSmall); + DEBUGLOG(5,"Writing 32-bit content checksum"); LZ4F_writeLE32(dstPtr, xxh); dstPtr+=4; /* content Checksum */ } @@ -978,10 +1180,10 @@ size_t LZ4F_compressEnd(LZ4F_cctx* cctxPtr, if (cctxPtr->prefs.frameInfo.contentSize) { if (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize) - return err0r(LZ4F_ERROR_frameSize_wrong); + RETURN_ERROR(frameSize_wrong); } - return dstPtr - dstStart; + return (size_t)(dstPtr - dstStart); } @@ -1002,6 +1204,7 @@ typedef enum { } dStage_t; struct LZ4F_dctx_s { + LZ4F_CustomMem cmem; LZ4F_frameInfo_t frameInfo; U32 version; dStage_t dStage; @@ -1019,23 +1222,37 @@ struct LZ4F_dctx_s { size_t tmpOutStart; XXH32_state_t xxh; XXH32_state_t blockChecksum; + int skipChecksum; BYTE header[LZ4F_HEADER_SIZE_MAX]; }; /* typedef'd to LZ4F_dctx in lz4frame.h */ +LZ4F_dctx* LZ4F_createDecompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version) +{ + LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem); + if (dctx == NULL) return NULL; + + dctx->cmem = customMem; + dctx->version = version; + return dctx; +} + /*! LZ4F_createDecompressionContext() : * Create a decompressionContext object, which will track all decompression operations. * Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. * Object can later be released using LZ4F_freeDecompressionContext(). * @return : if != 0, there was an error during context creation. */ -LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** LZ4F_decompressionContextPtr, unsigned versionNumber) +LZ4F_errorCode_t +LZ4F_createDecompressionContext(LZ4F_dctx** LZ4F_decompressionContextPtr, unsigned versionNumber) { - LZ4F_dctx* const dctx = (LZ4F_dctx*)ALLOC_AND_ZERO(sizeof(LZ4F_dctx)); - if (dctx==NULL) return err0r(LZ4F_ERROR_GENERIC); + assert(LZ4F_decompressionContextPtr != NULL); /* violation of narrow contract */ + RETURN_ERROR_IF(LZ4F_decompressionContextPtr == NULL, parameter_null); /* in case it nonetheless happen in production */ - dctx->version = versionNumber; - *LZ4F_decompressionContextPtr = dctx; + *LZ4F_decompressionContextPtr = LZ4F_createDecompressionContext_advanced(LZ4F_defaultCMem, versionNumber); + if (*LZ4F_decompressionContextPtr == NULL) { /* failed allocation */ + RETURN_ERROR(allocation_failed); + } return LZ4F_OK_NoError; } @@ -1044,9 +1261,9 @@ LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx) LZ4F_errorCode_t result = LZ4F_OK_NoError; if (dctx != NULL) { /* can accept NULL input, like free() */ result = (LZ4F_errorCode_t)dctx->dStage; - FREEMEM(dctx->tmpIn); - FREEMEM(dctx->tmpOutBuffer); - FREEMEM(dctx); + LZ4F_free(dctx->tmpIn, dctx->cmem); + LZ4F_free(dctx->tmpOutBuffer, dctx->cmem); + LZ4F_free(dctx, dctx->cmem); } return result; } @@ -1059,31 +1276,7 @@ void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx) dctx->dStage = dstage_getFrameHeader; dctx->dict = NULL; dctx->dictSize = 0; -} - - -/*! LZ4F_headerSize() : - * @return : size of frame header - * or an error code, which can be tested using LZ4F_isError() - */ -static size_t LZ4F_headerSize(const void* src, size_t srcSize) -{ - /* minimal srcSize to determine header size */ - if (srcSize < 5) return err0r(LZ4F_ERROR_frameHeader_incomplete); - - /* special case : skippable frames */ - if ((LZ4F_readLE32(src) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) return 8; - - /* control magic number */ - if (LZ4F_readLE32(src) != LZ4F_MAGICNUMBER) - return err0r(LZ4F_ERROR_frameType_unknown); - - /* Frame Header Size */ - { BYTE const FLG = ((const BYTE*)src)[4]; - U32 const contentSizeFlag = (FLG>>3) & _1BIT; - U32 const dictIDFlag = FLG & _1BIT; - return minFHSize + (contentSizeFlag*8) + (dictIDFlag*4); - } + dctx->skipChecksum = 0; } @@ -1101,8 +1294,9 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize size_t frameHeaderSize; const BYTE* srcPtr = (const BYTE*)src; + DEBUGLOG(5, "LZ4F_decodeHeader"); /* need to decode header to get frameInfo */ - if (srcSize < minFHSize) return err0r(LZ4F_ERROR_frameHeader_incomplete); /* minimal frame header size */ + RETURN_ERROR_IF(srcSize < minFHSize, frameHeader_incomplete); /* minimal frame header size */ MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo)); /* special case : skippable frames */ @@ -1116,12 +1310,15 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize } else { dctx->dStage = dstage_getSFrameSize; return 4; - } - } + } } /* control magic number */ - if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) - return err0r(LZ4F_ERROR_frameType_unknown); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) { + DEBUGLOG(4, "frame header error : unknown magic number"); + RETURN_ERROR(frameType_unknown); + } +#endif dctx->frameInfo.frameType = LZ4F_frame; /* Flags */ @@ -1133,12 +1330,12 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize contentChecksumFlag = (FLG>>2) & _1BIT; dictIDFlag = FLG & _1BIT; /* validate */ - if (((FLG>>1)&_1BIT) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bit */ - if (version != 1) return err0r(LZ4F_ERROR_headerVersion_wrong); /* Version Number, only supported value */ + if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */ + if (version != 1) RETURN_ERROR(headerVersion_wrong); /* Version Number, only supported value */ } /* Frame Header Size */ - frameHeaderSize = minFHSize + (contentSizeFlag*8) + (dictIDFlag*4); + frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0); if (srcSize < frameHeaderSize) { /* not enough input to fully decode frame header */ @@ -1153,26 +1350,27 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize { U32 const BD = srcPtr[5]; blockSizeID = (BD>>4) & _3BITS; /* validate */ - if (((BD>>7)&_1BIT) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bit */ - if (blockSizeID < 4) return err0r(LZ4F_ERROR_maxBlockSize_invalid); /* 4-7 only supported values for the time being */ - if (((BD>>0)&_4BITS) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bits */ + if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */ + if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid); /* 4-7 only supported values for the time being */ + if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bits */ } /* check header */ + assert(frameHeaderSize > 5); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION { BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5); - if (HC != srcPtr[frameHeaderSize-1]) - return err0r(LZ4F_ERROR_headerChecksum_invalid); + RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid); } +#endif /* save */ dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode; dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag; dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag; dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID; - dctx->maxBlockSize = LZ4F_getBlockSize(blockSizeID); + dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID); if (contentSizeFlag) - dctx->frameRemainingSize = - dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6); + dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6); if (dictIDFlag) dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5); @@ -1182,6 +1380,36 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize } +/*! LZ4F_headerSize() : + * @return : size of frame header + * or an error code, which can be tested using LZ4F_isError() + */ +size_t LZ4F_headerSize(const void* src, size_t srcSize) +{ + RETURN_ERROR_IF(src == NULL, srcPtr_wrong); + + /* minimal srcSize to determine header size */ + if (srcSize < LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH) + RETURN_ERROR(frameHeader_incomplete); + + /* special case : skippable frames */ + if ((LZ4F_readLE32(src) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) + return 8; + + /* control magic number */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + if (LZ4F_readLE32(src) != LZ4F_MAGICNUMBER) + RETURN_ERROR(frameType_unknown); +#endif + + /* Frame Header Size */ + { BYTE const FLG = ((const BYTE*)src)[4]; + U32 const contentSizeFlag = (FLG>>3) & _1BIT; + U32 const dictIDFlag = FLG & _1BIT; + return minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0); + } +} + /*! LZ4F_getFrameInfo() : * This function extracts frame parameters (max blockSize, frame checksum, etc.). * Usage is optional. Objective is to provide relevant information for allocation purposes. @@ -1197,10 +1425,12 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize * note 1 : in case of error, dctx is not modified. Decoding operations can resume from where they stopped. * note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure. */ -LZ4F_errorCode_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, LZ4F_frameInfo_t* frameInfoPtr, - const void* srcBuffer, size_t* srcSizePtr) +LZ4F_errorCode_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, + LZ4F_frameInfo_t* frameInfoPtr, + const void* srcBuffer, size_t* srcSizePtr) { - if (dctx->dStage > dstage_storeFrameHeader) { /* assumption : dstage_* header enum at beginning of range */ + LZ4F_STATIC_ASSERT(dstage_getFrameHeader < dstage_storeFrameHeader); + if (dctx->dStage > dstage_storeFrameHeader) { /* frameInfo already decoded */ size_t o=0, i=0; *srcSizePtr = 0; @@ -1211,54 +1441,58 @@ LZ4F_errorCode_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, LZ4F_frameInfo_t* frameInfoP if (dctx->dStage == dstage_storeFrameHeader) { /* frame decoding already started, in the middle of header => automatic fail */ *srcSizePtr = 0; - return err0r(LZ4F_ERROR_frameDecoding_alreadyStarted); + RETURN_ERROR(frameDecoding_alreadyStarted); } else { - size_t decodeResult; size_t const hSize = LZ4F_headerSize(srcBuffer, *srcSizePtr); if (LZ4F_isError(hSize)) { *srcSizePtr=0; return hSize; } if (*srcSizePtr < hSize) { *srcSizePtr=0; - return err0r(LZ4F_ERROR_frameHeader_incomplete); + RETURN_ERROR(frameHeader_incomplete); } - decodeResult = LZ4F_decodeHeader(dctx, srcBuffer, hSize); - if (LZ4F_isError(decodeResult)) { - *srcSizePtr = 0; - } else { - *srcSizePtr = decodeResult; - decodeResult = BHSize; /* block header size */ - } - *frameInfoPtr = dctx->frameInfo; - return decodeResult; - } } + { size_t decodeResult = LZ4F_decodeHeader(dctx, srcBuffer, hSize); + if (LZ4F_isError(decodeResult)) { + *srcSizePtr = 0; + } else { + *srcSizePtr = decodeResult; + decodeResult = BHSize; /* block header size */ + } + *frameInfoPtr = dctx->frameInfo; + return decodeResult; + } } } } /* LZ4F_updateDict() : - * only used for LZ4F_blockLinked mode */ + * only used for LZ4F_blockLinked mode + * Condition : @dstPtr != NULL + */ static void LZ4F_updateDict(LZ4F_dctx* dctx, const BYTE* dstPtr, size_t dstSize, const BYTE* dstBufferStart, unsigned withinTmp) { - if (dctx->dictSize==0) - dctx->dict = (const BYTE*)dstPtr; /* priority to dictionary continuity */ + assert(dstPtr != NULL); + if (dctx->dictSize==0) dctx->dict = (const BYTE*)dstPtr; /* will lead to prefix mode */ + assert(dctx->dict != NULL); - if (dctx->dict + dctx->dictSize == dstPtr) { /* dictionary continuity, directly within dstBuffer */ + if (dctx->dict + dctx->dictSize == dstPtr) { /* prefix mode, everything within dstBuffer */ dctx->dictSize += dstSize; return; } - if (dstPtr - dstBufferStart + dstSize >= 64 KB) { /* history in dstBuffer becomes large enough to become dictionary */ + assert(dstPtr >= dstBufferStart); + if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) { /* history in dstBuffer becomes large enough to become dictionary */ dctx->dict = (const BYTE*)dstBufferStart; - dctx->dictSize = dstPtr - dstBufferStart + dstSize; + dctx->dictSize = (size_t)(dstPtr - dstBufferStart) + dstSize; return; } assert(dstSize < 64 KB); /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */ - /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOut */ + /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */ + assert(dctx->tmpOutBuffer != NULL); - if ((withinTmp) && (dctx->dict == dctx->tmpOutBuffer)) { /* continue history within tmpOutBuffer */ + if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) { /* continue history within tmpOutBuffer */ /* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */ assert(dctx->dict + dctx->dictSize == dctx->tmpOut + dctx->tmpOutStart); dctx->dictSize += dstSize; @@ -1266,7 +1500,7 @@ static void LZ4F_updateDict(LZ4F_dctx* dctx, } if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */ - size_t const preserveSize = dctx->tmpOut - dctx->tmpOutBuffer; + size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer); size_t copySize = 64 KB - dctx->tmpOutSize; const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart; if (dctx->tmpOutSize > 64 KB) copySize = 0; @@ -1301,7 +1535,6 @@ static void LZ4F_updateDict(LZ4F_dctx* dctx, } - /*! LZ4F_decompress() : * Call this function repetitively to regenerate compressed data in srcBuffer. * The function will attempt to decode up to *srcSizePtr bytes from srcBuffer @@ -1330,17 +1563,22 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, const BYTE* const srcEnd = srcStart + *srcSizePtr; const BYTE* srcPtr = srcStart; BYTE* const dstStart = (BYTE*)dstBuffer; - BYTE* const dstEnd = dstStart + *dstSizePtr; + BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL; BYTE* dstPtr = dstStart; const BYTE* selectedIn = NULL; unsigned doAnotherStage = 1; size_t nextSrcSizeHint = 1; + DEBUGLOG(5, "LZ4F_decompress : %p,%u => %p,%u", + srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr); + if (dstBuffer == NULL) assert(*dstSizePtr == 0); MEM_INIT(&optionsNull, 0, sizeof(optionsNull)); if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull; *srcSizePtr = 0; *dstSizePtr = 0; + assert(dctx != NULL); + dctx->skipChecksum |= (decompressOptionsPtr->skipChecksums != 0); /* once set, disable for the remainder of the frame */ /* behaves as a state machine */ @@ -1350,9 +1588,10 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, { case dstage_getFrameHeader: + DEBUGLOG(6, "dstage_getFrameHeader"); if ((size_t)(srcEnd-srcPtr) >= maxFHSize) { /* enough to decode - shortcut */ - size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, srcEnd-srcPtr); /* will update dStage appropriately */ - if (LZ4F_isError(hSize)) return hSize; + size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr)); /* will update dStage appropriately */ + FORWARD_IF_ERROR(hSize); srcPtr += hSize; break; } @@ -1363,6 +1602,7 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, /* fall-through */ case dstage_storeFrameHeader: + DEBUGLOG(6, "dstage_storeFrameHeader"); { size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr)); memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy); dctx->tmpInSize += sizeToCopy; @@ -1373,26 +1613,23 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, doAnotherStage = 0; /* not enough src data, ask for some more */ break; } - { size_t const hSize = LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget); /* will update dStage appropriately */ - if (LZ4F_isError(hSize)) return hSize; - } + FORWARD_IF_ERROR( LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget) ); /* will update dStage appropriately */ break; case dstage_init: + DEBUGLOG(6, "dstage_init"); if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0); /* internal buffers allocation */ { size_t const bufferNeeded = dctx->maxBlockSize - + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) * 128 KB); + + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) ? 128 KB : 0); if (bufferNeeded > dctx->maxBufferSize) { /* tmp buffers too small */ dctx->maxBufferSize = 0; /* ensure allocation will be re-attempted on next entry*/ - FREEMEM(dctx->tmpIn); - dctx->tmpIn = (BYTE*)ALLOC(dctx->maxBlockSize + 4 /* block checksum */); - if (dctx->tmpIn == NULL) - return err0r(LZ4F_ERROR_allocation_failed); - FREEMEM(dctx->tmpOutBuffer); - dctx->tmpOutBuffer= (BYTE*)ALLOC(bufferNeeded); - if (dctx->tmpOutBuffer== NULL) - return err0r(LZ4F_ERROR_allocation_failed); + LZ4F_free(dctx->tmpIn, dctx->cmem); + dctx->tmpIn = (BYTE*)LZ4F_malloc(dctx->maxBlockSize + BFSize /* block checksum */, dctx->cmem); + RETURN_ERROR_IF(dctx->tmpIn == NULL, allocation_failed); + LZ4F_free(dctx->tmpOutBuffer, dctx->cmem); + dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(bufferNeeded, dctx->cmem); + RETURN_ERROR_IF(dctx->tmpOutBuffer== NULL, allocation_failed); dctx->maxBufferSize = bufferNeeded; } } dctx->tmpInSize = 0; @@ -1432,17 +1669,21 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } /* if (dctx->dStage == dstage_storeBlockHeader) */ /* decode block header */ - { size_t const nextCBlockSize = LZ4F_readLE32(selectedIn) & 0x7FFFFFFFU; - size_t const crcSize = dctx->frameInfo.blockChecksumFlag * 4; - if (nextCBlockSize==0) { /* frameEnd signal, no more block */ + { U32 const blockHeader = LZ4F_readLE32(selectedIn); + size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU; + size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize; + if (blockHeader==0) { /* frameEnd signal, no more block */ + DEBUGLOG(5, "end of frame"); dctx->dStage = dstage_getSuffix; break; } - if (nextCBlockSize > dctx->maxBlockSize) - return err0r(LZ4F_ERROR_maxBlockSize_invalid); - if (LZ4F_readLE32(selectedIn) & LZ4F_BLOCKUNCOMPRESSED_FLAG) { + if (nextCBlockSize > dctx->maxBlockSize) { + RETURN_ERROR(maxBlockSize_invalid); + } + if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) { /* next block is uncompressed */ dctx->tmpInTarget = nextCBlockSize; + DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize); if (dctx->frameInfo.blockChecksumFlag) { (void)XXH32_reset(&dctx->blockChecksum, 0); } @@ -1452,28 +1693,36 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, /* next block is a compressed block */ dctx->tmpInTarget = nextCBlockSize + crcSize; dctx->dStage = dstage_getCBlock; - if (dstPtr==dstEnd) { - nextSrcSizeHint = nextCBlockSize + crcSize + BHSize; + if (dstPtr==dstEnd || srcPtr==srcEnd) { + nextSrcSizeHint = BHSize + nextCBlockSize + crcSize; doAnotherStage = 0; } break; } case dstage_copyDirect: /* uncompressed block */ - { size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr)); - size_t const sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize); - memcpy(dstPtr, srcPtr, sizeToCopy); - if (dctx->frameInfo.blockChecksumFlag) { - (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy); - } - if (dctx->frameInfo.contentChecksumFlag) - (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy); - if (dctx->frameInfo.contentSize) - dctx->frameRemainingSize -= sizeToCopy; + DEBUGLOG(6, "dstage_copyDirect"); + { size_t sizeToCopy; + if (dstPtr == NULL) { + sizeToCopy = 0; + } else { + size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr)); + sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize); + memcpy(dstPtr, srcPtr, sizeToCopy); + if (!dctx->skipChecksum) { + if (dctx->frameInfo.blockChecksumFlag) { + (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy); + } + if (dctx->frameInfo.contentChecksumFlag) + (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy); + } + if (dctx->frameInfo.contentSize) + dctx->frameRemainingSize -= sizeToCopy; - /* history management (linked blocks only)*/ - if (dctx->frameInfo.blockMode == LZ4F_blockLinked) - LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0); + /* history management (linked blocks only)*/ + if (dctx->frameInfo.blockMode == LZ4F_blockLinked) { + LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0); + } } srcPtr += sizeToCopy; dstPtr += sizeToCopy; @@ -1486,15 +1735,16 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, break; } dctx->tmpInTarget -= sizeToCopy; /* need to copy more */ - nextSrcSizeHint = dctx->tmpInTarget + - + dctx->frameInfo.blockChecksumFlag * 4 /* size for block checksum */ - + BHSize /* next header size */; - doAnotherStage = 0; - break; } + nextSrcSizeHint = dctx->tmpInTarget + + +(dctx->frameInfo.blockChecksumFlag ? BFSize : 0) + + BHSize /* next header size */; + doAnotherStage = 0; + break; /* check block checksum for recently transferred uncompressed block */ case dstage_getBlockChecksum: + DEBUGLOG(6, "dstage_getBlockChecksum"); { const void* crcSrc; if ((srcEnd-srcPtr >= 4) && (dctx->tmpInSize==0)) { crcSrc = srcPtr; @@ -1511,15 +1761,26 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } crcSrc = dctx->header; } - { U32 const readCRC = LZ4F_readLE32(crcSrc); + if (!dctx->skipChecksum) { + U32 const readCRC = LZ4F_readLE32(crcSrc); U32 const calcCRC = XXH32_digest(&dctx->blockChecksum); - if (readCRC != calcCRC) - return err0r(LZ4F_ERROR_blockChecksum_invalid); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + DEBUGLOG(6, "compare block checksum"); + if (readCRC != calcCRC) { + DEBUGLOG(4, "incorrect block checksum: %08X != %08X", + readCRC, calcCRC); + RETURN_ERROR(blockChecksum_invalid); + } +#else + (void)readCRC; + (void)calcCRC; +#endif } } dctx->dStage = dstage_getBlockHeader; /* new block */ break; case dstage_getCBlock: + DEBUGLOG(6, "dstage_getCBlock"); if ((size_t)(srcEnd-srcPtr) < dctx->tmpInTarget) { dctx->tmpInSize = 0; dctx->dStage = dstage_storeCBlock; @@ -1529,7 +1790,7 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, selectedIn = srcPtr; srcPtr += dctx->tmpInTarget; - if (0) /* jump over next block */ + if (0) /* always jump over next block */ case dstage_storeCBlock: { size_t const wantedData = dctx->tmpInTarget - dctx->tmpInSize; size_t const inputLeft = (size_t)(srcEnd-srcPtr); @@ -1539,7 +1800,7 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, srcPtr += sizeToCopy; if (dctx->tmpInSize < dctx->tmpInTarget) { /* need more input */ nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) - + dctx->frameInfo.blockChecksumFlag * 4 /* size for block checksum */ + + (dctx->frameInfo.blockChecksumFlag ? BFSize : 0) + BHSize /* next header size */; doAnotherStage = 0; break; @@ -1548,59 +1809,75 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } /* At this stage, input is large enough to decode a block */ + + /* First, decode and control block checksum if it exists */ if (dctx->frameInfo.blockChecksumFlag) { + assert(dctx->tmpInTarget >= 4); dctx->tmpInTarget -= 4; assert(selectedIn != NULL); /* selectedIn is defined at this stage (either srcPtr, or dctx->tmpIn) */ { U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget); U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0); - if (readBlockCrc != calcBlockCrc) - return err0r(LZ4F_ERROR_blockChecksum_invalid); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + RETURN_ERROR_IF(readBlockCrc != calcBlockCrc, blockChecksum_invalid); +#else + (void)readBlockCrc; + (void)calcBlockCrc; +#endif } } - if ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize) { + /* decode directly into destination buffer if there is enough room */ + if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize) + /* unless the dictionary is stored in tmpOut: + * in which case it's faster to decode within tmpOut + * to benefit from prefix speedup */ + && !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) ) + { const char* dict = (const char*)dctx->dict; size_t dictSize = dctx->dictSize; int decodedSize; + assert(dstPtr != NULL); if (dict && dictSize > 1 GB) { - /* the dictSize param is an int, avoid truncation / sign issues */ + /* overflow control : dctx->dictSize is an int, avoid truncation / sign issues */ dict += dictSize - 64 KB; dictSize = 64 KB; } - /* enough capacity in `dst` to decompress directly there */ decodedSize = LZ4_decompress_safe_usingDict( (const char*)selectedIn, (char*)dstPtr, (int)dctx->tmpInTarget, (int)dctx->maxBlockSize, dict, (int)dictSize); - if (decodedSize < 0) return err0r(LZ4F_ERROR_GENERIC); /* decompression failed */ - if (dctx->frameInfo.contentChecksumFlag) - XXH32_update(&(dctx->xxh), dstPtr, decodedSize); + RETURN_ERROR_IF(decodedSize < 0, decompressionFailed); + if ((dctx->frameInfo.contentChecksumFlag) && (!dctx->skipChecksum)) + XXH32_update(&(dctx->xxh), dstPtr, (size_t)decodedSize); if (dctx->frameInfo.contentSize) - dctx->frameRemainingSize -= decodedSize; + dctx->frameRemainingSize -= (size_t)decodedSize; /* dictionary management */ - if (dctx->frameInfo.blockMode==LZ4F_blockLinked) - LZ4F_updateDict(dctx, dstPtr, decodedSize, dstStart, 0); + if (dctx->frameInfo.blockMode==LZ4F_blockLinked) { + LZ4F_updateDict(dctx, dstPtr, (size_t)decodedSize, dstStart, 0); + } dstPtr += decodedSize; - dctx->dStage = dstage_getBlockHeader; + dctx->dStage = dstage_getBlockHeader; /* end of block, let's get another one */ break; } /* not enough place into dst : decode into tmpOut */ - /* ensure enough place for tmpOut */ + + /* manage dictionary */ if (dctx->frameInfo.blockMode == LZ4F_blockLinked) { if (dctx->dict == dctx->tmpOutBuffer) { + /* truncate dictionary to 64 KB if too big */ if (dctx->dictSize > 128 KB) { memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB); dctx->dictSize = 64 KB; } dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize; - } else { /* dict not within tmp */ + } else { /* dict not within tmpOut */ size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB); dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace; } } - /* Decode block */ + /* Decode block into tmpOut */ { const char* dict = (const char*)dctx->dict; size_t dictSize = dctx->dictSize; int decodedSize; @@ -1613,20 +1890,21 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, (const char*)selectedIn, (char*)dctx->tmpOut, (int)dctx->tmpInTarget, (int)dctx->maxBlockSize, dict, (int)dictSize); - if (decodedSize < 0) /* decompression failed */ - return err0r(LZ4F_ERROR_decompressionFailed); - if (dctx->frameInfo.contentChecksumFlag) - XXH32_update(&(dctx->xxh), dctx->tmpOut, decodedSize); + RETURN_ERROR_IF(decodedSize < 0, decompressionFailed); + if (dctx->frameInfo.contentChecksumFlag && !dctx->skipChecksum) + XXH32_update(&(dctx->xxh), dctx->tmpOut, (size_t)decodedSize); if (dctx->frameInfo.contentSize) - dctx->frameRemainingSize -= decodedSize; - dctx->tmpOutSize = decodedSize; + dctx->frameRemainingSize -= (size_t)decodedSize; + dctx->tmpOutSize = (size_t)decodedSize; dctx->tmpOutStart = 0; dctx->dStage = dstage_flushOut; } /* fall-through */ case dstage_flushOut: /* flush decoded data from tmpOut to dstBuffer */ - { size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr)); + DEBUGLOG(6, "dstage_flushOut"); + if (dstPtr != NULL) { + size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr)); memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy); /* dictionary management */ @@ -1635,20 +1913,18 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, dctx->tmpOutStart += sizeToCopy; dstPtr += sizeToCopy; - - if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */ - dctx->dStage = dstage_getBlockHeader; /* get next block */ - break; - } - /* could not flush everything : stop there, just request a block header */ - doAnotherStage = 0; - nextSrcSizeHint = BHSize; + } + if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */ + dctx->dStage = dstage_getBlockHeader; /* get next block */ break; } + /* could not flush everything : stop there, just request a block header */ + doAnotherStage = 0; + nextSrcSizeHint = BHSize; + break; case dstage_getSuffix: - if (dctx->frameRemainingSize) - return err0r(LZ4F_ERROR_frameSize_wrong); /* incorrect frame size decoded */ + RETURN_ERROR_IF(dctx->frameRemainingSize, frameSize_wrong); /* incorrect frame size decoded */ if (!dctx->frameInfo.contentChecksumFlag) { /* no checksum, frame is completed */ nextSrcSizeHint = 0; LZ4F_resetDecompressionContext(dctx); @@ -1680,15 +1956,20 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } /* if (dctx->dStage == dstage_storeSuffix) */ /* case dstage_checkSuffix: */ /* no direct entry, avoid initialization risks */ - { U32 const readCRC = LZ4F_readLE32(selectedIn); + if (!dctx->skipChecksum) { + U32 const readCRC = LZ4F_readLE32(selectedIn); U32 const resultCRC = XXH32_digest(&(dctx->xxh)); - if (readCRC != resultCRC) - return err0r(LZ4F_ERROR_contentChecksum_invalid); - nextSrcSizeHint = 0; - LZ4F_resetDecompressionContext(dctx); - doAnotherStage = 0; - break; +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + RETURN_ERROR_IF(readCRC != resultCRC, contentChecksum_invalid); +#else + (void)readCRC; + (void)resultCRC; +#endif } + nextSrcSizeHint = 0; + LZ4F_resetDecompressionContext(dctx); + doAnotherStage = 0; + break; case dstage_getSFrameSize: if ((srcEnd - srcPtr) >= 4) { @@ -1739,22 +2020,23 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } /* switch (dctx->dStage) */ } /* while (doAnotherStage) */ - /* preserve history within tmp whenever necessary */ + /* preserve history within tmpOut whenever necessary */ LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2); if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked) /* next block will use up to 64KB from previous ones */ && (dctx->dict != dctx->tmpOutBuffer) /* dictionary is not already within tmp */ + && (dctx->dict != NULL) /* dictionary exists */ && (!decompressOptionsPtr->stableDst) /* cannot rely on dst data to remain there for next call */ && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) ) /* valid stages : [init ... getSuffix[ */ { if (dctx->dStage == dstage_flushOut) { - size_t const preserveSize = dctx->tmpOut - dctx->tmpOutBuffer; + size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer); size_t copySize = 64 KB - dctx->tmpOutSize; const BYTE* oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart; if (dctx->tmpOutSize > 64 KB) copySize = 0; if (copySize > preserveSize) copySize = preserveSize; + assert(dctx->tmpOutBuffer != NULL); - if (copySize > 0) - memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize); + memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize); dctx->dict = dctx->tmpOutBuffer; dctx->dictSize = preserveSize + dctx->tmpOutStart; @@ -1762,8 +2044,7 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize; size_t const newDictSize = MIN(dctx->dictSize, 64 KB); - if (newDictSize > 0) - memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize); + memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize); dctx->dict = dctx->tmpOutBuffer; dctx->dictSize = newDictSize; @@ -1771,8 +2052,8 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx, } } - *srcSizePtr = (srcPtr - srcStart); - *dstSizePtr = (dstPtr - dstStart); + *srcSizePtr = (size_t)(srcPtr - srcStart); + *dstSizePtr = (size_t)(dstPtr - dstStart); return nextSrcSizeHint; } diff --git a/cdk/extra/lz4/lz4frame.h b/cdk/extra/lz4/lib/lz4frame.h similarity index 63% rename from cdk/extra/lz4/lz4frame.h rename to cdk/extra/lz4/lib/lz4frame.h index 68f41181d..1bdf6c4fc 100644 --- a/cdk/extra/lz4/lz4frame.h +++ b/cdk/extra/lz4/lib/lz4frame.h @@ -1,7 +1,7 @@ /* - LZ4 auto-framing library + LZ4F - LZ4-Frame library Header File - Copyright (C) 2011-2017, Yann Collet. + Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without @@ -32,11 +32,14 @@ - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c */ -/* LZ4F is a stand-alone API to create LZ4-compressed frames - * conformant with specification v1.6.1. - * It also offers streaming capabilities. +/* LZ4F is a stand-alone API able to create and decode LZ4 frames + * conformant with specification v1.6.1 in doc/lz4_Frame_format.md . + * Generated frames are compatible with `lz4` CLI. + * + * LZ4F also offers streaming capabilities. + * * lz4.h is not required when using lz4frame.h, - * except to get constant such as LZ4_VERSION_NUMBER. + * except to extract common constants such as LZ4_VERSION_NUMBER. * */ #ifndef LZ4F_H_09782039843 @@ -51,29 +54,34 @@ extern "C" { /** - Introduction - - lz4frame.h implements LZ4 frame specification (doc/lz4_Frame_format.md). - lz4frame.h provides frame compression functions that take care - of encoding standard metadata alongside LZ4-compressed blocks. -*/ + * Introduction + * + * lz4frame.h implements LZ4 frame specification: see doc/lz4_Frame_format.md . + * LZ4 Frames are compatible with `lz4` CLI, + * and designed to be interoperable with any system. +**/ /*-*************************************************************** * Compiler specifics *****************************************************************/ /* LZ4_DLL_EXPORT : * Enable exporting of functions when building a Windows DLL - * LZ4FLIB_API : + * LZ4FLIB_VISIBILITY : * Control library symbols visibility. */ +#ifndef LZ4FLIB_VISIBILITY +# if defined(__GNUC__) && (__GNUC__ >= 4) +# define LZ4FLIB_VISIBILITY __attribute__ ((visibility ("default"))) +# else +# define LZ4FLIB_VISIBILITY +# endif +#endif #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) -# define LZ4FLIB_API __declspec(dllexport) +# define LZ4FLIB_API __declspec(dllexport) LZ4FLIB_VISIBILITY #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) -# define LZ4FLIB_API __declspec(dllimport) -#elif defined(__GNUC__) && (__GNUC__ >= 4) -# define LZ4FLIB_API __attribute__ ((__visibility__ ("default"))) +# define LZ4FLIB_API __declspec(dllimport) LZ4FLIB_VISIBILITY #else -# define LZ4FLIB_API +# define LZ4FLIB_API LZ4FLIB_VISIBILITY #endif #ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS @@ -100,7 +108,7 @@ LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /**< return /*-************************************ * Frame compression types - **************************************/ + ************************************* */ /* #define LZ4F_ENABLE_OBSOLETE_ENUMS // uncomment to enable obsolete enums */ #ifdef LZ4F_ENABLE_OBSOLETE_ENUMS # define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x @@ -110,7 +118,8 @@ LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /**< return /* The larger the block size, the (slightly) better the compression ratio, * though there are diminishing returns. - * Larger blocks also increase memory usage on both compression and decompression sides. */ + * Larger blocks also increase memory usage on both compression and decompression sides. + */ typedef enum { LZ4F_default=0, LZ4F_max64KB=4, @@ -173,7 +182,7 @@ typedef struct { LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0: disabled (default) */ } LZ4F_frameInfo_t; -#define LZ4F_INIT_FRAMEINFO { 0, 0, 0, 0, 0, 0, 0 } /* v1.8.3+ */ +#define LZ4F_INIT_FRAMEINFO { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */ /*! LZ4F_preferences_t : * makes it possible to supply advanced compression instructions to streaming interface. @@ -188,20 +197,20 @@ typedef struct { unsigned reserved[3]; /* must be zero for forward compatibility */ } LZ4F_preferences_t; -#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0, 0, { 0, 0, 0 } } /* v1.8.3+ */ +#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } } /* v1.8.3+ */ /*-********************************* * Simple compression function ***********************************/ -LZ4FLIB_API int LZ4F_compressionLevel_max(void); +LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */ /*! LZ4F_compressFrameBound() : * Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences. * `preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences. * Note : this result is only usable with LZ4F_compressFrame(). - * It may also be used with LZ4F_compressUpdate() _if no flush() operation_ is performed. + * It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed. */ LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr); @@ -221,7 +230,7 @@ LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, * Advanced compression functions *************************************/ typedef struct LZ4F_cctx_s LZ4F_cctx; /* incomplete type */ -typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with previous API version */ +typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with older APIs, prefer using LZ4F_cctx */ typedef struct { unsigned stableSrc; /* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */ @@ -234,20 +243,37 @@ typedef struct { LZ4FLIB_API unsigned LZ4F_getVersion(void); /*! LZ4F_createCompressionContext() : - * The first thing to do is to create a compressionContext object, which will be used in all compression operations. - * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version. - * The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. - * The function will provide a pointer to a fully allocated LZ4F_cctx object. - * If @return != zero, there was an error during context creation. - * Object can release its memory using LZ4F_freeCompressionContext(); - */ + * The first thing to do is to create a compressionContext object, + * which will keep track of operation state during streaming compression. + * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version, + * and a pointer to LZ4F_cctx*, to write the resulting pointer into. + * @version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. + * The function provides a pointer to a fully allocated LZ4F_cctx object. + * @cctxPtr MUST be != NULL. + * If @return != zero, context creation failed. + * A created compression context can be employed multiple times for consecutive streaming operations. + * Once all streaming compression jobs are completed, + * the state object can be released using LZ4F_freeCompressionContext(). + * Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored. + * Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing). +**/ LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version); LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx); /*---- Compression ----*/ -#define LZ4F_HEADER_SIZE_MAX 19 /* LZ4 Frame header size can vary from 7 to 19 bytes */ +#define LZ4F_HEADER_SIZE_MIN 7 /* LZ4 Frame header size can vary, depending on selected parameters */ +#define LZ4F_HEADER_SIZE_MAX 19 + +/* Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed */ +#define LZ4F_BLOCK_HEADER_SIZE 4 + +/* Size in bytes of a block checksum footer in little-endian format. */ +#define LZ4F_BLOCK_CHECKSUM_SIZE 4 + +/* Size in bytes of the content checksum. */ +#define LZ4F_CONTENT_CHECKSUM_SIZE 4 /*! LZ4F_compressBegin() : * will write the frame header into dstBuffer. @@ -271,7 +297,7 @@ LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx* cctx, * @return is always the same for a srcSize and prefsPtr. * prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario. * tech details : - * @return includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes. + * @return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes. * It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd(). * @return doesn't include frame header, as it was already generated by LZ4F_compressBegin(). */ @@ -282,8 +308,9 @@ LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* * Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations. * This value is provided by LZ4F_compressBound(). * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). - * LZ4F_compressUpdate() doesn't guarantee error recovery. - * When an error occurs, compression context must be freed or resized. + * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously an uncompressed block was written, buffered data is flushed + * before appending compressed data is continued. * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). * or an error code if it fails (which can be tested using LZ4F_isError()) @@ -328,8 +355,12 @@ typedef struct LZ4F_dctx_s LZ4F_dctx; /* incomplete type */ typedef LZ4F_dctx* LZ4F_decompressionContext_t; /* compatibility with previous API versions */ typedef struct { - unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified. This optimization skips storage operations in tmp buffers. */ - unsigned reserved[3]; /* must be set to zero for forward compatibility */ + unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified between invocations. + * This optimization skips storage operations in tmp buffers. */ + unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time. + * Setting this option to 1 once disables all checksums for the rest of the frame. */ + unsigned reserved1; /* must be set to zero for forward compatibility */ + unsigned reserved0; /* idem */ } LZ4F_decompressOptions_t; @@ -337,9 +368,10 @@ typedef struct { /*! LZ4F_createDecompressionContext() : * Create an LZ4F_dctx object, to track all decompression operations. - * The version provided MUST be LZ4F_VERSION. - * The function provides a pointer to an allocated and initialized LZ4F_dctx object. - * The result is an errorCode, which can be tested using LZ4F_isError(). + * @version provided MUST be LZ4F_VERSION. + * @dctxPtr MUST be valid. + * The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object. + * The @return is an errorCode, which can be tested using LZ4F_isError(). * dctx memory can be released using LZ4F_freeDecompressionContext(); * Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released. * That is, it should be == 0 if decompression has been completed fully and correctly. @@ -352,34 +384,74 @@ LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx); * Streaming decompression functions *************************************/ +#define LZ4F_MAGICNUMBER 0x184D2204U +#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U +#define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5 + +/*! LZ4F_headerSize() : v1.9.0+ + * Provide the header size of a frame starting at `src`. + * `srcSize` must be >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH, + * which is enough to decode the header length. + * @return : size of frame header + * or an error code, which can be tested using LZ4F_isError() + * note : Frame header size is variable, but is guaranteed to be + * >= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes. + */ +LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize); + /*! LZ4F_getFrameInfo() : * This function extracts frame parameters (max blockSize, dictID, etc.). - * Its usage is optional. - * Extracted information is typically useful for allocation and dictionary. - * This function works in 2 situations : - * - At the beginning of a new frame, in which case - * it will decode information from `srcBuffer`, starting the decoding process. - * Input size must be large enough to successfully decode the entire frame header. - * Frame header size is variable, but is guaranteed to be <= LZ4F_HEADER_SIZE_MAX bytes. - * It's allowed to provide more input data than this minimum. - * - After decoding has been started. - * In which case, no input is read, frame parameters are extracted from dctx. - * - If decoding has barely started, but not yet extracted information from header, + * Its usage is optional: user can also invoke LZ4F_decompress() directly. + * + * Extracted information will fill an existing LZ4F_frameInfo_t structure. + * This can be useful for allocation and dictionary identification purposes. + * + * LZ4F_getFrameInfo() can work in the following situations : + * + * 1) At the beginning of a new frame, before any invocation of LZ4F_decompress(). + * It will decode header from `srcBuffer`, + * consuming the header and starting the decoding process. + * + * Input size must be large enough to contain the full frame header. + * Frame header size can be known beforehand by LZ4F_headerSize(). + * Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes, + * and not more than <= LZ4F_HEADER_SIZE_MAX bytes. + * Hence, blindly providing LZ4F_HEADER_SIZE_MAX bytes or more will always work. + * It's allowed to provide more input data than the header size, + * LZ4F_getFrameInfo() will only consume the header. + * + * If input size is not large enough, + * aka if it's smaller than header size, + * function will fail and return an error code. + * + * 2) After decoding has been started, + * it's possible to invoke LZ4F_getFrameInfo() anytime + * to extract already decoded frame parameters stored within dctx. + * + * Note that, if decoding has barely started, + * and not yet read enough information to decode the header, * LZ4F_getFrameInfo() will fail. - * The number of bytes consumed from srcBuffer will be updated within *srcSizePtr (necessarily <= original value). - * Decompression must resume from (srcBuffer + *srcSizePtr). - * @return : an hint about how many srcSize bytes LZ4F_decompress() expects for next call, + * + * The number of bytes consumed from srcBuffer will be updated in *srcSizePtr (necessarily <= original value). + * LZ4F_getFrameInfo() only consumes bytes when decoding has not yet started, + * and when decoding the header has been successful. + * Decompression must then resume from (srcBuffer + *srcSizePtr). + * + * @return : a hint about how many srcSize bytes LZ4F_decompress() expects for next call, * or an error code which can be tested using LZ4F_isError(). * note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely. * note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure. */ -LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, - LZ4F_frameInfo_t* frameInfoPtr, - const void* srcBuffer, size_t* srcSizePtr); +LZ4FLIB_API size_t +LZ4F_getFrameInfo(LZ4F_dctx* dctx, + LZ4F_frameInfo_t* frameInfoPtr, + const void* srcBuffer, size_t* srcSizePtr); /*! LZ4F_decompress() : - * Call this function repetitively to regenerate compressed data from `srcBuffer`. - * The function will read up to *srcSizePtr bytes from srcBuffer, + * Call this function repetitively to regenerate data compressed in `srcBuffer`. + * + * The function requires a valid dctx state. + * It will read up to *srcSizePtr bytes from srcBuffer, * and decompress data into dstBuffer, of capacity *dstSizePtr. * * The nb of bytes consumed from srcBuffer will be written into *srcSizePtr (necessarily <= original value). @@ -406,10 +478,11 @@ LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, * * After a frame is fully decoded, dctx can be used again to decompress another frame. */ -LZ4FLIB_API size_t LZ4F_decompress(LZ4F_dctx* dctx, - void* dstBuffer, size_t* dstSizePtr, - const void* srcBuffer, size_t* srcSizePtr, - const LZ4F_decompressOptions_t* dOptPtr); +LZ4FLIB_API size_t +LZ4F_decompress(LZ4F_dctx* dctx, + void* dstBuffer, size_t* dstSizePtr, + const void* srcBuffer, size_t* srcSizePtr, + const LZ4F_decompressOptions_t* dOptPtr); /*! LZ4F_resetDecompressionContext() : added in v1.8.0 @@ -445,9 +518,9 @@ extern "C" { * Use at your own risk. */ #ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS -#define LZ4FLIB_STATIC_API LZ4FLIB_API +# define LZ4FLIB_STATIC_API LZ4FLIB_API #else -#define LZ4FLIB_STATIC_API +# define LZ4FLIB_STATIC_API #endif @@ -473,6 +546,8 @@ extern "C" { ITEM(ERROR_headerChecksum_invalid) \ ITEM(ERROR_contentChecksum_invalid) \ ITEM(ERROR_frameDecoding_alreadyStarted) \ + ITEM(ERROR_compressionState_uninitialized) \ + ITEM(ERROR_parameter_null) \ ITEM(ERROR_maxCode) #define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM, @@ -483,15 +558,57 @@ typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult); -LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(unsigned); + +/*! LZ4F_getBlockSize() : + * Return, in scalar format (size_t), + * the maximum block size associated with blockSizeID. +**/ +LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID); + +/*! LZ4F_uncompressedUpdate() : + * LZ4F_uncompressedUpdate() can be called repetitively to add as much data uncompressed data as necessary. + * Important rule: dstCapacity MUST be large enough to store the entire source buffer as + * no compression is done for this operation + * If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode). + * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously a compressed block was written, buffered data is flushed + * before appending uncompressed data is continued. + * This is only supported when LZ4F_blockIndependent is used + * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. + * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). + * or an error code if it fails (which can be tested using LZ4F_isError()) + */ +LZ4FLIB_STATIC_API size_t +LZ4F_uncompressedUpdate(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* cOptPtr); /********************************** * Bulk processing dictionary API *********************************/ + +/* A Dictionary is useful for the compression of small messages (KB range). + * It dramatically improves compression efficiency. + * + * LZ4 can ingest any input as dictionary, though only the last 64 KB are useful. + * Best results are generally achieved by using Zstandard's Dictionary Builder + * to generate a high-quality dictionary from a set of samples. + * + * Loading a dictionary has a cost, since it involves construction of tables. + * The Bulk processing dictionary API makes it possible to share this cost + * over an arbitrary number of compression jobs, even concurrently, + * markedly improving compression latency for these cases. + * + * The same dictionary will have to be used on the decompression side + * for decoding to be successful. + * To help identify the correct dictionary at decoding stage, + * the frame header allows optional embedding of a dictID field. + */ typedef struct LZ4F_CDict_s LZ4F_CDict; /*! LZ4_createCDict() : - * When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. + * When compressing multiple messages / blocks using the same dictionary, it's recommended to load it just once. * LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. * LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. * `dictBuffer` can be released after LZ4_CDict creation, since its content is copied within CDict */ @@ -509,12 +626,12 @@ LZ4FLIB_STATIC_API void LZ4F_freeCDict(LZ4F_CDict* CDict); * but it's not recommended, as it's the only way to provide dictID in the frame header. * @return : number of bytes written into dstBuffer. * or an error code if it fails (can be tested using LZ4F_isError()) */ -LZ4FLIB_STATIC_API size_t LZ4F_compressFrame_usingCDict( - LZ4F_cctx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const LZ4F_CDict* cdict, - const LZ4F_preferences_t* preferencesPtr); +LZ4FLIB_STATIC_API size_t +LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx, + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, + const LZ4F_CDict* cdict, + const LZ4F_preferences_t* preferencesPtr); /*! LZ4F_compressBegin_usingCDict() : @@ -524,23 +641,49 @@ LZ4FLIB_STATIC_API size_t LZ4F_compressFrame_usingCDict( * however, it's the only way to provide dictID in the frame header. * @return : number of bytes written into dstBuffer for the header, * or an error code (which can be tested using LZ4F_isError()) */ -LZ4FLIB_STATIC_API size_t LZ4F_compressBegin_usingCDict( - LZ4F_cctx* cctx, - void* dstBuffer, size_t dstCapacity, - const LZ4F_CDict* cdict, - const LZ4F_preferences_t* prefsPtr); +LZ4FLIB_STATIC_API size_t +LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const LZ4F_CDict* cdict, + const LZ4F_preferences_t* prefsPtr); /*! LZ4F_decompress_usingDict() : * Same as LZ4F_decompress(), using a predefined dictionary. * Dictionary is used "in place", without any preprocessing. - * It must remain accessible throughout the entire frame decoding. */ -LZ4FLIB_STATIC_API size_t LZ4F_decompress_usingDict( - LZ4F_dctx* dctxPtr, - void* dstBuffer, size_t* dstSizePtr, - const void* srcBuffer, size_t* srcSizePtr, - const void* dict, size_t dictSize, - const LZ4F_decompressOptions_t* decompressOptionsPtr); +** It must remain accessible throughout the entire frame decoding. */ +LZ4FLIB_STATIC_API size_t +LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr, + void* dstBuffer, size_t* dstSizePtr, + const void* srcBuffer, size_t* srcSizePtr, + const void* dict, size_t dictSize, + const LZ4F_decompressOptions_t* decompressOptionsPtr); + + +/*! Custom memory allocation : + * These prototypes make it possible to pass custom allocation/free functions. + * LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below. + * All allocation/free operations will be completed using these custom variants instead of regular ones. + */ +typedef void* (*LZ4F_AllocFunction) (void* opaqueState, size_t size); +typedef void* (*LZ4F_CallocFunction) (void* opaqueState, size_t size); +typedef void (*LZ4F_FreeFunction) (void* opaqueState, void* address); +typedef struct { + LZ4F_AllocFunction customAlloc; + LZ4F_CallocFunction customCalloc; /* optional; when not defined, uses customAlloc + memset */ + LZ4F_FreeFunction customFree; + void* opaqueState; +} LZ4F_CustomMem; +static +#ifdef __GNUC__ +__attribute__((__unused__)) +#endif +LZ4F_CustomMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */ + +LZ4FLIB_STATIC_API LZ4F_cctx* LZ4F_createCompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version); +LZ4FLIB_STATIC_API LZ4F_dctx* LZ4F_createDecompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version); +LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict_advanced(LZ4F_CustomMem customMem, const void* dictBuffer, size_t dictSize); + #if defined (__cplusplus) } diff --git a/cdk/extra/lz4/lz4frame_static.h b/cdk/extra/lz4/lib/lz4frame_static.h similarity index 97% rename from cdk/extra/lz4/lz4frame_static.h rename to cdk/extra/lz4/lib/lz4frame_static.h index 925a2c5c3..2b44a6315 100644 --- a/cdk/extra/lz4/lz4frame_static.h +++ b/cdk/extra/lz4/lib/lz4frame_static.h @@ -1,7 +1,7 @@ /* LZ4 auto-framing library Header File for static linking only - Copyright (C) 2011-2016, Yann Collet. + Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) diff --git a/cdk/extra/lz4/lz4hc.c b/cdk/extra/lz4/lib/lz4hc.c similarity index 62% rename from cdk/extra/lz4/lz4hc.c rename to cdk/extra/lz4/lib/lz4hc.c index 129bf0cbd..b21ad6bb5 100644 --- a/cdk/extra/lz4/lz4hc.c +++ b/cdk/extra/lz4/lib/lz4hc.c @@ -1,6 +1,6 @@ /* LZ4 HC - High Compression Mode of LZ4 - Copyright (C) 2011-2017, Yann Collet. + Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) @@ -42,7 +42,7 @@ * Select how default compression function will allocate workplace memory, * in stack (0:fastest), or in heap (1:requires malloc()). * Since workplace is rather large, heap mode is recommended. - */ +**/ #ifndef LZ4HC_HEAPMODE # define LZ4HC_HEAPMODE 1 #endif @@ -53,7 +53,7 @@ #include "lz4hc.h" -/*=== Common LZ4 definitions ===*/ +/*=== Common definitions ===*/ #if defined(__GNUC__) # pragma GCC diagnostic ignored "-Wunused-function" #endif @@ -61,22 +61,16 @@ # pragma clang diagnostic ignored "-Wunused-function" #endif -/*=== Enums ===*/ -typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive; -#ifndef LZ4_SRC_INCLUDED -typedef enum { - noLimit = 0, - limitedOutput = 1, - limitedDestSize = 2 -} limitedOutput_directive; -#endif - - #define LZ4_COMMONDEFS_ONLY #ifndef LZ4_SRC_INCLUDED #include "lz4.c" /* LZ4_count, constants, mem */ #endif + +/*=== Enums ===*/ +typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive; + + /*=== Constants ===*/ #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) #define LZ4_OPT_NUM (1<<12) @@ -99,24 +93,26 @@ static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr) **************************************/ static void LZ4HC_clearTables (LZ4HC_CCtx_internal* hc4) { - MEM_INIT((void*)hc4->hashTable, 0, sizeof(hc4->hashTable)); + MEM_INIT(hc4->hashTable, 0, sizeof(hc4->hashTable)); MEM_INIT(hc4->chainTable, 0xFF, sizeof(hc4->chainTable)); } -static void LZ4HC_init (LZ4HC_CCtx_internal* hc4, const BYTE* start) +static void LZ4HC_init_internal (LZ4HC_CCtx_internal* hc4, const BYTE* start) { - uptrval startingOffset = hc4->end - hc4->base; - if (startingOffset > 1 GB) { + size_t const bufferSize = (size_t)(hc4->end - hc4->prefixStart); + size_t newStartingOffset = bufferSize + hc4->dictLimit; + assert(newStartingOffset >= bufferSize); /* check overflow */ + if (newStartingOffset > 1 GB) { LZ4HC_clearTables(hc4); - startingOffset = 0; + newStartingOffset = 0; } - startingOffset += 64 KB; - hc4->nextToUpdate = (U32) startingOffset; - hc4->base = start - startingOffset; + newStartingOffset += 64 KB; + hc4->nextToUpdate = (U32)newStartingOffset; + hc4->prefixStart = start; hc4->end = start; - hc4->dictBase = start - startingOffset; - hc4->dictLimit = (U32) startingOffset; - hc4->lowLimit = (U32) startingOffset; + hc4->dictStart = start; + hc4->dictLimit = (U32)newStartingOffset; + hc4->lowLimit = (U32)newStartingOffset; } @@ -125,14 +121,17 @@ LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) { U16* const chainTable = hc4->chainTable; U32* const hashTable = hc4->hashTable; - const BYTE* const base = hc4->base; - U32 const target = (U32)(ip - base); + const BYTE* const prefixPtr = hc4->prefixStart; + U32 const prefixIdx = hc4->dictLimit; + U32 const target = (U32)(ip - prefixPtr) + prefixIdx; U32 idx = hc4->nextToUpdate; + assert(ip >= prefixPtr); + assert(target >= prefixIdx); while (idx < target) { - U32 const h = LZ4HC_hashPtr(base+idx); + U32 const h = LZ4HC_hashPtr(prefixPtr+idx-prefixIdx); size_t delta = idx - hashTable[h]; - if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; + if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX; DELTANEXTU16(chainTable, idx) = (U16)delta; hashTable[h] = idx; idx++; @@ -158,13 +157,28 @@ int LZ4HC_countBack(const BYTE* const ip, const BYTE* const match, return back; } +#if defined(_MSC_VER) +# define LZ4HC_rotl32(x,r) _rotl(x,r) +#else +# define LZ4HC_rotl32(x,r) ((x << r) | (x >> (32 - r))) +#endif + + +static U32 LZ4HC_rotatePattern(size_t const rotate, U32 const pattern) +{ + size_t const bitsToRotate = (rotate & (sizeof(pattern) - 1)) << 3; + if (bitsToRotate == 0) return pattern; + return LZ4HC_rotl32(pattern, (int)bitsToRotate); +} + /* LZ4HC_countPattern() : * pattern32 must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) */ static unsigned LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32) { const BYTE* const iStart = ip; - reg_t const pattern = (sizeof(pattern)==8) ? (reg_t)pattern32 + (((reg_t)pattern32) << 32) : pattern32; + reg_t const pattern = (sizeof(pattern)==8) ? + (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32; while (likely(ip < iEnd-(sizeof(pattern)-1))) { reg_t const diff = LZ4_read_ARCH(ip) ^ pattern; @@ -184,15 +198,14 @@ LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32) BYTE const byte = (BYTE)(pattern >> bitOffset); if (*ip != byte) break; ip ++; bitOffset -= 8; - } - } + } } return (unsigned)(ip - iStart); } /* LZ4HC_reverseCountPattern() : * pattern must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) - * read using natural platform endianess */ + * read using natural platform endianness */ static unsigned LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern) { @@ -202,7 +215,7 @@ LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern) if (LZ4_read32(ip-4) != pattern) break; ip -= 4; } - { const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianess */ + { const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */ while (likely(ip>iLow)) { if (ip[-1] != *bytePtr) break; ip--; bytePtr--; @@ -210,36 +223,46 @@ LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern) return (unsigned)(iStart - ip); } +/* LZ4HC_protectDictEnd() : + * Checks if the match is in the last 3 bytes of the dictionary, so reading the + * 4 byte MINMATCH would overflow. + * @returns true if the match index is okay. + */ +static int LZ4HC_protectDictEnd(U32 const dictLimit, U32 const matchIndex) +{ + return ((U32)((dictLimit - 1) - matchIndex) >= 3); +} + typedef enum { rep_untested, rep_not, rep_confirmed } repeat_state_e; typedef enum { favorCompressionRatio=0, favorDecompressionSpeed } HCfavor_e; LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( - LZ4HC_CCtx_internal* hc4, - const BYTE* const ip, - const BYTE* const iLowLimit, - const BYTE* const iHighLimit, - int longest, - const BYTE** matchpos, - const BYTE** startpos, - const int maxNbAttempts, - const int patternAnalysis, - const int chainSwap, - const dictCtx_directive dict, - const HCfavor_e favorDecSpeed) + LZ4HC_CCtx_internal* const hc4, + const BYTE* const ip, + const BYTE* const iLowLimit, const BYTE* const iHighLimit, + int longest, + const BYTE** matchpos, + const BYTE** startpos, + const int maxNbAttempts, + const int patternAnalysis, const int chainSwap, + const dictCtx_directive dict, + const HCfavor_e favorDecSpeed) { U16* const chainTable = hc4->chainTable; U32* const HashTable = hc4->hashTable; const LZ4HC_CCtx_internal * const dictCtx = hc4->dictCtx; - const BYTE* const base = hc4->base; - const U32 dictLimit = hc4->dictLimit; - const BYTE* const lowPrefixPtr = base + dictLimit; - const U32 ipIndex = (U32)(ip - base); - const U32 lowestMatchIndex = (hc4->lowLimit + 64 KB > ipIndex) ? hc4->lowLimit : ipIndex - MAX_DISTANCE; - const BYTE* const dictBase = hc4->dictBase; + const BYTE* const prefixPtr = hc4->prefixStart; + const U32 prefixIdx = hc4->dictLimit; + const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx; + const int withinStartDistance = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex); + const U32 lowestMatchIndex = (withinStartDistance) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX; + const BYTE* const dictStart = hc4->dictStart; + const U32 dictIdx = hc4->lowLimit; + const BYTE* const dictEnd = dictStart + prefixIdx - dictIdx; int const lookBackLength = (int)(ip-iLowLimit); int nbAttempts = maxNbAttempts; - int matchChainPos = 0; + U32 matchChainPos = 0; U32 const pattern = LZ4_read32(ip); U32 matchIndex; repeat_state_e repeat = rep_untested; @@ -252,21 +275,20 @@ LZ4HC_InsertAndGetWiderMatch ( DEBUGLOG(7, "First match at index %u / %u (lowestMatchIndex)", matchIndex, lowestMatchIndex); - while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) { + while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0)) { int matchLength=0; nbAttempts--; assert(matchIndex < ipIndex); if (favorDecSpeed && (ipIndex - matchIndex < 8)) { /* do nothing */ - } else if (matchIndex >= dictLimit) { /* within current Prefix */ - const BYTE* const matchPtr = base + matchIndex; - assert(matchPtr >= lowPrefixPtr); + } else if (matchIndex >= prefixIdx) { /* within current Prefix */ + const BYTE* const matchPtr = prefixPtr + matchIndex - prefixIdx; assert(matchPtr < ip); assert(longest >= 1); if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) { if (LZ4_read32(matchPtr) == pattern) { - int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, lowPrefixPtr) : 0; - matchLength = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit); + int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0; + matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit); matchLength -= back; if (matchLength > longest) { longest = matchLength; @@ -274,33 +296,40 @@ LZ4HC_InsertAndGetWiderMatch ( *startpos = ip + back; } } } } else { /* lowestMatchIndex <= matchIndex < dictLimit */ - const BYTE* const matchPtr = dictBase + matchIndex; - if (LZ4_read32(matchPtr) == pattern) { - const BYTE* const dictStart = dictBase + hc4->lowLimit; + const BYTE* const matchPtr = dictStart + (matchIndex - dictIdx); + assert(matchIndex >= dictIdx); + if ( likely(matchIndex <= prefixIdx - 4) + && (LZ4_read32(matchPtr) == pattern) ) { int back = 0; - const BYTE* vLimit = ip + (dictLimit - matchIndex); + const BYTE* vLimit = ip + (prefixIdx - matchIndex); if (vLimit > iHighLimit) vLimit = iHighLimit; - matchLength = LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; + matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; if ((ip+matchLength == vLimit) && (vLimit < iHighLimit)) - matchLength += LZ4_count(ip+matchLength, lowPrefixPtr, iHighLimit); + matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit); back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0; matchLength -= back; if (matchLength > longest) { longest = matchLength; - *matchpos = base + matchIndex + back; /* virtual pos, relative to ip, to retrieve offset */ + *matchpos = prefixPtr - prefixIdx + matchIndex + back; /* virtual pos, relative to ip, to retrieve offset */ *startpos = ip + back; } } } - if (chainSwap && matchLength==longest) { /* better match => select a better chain */ + if (chainSwap && matchLength==longest) { /* better match => select a better chain */ assert(lookBackLength==0); /* search forward only */ - if (matchIndex + longest <= ipIndex) { + if (matchIndex + (U32)longest <= ipIndex) { + int const kTrigger = 4; U32 distanceToNextMatch = 1; + int const end = longest - MINMATCH + 1; + int step = 1; + int accel = 1 << kTrigger; int pos; - for (pos = 0; pos <= longest - MINMATCH; pos++) { - U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + pos); + for (pos = 0; pos < end; pos += step) { + U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + (U32)pos); + step = (accel++ >> kTrigger); if (candidateDist > distanceToNextMatch) { distanceToNextMatch = candidateDist; - matchChainPos = pos; + matchChainPos = (U32)pos; + accel = 1 << kTrigger; } } if (distanceToNextMatch > 1) { if (distanceToNextMatch > matchIndex) break; /* avoid overflow */ @@ -320,83 +349,110 @@ LZ4HC_InsertAndGetWiderMatch ( } else { repeat = rep_not; } } - if ( (repeat == rep_confirmed) - && (matchCandidateIdx >= dictLimit) ) { /* same segment only */ - const BYTE* const matchPtr = base + matchCandidateIdx; + if ( (repeat == rep_confirmed) && (matchCandidateIdx >= lowestMatchIndex) + && LZ4HC_protectDictEnd(prefixIdx, matchCandidateIdx) ) { + const int extDict = matchCandidateIdx < prefixIdx; + const BYTE* const matchPtr = (extDict ? dictStart - dictIdx : prefixPtr - prefixIdx) + matchCandidateIdx; if (LZ4_read32(matchPtr) == pattern) { /* good candidate */ - size_t const forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern); - const BYTE* const lowestMatchPtr = (lowPrefixPtr + MAX_DISTANCE >= ip) ? lowPrefixPtr : ip - MAX_DISTANCE; - size_t const backLength = LZ4HC_reverseCountPattern(matchPtr, lowestMatchPtr, pattern); - size_t const currentSegmentLength = backLength + forwardPatternLength; - - if ( (currentSegmentLength >= srcPatternLength) /* current pattern segment large enough to contain full srcPatternLength */ - && (forwardPatternLength <= srcPatternLength) ) { /* haven't reached this position yet */ - matchIndex = matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength; /* best position, full pattern, might be followed by more match */ - } else { - matchIndex = matchCandidateIdx - (U32)backLength; /* farthest position in current segment, will find a match of length currentSegmentLength + maybe some back */ - if (lookBackLength==0) { /* no back possible */ - size_t const maxML = MIN(currentSegmentLength, srcPatternLength); - if ((size_t)longest < maxML) { - assert(base + matchIndex < ip); - if (ip - (base+matchIndex) > MAX_DISTANCE) break; - assert(maxML < 2 GB); - longest = (int)maxML; - *matchpos = base + matchIndex; /* virtual pos, relative to ip, to retrieve offset */ - *startpos = ip; + const BYTE* const iLimit = extDict ? dictEnd : iHighLimit; + size_t forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern); + if (extDict && matchPtr + forwardPatternLength == iLimit) { + U32 const rotatedPattern = LZ4HC_rotatePattern(forwardPatternLength, pattern); + forwardPatternLength += LZ4HC_countPattern(prefixPtr, iHighLimit, rotatedPattern); + } + { const BYTE* const lowestMatchPtr = extDict ? dictStart : prefixPtr; + size_t backLength = LZ4HC_reverseCountPattern(matchPtr, lowestMatchPtr, pattern); + size_t currentSegmentLength; + if (!extDict + && matchPtr - backLength == prefixPtr + && dictIdx < prefixIdx) { + U32 const rotatedPattern = LZ4HC_rotatePattern((U32)(-(int)backLength), pattern); + backLength += LZ4HC_reverseCountPattern(dictEnd, dictStart, rotatedPattern); + } + /* Limit backLength not go further than lowestMatchIndex */ + backLength = matchCandidateIdx - MAX(matchCandidateIdx - (U32)backLength, lowestMatchIndex); + assert(matchCandidateIdx - backLength >= lowestMatchIndex); + currentSegmentLength = backLength + forwardPatternLength; + /* Adjust to end of pattern if the source pattern fits, otherwise the beginning of the pattern */ + if ( (currentSegmentLength >= srcPatternLength) /* current pattern segment large enough to contain full srcPatternLength */ + && (forwardPatternLength <= srcPatternLength) ) { /* haven't reached this position yet */ + U32 const newMatchIndex = matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength; /* best position, full pattern, might be followed by more match */ + if (LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) + matchIndex = newMatchIndex; + else { + /* Can only happen if started in the prefix */ + assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict); + matchIndex = prefixIdx; } - { U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex); - if (distToNextPattern > matchIndex) break; /* avoid overflow */ - matchIndex -= distToNextPattern; - } } } + } else { + U32 const newMatchIndex = matchCandidateIdx - (U32)backLength; /* farthest position in current segment, will find a match of length currentSegmentLength + maybe some back */ + if (!LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) { + assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict); + matchIndex = prefixIdx; + } else { + matchIndex = newMatchIndex; + if (lookBackLength==0) { /* no back possible */ + size_t const maxML = MIN(currentSegmentLength, srcPatternLength); + if ((size_t)longest < maxML) { + assert(prefixPtr - prefixIdx + matchIndex != ip); + if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break; + assert(maxML < 2 GB); + longest = (int)maxML; + *matchpos = prefixPtr - prefixIdx + matchIndex; /* virtual pos, relative to ip, to retrieve offset */ + *startpos = ip; + } + { U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex); + if (distToNextPattern > matchIndex) break; /* avoid overflow */ + matchIndex -= distToNextPattern; + } } } } } continue; } } } } /* PA optimization */ /* follow current chain */ - matchIndex -= DELTANEXTU16(chainTable, matchIndex+matchChainPos); + matchIndex -= DELTANEXTU16(chainTable, matchIndex + matchChainPos); } /* while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) */ - if (dict == usingDictCtxHc && nbAttempts && ipIndex - lowestMatchIndex < MAX_DISTANCE) { - size_t const dictEndOffset = dictCtx->end - dictCtx->base; + if ( dict == usingDictCtxHc + && nbAttempts > 0 + && ipIndex - lowestMatchIndex < LZ4_DISTANCE_MAX) { + size_t const dictEndOffset = (size_t)(dictCtx->end - dictCtx->prefixStart) + dictCtx->dictLimit; U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)]; assert(dictEndOffset <= 1 GB); matchIndex = dictMatchIndex + lowestMatchIndex - (U32)dictEndOffset; - while (ipIndex - matchIndex <= MAX_DISTANCE && nbAttempts--) { - const BYTE* const matchPtr = dictCtx->base + dictMatchIndex; + while (ipIndex - matchIndex <= LZ4_DISTANCE_MAX && nbAttempts--) { + const BYTE* const matchPtr = dictCtx->prefixStart - dictCtx->dictLimit + dictMatchIndex; if (LZ4_read32(matchPtr) == pattern) { int mlt; int back = 0; const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex); if (vLimit > iHighLimit) vLimit = iHighLimit; - mlt = LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; - back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->base + dictCtx->dictLimit) : 0; + mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH; + back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0; mlt -= back; if (mlt > longest) { longest = mlt; - *matchpos = base + matchIndex + back; + *matchpos = prefixPtr - prefixIdx + matchIndex + back; *startpos = ip + back; - } - } + } } { U32 const nextOffset = DELTANEXTU16(dictCtx->chainTable, dictMatchIndex); dictMatchIndex -= nextOffset; matchIndex -= nextOffset; - } - } - } + } } } return longest; } -LZ4_FORCE_INLINE -int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ - const BYTE* const ip, const BYTE* const iLimit, - const BYTE** matchpos, - const int maxNbAttempts, - const int patternAnalysis, - const dictCtx_directive dict) +LZ4_FORCE_INLINE int +LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ + const BYTE* const ip, const BYTE* const iLimit, + const BYTE** matchpos, + const int maxNbAttempts, + const int patternAnalysis, + const dictCtx_directive dict) { const BYTE* uselessPtr = ip; /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos), @@ -409,74 +465,90 @@ int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index tabl * @return : 0 if ok, * 1 if buffer issue detected */ LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( - const BYTE** ip, - BYTE** op, - const BYTE** anchor, + const BYTE** _ip, + BYTE** _op, + const BYTE** _anchor, int matchLength, const BYTE* const match, limitedOutput_directive limit, BYTE* oend) { +#define ip (*_ip) +#define op (*_op) +#define anchor (*_anchor) + size_t length; - BYTE* const token = (*op)++; + BYTE* const token = op++; #if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 6) static const BYTE* start = NULL; static U32 totalCost = 0; - U32 const pos = (start==NULL) ? 0 : (U32)(*anchor - start); - U32 const ll = (U32)(*ip - *anchor); + U32 const pos = (start==NULL) ? 0 : (U32)(anchor - start); + U32 const ll = (U32)(ip - anchor); U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0; U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0; U32 const cost = 1 + llAdd + ll + 2 + mlAdd; - if (start==NULL) start = *anchor; /* only works for single segment */ + if (start==NULL) start = anchor; /* only works for single segment */ /* g_debuglog_enable = (pos >= 2228) & (pos <= 2262); */ - DEBUGLOG(6, "pos:%7u -- literals:%3u, match:%4i, offset:%5u, cost:%3u + %u", + DEBUGLOG(6, "pos:%7u -- literals:%4u, match:%4i, offset:%5u, cost:%4u + %5u", pos, - (U32)(*ip - *anchor), matchLength, (U32)(*ip-match), + (U32)(ip - anchor), matchLength, (U32)(ip-match), cost, totalCost); totalCost += cost; #endif /* Encode Literal length */ - length = (size_t)(*ip - *anchor); - if ((limit) && ((*op + (length / 255) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ + length = (size_t)(ip - anchor); + LZ4_STATIC_ASSERT(notLimited == 0); + /* Check output limit */ + if (limit && ((op + (length / 255) + length + (2 + 1 + LASTLITERALS)) > oend)) { + DEBUGLOG(6, "Not enough room to write %i literals (%i bytes remaining)", + (int)length, (int)(oend - op)); + return 1; + } if (length >= RUN_MASK) { size_t len = length - RUN_MASK; *token = (RUN_MASK << ML_BITS); - for(; len >= 255 ; len -= 255) *(*op)++ = 255; - *(*op)++ = (BYTE)len; + for(; len >= 255 ; len -= 255) *op++ = 255; + *op++ = (BYTE)len; } else { *token = (BYTE)(length << ML_BITS); } /* Copy Literals */ - LZ4_wildCopy(*op, *anchor, (*op) + length); - *op += length; + LZ4_wildCopy8(op, anchor, op + length); + op += length; /* Encode Offset */ - assert( (*ip - match) <= MAX_DISTANCE ); /* note : consider providing offset as a value, rather than as a pointer difference */ - LZ4_writeLE16(*op, (U16)(*ip-match)); *op += 2; + assert( (ip - match) <= LZ4_DISTANCE_MAX ); /* note : consider providing offset as a value, rather than as a pointer difference */ + LZ4_writeLE16(op, (U16)(ip - match)); op += 2; /* Encode MatchLength */ assert(matchLength >= MINMATCH); - length = (size_t)(matchLength - MINMATCH); - if ((limit) && (*op + (length / 255) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ + length = (size_t)matchLength - MINMATCH; + if (limit && (op + (length / 255) + (1 + LASTLITERALS) > oend)) { + DEBUGLOG(6, "Not enough room to write match length"); + return 1; /* Check output limit */ + } if (length >= ML_MASK) { *token += ML_MASK; length -= ML_MASK; - for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } - if (length >= 255) { length -= 255; *(*op)++ = 255; } - *(*op)++ = (BYTE)length; + for(; length >= 510 ; length -= 510) { *op++ = 255; *op++ = 255; } + if (length >= 255) { length -= 255; *op++ = 255; } + *op++ = (BYTE)length; } else { *token += (BYTE)(length); } /* Prepare next loop */ - *ip += matchLength; - *anchor = *ip; + ip += matchLength; + anchor = ip; return 0; } +#undef ip +#undef op +#undef anchor LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( LZ4HC_CCtx_internal* const ctx, @@ -484,7 +556,7 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( char* const dest, int* srcSizePtr, int const maxOutputSize, - unsigned maxNbAttempts, + int maxNbAttempts, const limitedOutput_directive limit, const dictCtx_directive dict ) @@ -513,12 +585,12 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( /* init */ *srcSizePtr = 0; - if (limit == limitedDestSize) oend -= LASTLITERALS; /* Hack for support LZ4 format restriction */ - if (inputSize < LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ + if (limit == fillOutput) oend -= LASTLITERALS; /* Hack for support LZ4 format restriction */ + if (inputSize < LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ /* Main Loop */ while (ip <= mflimit) { - ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, &ref, maxNbAttempts, patternAnalysis, dict); + ml = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, &ref, maxNbAttempts, patternAnalysis, dict); if (ml oend)) { - if (limit == limitedOutput) return 0; /* Check output limit */ + if (limit == limitedOutput) return 0; /* adapt lastRunSize to fill 'dest' */ - lastRunSize = (size_t)(oend - op) - 1; - litLength = (lastRunSize + 255 - RUN_MASK) / 255; - lastRunSize -= litLength; + lastRunSize = (size_t)(oend - op) - 1 /*token*/; + llAdd = (lastRunSize + 256 - RUN_MASK) / 256; + lastRunSize -= llAdd; } - ip = anchor + lastRunSize; + DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize); + ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */ if (lastRunSize >= RUN_MASK) { size_t accumulator = lastRunSize - RUN_MASK; @@ -678,7 +755,7 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( } else { *op++ = (BYTE)(lastRunSize << ML_BITS); } - memcpy(op, anchor, lastRunSize); + LZ4_memcpy(op, anchor, lastRunSize); op += lastRunSize; } @@ -687,10 +764,26 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( return (int) (((char*)op)-dest); _dest_overflow: - if (limit == limitedDestSize) { + if (limit == fillOutput) { + /* Assumption : ip, anchor, ml and ref must be set correctly */ + size_t const ll = (size_t)(ip - anchor); + size_t const ll_addbytes = (ll + 240) / 255; + size_t const ll_totalCost = 1 + ll_addbytes + ll; + BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */ + DEBUGLOG(6, "Last sequence overflowing"); op = optr; /* restore correct out pointer */ + if (op + ll_totalCost <= maxLitPos) { + /* ll validated; now adjust match length */ + size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost)); + size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255); + assert(maxMlSize < INT_MAX); assert(ml >= 0); + if ((size_t)ml > maxMlSize) ml = (int)maxMlSize; + if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ml >= MFLIMIT) { + LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, notLimited, oend); + } } goto _last_literals; } + /* compression failed */ return 0; } @@ -701,7 +794,7 @@ static int LZ4HC_compress_optimal( LZ4HC_CCtx_internal* ctx, int const nbSearches, size_t sufficient_len, const limitedOutput_directive limit, int const fullUpdate, const dictCtx_directive dict, - HCfavor_e favorDecSpeed); + const HCfavor_e favorDecSpeed); LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( @@ -718,7 +811,7 @@ LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( typedef enum { lz4hc, lz4opt } lz4hc_strat_e; typedef struct { lz4hc_strat_e strat; - U32 nbSearches; + int nbSearches; U32 targetLength; } cParams_t; static const cParams_t clTable[LZ4HC_CLEVEL_MAX+1] = { @@ -737,10 +830,11 @@ LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( { lz4opt,16384,LZ4_OPT_NUM }, /* 12==LZ4HC_CLEVEL_MAX */ }; - DEBUGLOG(4, "LZ4HC_compress_generic(%p, %p, %d)", ctx, src, *srcSizePtr); + DEBUGLOG(4, "LZ4HC_compress_generic(ctx=%p, src=%p, srcSize=%d, limit=%d)", + ctx, src, *srcSizePtr, limit); - if (limit == limitedDestSize && dstCapacity < 1) return 0; /* Impossible to store anything */ - if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size (too large or negative) */ + if (limit == fillOutput && dstCapacity < 1) return 0; /* Impossible to store anything */ + if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size (too large or negative) */ ctx->end += *srcSizePtr; if (cLevel < 1) cLevel = LZ4HC_CLEVEL_DEFAULT; /* note : convention is different from lz4frame, maybe something to review */ @@ -768,37 +862,39 @@ LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock); -static int LZ4HC_compress_generic_noDictCtx ( - LZ4HC_CCtx_internal* const ctx, - const char* const src, - char* const dst, - int* const srcSizePtr, - int const dstCapacity, - int cLevel, - limitedOutput_directive limit - ) +static int +LZ4HC_compress_generic_noDictCtx ( + LZ4HC_CCtx_internal* const ctx, + const char* const src, + char* const dst, + int* const srcSizePtr, + int const dstCapacity, + int cLevel, + limitedOutput_directive limit + ) { assert(ctx->dictCtx == NULL); return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx); } -static int LZ4HC_compress_generic_dictCtx ( - LZ4HC_CCtx_internal* const ctx, - const char* const src, - char* const dst, - int* const srcSizePtr, - int const dstCapacity, - int cLevel, - limitedOutput_directive limit - ) +static int +LZ4HC_compress_generic_dictCtx ( + LZ4HC_CCtx_internal* const ctx, + const char* const src, + char* const dst, + int* const srcSizePtr, + int const dstCapacity, + int cLevel, + limitedOutput_directive limit + ) { - const size_t position = ctx->end - ctx->base - ctx->lowLimit; + const size_t position = (size_t)(ctx->end - ctx->prefixStart) + (ctx->dictLimit - ctx->lowLimit); assert(ctx->dictCtx != NULL); if (position >= 64 KB) { ctx->dictCtx = NULL; return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit); } else if (position == 0 && *srcSizePtr > 4 KB) { - memcpy(ctx, ctx->dictCtx, sizeof(LZ4HC_CCtx_internal)); + LZ4_memcpy(ctx, ctx->dictCtx, sizeof(LZ4HC_CCtx_internal)); LZ4HC_setExternalDict(ctx, (const BYTE *)src); ctx->compressionLevel = (short)cLevel; return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit); @@ -807,15 +903,16 @@ static int LZ4HC_compress_generic_dictCtx ( } } -static int LZ4HC_compress_generic ( - LZ4HC_CCtx_internal* const ctx, - const char* const src, - char* const dst, - int* const srcSizePtr, - int const dstCapacity, - int cLevel, - limitedOutput_directive limit - ) +static int +LZ4HC_compress_generic ( + LZ4HC_CCtx_internal* const ctx, + const char* const src, + char* const dst, + int* const srcSizePtr, + int const dstCapacity, + int cLevel, + limitedOutput_directive limit + ) { if (ctx->dictCtx == NULL) { return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit); @@ -825,50 +922,64 @@ static int LZ4HC_compress_generic ( } -int LZ4_sizeofStateHC(void) { return sizeof(LZ4_streamHC_t); } +int LZ4_sizeofStateHC(void) { return (int)sizeof(LZ4_streamHC_t); } + +static size_t LZ4_streamHC_t_alignment(void) +{ +#if LZ4_ALIGN_TEST + typedef struct { char c; LZ4_streamHC_t t; } t_a; + return sizeof(t_a) - sizeof(LZ4_streamHC_t); +#else + return 1; /* effectively disabled */ +#endif +} +/* state is presumed correctly initialized, + * in which case its size and alignment have already been validate */ int LZ4_compress_HC_extStateHC_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) { LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse; - if (((size_t)(state)&(sizeof(void*)-1)) != 0) return 0; /* Error : state is not aligned for pointers (32 or 64 bits) */ + if (!LZ4_isAligned(state, LZ4_streamHC_t_alignment())) return 0; LZ4_resetStreamHC_fast((LZ4_streamHC_t*)state, compressionLevel); - LZ4HC_init (ctx, (const BYTE*)src); + LZ4HC_init_internal (ctx, (const BYTE*)src); if (dstCapacity < LZ4_compressBound(srcSize)) return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput); else - return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, noLimit); + return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited); } int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) { - if (((size_t)(state)&(sizeof(void*)-1)) != 0) return 0; /* Error : state is not aligned for pointers (32 or 64 bits) */ - LZ4_resetStreamHC ((LZ4_streamHC_t*)state, compressionLevel); + LZ4_streamHC_t* const ctx = LZ4_initStreamHC(state, sizeof(*ctx)); + if (ctx==NULL) return 0; /* init failure */ return LZ4_compress_HC_extStateHC_fastReset(state, src, dst, srcSize, dstCapacity, compressionLevel); } int LZ4_compress_HC(const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) { + int cSize; #if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 LZ4_streamHC_t* const statePtr = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t)); + if (statePtr==NULL) return 0; #else LZ4_streamHC_t state; LZ4_streamHC_t* const statePtr = &state; #endif - int const cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel); + cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel); #if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 - free(statePtr); + FREEMEM(statePtr); #endif return cSize; } -/* LZ4_compress_HC_destSize() : - * only compatible with regular HC parser */ -int LZ4_compress_HC_destSize(void* LZ4HC_Data, const char* source, char* dest, int* sourceSizePtr, int targetDestSize, int cLevel) +/* state is presumed sized correctly (>= sizeof(LZ4_streamHC_t)) */ +int LZ4_compress_HC_destSize(void* state, const char* source, char* dest, int* sourceSizePtr, int targetDestSize, int cLevel) { - LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse; - LZ4_resetStreamHC((LZ4_streamHC_t*)LZ4HC_Data, cLevel); - LZ4HC_init(ctx, (const BYTE*) source); - return LZ4HC_compress_generic(ctx, source, dest, sourceSizePtr, targetDestSize, cLevel, limitedDestSize); + LZ4_streamHC_t* const ctx = LZ4_initStreamHC(state, sizeof(*ctx)); + if (ctx==NULL) return 0; /* init failure */ + LZ4HC_init_internal(&ctx->internal_donotuse, (const BYTE*) source); + LZ4_setCompressionLevel(ctx, cLevel); + return LZ4HC_compress_generic(&ctx->internal_donotuse, source, dest, sourceSizePtr, targetDestSize, cLevel, fillOutput); } @@ -877,31 +988,45 @@ int LZ4_compress_HC_destSize(void* LZ4HC_Data, const char* source, char* dest, i * Streaming Functions **************************************/ /* allocation */ -LZ4_streamHC_t* LZ4_createStreamHC(void) { - LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t)); - if (LZ4_streamHCPtr==NULL) return NULL; - LZ4_resetStreamHC(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT); - return LZ4_streamHCPtr; +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) +LZ4_streamHC_t* LZ4_createStreamHC(void) +{ + LZ4_streamHC_t* const state = + (LZ4_streamHC_t*)ALLOC_AND_ZERO(sizeof(LZ4_streamHC_t)); + if (state == NULL) return NULL; + LZ4_setCompressionLevel(state, LZ4HC_CLEVEL_DEFAULT); + return state; } -int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) { +int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) +{ DEBUGLOG(4, "LZ4_freeStreamHC(%p)", LZ4_streamHCPtr); if (!LZ4_streamHCPtr) return 0; /* support free on NULL */ - free(LZ4_streamHCPtr); + FREEMEM(LZ4_streamHCPtr); return 0; } +#endif -/* initialization */ +LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size) +{ + LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)buffer; + DEBUGLOG(4, "LZ4_initStreamHC(%p, %u)", buffer, (unsigned)size); + /* check conditions */ + if (buffer == NULL) return NULL; + if (size < sizeof(LZ4_streamHC_t)) return NULL; + if (!LZ4_isAligned(buffer, LZ4_streamHC_t_alignment())) return NULL; + /* init */ + { LZ4HC_CCtx_internal* const hcstate = &(LZ4_streamHCPtr->internal_donotuse); + MEM_INIT(hcstate, 0, sizeof(*hcstate)); } + LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT); + return LZ4_streamHCPtr; +} + +/* just a stub */ void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) { - LZ4_STATIC_ASSERT(sizeof(LZ4HC_CCtx_internal) <= sizeof(size_t) * LZ4_STREAMHCSIZE_SIZET); /* if compilation fails here, LZ4_STREAMHCSIZE must be increased */ - DEBUGLOG(4, "LZ4_resetStreamHC(%p, %d)", LZ4_streamHCPtr, compressionLevel); - LZ4_streamHCPtr->internal_donotuse.end = (const BYTE *)(ptrdiff_t)-1; - LZ4_streamHCPtr->internal_donotuse.base = NULL; - LZ4_streamHCPtr->internal_donotuse.dictCtx = NULL; - LZ4_streamHCPtr->internal_donotuse.favorDecSpeed = 0; - LZ4_streamHCPtr->internal_donotuse.dirty = 0; + LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr)); LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel); } @@ -909,17 +1034,23 @@ void LZ4_resetStreamHC_fast (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLev { DEBUGLOG(4, "LZ4_resetStreamHC_fast(%p, %d)", LZ4_streamHCPtr, compressionLevel); if (LZ4_streamHCPtr->internal_donotuse.dirty) { - LZ4_resetStreamHC(LZ4_streamHCPtr, compressionLevel); + LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr)); } else { - LZ4_streamHCPtr->internal_donotuse.end -= (uptrval)LZ4_streamHCPtr->internal_donotuse.base; - LZ4_streamHCPtr->internal_donotuse.base = NULL; + /* preserve end - prefixStart : can trigger clearTable's threshold */ + if (LZ4_streamHCPtr->internal_donotuse.end != NULL) { + LZ4_streamHCPtr->internal_donotuse.end -= (uptrval)LZ4_streamHCPtr->internal_donotuse.prefixStart; + } else { + assert(LZ4_streamHCPtr->internal_donotuse.prefixStart == NULL); + } + LZ4_streamHCPtr->internal_donotuse.prefixStart = NULL; LZ4_streamHCPtr->internal_donotuse.dictCtx = NULL; - LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel); } + LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel); } void LZ4_setCompressionLevel(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) { + DEBUGLOG(5, "LZ4_setCompressionLevel(%p, %d)", LZ4_streamHCPtr, compressionLevel); if (compressionLevel < 1) compressionLevel = LZ4HC_CLEVEL_DEFAULT; if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX; LZ4_streamHCPtr->internal_donotuse.compressionLevel = (short)compressionLevel; @@ -930,16 +1061,24 @@ void LZ4_favorDecompressionSpeed(LZ4_streamHC_t* LZ4_streamHCPtr, int favor) LZ4_streamHCPtr->internal_donotuse.favorDecSpeed = (favor!=0); } -int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, const char* dictionary, int dictSize) +/* LZ4_loadDictHC() : + * LZ4_streamHCPtr is presumed properly initialized */ +int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, + const char* dictionary, int dictSize) { LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse; - DEBUGLOG(4, "LZ4_loadDictHC(%p, %p, %d)", LZ4_streamHCPtr, dictionary, dictSize); + DEBUGLOG(4, "LZ4_loadDictHC(ctx:%p, dict:%p, dictSize:%d)", LZ4_streamHCPtr, dictionary, dictSize); + assert(LZ4_streamHCPtr != NULL); if (dictSize > 64 KB) { - dictionary += dictSize - 64 KB; + dictionary += (size_t)dictSize - 64 KB; dictSize = 64 KB; } - LZ4_resetStreamHC(LZ4_streamHCPtr, ctxPtr->compressionLevel); - LZ4HC_init (ctxPtr, (const BYTE*)dictionary); + /* need a full initialization, there are bad side-effects when using resetFast() */ + { int const cLevel = ctxPtr->compressionLevel; + LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr)); + LZ4_setCompressionLevel(LZ4_streamHCPtr, cLevel); + } + LZ4HC_init_internal (ctxPtr, (const BYTE*)dictionary); ctxPtr->end = (const BYTE*)dictionary + dictSize; if (dictSize >= 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); return dictSize; @@ -954,48 +1093,57 @@ void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock) { DEBUGLOG(4, "LZ4HC_setExternalDict(%p, %p)", ctxPtr, newBlock); - if (ctxPtr->end >= ctxPtr->base + ctxPtr->dictLimit + 4) + if (ctxPtr->end >= ctxPtr->prefixStart + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ /* Only one memory segment for extDict, so any previous extDict is lost at this stage */ ctxPtr->lowLimit = ctxPtr->dictLimit; - ctxPtr->dictLimit = (U32)(ctxPtr->end - ctxPtr->base); - ctxPtr->dictBase = ctxPtr->base; - ctxPtr->base = newBlock - ctxPtr->dictLimit; + ctxPtr->dictStart = ctxPtr->prefixStart; + ctxPtr->dictLimit += (U32)(ctxPtr->end - ctxPtr->prefixStart); + ctxPtr->prefixStart = newBlock; ctxPtr->end = newBlock; ctxPtr->nextToUpdate = ctxPtr->dictLimit; /* match referencing will resume from there */ + + /* cannot reference an extDict and a dictCtx at the same time */ + ctxPtr->dictCtx = NULL; } -static int LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, - const char* src, char* dst, - int* srcSizePtr, int dstCapacity, - limitedOutput_directive limit) +static int +LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, + const char* src, char* dst, + int* srcSizePtr, int dstCapacity, + limitedOutput_directive limit) { LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse; - DEBUGLOG(4, "LZ4_compressHC_continue_generic(%p, %p, %d)", LZ4_streamHCPtr, src, *srcSizePtr); + DEBUGLOG(5, "LZ4_compressHC_continue_generic(ctx=%p, src=%p, srcSize=%d, limit=%d)", + LZ4_streamHCPtr, src, *srcSizePtr, limit); + assert(ctxPtr != NULL); /* auto-init if forgotten */ - if (ctxPtr->base == NULL) LZ4HC_init (ctxPtr, (const BYTE*) src); + if (ctxPtr->prefixStart == NULL) LZ4HC_init_internal (ctxPtr, (const BYTE*) src); /* Check overflow */ - if ((size_t)(ctxPtr->end - ctxPtr->base) > 2 GB) { - size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->base) - ctxPtr->dictLimit; + if ((size_t)(ctxPtr->end - ctxPtr->prefixStart) + ctxPtr->dictLimit > 2 GB) { + size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->prefixStart); if (dictSize > 64 KB) dictSize = 64 KB; LZ4_loadDictHC(LZ4_streamHCPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize); } /* Check if blocks follow each other */ - if ((const BYTE*)src != ctxPtr->end) LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src); + if ((const BYTE*)src != ctxPtr->end) + LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src); /* Check overlapping input/dictionary space */ { const BYTE* sourceEnd = (const BYTE*) src + *srcSizePtr; - const BYTE* const dictBegin = ctxPtr->dictBase + ctxPtr->lowLimit; - const BYTE* const dictEnd = ctxPtr->dictBase + ctxPtr->dictLimit; + const BYTE* const dictBegin = ctxPtr->dictStart; + const BYTE* const dictEnd = ctxPtr->dictStart + (ctxPtr->dictLimit - ctxPtr->lowLimit); if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) { if (sourceEnd > dictEnd) sourceEnd = dictEnd; - ctxPtr->lowLimit = (U32)(sourceEnd - ctxPtr->dictBase); - if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) ctxPtr->lowLimit = ctxPtr->dictLimit; - } - } + ctxPtr->lowLimit += (U32)(sourceEnd - ctxPtr->dictStart); + ctxPtr->dictStart += (U32)(sourceEnd - ctxPtr->dictStart); + if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) { + ctxPtr->lowLimit = ctxPtr->dictLimit; + ctxPtr->dictStart = ctxPtr->prefixStart; + } } } return LZ4HC_compress_generic (ctxPtr, src, dst, srcSizePtr, dstCapacity, ctxPtr->compressionLevel, limit); } @@ -1005,43 +1153,53 @@ int LZ4_compress_HC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, if (dstCapacity < LZ4_compressBound(srcSize)) return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, limitedOutput); else - return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, noLimit); + return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, notLimited); } int LZ4_compress_HC_continue_destSize (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, int* srcSizePtr, int targetDestSize) { - return LZ4_compressHC_continue_generic(LZ4_streamHCPtr, src, dst, srcSizePtr, targetDestSize, limitedDestSize); + return LZ4_compressHC_continue_generic(LZ4_streamHCPtr, src, dst, srcSizePtr, targetDestSize, fillOutput); } -/* dictionary saving */ - +/* LZ4_saveDictHC : + * save history content + * into a user-provided buffer + * which is then used to continue compression + */ int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictSize) { LZ4HC_CCtx_internal* const streamPtr = &LZ4_streamHCPtr->internal_donotuse; - int const prefixSize = (int)(streamPtr->end - (streamPtr->base + streamPtr->dictLimit)); - DEBUGLOG(4, "LZ4_saveDictHC(%p, %p, %d)", LZ4_streamHCPtr, safeBuffer, dictSize); + int const prefixSize = (int)(streamPtr->end - streamPtr->prefixStart); + DEBUGLOG(5, "LZ4_saveDictHC(%p, %p, %d)", LZ4_streamHCPtr, safeBuffer, dictSize); + assert(prefixSize >= 0); if (dictSize > 64 KB) dictSize = 64 KB; if (dictSize < 4) dictSize = 0; if (dictSize > prefixSize) dictSize = prefixSize; - memmove(safeBuffer, streamPtr->end - dictSize, dictSize); - { U32 const endIndex = (U32)(streamPtr->end - streamPtr->base); + if (safeBuffer == NULL) assert(dictSize == 0); + if (dictSize > 0) + LZ4_memmove(safeBuffer, streamPtr->end - dictSize, dictSize); + { U32 const endIndex = (U32)(streamPtr->end - streamPtr->prefixStart) + streamPtr->dictLimit; streamPtr->end = (const BYTE*)safeBuffer + dictSize; - streamPtr->base = streamPtr->end - endIndex; - streamPtr->dictLimit = endIndex - dictSize; - streamPtr->lowLimit = endIndex - dictSize; - if (streamPtr->nextToUpdate < streamPtr->dictLimit) streamPtr->nextToUpdate = streamPtr->dictLimit; + streamPtr->prefixStart = streamPtr->end - dictSize; + streamPtr->dictLimit = endIndex - (U32)dictSize; + streamPtr->lowLimit = endIndex - (U32)dictSize; + streamPtr->dictStart = streamPtr->prefixStart; + if (streamPtr->nextToUpdate < streamPtr->dictLimit) + streamPtr->nextToUpdate = streamPtr->dictLimit; } return dictSize; } -/*********************************** +/*************************************************** * Deprecated Functions -***********************************/ +***************************************************/ + /* These functions currently generate deprecation warnings */ -/* Deprecated compression functions */ + +/* Wrappers for deprecated compression functions */ int LZ4_compressHC(const char* src, char* dst, int srcSize) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), 0); } int LZ4_compressHC_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC(src, dst, srcSize, maxDstSize, 0); } int LZ4_compressHC2(const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compress_HC (src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } @@ -1055,35 +1213,38 @@ int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* ctx, const char* src, /* Deprecated streaming functions */ -int LZ4_sizeofStreamStateHC(void) { return LZ4_STREAMHCSIZE; } +int LZ4_sizeofStreamStateHC(void) { return sizeof(LZ4_streamHC_t); } +/* state is presumed correctly sized, aka >= sizeof(LZ4_streamHC_t) + * @return : 0 on success, !=0 if error */ int LZ4_resetStreamStateHC(void* state, char* inputBuffer) { - LZ4HC_CCtx_internal *ctx = &((LZ4_streamHC_t*)state)->internal_donotuse; - if ((((size_t)state) & (sizeof(void*)-1)) != 0) return 1; /* Error : pointer is not aligned for pointer (32 or 64 bits) */ - LZ4_resetStreamHC((LZ4_streamHC_t*)state, ((LZ4_streamHC_t*)state)->internal_donotuse.compressionLevel); - LZ4HC_init(ctx, (const BYTE*)inputBuffer); + LZ4_streamHC_t* const hc4 = LZ4_initStreamHC(state, sizeof(*hc4)); + if (hc4 == NULL) return 1; /* init failed */ + LZ4HC_init_internal (&hc4->internal_donotuse, (const BYTE*)inputBuffer); return 0; } +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) void* LZ4_createHC (const char* inputBuffer) { - LZ4_streamHC_t* hc4 = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t)); + LZ4_streamHC_t* const hc4 = LZ4_createStreamHC(); if (hc4 == NULL) return NULL; /* not enough memory */ - LZ4_resetStreamHC(hc4, 0 /* compressionLevel */); - LZ4HC_init (&hc4->internal_donotuse, (const BYTE*)inputBuffer); + LZ4HC_init_internal (&hc4->internal_donotuse, (const BYTE*)inputBuffer); return hc4; } -int LZ4_freeHC (void* LZ4HC_Data) { +int LZ4_freeHC (void* LZ4HC_Data) +{ if (!LZ4HC_Data) return 0; /* support free on NULL */ FREEMEM(LZ4HC_Data); return 0; } +#endif int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int cLevel) { - return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, 0, cLevel, noLimit); + return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, 0, cLevel, notLimited); } int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int dstCapacity, int cLevel) @@ -1093,16 +1254,16 @@ int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* src, c char* LZ4_slideInputBufferHC(void* LZ4HC_Data) { - LZ4_streamHC_t *ctx = (LZ4_streamHC_t*)LZ4HC_Data; - const BYTE *bufferStart = ctx->internal_donotuse.base + ctx->internal_donotuse.lowLimit; + LZ4_streamHC_t* const ctx = (LZ4_streamHC_t*)LZ4HC_Data; + const BYTE* bufferStart = ctx->internal_donotuse.prefixStart - ctx->internal_donotuse.dictLimit + ctx->internal_donotuse.lowLimit; LZ4_resetStreamHC_fast(ctx, ctx->internal_donotuse.compressionLevel); /* avoid const char * -> char * conversion warning :( */ - return (char *)(uptrval)bufferStart; + return (char*)(uptrval)bufferStart; } /* ================================================ - * LZ4 Optimal parser (levels 10-12) + * LZ4 Optimal parser (levels [LZ4HC_CLEVEL_OPT_MIN - LZ4HC_CLEVEL_MAX]) * ===============================================*/ typedef struct { int price; @@ -1115,8 +1276,9 @@ typedef struct { LZ4_FORCE_INLINE int LZ4HC_literalsPrice(int const litlen) { int price = litlen; + assert(litlen >= 0); if (litlen >= (int)RUN_MASK) - price += 1 + (litlen-RUN_MASK)/255; + price += 1 + ((litlen-(int)RUN_MASK) / 255); return price; } @@ -1125,11 +1287,13 @@ LZ4_FORCE_INLINE int LZ4HC_literalsPrice(int const litlen) LZ4_FORCE_INLINE int LZ4HC_sequencePrice(int litlen, int mlen) { int price = 1 + 2 ; /* token + 16-bit offset */ + assert(litlen >= 0); + assert(mlen >= MINMATCH); price += LZ4HC_literalsPrice(litlen); if (mlen >= (int)(ML_MASK+MINMATCH)) - price += 1 + (mlen-(ML_MASK+MINMATCH))/255; + price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255); return price; } @@ -1175,8 +1339,13 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, const dictCtx_directive dict, const HCfavor_e favorDecSpeed) { + int retval = 0; #define TRAILING_LITERALS 3 +#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 + LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS)); +#else LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS]; /* ~64 KB, which is a bit large for stack... */ +#endif const BYTE* ip = (const BYTE*) source; const BYTE* anchor = ip; @@ -1186,15 +1355,19 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, BYTE* op = (BYTE*) dst; BYTE* opSaved = (BYTE*) dst; BYTE* oend = op + dstCapacity; + int ovml = MINMATCH; /* overflow - last sequence */ + const BYTE* ovref = NULL; /* init */ - DEBUGLOG(5, "LZ4HC_compress_optimal"); +#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 + if (opt == NULL) goto _return_label; +#endif + DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity); *srcSizePtr = 0; - if (limit == limitedDestSize) oend -= LASTLITERALS; /* Hack for support LZ4 format restriction */ + if (limit == fillOutput) oend -= LASTLITERALS; /* Hack for support LZ4 format restriction */ if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1; /* Main Loop */ - assert(ip - anchor < LZ4_MAX_INPUT_SIZE); while (ip <= mflimit) { int const llen = (int)(ip - anchor); int best_mlen, best_off; @@ -1208,8 +1381,11 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, int const firstML = firstMatch.len; const BYTE* const matchPos = ip - firstMatch.off; opSaved = op; - if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), firstML, matchPos, limit, oend) ) /* updates ip, op and anchor */ + if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), firstML, matchPos, limit, oend) ) { /* updates ip, op and anchor */ + ovml = firstML; + ovref = matchPos; goto _dest_overflow; + } continue; } @@ -1346,11 +1522,12 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, } } } /* for (cur = 1; cur <= last_match_pos; cur++) */ + assert(last_match_pos < LZ4_OPT_NUM + TRAILING_LITERALS); best_mlen = opt[last_match_pos].mlen; best_off = opt[last_match_pos].off; cur = last_match_pos - best_mlen; - encode: /* cur, last_match_pos, best_mlen, best_off must be set */ +encode: /* cur, last_match_pos, best_mlen, best_off must be set */ assert(cur < LZ4_OPT_NUM); assert(last_match_pos >= 1); /* == 1 when only one candidate */ DEBUGLOG(6, "reverse traversal, looking for shortest path (last_match_pos=%i)", last_match_pos); @@ -1378,27 +1555,33 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, if (ml == 1) { ip++; rPos++; continue; } /* literal; note: can end up with several literals, in which case, skip them */ rPos += ml; assert(ml >= MINMATCH); - assert((offset >= 1) && (offset <= MAX_DISTANCE)); + assert((offset >= 1) && (offset <= LZ4_DISTANCE_MAX)); opSaved = op; - if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ip - offset, limit, oend) ) /* updates ip, op and anchor */ + if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ip - offset, limit, oend) ) { /* updates ip, op and anchor */ + ovml = ml; + ovref = ip - offset; goto _dest_overflow; - } } + } } } } /* while (ip <= mflimit) */ - _last_literals: +_last_literals: /* Encode Last Literals */ { size_t lastRunSize = (size_t)(iend - anchor); /* literals */ - size_t litLength = (lastRunSize + 255 - RUN_MASK) / 255; - size_t const totalSize = 1 + litLength + lastRunSize; - if (limit == limitedDestSize) oend += LASTLITERALS; /* restore correct value */ + size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255; + size_t const totalSize = 1 + llAdd + lastRunSize; + if (limit == fillOutput) oend += LASTLITERALS; /* restore correct value */ if (limit && (op + totalSize > oend)) { - if (limit == limitedOutput) return 0; /* Check output limit */ + if (limit == limitedOutput) { /* Check output limit */ + retval = 0; + goto _return_label; + } /* adapt lastRunSize to fill 'dst' */ - lastRunSize = (size_t)(oend - op) - 1; - litLength = (lastRunSize + 255 - RUN_MASK) / 255; - lastRunSize -= litLength; + lastRunSize = (size_t)(oend - op) - 1 /*token*/; + llAdd = (lastRunSize + 256 - RUN_MASK) / 256; + lastRunSize -= llAdd; } - ip = anchor + lastRunSize; + DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize); + ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */ if (lastRunSize >= RUN_MASK) { size_t accumulator = lastRunSize - RUN_MASK; @@ -1408,18 +1591,41 @@ static int LZ4HC_compress_optimal ( LZ4HC_CCtx_internal* ctx, } else { *op++ = (BYTE)(lastRunSize << ML_BITS); } - memcpy(op, anchor, lastRunSize); + LZ4_memcpy(op, anchor, lastRunSize); op += lastRunSize; } /* End */ *srcSizePtr = (int) (((const char*)ip) - source); - return (int) ((char*)op-dst); + retval = (int) ((char*)op-dst); + goto _return_label; - _dest_overflow: - if (limit == limitedDestSize) { - op = opSaved; /* restore correct out pointer */ - goto _last_literals; - } - return 0; - } +_dest_overflow: +if (limit == fillOutput) { + /* Assumption : ip, anchor, ovml and ovref must be set correctly */ + size_t const ll = (size_t)(ip - anchor); + size_t const ll_addbytes = (ll + 240) / 255; + size_t const ll_totalCost = 1 + ll_addbytes + ll; + BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */ + DEBUGLOG(6, "Last sequence overflowing (only %i bytes remaining)", (int)(oend-1-opSaved)); + op = opSaved; /* restore correct out pointer */ + if (op + ll_totalCost <= maxLitPos) { + /* ll validated; now adjust match length */ + size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost)); + size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255); + assert(maxMlSize < INT_MAX); assert(ovml >= 0); + if ((size_t)ovml > maxMlSize) ovml = (int)maxMlSize; + if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ovml >= MFLIMIT) { + DEBUGLOG(6, "Space to end : %i + ml (%i)", (int)((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1), ovml); + DEBUGLOG(6, "Before : ip = %p, anchor = %p", ip, anchor); + LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ovml, ovref, notLimited, oend); + DEBUGLOG(6, "After : ip = %p, anchor = %p", ip, anchor); + } } + goto _last_literals; +} +_return_label: +#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 + FREEMEM(opt); +#endif + return retval; +} diff --git a/cdk/extra/lz4/lz4hc.h b/cdk/extra/lz4/lib/lz4hc.h similarity index 64% rename from cdk/extra/lz4/lz4hc.h rename to cdk/extra/lz4/lib/lz4hc.h index d3fb59487..e937acfef 100644 --- a/cdk/extra/lz4/lz4hc.h +++ b/cdk/extra/lz4/lib/lz4hc.h @@ -1,7 +1,7 @@ /* LZ4 HC - High Compression Mode of LZ4 Header File - Copyright (C) 2011-2017, Yann Collet. + Copyright (C) 2011-2020, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without @@ -54,7 +54,7 @@ extern "C" { * Block Compression **************************************/ /*! LZ4_compress_HC() : - * Compress data from `src` into `dst`, using the more powerful but slower "HC" algorithm. + * Compress data from `src` into `dst`, using the powerful but slower "HC" algorithm. * `dst` must be already allocated. * Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h") * Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h") @@ -77,7 +77,21 @@ LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dst * Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly). */ LZ4LIB_API int LZ4_sizeofStateHC(void); -LZ4LIB_API int LZ4_compress_HC_extStateHC(void* state, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); +LZ4LIB_API int LZ4_compress_HC_extStateHC(void* stateHC, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel); + + +/*! LZ4_compress_HC_destSize() : v1.9.0+ + * Will compress as much data as possible from `src` + * to fit into `targetDstSize` budget. + * Result is provided in 2 parts : + * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) + * or 0 if compression fails. + * `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src` + */ +LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC, + const char* src, char* dst, + int* srcSizePtr, int targetDstSize, + int compressionLevel); /*-************************************ @@ -89,39 +103,77 @@ LZ4LIB_API int LZ4_compress_HC_extStateHC(void* state, const char* src, char* ds /*! LZ4_createStreamHC() and LZ4_freeStreamHC() : * These functions create and release memory for LZ4 HC streaming state. * Newly created states are automatically initialized. - * Existing states can be re-used several times, using LZ4_resetStreamHC(). - * These methods are API and ABI stable, they can be used in combination with a DLL. + * A same state can be used multiple times consecutively, + * starting with LZ4_resetStreamHC_fast() to start a new stream of blocks. */ LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void); LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); -LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); -LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); - -LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, const char* src, char* dst, int srcSize, int maxDstSize); - -LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize); - /* - These functions compress data in successive blocks of any size, using previous blocks as dictionary. + These functions compress data in successive blocks of any size, + using previous blocks as dictionary, to improve compression ratio. One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks. There is an exception for ring buffers, which can be smaller than 64 KB. - Ring buffers scenario is automatically detected and handled by LZ4_compress_HC_continue(). + Ring-buffer scenario is automatically detected and handled within LZ4_compress_HC_continue(). + + Before starting compression, state must be allocated and properly initialized. + LZ4_createStreamHC() does both, though compression level is set to LZ4HC_CLEVEL_DEFAULT. + + Selecting the compression level can be done with LZ4_resetStreamHC_fast() (starts a new stream) + or LZ4_setCompressionLevel() (anytime, between blocks in the same stream) (experimental). + LZ4_resetStreamHC_fast() only works on states which have been properly initialized at least once, + which is automatically the case when state is created using LZ4_createStreamHC(). + + After reset, a first "fictional block" can be designated as initial dictionary, + using LZ4_loadDictHC() (Optional). + + Invoke LZ4_compress_HC_continue() to compress each successive block. + The number of blocks is unlimited. + Previous input blocks, including initial dictionary when present, + must remain accessible and unmodified during compression. + + It's allowed to update compression level anytime between blocks, + using LZ4_setCompressionLevel() (experimental). + + 'dst' buffer should be sized to handle worst case scenarios + (see LZ4_compressBound(), it ensures compression success). + In case of failure, the API does not guarantee recovery, + so the state _must_ be reset. + To ensure compression success + whenever `dst` buffer size cannot be made >= LZ4_compressBound(), + consider using LZ4_compress_HC_continue_destSize(). + + Whenever previous input blocks can't be preserved unmodified in-place during compression of next blocks, + it's possible to copy the last blocks into a more stable memory space, using LZ4_saveDictHC(). + Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer' (<= 64 KB) + + After completing a streaming compression, + it's possible to start a new stream of blocks, using the same LZ4_streamHC_t state, + just by resetting it, using LZ4_resetStreamHC_fast(). +*/ - Before starting compression, state must be properly initialized, using LZ4_resetStreamHC(). - A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional). +LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */ +LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); - Then, use LZ4_compress_HC_continue() to compress each successive block. - Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression. - 'dst' buffer should be sized to handle worst case scenarios (see LZ4_compressBound()), to ensure operation success. - Because in case of failure, the API does not guarantee context recovery, and context will have to be reset. - If `dst` buffer budget cannot be >= LZ4_compressBound(), consider using LZ4_compress_HC_continue_destSize() instead. +LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, + const char* src, char* dst, + int srcSize, int maxDstSize); - If, for any reason, previous data block can't be preserved unmodified in memory for next compression block, - you can save it to a more stable memory space, using LZ4_saveDictHC(). - Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer'. -*/ +/*! LZ4_compress_HC_continue_destSize() : v1.9.0+ + * Similar to LZ4_compress_HC_continue(), + * but will read as much data as possible from `src` + * to fit into `targetDstSize` budget. + * Result is provided into 2 parts : + * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) + * or 0 if compression fails. + * `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`. + * Note that this function may not consume the entire input. + */ +LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr, + const char* src, char* dst, + int* srcSizePtr, int targetDstSize); +LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize); @@ -146,66 +198,52 @@ LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, in #define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1) -#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -#include - -typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal; -struct LZ4HC_CCtx_internal -{ - uint32_t hashTable[LZ4HC_HASHTABLESIZE]; - uint16_t chainTable[LZ4HC_MAXD]; - const uint8_t* end; /* next block here to continue on current prefix */ - const uint8_t* base; /* All index relative to this position */ - const uint8_t* dictBase; /* alternate base for extDict */ - uint32_t dictLimit; /* below that point, need extDict */ - uint32_t lowLimit; /* below that point, no more dict */ - uint32_t nextToUpdate; /* index from which to continue dictionary update */ - short compressionLevel; - int8_t favorDecSpeed; /* favor decompression speed if this flag set, - otherwise, favor compression ratio */ - int8_t dirty; /* stream has to be fully reset if this flag is set */ - const LZ4HC_CCtx_internal* dictCtx; -}; - -#else - +/* Never ever use these definitions directly ! + * Declare or allocate an LZ4_streamHC_t instead. +**/ typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal; struct LZ4HC_CCtx_internal { - unsigned int hashTable[LZ4HC_HASHTABLESIZE]; - unsigned short chainTable[LZ4HC_MAXD]; - const unsigned char* end; /* next block here to continue on current prefix */ - const unsigned char* base; /* All index relative to this position */ - const unsigned char* dictBase; /* alternate base for extDict */ - unsigned int dictLimit; /* below that point, need extDict */ - unsigned int lowLimit; /* below that point, no more dict */ - unsigned int nextToUpdate; /* index from which to continue dictionary update */ - short compressionLevel; - char favorDecSpeed; /* favor decompression speed if this flag set, - otherwise, favor compression ratio */ - char dirty; /* stream has to be fully reset if this flag is set */ + LZ4_u32 hashTable[LZ4HC_HASHTABLESIZE]; + LZ4_u16 chainTable[LZ4HC_MAXD]; + const LZ4_byte* end; /* next block here to continue on current prefix */ + const LZ4_byte* prefixStart; /* Indexes relative to this position */ + const LZ4_byte* dictStart; /* alternate reference for extDict */ + LZ4_u32 dictLimit; /* below that point, need extDict */ + LZ4_u32 lowLimit; /* below that point, no more dict */ + LZ4_u32 nextToUpdate; /* index from which to continue dictionary update */ + short compressionLevel; + LZ4_i8 favorDecSpeed; /* favor decompression speed if this flag set, + otherwise, favor compression ratio */ + LZ4_i8 dirty; /* stream has to be fully reset if this flag is set */ const LZ4HC_CCtx_internal* dictCtx; }; -#endif - - -/* do not use these definitions directly. - * allocate an LZ4_streamHC_t instead. */ -#define LZ4_STREAMHCSIZE (4*LZ4HC_HASHTABLESIZE + 2*LZ4HC_MAXD + 56 + ((sizeof(void*)==16) ? 56 : 0) /* AS400*/ ) /* 262200 or 262256*/ -#define LZ4_STREAMHCSIZE_SIZET (LZ4_STREAMHCSIZE / sizeof(size_t)) +#define LZ4_STREAMHC_MINSIZE 262200 /* static size, for inter-version compatibility */ union LZ4_streamHC_u { - size_t table[LZ4_STREAMHCSIZE_SIZET]; + char minStateSize[LZ4_STREAMHC_MINSIZE]; LZ4HC_CCtx_internal internal_donotuse; }; /* previously typedef'd to LZ4_streamHC_t */ + /* LZ4_streamHC_t : * This structure allows static allocation of LZ4 HC streaming state. - * State must be initialized using LZ4_resetStreamHC() before first use. + * This can be used to allocate statically on stack, or as part of a larger structure. + * + * Such state **must** be initialized using LZ4_initStreamHC() before first use. + * + * Note that invoking LZ4_initStreamHC() is not required when + * the state was created using LZ4_createStreamHC() (which is recommended). + * Using the normal builder, a newly created state is automatically initialized. * * Static allocation shall only be used in combination with static linking. - * When invoking LZ4 from a DLL, use create/free functions instead, which are API and ABI stable. */ +/* LZ4_initStreamHC() : v1.9.0+ + * Required before first use of a statically allocated LZ4_streamHC_t. + * Before v1.9.0 : use LZ4_resetStreamHC() instead + */ +LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC(void* buffer, size_t size); + /*-************************************ * Deprecated Functions @@ -215,11 +253,11 @@ union LZ4_streamHC_u { /* deprecated compression functions */ LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC (const char* source, char* dest, int inputSize); LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize); -LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel); -LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); +LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel); +LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize); LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); -LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel); +LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel); LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize); LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize); @@ -232,13 +270,26 @@ LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_comp * LZ4_slideInputBufferHC() will truncate the history of the stream, rather * than preserve a window-sized chunk of history. */ +#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API void* LZ4_createHC (const char* inputBuffer); -LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char* LZ4_slideInputBufferHC (void* LZ4HC_Data); LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") LZ4LIB_API int LZ4_freeHC (void* LZ4HC_Data); -LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); +#endif +LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char* LZ4_slideInputBufferHC (void* LZ4HC_Data); +LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API int LZ4_sizeofStreamStateHC(void); -LZ4_DEPRECATED("use LZ4_resetStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void* state, char* inputBuffer); +LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void* state, char* inputBuffer); + + +/* LZ4_resetStreamHC() is now replaced by LZ4_initStreamHC(). + * The intention is to emphasize the difference with LZ4_resetStreamHC_fast(), + * which is now the recommended function to start a new stream of blocks, + * but cannot be used to initialize a memory segment containing arbitrary garbage data. + * + * It is recommended to switch to LZ4_initStreamHC(). + * LZ4_resetStreamHC() will generate deprecation warnings in a future version. + */ +LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); #if defined (__cplusplus) @@ -254,58 +305,35 @@ LZ4_DEPRECATED("use LZ4_resetStreamHC() instead") LZ4LIB_API int LZ4_resetStr * They should not be linked from DLL, * as there is no guarantee of API stability yet. * Prototypes will be promoted to "stable" status - * after successfull usage in real-life scenarios. + * after successful usage in real-life scenarios. ***************************************************/ #ifdef LZ4_HC_STATIC_LINKING_ONLY /* protection macro */ #ifndef LZ4_HC_SLO_098092834 #define LZ4_HC_SLO_098092834 +#define LZ4_STATIC_LINKING_ONLY /* LZ4LIB_STATIC_API */ +#include "lz4.h" + #if defined (__cplusplus) extern "C" { #endif -/*! LZ4_compress_HC_destSize() : v1.8.0 (experimental) - * Will try to compress as much data from `src` as possible - * that can fit into `targetDstSize` budget. - * Result is provided in 2 parts : - * @return : the number of bytes written into 'dst' - * or 0 if compression fails. - * `srcSizePtr` : value will be updated to indicate how much bytes were read from `src` - */ -LZ4LIB_STATIC_API int LZ4_compress_HC_destSize( - void* LZ4HC_Data, - const char* src, char* dst, - int* srcSizePtr, int targetDstSize, - int compressionLevel); - -/*! LZ4_compress_HC_continue_destSize() : v1.8.0 (experimental) - * Similar as LZ4_compress_HC_continue(), - * but will read a variable nb of bytes from `src` - * to fit into `targetDstSize` budget. - * Result is provided in 2 parts : - * @return : the number of bytes written into 'dst' - * or 0 if compression fails. - * `srcSizePtr` : value will be updated to indicate how much bytes were read from `src`. - */ -LZ4LIB_STATIC_API int LZ4_compress_HC_continue_destSize( - LZ4_streamHC_t* LZ4_streamHCPtr, - const char* src, char* dst, - int* srcSizePtr, int targetDstSize); - -/*! LZ4_setCompressionLevel() : v1.8.0 (experimental) - * It's possible to change compression level between 2 invocations of LZ4_compress_HC_continue*() +/*! LZ4_setCompressionLevel() : v1.8.0+ (experimental) + * It's possible to change compression level + * between successive invocations of LZ4_compress_HC_continue*() + * for dynamic adaptation. */ LZ4LIB_STATIC_API void LZ4_setCompressionLevel( LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel); -/*! LZ4_favorDecompressionSpeed() : v1.8.2 (experimental) - * Parser will select decisions favoring decompression over compression ratio. - * Only work at highest compression settings (level >= LZ4HC_CLEVEL_OPT_MIN) +/*! LZ4_favorDecompressionSpeed() : v1.8.2+ (experimental) + * Opt. Parser will favor decompression speed over compression ratio. + * Only applicable to levels >= LZ4HC_CLEVEL_OPT_MIN. */ LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed( LZ4_streamHC_t* LZ4_streamHCPtr, int favor); -/*! LZ4_resetStreamHC_fast() : +/*! LZ4_resetStreamHC_fast() : v1.9.0+ * When an LZ4_streamHC_t is known to be in a internally coherent state, * it can often be prepared for a new compression with almost no work, only * sometimes falling back to the full, expensive reset that is always required diff --git a/cdk/extra/lz4/xxhash.c b/cdk/extra/lz4/lib/xxhash.c similarity index 100% rename from cdk/extra/lz4/xxhash.c rename to cdk/extra/lz4/lib/xxhash.c diff --git a/cdk/extra/lz4/xxhash.h b/cdk/extra/lz4/lib/xxhash.h similarity index 100% rename from cdk/extra/lz4/xxhash.h rename to cdk/extra/lz4/lib/xxhash.h diff --git a/cdk/extra/lz4/my_xxhash.h b/cdk/extra/lz4/my_xxhash.h deleted file mode 100644 index b8d04004c..000000000 --- a/cdk/extra/lz4/my_xxhash.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MY_XXHASH_H_INCLUDED -#define MY_XXHASH_H_INCLUDED - -/* - Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -// Define a namespace prefix to all xxhash functions. This is done to -// avoid conflict with xxhash symbols in liblz4. -#define XXH_NAMESPACE MY_ - -#include "xxhash.h" // IWYU pragma: export - -#endif // MY_XXHASH_H_INCLUDED diff --git a/cdk/extra/ngs_mockup/CMakeLists.txt b/cdk/extra/ngs_mockup/CMakeLists.txt index 5b6b45b69..3c69f40ba 100644 --- a/cdk/extra/ngs_mockup/CMakeLists.txt +++ b/cdk/extra/ngs_mockup/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA CMAKE_MINIMUM_REQUIRED(VERSION 2.8) diff --git a/cdk/extra/ngs_mockup/ngs_mockup.cc b/cdk/extra/ngs_mockup/ngs_mockup.cc index c231f74c3..ab48e8e90 100644 --- a/cdk/extra/ngs_mockup/ngs_mockup.cc +++ b/cdk/extra/ngs_mockup/ngs_mockup.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* diff --git a/cdk/extra/process_launcher/CMakeLists.txt b/cdk/extra/process_launcher/CMakeLists.txt index 6b09630fc..64e179848 100644 --- a/cdk/extra/process_launcher/CMakeLists.txt +++ b/cdk/extra/process_launcher/CMakeLists.txt @@ -1,21 +1,21 @@ -# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Sample cmakes (keep as reference) diff --git a/cdk/extra/process_launcher/process_launcher.cc b/cdk/extra/process_launcher/process_launcher.cc index 67e2d0488..0d7cfea8d 100644 --- a/cdk/extra/process_launcher/process_launcher.cc +++ b/cdk/extra/process_launcher/process_launcher.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,8 +25,9 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + #include "process_launcher.h" #include "exception.h" diff --git a/cdk/extra/process_launcher/process_launcher.h b/cdk/extra/process_launcher/process_launcher.h index ee45ae649..17df0c90f 100644 --- a/cdk/extra/process_launcher/process_launcher.h +++ b/cdk/extra/process_launcher/process_launcher.h @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of MySQL Connector/C++, is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _PROCESS_LAUNCHER_H_ diff --git a/cdk/extra/process_launcher/tests/gunit_test_main.cc b/cdk/extra/process_launcher/tests/gunit_test_main.cc index 79a153dd8..4360ebb7a 100644 --- a/cdk/extra/process_launcher/tests/gunit_test_main.cc +++ b/cdk/extra/process_launcher/tests/gunit_test_main.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,9 +25,10 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + #include #include diff --git a/cdk/extra/process_launcher/tests/scripts/long_test.py b/cdk/extra/process_launcher/tests/scripts/long_test.py index d8a1db2e2..17d3c6d20 100644 --- a/cdk/extra/process_launcher/tests/scripts/long_test.py +++ b/cdk/extra/process_launcher/tests/scripts/long_test.py @@ -1,22 +1,22 @@ #/usr/bin/env python -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import time diff --git a/cdk/extra/process_launcher/tests/scripts/printn.py b/cdk/extra/process_launcher/tests/scripts/printn.py index fe2293826..0c91f1fc4 100644 --- a/cdk/extra/process_launcher/tests/scripts/printn.py +++ b/cdk/extra/process_launcher/tests/scripts/printn.py @@ -1,22 +1,22 @@ #/usr/bin/env python -# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an -# additional permission to link the program and your derivative works -# with the separately licensed software that they have included with -# MySQL. +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional +# permission to link the program and your derivative works with the +# separately licensed software that they have either included with +# the program or referenced in the documentation. # # Without limiting anything contained in the foregoing, this file, -# which is part of MySQL Connector/C++, is also subject to the +# which is part of Connector/C++, is also subject to the # Universal FOSS Exception, version 1.0, a copy of which can be found at -# http://oss.oracle.com/licenses/universal-foss-exception. +# https://oss.oracle.com/licenses/universal-foss-exception. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import sys diff --git a/cdk/extra/process_launcher/tests/unit_tests.cc b/cdk/extra/process_launcher/tests/unit_tests.cc index 975dadcdf..3734f519b 100644 --- a/cdk/extra/process_launcher/tests/unit_tests.cc +++ b/cdk/extra/process_launcher/tests/unit_tests.cc @@ -1,22 +1,22 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2.0, as * published by the Free Software Foundation. * - * This program is also distributed with certain software (including - * but not limited to OpenSSL) that is licensed under separate terms, - * as designated in a particular file or component or in included license - * documentation. The authors of MySQL hereby grant you an - * additional permission to link the program and your derivative works - * with the separately licensed software that they have included with - * MySQL. + * This program is designed to work with certain software (including + * but not limited to OpenSSL) that is licensed under separate terms, as + * designated in a particular file or component or in included license + * documentation. The authors of MySQL hereby grant you an additional + * permission to link the program and your derivative works with the + * separately licensed software that they have either included with + * the program or referenced in the documentation. * * Without limiting anything contained in the foregoing, this file, - * which is part of , is also subject to the + * which is part of Connector/C++, is also subject to the * Universal FOSS Exception, version 1.0, a copy of which can be found at - * http://oss.oracle.com/licenses/universal-foss-exception. + * https://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +25,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifdef WIN32 @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "process_launcher.h" #include "gtest/gtest.h" diff --git a/cdk/extra/protobuf/CMakeLists.txt b/cdk/extra/protobuf/CMakeLists.txt index 8eb1d1ef0..a787985f5 100644 --- a/cdk/extra/protobuf/CMakeLists.txt +++ b/cdk/extra/protobuf/CMakeLists.txt @@ -1,50 +1,56 @@ -# Copyright (c) 2015, 2020, Oracle and/or its affiliates. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # -# This program is also distributed with certain software (including -# but not limited to OpenSSL) that is licensed under separate terms, -# as designated in a particular file or component or in included license -# documentation. The authors of MySQL hereby grant you an additional +# This program is designed to work with certain software (including +# but not limited to OpenSSL) that is licensed under separate terms, as +# designated in a particular file or component or in included license +# documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the -# separately licensed software that they have included with MySQL. +# separately licensed software that they have either included with +# the program or referenced in the documentation. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License, version 2.0, for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License, version 2.0, for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# The files in protobuf-3.11.4/ are almost unmodified versions of google +# The files in protobuf-3.19.6/ are almost unmodified versions of google # source files taken from protobuf-cpp-3.11.4.tar.gz archive. # Changes: # - remove directories and files -# protobuf-3.11.4/benchmarks/ -# protobuf-3.11.4/conformance/ -# protobuf-3.11.4/editors/ -# protobuf-3.11.4/examples/ -# protobuf-3.11.4/m4/ -# protobuf-3.11.4/objectivec/ -# protobuf-3.11.4/python/ -# protobuf-3.11.4/third_party/ -# protobuf-3.11.4/util/ -# protobuf-3.11.4/ar-lib -# protobuf-3.11.4/compile -# protobuf-3.11.4/config.guess -# protobuf-3.11.4/config.h.in -# protobuf-3.11.4/config.sub -# protobuf-3.11.4/configure -# protobuf-3.11.4/depcomp -# protobuf-3.11.4/install-sh -# protobuf-3.11.4/ltmain.sh -# protobuf-3.11.4/missing -# protobuf-3.11.4/test-driver -# protobuf-3.11.4/update_file_lists.sh +# protobuf-3.19.6/benchmarks/ +# protobuf-3.19.6/conformance/ +# protobuf-3.19.6/editors/ +# protobuf-3.19.6/examples/ +# protobuf-3.19.6/m4/ +# protobuf-3.19.6/objectivec/ +# protobuf-3.19.6/python/ +# protobuf-3.19.6/third_party/ +# protobuf-3.19.6/util/ +# protobuf-3.19.6/ar-lib +# protobuf-3.19.6/compile +# protobuf-3.19.6/config.guess +# protobuf-3.19.6/config.h.in +# protobuf-3.19.6/config.sub +# protobuf-3.19.6/configure +# protobuf-3.19.6/depcomp +# protobuf-3.19.6/install-sh +# protobuf-3.19.6/ltmain.sh +# protobuf-3.19.6/missing +# protobuf-3.19.6/test-driver +# protobuf-3.19.6/update_file_lists.sh +# protobuf-3.19.6/autogen.sh +# protobuf-3.19.6/build_files_updated_unittest.sh +# protobuf-3.19.6/generate_descriptor_proto.sh +# protobuf-3.19.6/maven_install.json + # - disable configuration check of cmake's mimimum version # - disable configuration zlib check # - disable installation script @@ -57,7 +63,7 @@ PROJECT(Protobuf) include(../setup.cmake) include(platform) -SET(PROTO_SRC_DIR "${PROJECT_SOURCE_DIR}/protobuf-3.11.4") +SET(PROTO_SRC_DIR "${PROJECT_SOURCE_DIR}/protobuf-3.19.6") # # Produce position independent code. @@ -65,6 +71,20 @@ SET(PROTO_SRC_DIR "${PROJECT_SOURCE_DIR}/protobuf-3.11.4") # enable_pic() +enable_cxx17() + +if(WERROR) + add_compile_options(${WERROR}) +endif() + +# -O3 using GCC on SPARC leds to segfault on protoc +if(SPARC AND GCC) + foreach(LANG C CXX) + foreach(TYPE RELEASE) + string(REPLACE "-O3" "-O2" CMAKE_${LANG}_FLAGS_${TYPE} "${CMAKE_${LANG}_FLAGS_${TYPE}}") + endforeach(TYPE) + endforeach(LANG) +endif() # # Do not export any symbols @@ -74,10 +94,25 @@ enable_pic() set_visibility(hidden) -if(NOT MSVC) - add_compile_options(-Wno-stringop-overflow) +if(GCC AND GCC VERSION_GREATER 11) + # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106199 + set_compiler_flag(-Wno-stringop-overflow) + set_compiler_flag(-Wno-stringop-overread) +endif() + +if(NOT MSVC OR CLANG) + set_compiler_flag(-Wno-unused-const-variable) +endif() + +if(WIN32) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) endif() +if(APPLE) + set_compiler_flag(-Wno-deprecated-declarations) +endif() + + # # Configure static runtime library on Windows if requested # diff --git a/cdk/extra/protobuf/protobuf-3.11.4/README.md b/cdk/extra/protobuf/protobuf-3.11.4/README.md deleted file mode 100644 index 0e5ae61e2..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/README.md +++ /dev/null @@ -1,85 +0,0 @@ -Protocol Buffers - Google's data interchange format -=================================================== - -Copyright 2008 Google Inc. - -https://developers.google.com/protocol-buffers/ - -Overview --------- - -Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, -platform-neutral, extensible mechanism for serializing structured data. You -can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/). - -This README file contains protobuf installation instructions. To install -protobuf, you need to install the protocol compiler (used to compile .proto -files) and the protobuf runtime for your chosen programming language. - -Protocol Compiler Installation ------------------------------- - -The protocol compiler is written in C++. If you are using C++, please follow -the [C++ Installation Instructions](src/README.md) to install protoc along -with the C++ runtime. - -For non-C++ users, the simplest way to install the protocol compiler is to -download a pre-built binary from our release page: - - [https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases) - -In the downloads section of each release, you can find pre-built binaries in -zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary -as well as a set of standard .proto files distributed along with protobuf. - -If you are looking for an old version that is not available in the release -page, check out the maven repo here: - - [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/) - -These pre-built binaries are only provided for released versions. If you want -to use the github master version at HEAD, or you need to modify protobuf code, -or you are using C++, it's recommended to build your own protoc binary from -source. - -If you would like to build protoc binary from source, see the [C++ Installation -Instructions](src/README.md). - -Protobuf Runtime Installation ------------------------------ - -Protobuf supports several different programming languages. For each programming -language, you can find instructions in the corresponding source directory about -how to install protobuf runtime for that specific language: - -| Language | Source | Ubuntu | MacOS | Windows | -|--------------------------------------|-------------------------------------------------------------|--------|-------|---------| -| C++ (include C++ runtime and protoc) | [src](src) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcpp_distcheck%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-bazel.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fbazel%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-dist_install.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fdist_install%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp_distcheck%2Fcontinuous) | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) | -| Java | [java](java) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_compatibility%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_jdk7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_jdk7%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_oracle7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_oracle7%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_linkage_monitor.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_linkage_monitor%2Fcontinuous) | | | -| Python | [python](python) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python27.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython27%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python33.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython33%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python34.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython34%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python35.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython35%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python36.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython36%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python37.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython37%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_compatibility%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python27_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython27_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python33_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython33_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python34_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython34_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python35_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython35_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python36_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython36_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python37_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython37_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/windows-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fwindows%2Fpython_release%2Fcontinuous) | -| Objective-C | [objectivec](objectivec) | | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_cocoapods_integration.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_cocoapods_integration%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_debug.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_debug%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_release%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_osx.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_osx%2Fcontinuous) | | -| C# | [csharp](csharp) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-csharp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcsharp%2Fcontinuous) | | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/windows-csharp-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fwindows%2Fcsharp_release%2Fcontinuous) | -| JavaScript | [js](js) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjavascript%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fjavascript%2Fcontinuous) | | -| Ruby | [ruby](ruby) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby23.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby23%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby24.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby24%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby25.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby25%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby26.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby26%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby23.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby23%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby24.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby24%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby25.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby25%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby26.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby26%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby_release%2Fcontinuous) | | -| Go | [golang/protobuf](https://github.com/golang/protobuf) | | | | -| PHP | [php](php) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-php_all.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fphp_all%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-32-bit.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2F32-bit%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php5.6_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp5.6_mac%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php7.0_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp7.0_mac%2Fcontinuous) | | -| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | [![Build Status](https://travis-ci.org/dart-lang/protobuf.svg?branch=master)](https://travis-ci.org/dart-lang/protobuf) | | | - -Quick Start ------------ - -The best way to learn how to use protobuf is to follow the tutorials in our -developer guide: - -https://developers.google.com/protocol-buffers/docs/tutorials - -If you want to learn from code examples, take a look at the examples in the -[examples](examples) directory. - -Documentation -------------- - -The complete documentation for Protocol Buffers is available via the -web at: - -https://developers.google.com/protocol-buffers/ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/WORKSPACE b/cdk/extra/protobuf/protobuf-3.11.4/WORKSPACE deleted file mode 100644 index 39672c882..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/WORKSPACE +++ /dev/null @@ -1,83 +0,0 @@ -workspace(name = "com_google_protobuf") - -local_repository( - name = "com_google_protobuf_examples", - path = "examples", -) - -local_repository( - name = "submodule_gmock", - path = "third_party/googletest", -) - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:protobuf_deps.bzl", "protobuf_deps") - -# Load common dependencies. -protobuf_deps() -load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") - -bind( - name = "python_headers", - actual = "//util/python:python_headers", -) - -bind( - name = "gtest", - actual = "@submodule_gmock//:gtest", -) - -bind( - name = "gtest_main", - actual = "@submodule_gmock//:gtest_main", -) - -jvm_maven_import_external( - name = "guava_maven", - artifact = "com.google.guava:guava:18.0", - artifact_sha256 = "d664fbfc03d2e5ce9cab2a44fb01f1d0bf9dfebeccc1a473b1f9ea31f79f6f99", - server_urls = [ - "https://jcenter.bintray.com/", - "https://repo1.maven.org/maven2", - ], -) - -bind( - name = "guava", - actual = "@guava_maven//jar", -) - -jvm_maven_import_external( - name = "gson_maven", - artifact = "com.google.code.gson:gson:2.7", - artifact_sha256 = "2d43eb5ea9e133d2ee2405cc14f5ee08951b8361302fdd93494a3a997b508d32", - server_urls = [ - "https://jcenter.bintray.com/", - "https://repo1.maven.org/maven2", - ], -) - -bind( - name = "gson", - actual = "@gson_maven//jar", -) - -jvm_maven_import_external( - name = "error_prone_annotations_maven", - artifact = "com.google.errorprone:error_prone_annotations:2.3.2", - artifact_sha256 = "357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d", - server_urls = [ - "https://jcenter.bintray.com/", - "https://repo1.maven.org/maven2", - ], -) - -bind( - name = "error_prone_annotations", - actual = "@error_prone_annotations_maven//jar", -) - -# For `cc_proto_blacklist_test`. -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/autogen.sh b/cdk/extra/protobuf/protobuf-3.11.4/autogen.sh deleted file mode 100644 index d00d21727..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/autogen.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# Run this script to generate the configure script and other files that will -# be included in the distribution. These files are not checked in because they -# are automatically generated. - -set -e - -if [ ! -z "$@" ]; then - for argument in "$@"; do - case $argument in - # make curl silent - "-s") - curlopts="-s" - ;; - esac - done -fi - -# Check that we're being run from the right directory. -if test ! -f src/google/protobuf/stubs/common.h; then - cat >&2 << __EOF__ -Could not find source code. Make sure you are running this script from the -root of the distribution tree. -__EOF__ - exit 1 -fi - -set -ex - -# The absence of a m4 directory in googletest causes autoreconf to fail when -# building under the CentOS docker image. It's a warning in regular build on -# Ubuntu/gLinux as well. -mkdir -p third_party/googletest/m4 - -# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings. -autoreconf -f -i -Wall,no-obsolete - -rm -rf autom4te.cache config.h.in~ -exit 0 diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotoc.cmake b/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotoc.cmake deleted file mode 100644 index 674d834c9..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotoc.cmake +++ /dev/null @@ -1,208 +0,0 @@ -# 2021-06-16: rafal.somla@oracle.com -# Disabled all generators other than C++ - -set(libprotoc_files - ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc -# ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc -) - -set(libprotoc_headers - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h -# ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/scc.h - ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h - ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h -) - -if (MSVC AND NOT WIN32_CLANG) -set(libprotoc_rc_files - ${CMAKE_CURRENT_BINARY_DIR}/version.rc -) -endif() - -### The custom command using xprotocol_plugin hangs on solaris if -### libprotoc is a shared library. -### TODO: should we make it STATIC on all platforms? -IF(SOLARIS) - add_library(libprotoc STATIC - ${libprotoc_files} ${libprotoc_headers}) -ELSE() - add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files}) -ENDIF() - -target_link_libraries(libprotoc libprotobuf) -if(MSVC AND protobuf_BUILD_SHARED_LIBS) - target_compile_definitions(libprotoc - PUBLIC PROTOBUF_USE_DLLS - PRIVATE LIBPROTOC_EXPORTS) -endif() -set_target_properties(libprotoc PROPERTIES - COMPILE_DEFINITIONS LIBPROTOC_EXPORTS - VERSION ${protobuf_VERSION} - OUTPUT_NAME ${LIB_PREFIX}protoc - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") -add_library(protobuf::libprotoc ALIAS libprotoc) - -### -IF(protobuf_BUILD_SHARED_LIBS AND NOT SOLARIS) - SET_TARGET_PROPERTIES(libprotoc PROPERTIES - DEBUG_POSTFIX "" - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/library_output_directory - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/library_output_directory) - IF(WIN32) - ADD_CUSTOM_COMMAND(TARGET libprotoc POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CMAKE_BINARY_DIR}/library_output_directory/${CMAKE_CFG_INTDIR}/libprotoc.dll" - "${CMAKE_BINARY_DIR}/runtime_output_directory/${CMAKE_CFG_INTDIR}/libprotoc.dll" - ) - ENDIF() -ENDIF() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/generate_descriptor_proto.sh b/cdk/extra/protobuf/protobuf-3.11.4/generate_descriptor_proto.sh deleted file mode 100644 index e533d05b4..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/generate_descriptor_proto.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env bash - -# Run this script to regenerate descriptor.pb.{h,cc} after the protocol -# compiler changes. Since these files are compiled into the protocol compiler -# itself, they cannot be generated automatically by a make rule. "make check" -# will fail if these files do not match what the protocol compiler would -# generate. -# -# HINT: Flags passed to generate_descriptor_proto.sh will be passed directly -# to make when building protoc. This is particularly useful for passing -# -j4 to run 4 jobs simultaneously. - -if test ! -e src/google/protobuf/stubs/common.h; then - cat >&2 << __EOF__ -Could not find source code. Make sure you are running this script from the -root of the distribution tree. -__EOF__ - exit 1 -fi - -cd src - -declare -a RUNTIME_PROTO_FILES=(\ - google/protobuf/any.proto \ - google/protobuf/api.proto \ - google/protobuf/descriptor.proto \ - google/protobuf/duration.proto \ - google/protobuf/empty.proto \ - google/protobuf/field_mask.proto \ - google/protobuf/source_context.proto \ - google/protobuf/struct.proto \ - google/protobuf/timestamp.proto \ - google/protobuf/type.proto \ - google/protobuf/wrappers.proto) - -declare -a COMPILER_PROTO_FILES=(\ - google/protobuf/compiler/plugin.proto) - -CORE_PROTO_IS_CORRECT=0 -PROCESS_ROUND=1 -BOOTSTRAP_PROTOC="" -while [ $# -gt 0 ]; do - case $1 in - --bootstrap_protoc) - BOOTSTRAP_PROTOC=$2 - shift 2 - ;; - *) - break - ;; - esac - shift -done -TMP=$(mktemp -d) -echo "Updating descriptor protos..." -while [ $CORE_PROTO_IS_CORRECT -ne 1 ] -do - echo "Round $PROCESS_ROUND" - CORE_PROTO_IS_CORRECT=1 - - if [ "$BOOTSTRAP_PROTOC" != "" ]; then - PROTOC=$BOOTSTRAP_PROTOC - BOOTSTRAP_PROTOC="" - else - make $@ protoc - if test $? -ne 0; then - echo "Failed to build protoc." - exit 1 - fi - PROTOC="./protoc" - fi - - $PROTOC --cpp_out=dllexport_decl=PROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \ - $PROTOC --cpp_out=dllexport_decl=PROTOC_EXPORT:$TMP ${COMPILER_PROTO_FILES[@]} - - for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do - BASE_NAME=${PROTO_FILE%.*} - diff ${BASE_NAME}.pb.h $TMP/${BASE_NAME}.pb.h > /dev/null - if test $? -ne 0; then - CORE_PROTO_IS_CORRECT=0 - fi - diff ${BASE_NAME}.pb.cc $TMP/${BASE_NAME}.pb.cc > /dev/null - if test $? -ne 0; then - CORE_PROTO_IS_CORRECT=0 - fi - done - - # Only override the output if the files are different to avoid re-compilation - # of the protoc. - if [ $CORE_PROTO_IS_CORRECT -ne 1 ]; then - for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do - BASE_NAME=${PROTO_FILE%.*} - mv $TMP/${BASE_NAME}.pb.h ${BASE_NAME}.pb.h - mv $TMP/${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc - done - fi - - PROCESS_ROUND=$((PROCESS_ROUND + 1)) -done -cd .. - -if test -x objectivec/generate_well_known_types.sh; then - echo "Generating messages for objc." - objectivec/generate_well_known_types.sh $@ -fi - -if test -x csharp/generate_protos.sh; then - echo "Generating messages for C#." - csharp/generate_protos.sh $@ -fi - -if test -x php/generate_descriptor_protos.sh; then - echo "Generating messages for PHP." - php/generate_descriptor_protos.sh $@ -fi diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.cc deleted file mode 100644 index 5a79335b6..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.cc +++ /dev/null @@ -1,340 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class AnyDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Any_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_Any_google_2fprotobuf_2fany_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Any_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Any(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Any::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Any_google_2fprotobuf_2fany_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Any_google_2fprotobuf_2fany_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, value_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Any)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Any_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fany_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\031google/protobuf/any.proto\022\017google.prot" - "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002" - " \001(\014Bo\n\023com.google.protobufB\010AnyProtoP\001Z" - "%github.com/golang/protobuf/ptypes/any\242\002" - "\003GPB\252\002\036Google.Protobuf.WellKnownTypesb\006p" - "roto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fany_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fany_2eproto_sccs[1] = { - &scc_info_Any_google_2fprotobuf_2fany_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fany_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fany_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto = { - &descriptor_table_google_2fprotobuf_2fany_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fany_2eproto, "google/protobuf/any.proto", 205, - &descriptor_table_google_2fprotobuf_2fany_2eproto_once, descriptor_table_google_2fprotobuf_2fany_2eproto_sccs, descriptor_table_google_2fprotobuf_2fany_2eproto_deps, 1, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fany_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fany_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto, file_level_service_descriptors_google_2fprotobuf_2fany_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fany_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fany_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void Any::InitAsDefaultInstance() { -} -bool Any::GetAnyFieldDescriptors( - const ::PROTOBUF_NAMESPACE_ID::Message& message, - const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** type_url_field, - const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field) { - return ::PROTOBUF_NAMESPACE_ID::internal::GetAnyFieldDescriptors( - message, type_url_field, value_field); -} -bool Any::ParseAnyTypeUrl(const string& type_url, - std::string* full_type_name) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseAnyTypeUrl(type_url, - full_type_name); -} - -class Any::_Internal { - public: -}; - -Any::Any() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), _any_metadata_(&type_url_, &value_) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Any) -} -Any::Any(const Any& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), - _any_metadata_(&type_url_, &value_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_type_url().empty()) { - type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url_); - } - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_value().empty()) { - value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) -} - -void Any::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Any_google_2fprotobuf_2fany_2eproto.base); - type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -Any::~Any() { - // @@protoc_insertion_point(destructor:google.protobuf.Any) - SharedDtor(); -} - -void Any::SharedDtor() { - type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void Any::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Any& Any::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Any_google_2fprotobuf_2fany_2eproto.base); - return *internal_default_instance(); -} - - -void Any::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Any) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - value_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - _internal_metadata_.Clear(); -} - -const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // string type_url = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_type_url(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url")); - CHK_(ptr); - } else goto handle_unusual; - continue; - // bytes value = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - auto str = _internal_mutable_value(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Any::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // string type_url = 1; - if (this->type_url().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_type_url().data(), static_cast(this->_internal_type_url().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "google.protobuf.Any.type_url"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_type_url(), target); - } - - // bytes value = 2; - if (this->value().size() > 0) { - target = stream->WriteBytesMaybeAliased( - 2, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any) - return target; -} - -size_t Any::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // string type_url = 1; - if (this->type_url().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_type_url()); - } - - // bytes value = 2; - if (this->value().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Any::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Any) - GOOGLE_DCHECK_NE(&from, this); - const Any* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Any) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Any) - MergeFrom(*source); - } -} - -void Any::MergeFrom(const Any& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.type_url().size() > 0) { - - type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url_); - } - if (from.value().size() > 0) { - - value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_); - } -} - -void Any::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Any) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Any::CopyFrom(const Any& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Any) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Any::IsInitialized() const { - return true; -} - -void Any::InternalSwap(Any* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - type_url_.Swap(&other->type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Any >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::Any >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.cc deleted file mode 100644 index 069dcdfa3..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.cc +++ /dev/null @@ -1,388 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include - -#include -#include -#include - -#include - -#ifdef ADDRESS_SANITIZER -#include -#endif // ADDRESS_SANITIZER - -#include - -static const size_t kMinCleanupListElements = 8; -static const size_t kMaxCleanupListElements = 64; // 1kB on 64-bit. - -namespace google { -namespace protobuf { -namespace internal { - - -std::atomic ArenaImpl::lifecycle_id_generator_; -#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) -ArenaImpl::ThreadCache& ArenaImpl::thread_cache() { - static internal::ThreadLocalStorage* thread_cache_ = - new internal::ThreadLocalStorage(); - return *thread_cache_->Get(); -} -#elif defined(PROTOBUF_USE_DLLS) -ArenaImpl::ThreadCache& ArenaImpl::thread_cache() { - static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = {-1, NULL}; - return thread_cache_; -} -#else -GOOGLE_THREAD_LOCAL ArenaImpl::ThreadCache ArenaImpl::thread_cache_ = {-1, NULL}; -#endif - -void ArenaImpl::Init() { - lifecycle_id_ = - lifecycle_id_generator_.fetch_add(1, std::memory_order_relaxed); - hint_.store(nullptr, std::memory_order_relaxed); - threads_.store(nullptr, std::memory_order_relaxed); - - if (initial_block_) { - // Thread which calls Init() owns the first block. This allows the - // single-threaded case to allocate on the first block without having to - // perform atomic operations. - new (initial_block_) Block(options_.initial_block_size, NULL); - SerialArena* serial = - SerialArena::New(initial_block_, &thread_cache(), this); - serial->set_next(NULL); - threads_.store(serial, std::memory_order_relaxed); - space_allocated_.store(options_.initial_block_size, - std::memory_order_relaxed); - CacheSerialArena(serial); - } else { - space_allocated_.store(0, std::memory_order_relaxed); - } -} - -ArenaImpl::~ArenaImpl() { - // Have to do this in a first pass, because some of the destructors might - // refer to memory in other blocks. - CleanupList(); - FreeBlocks(); -} - -uint64 ArenaImpl::Reset() { - // Have to do this in a first pass, because some of the destructors might - // refer to memory in other blocks. - CleanupList(); - uint64 space_allocated = FreeBlocks(); - Init(); - - return space_allocated; -} - -ArenaImpl::Block* ArenaImpl::NewBlock(Block* last_block, size_t min_bytes) { - size_t size; - if (last_block) { - // Double the current block size, up to a limit. - size = std::min(2 * last_block->size(), options_.max_block_size); - } else { - size = options_.start_block_size; - } - // Verify that min_bytes + kBlockHeaderSize won't overflow. - GOOGLE_CHECK_LE(min_bytes, std::numeric_limits::max() - kBlockHeaderSize); - size = std::max(size, kBlockHeaderSize + min_bytes); - - void* mem = options_.block_alloc(size); - Block* b = new (mem) Block(size, last_block); - space_allocated_.fetch_add(size, std::memory_order_relaxed); - return b; -} - -ArenaImpl::Block::Block(size_t size, Block* next) - : next_(next), pos_(kBlockHeaderSize), size_(size) {} - -PROTOBUF_NOINLINE -void ArenaImpl::SerialArena::AddCleanupFallback(void* elem, - void (*cleanup)(void*)) { - size_t size = cleanup_ ? cleanup_->size * 2 : kMinCleanupListElements; - size = std::min(size, kMaxCleanupListElements); - size_t bytes = internal::AlignUpTo8(CleanupChunk::SizeOf(size)); - CleanupChunk* list = reinterpret_cast(AllocateAligned(bytes)); - list->next = cleanup_; - list->size = size; - - cleanup_ = list; - cleanup_ptr_ = &list->nodes[0]; - cleanup_limit_ = &list->nodes[size]; - - AddCleanup(elem, cleanup); -} - -void* ArenaImpl::AllocateAlignedAndAddCleanup(size_t n, - void (*cleanup)(void*)) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - return arena->AllocateAlignedAndAddCleanup(n, cleanup); - } else { - return AllocateAlignedAndAddCleanupFallback(n, cleanup); - } -} - -void ArenaImpl::AddCleanup(void* elem, void (*cleanup)(void*)) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - arena->AddCleanup(elem, cleanup); - } else { - return AddCleanupFallback(elem, cleanup); - } -} - -PROTOBUF_NOINLINE -void* ArenaImpl::AllocateAlignedFallback(size_t n) { - return GetSerialArena()->AllocateAligned(n); -} - -PROTOBUF_NOINLINE -void* ArenaImpl::AllocateAlignedAndAddCleanupFallback(size_t n, - void (*cleanup)(void*)) { - return GetSerialArena()->AllocateAlignedAndAddCleanup(n, cleanup); -} - -PROTOBUF_NOINLINE -void ArenaImpl::AddCleanupFallback(void* elem, void (*cleanup)(void*)) { - GetSerialArena()->AddCleanup(elem, cleanup); -} - -ArenaImpl::SerialArena* ArenaImpl::GetSerialArena() { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - return arena; - } else { - return GetSerialArenaFallback(&thread_cache()); - } -} - -PROTOBUF_NOINLINE -void* ArenaImpl::SerialArena::AllocateAlignedFallback(size_t n) { - // Sync back to current's pos. - head_->set_pos(head_->size() - (limit_ - ptr_)); - - head_ = arena_->NewBlock(head_, n); - ptr_ = head_->Pointer(head_->pos()); - limit_ = head_->Pointer(head_->size()); - -#ifdef ADDRESS_SANITIZER - ASAN_POISON_MEMORY_REGION(ptr_, limit_ - ptr_); -#endif // ADDRESS_SANITIZER - - return AllocateAligned(n); -} - -uint64 ArenaImpl::SpaceAllocated() const { - return space_allocated_.load(std::memory_order_relaxed); -} - -uint64 ArenaImpl::SpaceUsed() const { - SerialArena* serial = threads_.load(std::memory_order_acquire); - uint64 space_used = 0; - for (; serial; serial = serial->next()) { - space_used += serial->SpaceUsed(); - } - return space_used; -} - -uint64 ArenaImpl::SerialArena::SpaceUsed() const { - // Get current block's size from ptr_ (since we can't trust head_->pos(). - uint64 space_used = ptr_ - head_->Pointer(kBlockHeaderSize); - // Get subsequent block size from b->pos(). - for (Block* b = head_->next(); b; b = b->next()) { - space_used += (b->pos() - kBlockHeaderSize); - } - // Remove the overhead of the SerialArena itself. - space_used -= kSerialArenaSize; - return space_used; -} - -uint64 ArenaImpl::FreeBlocks() { - uint64 space_allocated = 0; - // By omitting an Acquire barrier we ensure that any user code that doesn't - // properly synchronize Reset() or the destructor will throw a TSAN warning. - SerialArena* serial = threads_.load(std::memory_order_relaxed); - - while (serial) { - // This is inside a block we are freeing, so we need to read it now. - SerialArena* next = serial->next(); - space_allocated += ArenaImpl::SerialArena::Free(serial, initial_block_, - options_.block_dealloc); - // serial is dead now. - serial = next; - } - - return space_allocated; -} - -uint64 ArenaImpl::SerialArena::Free(ArenaImpl::SerialArena* serial, - Block* initial_block, - void (*block_dealloc)(void*, size_t)) { - uint64 space_allocated = 0; - - // We have to be careful in this function, since we will be freeing the Block - // that contains this SerialArena. Be careful about accessing |serial|. - - for (Block* b = serial->head_; b;) { - // This is inside the block we are freeing, so we need to read it now. - Block* next_block = b->next(); - space_allocated += (b->size()); - -#ifdef ADDRESS_SANITIZER - // This memory was provided by the underlying allocator as unpoisoned, so - // return it in an unpoisoned state. - ASAN_UNPOISON_MEMORY_REGION(b->Pointer(0), b->size()); -#endif // ADDRESS_SANITIZER - - if (b != initial_block) { - block_dealloc(b, b->size()); - } - - b = next_block; - } - - return space_allocated; -} - -void ArenaImpl::CleanupList() { - // By omitting an Acquire barrier we ensure that any user code that doesn't - // properly synchronize Reset() or the destructor will throw a TSAN warning. - SerialArena* serial = threads_.load(std::memory_order_relaxed); - - for (; serial; serial = serial->next()) { - serial->CleanupList(); - } -} - -void ArenaImpl::SerialArena::CleanupList() { - if (cleanup_ != NULL) { - CleanupListFallback(); - } -} - -void ArenaImpl::SerialArena::CleanupListFallback() { - // The first chunk might be only partially full, so calculate its size - // from cleanup_ptr_. Subsequent chunks are always full, so use list->size. - size_t n = cleanup_ptr_ - &cleanup_->nodes[0]; - CleanupChunk* list = cleanup_; - while (true) { - CleanupNode* node = &list->nodes[0]; - // Cleanup newest elements first (allocated last). - for (size_t i = n; i > 0; i--) { - node[i - 1].cleanup(node[i - 1].elem); - } - list = list->next; - if (list == nullptr) { - break; - } - // All but the first chunk are always full. - n = list->size; - } -} - -ArenaImpl::SerialArena* ArenaImpl::SerialArena::New(Block* b, void* owner, - ArenaImpl* arena) { - GOOGLE_DCHECK_EQ(b->pos(), kBlockHeaderSize); // Should be a fresh block - GOOGLE_DCHECK_LE(kBlockHeaderSize + kSerialArenaSize, b->size()); - SerialArena* serial = - reinterpret_cast(b->Pointer(kBlockHeaderSize)); - b->set_pos(kBlockHeaderSize + kSerialArenaSize); - serial->arena_ = arena; - serial->owner_ = owner; - serial->head_ = b; - serial->ptr_ = b->Pointer(b->pos()); - serial->limit_ = b->Pointer(b->size()); - serial->cleanup_ = NULL; - serial->cleanup_ptr_ = NULL; - serial->cleanup_limit_ = NULL; - return serial; -} - -PROTOBUF_NOINLINE -ArenaImpl::SerialArena* ArenaImpl::GetSerialArenaFallback(void* me) { - // Look for this SerialArena in our linked list. - SerialArena* serial = threads_.load(std::memory_order_acquire); - for (; serial; serial = serial->next()) { - if (serial->owner() == me) { - break; - } - } - - if (!serial) { - // This thread doesn't have any SerialArena, which also means it doesn't - // have any blocks yet. So we'll allocate its first block now. - Block* b = NewBlock(NULL, kSerialArenaSize); - serial = SerialArena::New(b, me, this); - - SerialArena* head = threads_.load(std::memory_order_relaxed); - do { - serial->set_next(head); - } while (!threads_.compare_exchange_weak( - head, serial, std::memory_order_release, std::memory_order_relaxed)); - } - - CacheSerialArena(serial); - return serial; -} - -} // namespace internal - -PROTOBUF_FUNC_ALIGN(32) -void* Arena::AllocateAlignedNoHook(size_t n) { - return impl_.AllocateAligned(n); -} - -void Arena::CallDestructorHooks() { - uint64 space_allocated = impl_.SpaceAllocated(); - // Call the reset hook - if (on_arena_reset_ != NULL) { - on_arena_reset_(this, hooks_cookie_, space_allocated); - } - - // Call the destruction hook - if (on_arena_destruction_ != NULL) { - on_arena_destruction_(this, hooks_cookie_, space_allocated); - } -} - -void Arena::OnArenaAllocation(const std::type_info* allocated_type, - size_t n) const { - if (on_arena_allocation_ != NULL) { - on_arena_allocation_(allocated_type, n, hooks_cookie_); - } -} - -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_impl.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_impl.h deleted file mode 100644 index d7b7ed73e..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_impl.h +++ /dev/null @@ -1,387 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This file defines an Arena allocator for better allocation performance. - -#ifndef GOOGLE_PROTOBUF_ARENA_IMPL_H__ -#define GOOGLE_PROTOBUF_ARENA_IMPL_H__ - -#include -#include - -#include -#include - -#ifdef ADDRESS_SANITIZER -#include -#endif // ADDRESS_SANITIZER - -#include - - -namespace google { -namespace protobuf { -namespace internal { - -inline size_t AlignUpTo8(size_t n) { - // Align n to next multiple of 8 (from Hacker's Delight, Chapter 3.) - return (n + 7) & static_cast(-8); -} - -using LifecycleId = int64_t; - -// This class provides the core Arena memory allocation library. Different -// implementations only need to implement the public interface below. -// Arena is not a template type as that would only be useful if all protos -// in turn would be templates, which will/cannot happen. However separating -// the memory allocation part from the cruft of the API users expect we can -// use #ifdef the select the best implementation based on hardware / OS. -class PROTOBUF_EXPORT ArenaImpl { - public: - struct Options { - size_t start_block_size; - size_t max_block_size; - char* initial_block; - size_t initial_block_size; - void* (*block_alloc)(size_t); - void (*block_dealloc)(void*, size_t); - - template - explicit Options(const O& options) - : start_block_size(options.start_block_size), - max_block_size(options.max_block_size), - initial_block(options.initial_block), - initial_block_size(options.initial_block_size), - block_alloc(options.block_alloc), - block_dealloc(options.block_dealloc) {} - }; - - template - explicit ArenaImpl(const O& options) : options_(options) { - if (options_.initial_block != NULL && options_.initial_block_size > 0) { - GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block)) - << ": Initial block size too small for header."; - initial_block_ = reinterpret_cast(options_.initial_block); - } else { - initial_block_ = NULL; - } - - Init(); - } - - // Destructor deletes all owned heap allocated objects, and destructs objects - // that have non-trivial destructors, except for proto2 message objects whose - // destructors can be skipped. Also, frees all blocks except the initial block - // if it was passed in. - ~ArenaImpl(); - - uint64 Reset(); - - uint64 SpaceAllocated() const; - uint64 SpaceUsed() const; - - void* AllocateAligned(size_t n) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - return arena->AllocateAligned(n); - } else { - return AllocateAlignedFallback(n); - } - } - - // This function allocates n bytes if the common happy case is true and - // returns true. Otherwise does nothing and returns false. This strange - // semantics is necessary to allow callers to program functions that only - // have fallback function calls in tail position. This substantially improves - // code for the happy path. - PROTOBUF_ALWAYS_INLINE bool MaybeAllocateAligned(size_t n, void** out) { - SerialArena* a; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFromThreadCache(&a))) { - return a->MaybeAllocateAligned(n, out); - } - return false; - } - - void* AllocateAlignedAndAddCleanup(size_t n, void (*cleanup)(void*)); - - // Add object pointer and cleanup function pointer to the list. - void AddCleanup(void* elem, void (*cleanup)(void*)); - - private: - void* AllocateAlignedFallback(size_t n); - void* AllocateAlignedAndAddCleanupFallback(size_t n, void (*cleanup)(void*)); - void AddCleanupFallback(void* elem, void (*cleanup)(void*)); - - // Node contains the ptr of the object to be cleaned up and the associated - // cleanup function ptr. - struct CleanupNode { - void* elem; // Pointer to the object to be cleaned up. - void (*cleanup)(void*); // Function pointer to the destructor or deleter. - }; - - // Cleanup uses a chunked linked list, to reduce pointer chasing. - struct CleanupChunk { - static size_t SizeOf(size_t i) { - return sizeof(CleanupChunk) + (sizeof(CleanupNode) * (i - 1)); - } - size_t size; // Total elements in the list. - CleanupChunk* next; // Next node in the list. - CleanupNode nodes[1]; // True length is |size|. - }; - - class Block; - - // A thread-unsafe Arena that can only be used within its owning thread. - class PROTOBUF_EXPORT SerialArena { - public: - // The allocate/free methods here are a little strange, since SerialArena is - // allocated inside a Block which it also manages. This is to avoid doing - // an extra allocation for the SerialArena itself. - - // Creates a new SerialArena inside Block* and returns it. - static SerialArena* New(Block* b, void* owner, ArenaImpl* arena); - - // Destroys this SerialArena, freeing all blocks with the given dealloc - // function, except any block equal to |initial_block|. - static uint64 Free(SerialArena* serial, Block* initial_block, - void (*block_dealloc)(void*, size_t)); - - void CleanupList(); - uint64 SpaceUsed() const; - - bool HasSpace(size_t n) { return n <= static_cast(limit_ - ptr_); } - - void* AllocateAligned(size_t n) { - GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. - GOOGLE_DCHECK_GE(limit_, ptr_); - if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) { - return AllocateAlignedFallback(n); - } - void* ret = ptr_; - ptr_ += n; -#ifdef ADDRESS_SANITIZER - ASAN_UNPOISON_MEMORY_REGION(ret, n); -#endif // ADDRESS_SANITIZER - return ret; - } - - // Allocate space if the current region provides enough space. - bool MaybeAllocateAligned(size_t n, void** out) { - GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. - GOOGLE_DCHECK_GE(limit_, ptr_); - if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; - void* ret = ptr_; - ptr_ += n; -#ifdef ADDRESS_SANITIZER - ASAN_UNPOISON_MEMORY_REGION(ret, n); -#endif // ADDRESS_SANITIZER - *out = ret; - return true; - } - - void AddCleanup(void* elem, void (*cleanup)(void*)) { - if (PROTOBUF_PREDICT_FALSE(cleanup_ptr_ == cleanup_limit_)) { - AddCleanupFallback(elem, cleanup); - return; - } - cleanup_ptr_->elem = elem; - cleanup_ptr_->cleanup = cleanup; - cleanup_ptr_++; - } - - void* AllocateAlignedAndAddCleanup(size_t n, void (*cleanup)(void*)) { - void* ret = AllocateAligned(n); - AddCleanup(ret, cleanup); - return ret; - } - - void* owner() const { return owner_; } - SerialArena* next() const { return next_; } - void set_next(SerialArena* next) { next_ = next; } - - private: - void* AllocateAlignedFallback(size_t n); - void AddCleanupFallback(void* elem, void (*cleanup)(void*)); - void CleanupListFallback(); - - ArenaImpl* arena_; // Containing arena. - void* owner_; // &ThreadCache of this thread; - Block* head_; // Head of linked list of blocks. - CleanupChunk* cleanup_; // Head of cleanup list. - SerialArena* next_; // Next SerialArena in this linked list. - - // Next pointer to allocate from. Always 8-byte aligned. Points inside - // head_ (and head_->pos will always be non-canonical). We keep these - // here to reduce indirection. - char* ptr_; - char* limit_; - - // Next CleanupList members to append to. These point inside cleanup_. - CleanupNode* cleanup_ptr_; - CleanupNode* cleanup_limit_; - }; - - // Blocks are variable length malloc-ed objects. The following structure - // describes the common header for all blocks. - class PROTOBUF_EXPORT Block { - public: - Block(size_t size, Block* next); - - char* Pointer(size_t n) { - GOOGLE_DCHECK(n <= size_); - return reinterpret_cast(this) + n; - } - - Block* next() const { return next_; } - size_t pos() const { return pos_; } - size_t size() const { return size_; } - void set_pos(size_t pos) { pos_ = pos; } - - private: - Block* next_; // Next block for this thread. - size_t pos_; - size_t size_; - // data follows - }; - - struct ThreadCache { -#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) - // If we are using the ThreadLocalStorage class to store the ThreadCache, - // then the ThreadCache's default constructor has to be responsible for - // initializing it. - ThreadCache() : last_lifecycle_id_seen(-1), last_serial_arena(NULL) {} -#endif - - // The ThreadCache is considered valid as long as this matches the - // lifecycle_id of the arena being used. - LifecycleId last_lifecycle_id_seen; - SerialArena* last_serial_arena; - }; - static std::atomic lifecycle_id_generator_; -#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) - // Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread - // local storage class we implemented. - // iOS also does not support the GOOGLE_THREAD_LOCAL keyword. - static ThreadCache& thread_cache(); -#elif defined(PROTOBUF_USE_DLLS) - // Thread local variables cannot be exposed through DLL interface but we can - // wrap them in static functions. - static ThreadCache& thread_cache(); -#else - static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_; - static ThreadCache& thread_cache() { return thread_cache_; } -#endif - - void Init(); - - // Free all blocks and return the total space used which is the sums of sizes - // of the all the allocated blocks. - uint64 FreeBlocks(); - // Delete or Destruct all objects owned by the arena. - void CleanupList(); - - inline void CacheSerialArena(SerialArena* serial) { - thread_cache().last_serial_arena = serial; - thread_cache().last_lifecycle_id_seen = lifecycle_id_; - // TODO(haberman): evaluate whether we would gain efficiency by getting rid - // of hint_. It's the only write we do to ArenaImpl in the allocation path, - // which will dirty the cache line. - - hint_.store(serial, std::memory_order_release); - } - - std::atomic - threads_; // Pointer to a linked list of SerialArena. - std::atomic hint_; // Fast thread-local block access - std::atomic space_allocated_; // Total size of all allocated blocks. - - Block* initial_block_; // If non-NULL, points to the block that came from - // user data. - - Block* NewBlock(Block* last_block, size_t min_bytes); - - SerialArena* GetSerialArena(); - PROTOBUF_ALWAYS_INLINE bool GetSerialArenaFast(SerialArena** arena) { - if (GetSerialArenaFromThreadCache(arena)) return true; - - // Check whether we own the last accessed SerialArena on this arena. This - // fast path optimizes the case where a single thread uses multiple arenas. - ThreadCache* tc = &thread_cache(); - SerialArena* serial = hint_.load(std::memory_order_acquire); - if (PROTOBUF_PREDICT_TRUE(serial != NULL && serial->owner() == tc)) { - *arena = serial; - return true; - } - return false; - } - - PROTOBUF_ALWAYS_INLINE bool GetSerialArenaFromThreadCache( - SerialArena** arena) { - // If this thread already owns a block in this arena then try to use that. - // This fast path optimizes the case where multiple threads allocate from - // the same arena. - ThreadCache* tc = &thread_cache(); - if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == lifecycle_id_)) { - *arena = tc->last_serial_arena; - return true; - } - return false; - } - SerialArena* GetSerialArenaFallback(void* me); - LifecycleId lifecycle_id_; // Unique for each arena. Changes on Reset(). - - Options options_; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArenaImpl); - // All protos have pointers back to the arena hence Arena must have - // pointer stability. - ArenaImpl(ArenaImpl&&) = delete; - ArenaImpl& operator=(ArenaImpl&&) = delete; - - public: - // kBlockHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 - // to protect the invariant that pos is always at a multiple of 8. - static const size_t kBlockHeaderSize = - (sizeof(Block) + 7) & static_cast(-8); - static const size_t kSerialArenaSize = - (sizeof(SerialArena) + 7) & static_cast(-8); - static_assert(kBlockHeaderSize % 8 == 0, - "kBlockHeaderSize must be a multiple of 8."); - static_assert(kSerialArenaSize % 8 == 0, - "kSerialArenaSize must be a multiple of 8."); -}; - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_ARENA_IMPL_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring.h deleted file mode 100644 index 122f391e5..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring.h +++ /dev/null @@ -1,405 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLE_PROTOBUF_ARENASTRING_H__ -#define GOOGLE_PROTOBUF_ARENASTRING_H__ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - - -// This is the implementation of arena string fields written for the open-source -// release. The ArenaStringPtr struct below is an internal implementation class -// and *should not be used* by user code. It is used to collect string -// operations together into one place and abstract away the underlying -// string-field pointer representation, so that (for example) an alternate -// implementation that knew more about ::std::string's internals could integrate -// more closely with the arena allocator. - -namespace google { -namespace protobuf { -namespace internal { - -template -class TaggedPtr { - public: - void Set(T* p) { ptr_ = reinterpret_cast(p); } - T* Get() const { return reinterpret_cast(ptr_); } - - bool IsNull() { return ptr_ == 0; } - - private: - uintptr_t ptr_; -}; - -struct PROTOBUF_EXPORT ArenaStringPtr { - inline void Set(const ::std::string* default_value, - const ::std::string& value, Arena* arena) { - if (ptr_ == default_value) { - CreateInstance(arena, &value); - } else { - *ptr_ = value; - } - } - - inline void SetLite(const ::std::string* default_value, - const ::std::string& value, Arena* arena) { - Set(default_value, value, arena); - } - - // Basic accessors. - inline const ::std::string& Get() const { return *ptr_; } - - inline ::std::string* Mutable(const ::std::string* default_value, - Arena* arena) { - if (ptr_ == default_value) { - CreateInstance(arena, default_value); - } - return ptr_; - } - - // Release returns a ::std::string* instance that is heap-allocated and is not - // Own()'d by any arena. If the field was not set, it returns NULL. The caller - // retains ownership. Clears this field back to NULL state. Used to implement - // release_() methods on generated classes. - inline ::std::string* Release(const ::std::string* default_value, - Arena* arena) { - if (ptr_ == default_value) { - return NULL; - } - return ReleaseNonDefault(default_value, arena); - } - - // Similar to Release, but ptr_ cannot be the default_value. - inline ::std::string* ReleaseNonDefault(const ::std::string* default_value, - Arena* arena) { - GOOGLE_DCHECK(!IsDefault(default_value)); - ::std::string* released = NULL; - if (arena != NULL) { - // ptr_ is owned by the arena. - released = new ::std::string; - released->swap(*ptr_); - } else { - released = ptr_; - } - ptr_ = const_cast< ::std::string*>(default_value); - return released; - } - - // UnsafeArenaRelease returns a ::std::string*, but it may be arena-owned - // (i.e. have its destructor already registered) if arena != NULL. If the - // field was not set, this returns NULL. This method clears this field back to - // NULL state. Used to implement unsafe_arena_release_() methods on - // generated classes. - inline ::std::string* UnsafeArenaRelease(const ::std::string* default_value, - Arena* /* arena */) { - if (ptr_ == default_value) { - return NULL; - } - ::std::string* released = ptr_; - ptr_ = const_cast< ::std::string*>(default_value); - return released; - } - - // Takes a string that is heap-allocated, and takes ownership. The string's - // destructor is registered with the arena. Used to implement - // set_allocated_ in generated classes. - inline void SetAllocated(const ::std::string* default_value, - ::std::string* value, Arena* arena) { - if (arena == NULL && ptr_ != default_value) { - Destroy(default_value, arena); - } - if (value != NULL) { - ptr_ = value; - if (arena != NULL) { - arena->Own(value); - } - } else { - ptr_ = const_cast< ::std::string*>(default_value); - } - } - - // Takes a string that has lifetime equal to the arena's lifetime. The arena - // must be non-null. It is safe only to pass this method a value returned by - // UnsafeArenaRelease() on another field of a message in the same arena. Used - // to implement unsafe_arena_set_allocated_ in generated classes. - inline void UnsafeArenaSetAllocated(const ::std::string* default_value, - ::std::string* value, - Arena* /* arena */) { - if (value != NULL) { - ptr_ = value; - } else { - ptr_ = const_cast< ::std::string*>(default_value); - } - } - - // Swaps internal pointers. Arena-safety semantics: this is guarded by the - // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is - // 'unsafe' if called directly. - PROTOBUF_ALWAYS_INLINE void Swap(ArenaStringPtr* other) { - std::swap(ptr_, other->ptr_); - } - PROTOBUF_ALWAYS_INLINE void Swap(ArenaStringPtr* other, - const ::std::string* default_value, - Arena* arena) { -#ifndef NDEBUG - // For debug builds, we swap the contents of the string, rather than the - // string instances themselves. This invalidates previously taken const - // references that are (per our documentation) invalidated by calling Swap() - // on the message. - // - // If both strings are the default_value, swapping is uninteresting. - // Otherwise, we use ArenaStringPtr::Mutable() to access the string, to - // ensure that we do not try to mutate default_value itself. - if (IsDefault(default_value) && other->IsDefault(default_value)) { - return; - } - - ::std::string* this_ptr = Mutable(default_value, arena); - ::std::string* other_ptr = other->Mutable(default_value, arena); - - this_ptr->swap(*other_ptr); -#else - std::swap(ptr_, other->ptr_); - (void)default_value; - (void)arena; -#endif - } - - // Frees storage (if not on an arena). - inline void Destroy(const ::std::string* default_value, Arena* arena) { - if (arena == NULL && ptr_ != default_value) { - delete ptr_; - } - } - - // Clears content, but keeps allocated string if arena != NULL, to avoid the - // overhead of heap operations. After this returns, the content (as seen by - // the user) will always be the empty string. Assumes that |default_value| - // is an empty string. - inline void ClearToEmpty(const ::std::string* default_value, - Arena* /* arena */) { - if (ptr_ == default_value) { - // Already set to default (which is empty) -- do nothing. - } else { - ptr_->clear(); - } - } - - // Clears content, assuming that the current value is not the empty string - // default. - inline void ClearNonDefaultToEmpty() { ptr_->clear(); } - inline void ClearNonDefaultToEmptyNoArena() { ptr_->clear(); } - - // Clears content, but keeps allocated string if arena != NULL, to avoid the - // overhead of heap operations. After this returns, the content (as seen by - // the user) will always be equal to |default_value|. - inline void ClearToDefault(const ::std::string* default_value, - Arena* /* arena */) { - if (ptr_ == default_value) { - // Already set to default -- do nothing. - } else { - // Have another allocated string -- rather than throwing this away and - // resetting ptr_ to the canonical default string instance, we just reuse - // this instance. - *ptr_ = *default_value; - } - } - - // Called from generated code / reflection runtime only. Resets value to point - // to a default string pointer, with the semantics that this ArenaStringPtr - // does not own the pointed-to memory. Disregards initial value of ptr_ (so - // this is the *ONLY* safe method to call after construction or when - // reinitializing after becoming the active field in a oneof union). - inline void UnsafeSetDefault(const ::std::string* default_value) { - // Casting away 'const' is safe here: accessors ensure that ptr_ is only - // returned as a const if it is equal to default_value. - ptr_ = const_cast< ::std::string*>(default_value); - } - - // The 'NoArena' variants of methods below assume arena == NULL and are - // optimized to provide very little overhead relative to a raw string pointer - // (while still being in-memory compatible with other code that assumes - // ArenaStringPtr). Note the invariant that a class instance that has only - // ever been mutated by NoArena methods must *only* be in the String state - // (i.e., tag bits are not used), *NEVER* ArenaString. This allows all - // tagged-pointer manipulations to be avoided. - inline void SetNoArena(const ::std::string* default_value, - const ::std::string& value) { - if (ptr_ == default_value) { - CreateInstanceNoArena(&value); - } else { - *ptr_ = value; - } - } - - void SetNoArena(const ::std::string* default_value, ::std::string&& value) { - if (IsDefault(default_value)) { - ptr_ = new ::std::string(std::move(value)); - } else { - *ptr_ = std::move(value); - } - } - - void AssignWithDefault(const ::std::string* default_value, - ArenaStringPtr value); - - inline const ::std::string& GetNoArena() const { return *ptr_; } - - inline ::std::string* MutableNoArena(const ::std::string* default_value) { - if (ptr_ == default_value) { - CreateInstanceNoArena(default_value); - } - return ptr_; - } - - inline ::std::string* ReleaseNoArena(const ::std::string* default_value) { - if (ptr_ == default_value) { - return NULL; - } else { - return ReleaseNonDefaultNoArena(default_value); - } - } - - inline ::std::string* ReleaseNonDefaultNoArena( - const ::std::string* default_value) { - GOOGLE_DCHECK(!IsDefault(default_value)); - ::std::string* released = ptr_; - ptr_ = const_cast< ::std::string*>(default_value); - return released; - } - - inline void SetAllocatedNoArena(const ::std::string* default_value, - ::std::string* value) { - if (ptr_ != default_value) { - delete ptr_; - } - if (value != NULL) { - ptr_ = value; - } else { - ptr_ = const_cast< ::std::string*>(default_value); - } - } - - inline void DestroyNoArena(const ::std::string* default_value) { - if (ptr_ != default_value) { - delete ptr_; - } - } - - inline void ClearToEmptyNoArena(const ::std::string* default_value) { - if (ptr_ == default_value) { - // Nothing: already equal to default (which is the empty string). - } else { - ptr_->clear(); - } - } - - inline void ClearToDefaultNoArena(const ::std::string* default_value) { - if (ptr_ == default_value) { - // Nothing: already set to default. - } else { - // Reuse existing allocated instance. - *ptr_ = *default_value; - } - } - - // Internal accessor used only at parse time to provide direct access to the - // raw pointer from the shared parse routine (in the non-arenas case). The - // parse routine does the string allocation in order to save code size in the - // generated parsing code. - inline ::std::string** UnsafeRawStringPointer() { return &ptr_; } - - inline bool IsDefault(const ::std::string* default_value) const { - return ptr_ == default_value; - } - - // Internal accessors!!!! - void UnsafeSetTaggedPointer(TaggedPtr< ::std::string> value) { - ptr_ = value.Get(); - } - // Generated code only! An optimization, in certain cases the generated - // code is certain we can obtain a string with no default checks and - // tag tests. - ::std::string* UnsafeMutablePointer() { return ptr_; } - - private: - ::std::string* ptr_; - - PROTOBUF_NOINLINE - void CreateInstance(Arena* arena, const ::std::string* initial_value) { - GOOGLE_DCHECK(initial_value != NULL); - // uses "new ::std::string" when arena is nullptr - ptr_ = Arena::Create< ::std::string>(arena, *initial_value); - } - PROTOBUF_NOINLINE - void CreateInstanceNoArena(const ::std::string* initial_value) { - GOOGLE_DCHECK(initial_value != NULL); - ptr_ = new ::std::string(*initial_value); - } -}; - -} // namespace internal -} // namespace protobuf - -namespace protobuf { -namespace internal { - -inline void ArenaStringPtr::AssignWithDefault( - const ::std::string* default_value, ArenaStringPtr value) { - const ::std::string* me = *UnsafeRawStringPointer(); - const ::std::string* other = *value.UnsafeRawStringPointer(); - // If the pointers are the same then do nothing. - if (me != other) { - SetNoArena(default_value, value.GetNoArena()); - } -} - -} // namespace internal -} // namespace protobuf -} // namespace google - - -#include - -#endif // GOOGLE_PROTOBUF_ARENASTRING_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring_unittest.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring_unittest.cc deleted file mode 100644 index c5da4476b..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arenastring_unittest.cc +++ /dev/null @@ -1,136 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Based on mvels@'s frankenstring. - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -namespace google { -namespace protobuf { - -using internal::ArenaStringPtr; - -static std::string WrapString(const char* value) { return value; } - -// Test ArenaStringPtr with arena == NULL. -TEST(ArenaStringPtrTest, ArenaStringPtrOnHeap) { - ArenaStringPtr field; - std::string default_value = "default"; - field.UnsafeSetDefault(&default_value); - EXPECT_EQ(std::string("default"), field.Get()); - field.Set(&default_value, WrapString("Test short"), NULL); - EXPECT_EQ(std::string("Test short"), field.Get()); - field.Set(&default_value, WrapString("Test long long long long value"), NULL); - EXPECT_EQ(std::string("Test long long long long value"), field.Get()); - field.Set(&default_value, std::string(""), NULL); - field.Destroy(&default_value, NULL); - - ArenaStringPtr field2; - field2.UnsafeSetDefault(&default_value); - std::string* mut = field2.Mutable(&default_value, NULL); - EXPECT_EQ(mut, field2.Mutable(&default_value, NULL)); - EXPECT_EQ(mut, &field2.Get()); - EXPECT_NE(&default_value, mut); - EXPECT_EQ(std::string("default"), *mut); - *mut = "Test long long long long value"; // ensure string allocates storage - EXPECT_EQ(std::string("Test long long long long value"), field2.Get()); - field2.Destroy(&default_value, NULL); -} - -TEST(ArenaStringPtrTest, ArenaStringPtrOnArena) { - Arena arena; - ArenaStringPtr field; - std::string default_value = "default"; - field.UnsafeSetDefault(&default_value); - EXPECT_EQ(std::string("default"), field.Get()); - field.Set(&default_value, WrapString("Test short"), &arena); - EXPECT_EQ(std::string("Test short"), field.Get()); - field.Set(&default_value, WrapString("Test long long long long value"), - &arena); - EXPECT_EQ(std::string("Test long long long long value"), field.Get()); - field.Set(&default_value, std::string(""), &arena); - field.Destroy(&default_value, &arena); - - ArenaStringPtr field2; - field2.UnsafeSetDefault(&default_value); - std::string* mut = field2.Mutable(&default_value, &arena); - EXPECT_EQ(mut, field2.Mutable(&default_value, &arena)); - EXPECT_EQ(mut, &field2.Get()); - EXPECT_NE(&default_value, mut); - EXPECT_EQ(std::string("default"), *mut); - *mut = "Test long long long long value"; // ensure string allocates storage - EXPECT_EQ(std::string("Test long long long long value"), field2.Get()); - field2.Destroy(&default_value, &arena); -} - -TEST(ArenaStringPtrTest, ArenaStringPtrOnArenaNoSSO) { - Arena arena; - ArenaStringPtr field; - std::string default_value = "default"; - field.UnsafeSetDefault(&default_value); - EXPECT_EQ(std::string("default"), field.Get()); - - // Avoid triggering the SSO optimization by setting the string to something - // larger than the internal buffer. - field.Set(&default_value, WrapString("Test long long long long value"), - &arena); - EXPECT_EQ(std::string("Test long long long long value"), field.Get()); - field.Set(&default_value, std::string(""), &arena); - field.Destroy(&default_value, &arena); - - ArenaStringPtr field2; - field2.UnsafeSetDefault(&default_value); - std::string* mut = field2.Mutable(&default_value, &arena); - EXPECT_EQ(mut, field2.Mutable(&default_value, &arena)); - EXPECT_EQ(mut, &field2.Get()); - EXPECT_NE(&default_value, mut); - EXPECT_EQ(std::string("default"), *mut); - *mut = "Test long long long long value"; // ensure string allocates storage - EXPECT_EQ(std::string("Test long long long long value"), field2.Get()); - field2.Destroy(&default_value, &arena); -} - - -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.cc deleted file mode 100644 index 5b2ca151d..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.cc +++ /dev/null @@ -1,194 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -using internal::WireFormat; - -void SetCommonFieldVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options) { - SetCommonVars(options, variables); - (*variables)["ns"] = Namespace(descriptor, options); - (*variables)["name"] = FieldName(descriptor); - (*variables)["index"] = StrCat(descriptor->index()); - (*variables)["number"] = StrCat(descriptor->number()); - (*variables)["classname"] = ClassName(FieldScope(descriptor), false); - (*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type()); - (*variables)["field_member"] = FieldName(descriptor) + "_"; - - (*variables)["tag_size"] = StrCat( - WireFormat::TagSize(descriptor->number(), descriptor->type())); - (*variables)["deprecated_attr"] = DeprecatedAttribute(options, descriptor); - - (*variables)["set_hasbit"] = ""; - (*variables)["clear_hasbit"] = ""; - if (HasFieldPresence(descriptor->file())) { - (*variables)["set_hasbit_io"] = - "_Internal::set_has_" + FieldName(descriptor) + "(&_has_bits_);"; - } else { - (*variables)["set_hasbit_io"] = ""; - } - (*variables)["annotate_accessor"] = ""; - - // These variables are placeholders to pick out the beginning and ends of - // identifiers for annotations (when doing so with existing variables would - // be ambiguous or impossible). They should never be set to anything but the - // empty string. - (*variables)["{"] = ""; - (*variables)["}"] = ""; -} - -void FieldGenerator::SetHasBitIndex(int32 has_bit_index) { - if (!HasFieldPresence(descriptor_->file()) || has_bit_index == -1) { - return; - } - variables_["set_hasbit"] = StrCat( - "_has_bits_[", has_bit_index / 32, "] |= 0x", - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); - variables_["clear_hasbit"] = StrCat( - "_has_bits_[", has_bit_index / 32, "] &= ~0x", - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); -} - -void SetCommonOneofFieldVariables( - const FieldDescriptor* descriptor, - std::map* variables) { - const std::string prefix = descriptor->containing_oneof()->name() + "_."; - (*variables)["oneof_name"] = descriptor->containing_oneof()->name(); - (*variables)["field_member"] = - StrCat(prefix, (*variables)["name"], "_"); -} - -FieldGenerator::~FieldGenerator() {} - -FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, - const Options& options, - MessageSCCAnalyzer* scc_analyzer) - : descriptor_(descriptor), field_generators_(descriptor->field_count()) { - // Construct all the FieldGenerators. - for (int i = 0; i < descriptor->field_count(); i++) { - field_generators_[i].reset( - MakeGenerator(descriptor->field(i), options, scc_analyzer)); - } -} - -FieldGenerator* FieldGeneratorMap::MakeGoogleInternalGenerator( - const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - - return nullptr; -} - -FieldGenerator* FieldGeneratorMap::MakeGenerator( - const FieldDescriptor* field, const Options& options, - MessageSCCAnalyzer* scc_analyzer) { - FieldGenerator* generator = - MakeGoogleInternalGenerator(field, options, scc_analyzer); - if (generator) { - return generator; - } - - if (field->is_repeated()) { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_MESSAGE: - if (field->is_map()) { - return new MapFieldGenerator(field, options); - } else { - return new RepeatedMessageFieldGenerator(field, options, - scc_analyzer); - } - case FieldDescriptor::CPPTYPE_STRING: - return new RepeatedStringFieldGenerator(field, options); - case FieldDescriptor::CPPTYPE_ENUM: - return new RepeatedEnumFieldGenerator(field, options); - default: - return new RepeatedPrimitiveFieldGenerator(field, options); - } - } else if (field->containing_oneof()) { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_MESSAGE: - return new MessageOneofFieldGenerator(field, options, scc_analyzer); - case FieldDescriptor::CPPTYPE_STRING: - return new StringOneofFieldGenerator(field, options); - case FieldDescriptor::CPPTYPE_ENUM: - return new EnumOneofFieldGenerator(field, options); - default: - return new PrimitiveOneofFieldGenerator(field, options); - } - } else { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_MESSAGE: - return new MessageFieldGenerator(field, options, scc_analyzer); - case FieldDescriptor::CPPTYPE_STRING: - return new StringFieldGenerator(field, options); - case FieldDescriptor::CPPTYPE_ENUM: - return new EnumFieldGenerator(field, options); - default: - return new PrimitiveFieldGenerator(field, options); - } - } -} - -FieldGeneratorMap::~FieldGeneratorMap() {} - -const FieldGenerator& FieldGeneratorMap::get( - const FieldDescriptor* field) const { - GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); - return *field_generators_[field->index()]; -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.cc deleted file mode 100644 index 847f76c21..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ /dev/null @@ -1,1209 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#include -#include -#include -#include -#include - - -namespace google { -namespace protobuf { -namespace compiler { -namespace cpp { - -namespace { - -void SetStringVariables(const FieldDescriptor* descriptor, - std::map* variables, - const Options& options) { - SetCommonFieldVariables(descriptor, variables, options); - (*variables)["default"] = DefaultValue(options, descriptor); - (*variables)["default_length"] = - StrCat(descriptor->default_value_string().length()); - std::string default_variable_string = MakeDefaultName(descriptor); - (*variables)["default_variable_name"] = default_variable_string; - (*variables)["default_variable"] = - descriptor->default_value_string().empty() - ? "&::" + (*variables)["proto_ns"] + - "::internal::GetEmptyStringAlreadyInited()" - : "&" + QualifiedClassName(descriptor->containing_type(), options) + - "::" + default_variable_string + ".get()"; - (*variables)["pointer_type"] = - descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char"; - (*variables)["null_check"] = (*variables)["DCHK"] + "(value != nullptr);\n"; - // NOTE: Escaped here to unblock proto1->proto2 migration. - // TODO(liujisi): Extend this to apply for other conflicting methods. - (*variables)["release_name"] = - SafeFunctionName(descriptor->containing_type(), descriptor, "release_"); - (*variables)["full_name"] = descriptor->full_name(); - - if (options.opensource_runtime) { - (*variables)["string_piece"] = "::std::string"; - } else { - (*variables)["string_piece"] = "::StringPiece"; - } - - (*variables)["lite"] = - HasDescriptorMethods(descriptor->file(), options) ? "" : "Lite"; -} - -} // namespace - -// =================================================================== - -StringFieldGenerator::StringFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : FieldGenerator(descriptor, options), - lite_(!HasDescriptorMethods(descriptor->file(), options)), - inlined_(IsStringInlined(descriptor, options)) { - SetStringVariables(descriptor, &variables_, options); -} - -StringFieldGenerator::~StringFieldGenerator() {} - -void StringFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { - Formatter format(printer, variables_); - if (inlined_) { - format("::$proto_ns$::internal::InlinedStringField $name$_;\n"); - } else { - // N.B. that we continue to use |ArenaStringPtr| instead of |string*| for - // string fields, even when SupportArenas(descriptor_) == false. Why? The - // simple answer is to avoid unmaintainable complexity. The reflection code - // assumes ArenaStringPtrs. These are *almost* in-memory-compatible with - // string*, except for the pointer tags and related ownership semantics. We - // could modify the runtime code to use string* for the - // not-supporting-arenas case, but this would require a way to detect which - // type of class was generated (adding overhead and complexity to - // GeneratedMessageReflection) and littering the runtime code paths with - // conditionals. It's simpler to stick with this but use lightweight - // accessors that assume arena == NULL. There should be very little - // overhead anyway because it's just a tagged pointer in-memory. - format("::$proto_ns$::internal::ArenaStringPtr $name$_;\n"); - } -} - -void StringFieldGenerator::GenerateStaticMembers(io::Printer* printer) const { - Formatter format(printer, variables_); - if (!descriptor_->default_value_string().empty()) { - // We make the default instance public, so it can be initialized by - // non-friend code. - format( - "public:\n" - "static ::$proto_ns$::internal::ExplicitlyConstructed" - " $default_variable_name$;\n" - "private:\n"); - } -} - -void StringFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - // If we're using StringFieldGenerator for a field with a ctype, it's - // because that ctype isn't actually implemented. In particular, this is - // true of ctype=CORD and ctype=STRING_PIECE in the open source release. - // We aren't releasing Cord because it has too many Google-specific - // dependencies and we aren't releasing StringPiece because it's hardly - // useful outside of Google and because it would get confusing to have - // multiple instances of the StringPiece class in different libraries (PCRE - // already includes it for their C++ bindings, which came from Google). - // - // In any case, we make all the accessors private while still actually - // using a string to represent the field internally. This way, we can - // guarantee that if we do ever implement the ctype, it won't break any - // existing users who might be -- for whatever reason -- already using .proto - // files that applied the ctype. The field can still be accessed via the - // reflection interface since the reflection interface is independent of - // the string's underlying representation. - - bool unknown_ctype = descriptor_->options().ctype() != - EffectiveStringCType(descriptor_, options_); - - if (unknown_ctype) { - format.Outdent(); - format( - " private:\n" - " // Hidden due to unknown ctype option.\n"); - format.Indent(); - } - - format( - "$deprecated_attr$const std::string& ${1$$name$$}$() const;\n" - "$deprecated_attr$void ${1$set_$name$$}$(const std::string& value);\n" - "$deprecated_attr$void ${1$set_$name$$}$(std::string&& value);\n" - "$deprecated_attr$void ${1$set_$name$$}$(const char* value);\n", - descriptor_); - if (!options_.opensource_runtime) { - format( - "$deprecated_attr$void ${1$set_$name$$}$(::StringPiece value);\n", - descriptor_); - } - format( - "$deprecated_attr$void ${1$set_$name$$}$(const $pointer_type$* " - "value, size_t size)" - ";\n" - "$deprecated_attr$std::string* ${1$mutable_$name$$}$();\n" - "$deprecated_attr$std::string* ${1$$release_name$$}$();\n" - "$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* " - "$name$);\n", - descriptor_); - if (options_.opensource_runtime) { - if (SupportsArenas(descriptor_)) { - format( - "$GOOGLE_PROTOBUF$_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors " - "for\"\n" - "\" string fields are deprecated and will be removed in a\"\n" - "\" future release.\")\n" - "std::string* ${1$unsafe_arena_release_$name$$}$();\n" - "$GOOGLE_PROTOBUF$_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors " - "for\"\n" - "\" string fields are deprecated and will be removed in a\"\n" - "\" future release.\")\n" - "void ${1$unsafe_arena_set_allocated_$name$$}$(\n" - " std::string* $name$);\n", - descriptor_); - } - } - format( - "private:\n" - "const std::string& _internal_$name$() const;\n" - "void _internal_set_$name$(const std::string& value);\n" - "std::string* _internal_mutable_$name$();\n" - "public:\n"); - - if (unknown_ctype) { - format.Outdent(); - format(" public:\n"); - format.Indent(); - } -} - -void StringFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline const std::string& $classname$::$name$() const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::set_$name$(const std::string& value) {\n" - "$annotate_accessor$" - " _internal_set_$name$(value);\n" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n" - "inline std::string* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return _internal_mutable_$name$();\n" - "}\n"); - if (SupportsArenas(descriptor_)) { - format( - "inline const std::string& $classname$::_internal_$name$() const {\n" - " return $name$_.Get();\n" - "}\n" - "inline void $classname$::_internal_set_$name$(const std::string& " - "value) {\n" - " $set_hasbit$\n" - " $name$_.Set$lite$($default_variable$, value, GetArenaNoVirtual());\n" - "}\n" - "inline void $classname$::set_$name$(std::string&& value) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.Set$lite$(\n" - " $default_variable$, ::std::move(value), GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" - "}\n" - "inline void $classname$::set_$name$(const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " $set_hasbit$\n" - " $name$_.Set$lite$($default_variable$, $string_piece$(value),\n" - " GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void $classname$::set_$name$(::StringPiece value) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.Set$lite$($default_variable$, value, " - "GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline " - "void $classname$::set_$name$(const $pointer_type$* value,\n" - " size_t size) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.Set$lite$($default_variable$, $string_piece$(\n" - " reinterpret_cast(value), size), " - "GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" - "}\n" - "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " $set_hasbit$\n" - " return $name$_.Mutable($default_variable$, GetArenaNoVirtual());\n" - "}\n" - "inline std::string* $classname$::$release_name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_release:$full_name$)\n"); - - if (HasFieldPresence(descriptor_->file())) { - format( - " if (!_internal_has_$name$()) {\n" - " return nullptr;\n" - " }\n" - " $clear_hasbit$\n" - " return $name$_.ReleaseNonDefault(" - "$default_variable$, GetArenaNoVirtual());\n"); - } else { - format( - " $clear_hasbit$\n" - " return $name$_.Release($default_variable$, " - "GetArenaNoVirtual());\n"); - } - - format( - "}\n" - "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" - "$annotate_accessor$" - " if ($name$ != nullptr) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " $name$_.SetAllocated($default_variable$, $name$,\n" - " GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); - if (options_.opensource_runtime) { - format( - "inline std::string* $classname$::unsafe_arena_release_$name$() {\n" - "$annotate_accessor$" - " // " - "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" - " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " $clear_hasbit$\n" - " return $name$_.UnsafeArenaRelease($default_variable$,\n" - " GetArenaNoVirtual());\n" - "}\n" - "inline void $classname$::unsafe_arena_set_allocated_$name$(\n" - "$annotate_accessor$" - " std::string* $name$) {\n" - " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " if ($name$ != nullptr) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " $name$_.UnsafeArenaSetAllocated($default_variable$,\n" - " $name$, GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" - "$full_name$)\n" - "}\n"); - } - } else { - // No-arena case. - format( - "inline const std::string& $classname$::_internal_$name$() const {\n" - " return $name$_.GetNoArena();\n" - "}\n" - "inline void $classname$::_internal_set_$name$(const std::string& " - "value) {\n" - " $set_hasbit$\n" - " $name$_.SetNoArena($default_variable$, value);\n" - "}\n" - "inline void $classname$::set_$name$(std::string&& value) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.SetNoArena(\n" - " $default_variable$, ::std::move(value));\n" - " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" - "}\n" - "inline void $classname$::set_$name$(const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " $set_hasbit$\n" - " $name$_.SetNoArena($default_variable$, $string_piece$(value));\n" - " // @@protoc_insertion_point(field_set_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void $classname$::set_$name$(::StringPiece value) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.SetNoArena($default_variable$, value);\n" - " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline " - "void $classname$::set_$name$(const $pointer_type$* value, " - "size_t size) {\n" - "$annotate_accessor$" - " $set_hasbit$\n" - " $name$_.SetNoArena($default_variable$,\n" - " $string_piece$(reinterpret_cast(value), size));\n" - " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" - "}\n" - "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " $set_hasbit$\n" - " return $name$_.MutableNoArena($default_variable$);\n" - "}\n" - "inline std::string* $classname$::$release_name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_release:$full_name$)\n"); - - if (HasFieldPresence(descriptor_->file())) { - format( - " if (!_internal_has_$name$()) {\n" - " return nullptr;\n" - " }\n" - " $clear_hasbit$\n" - " return $name$_.ReleaseNonDefaultNoArena($default_variable$);\n"); - } else { - format( - " $clear_hasbit$\n" - " return $name$_.ReleaseNoArena($default_variable$);\n"); - } - - format( - "}\n" - "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" - "$annotate_accessor$" - " if ($name$ != nullptr) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " $name$_.SetAllocatedNoArena($default_variable$, $name$);\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); - } -} - -void StringFieldGenerator::GenerateNonInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (!descriptor_->default_value_string().empty()) { - // Initialized in GenerateDefaultInstanceAllocator. - format( - "::$proto_ns$::internal::ExplicitlyConstructed " - "$classname$::$default_variable_name$;\n"); - } -} - -void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - // Two-dimension specialization here: supporting arenas or not, and default - // value is the empty string or not. Complexity here ensures the minimal - // number of branches / amount of extraneous code at runtime (given that the - // below methods are inlined one-liners)! - if (SupportsArenas(descriptor_)) { - if (descriptor_->default_value_string().empty()) { - format( - "$name$_.ClearToEmpty($default_variable$, GetArenaNoVirtual());\n"); - } else { - format( - "$name$_.ClearToDefault($default_variable$, GetArenaNoVirtual());\n"); - } - } else { - if (descriptor_->default_value_string().empty()) { - format("$name$_.ClearToEmptyNoArena($default_variable$);\n"); - } else { - format("$name$_.ClearToDefaultNoArena($default_variable$);\n"); - } - } -} - -void StringFieldGenerator::GenerateMessageClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - // Two-dimension specialization here: supporting arenas, field presence, or - // not, and default value is the empty string or not. Complexity here ensures - // the minimal number of branches / amount of extraneous code at runtime - // (given that the below methods are inlined one-liners)! - - // If we have field presence, then the Clear() method of the protocol buffer - // will have checked that this field is set. If so, we can avoid redundant - // checks against default_variable. - const bool must_be_present = HasFieldPresence(descriptor_->file()); - - if (inlined_ && must_be_present) { - // Calling mutable_$name$() gives us a string reference and sets the has bit - // for $name$ (in proto2). We may get here when the string field is inlined - // but the string's contents have not been changed by the user, so we cannot - // make an assertion about the contents of the string and could never make - // an assertion about the string instance. - // - // For non-inlined strings, we distinguish from non-default by comparing - // instances, rather than contents. - format("$DCHK$(!$name$_.IsDefault($default_variable$));\n"); - } - - if (SupportsArenas(descriptor_)) { - if (descriptor_->default_value_string().empty()) { - if (must_be_present) { - format("$name$_.ClearNonDefaultToEmpty();\n"); - } else { - format( - "$name$_.ClearToEmpty($default_variable$, GetArenaNoVirtual());\n"); - } - } else { - // Clear to a non-empty default is more involved, as we try to use the - // Arena if one is present and may need to reallocate the string. - format( - "$name$_.ClearToDefault($default_variable$, GetArenaNoVirtual());\n"); - } - } else if (must_be_present) { - // When Arenas are disabled and field presence has been checked, we can - // safely treat the ArenaStringPtr as a string*. - if (descriptor_->default_value_string().empty()) { - format("$name$_.ClearNonDefaultToEmptyNoArena();\n"); - } else { - format("$name$_.UnsafeMutablePointer()->assign(*$default_variable$);\n"); - } - } else { - if (descriptor_->default_value_string().empty()) { - format("$name$_.ClearToEmptyNoArena($default_variable$);\n"); - } else { - format("$name$_.ClearToDefaultNoArena($default_variable$);\n"); - } - } -} - -void StringFieldGenerator::GenerateMergingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) { - // TODO(gpike): improve this - format("_internal_set_$name$(from._internal_$name$());\n"); - } else { - format( - "$set_hasbit$\n" - "$name$_.AssignWithDefault($default_variable$, from.$name$_);\n"); - } -} - -void StringFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (inlined_) { - format("$name$_.Swap(&other->$name$_);\n"); - } else { - format( - "$name$_.Swap(&other->$name$_, $default_variable$,\n" - " GetArenaNoVirtual());\n"); - } -} - -void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { - Formatter format(printer, variables_); - // TODO(ckennelly): Construct non-empty strings as part of the initializer - // list. - if (inlined_ && descriptor_->default_value_string().empty()) { - // Automatic initialization will construct the string. - return; - } - - format("$name$_.UnsafeSetDefault($default_variable$);\n"); -} - -void StringFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - GenerateConstructorCode(printer); - - if (HasFieldPresence(descriptor_->file())) { - format("if (from._internal_has_$name$()) {\n"); - } else { - format("if (!from._internal_$name$().empty()) {\n"); - } - - format.Indent(); - - if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) { - // TODO(gpike): improve this - format( - "$name$_.Set$lite$($default_variable$, from._internal_$name$(),\n" - " GetArenaNoVirtual());\n"); - } else { - format("$name$_.AssignWithDefault($default_variable$, from.$name$_);\n"); - } - - format.Outdent(); - format("}\n"); -} - -void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { - Formatter format(printer, variables_); - if (inlined_) { - // The destructor is automatically invoked. - return; - } - - format("$name$_.DestroyNoArena($default_variable$);\n"); -} - -bool StringFieldGenerator::GenerateArenaDestructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (!inlined_) { - return false; - } - - format("_this->$name$_.DestroyNoArena($default_variable$);\n"); - return true; -} - -void StringFieldGenerator::GenerateDefaultInstanceAllocator( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (!descriptor_->default_value_string().empty()) { - format( - "$ns$::$classname$::$default_variable_name$.DefaultConstruct();\n" - "*$ns$::$classname$::$default_variable_name$.get_mutable() = " - "std::string($default$, $default_length$);\n" - "::$proto_ns$::internal::OnShutdownDestroyString(\n" - " $ns$::$classname$::$default_variable_name$.get_mutable());\n"); - } -} - -bool StringFieldGenerator::MergeFromCodedStreamNeedsArena() const { - return !lite_ && !inlined_ && !options_.opensource_runtime; -} - -void StringFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString( - descriptor_, options_, false, - "this->_internal_$name$().data(), " - "static_cast(this->_internal_$name$().length()),\n", - format); - } - format( - "target = stream->Write$declared_type$MaybeAliased(\n" - " $number$, this->_internal_$name$(), target);\n"); -} - -void StringFieldGenerator::GenerateByteSize(io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " this->_internal_$name$());\n"); -} - -uint32 StringFieldGenerator::CalculateFieldTag() const { - return inlined_ ? 1 : 0; -} - -// =================================================================== - -StringOneofFieldGenerator::StringOneofFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : StringFieldGenerator(descriptor, options) { - inlined_ = false; - - SetCommonOneofFieldVariables(descriptor, &variables_); - variables_["field_name"] = UnderscoresToCamelCase(descriptor->name(), true); - variables_["oneof_index"] = - StrCat(descriptor->containing_oneof()->index()); -} - -StringOneofFieldGenerator::~StringOneofFieldGenerator() {} - -void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline const std::string& $classname$::$name$() const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$();\n" - "}\n" - "inline void $classname$::set_$name$(const std::string& value) {\n" - "$annotate_accessor$" - " _internal_set_$name$(value);\n" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n" - "inline std::string* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return _internal_mutable_$name$();\n" - "}\n"); - if (SupportsArenas(descriptor_)) { - format( - "inline const std::string& $classname$::_internal_$name$() const {\n" - " if (_internal_has_$name$()) {\n" - " return $field_member$.Get();\n" - " }\n" - " return *$default_variable$;\n" - "}\n" - "inline void $classname$::_internal_set_$name$(const std::string& " - "value) {\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.Set$lite$($default_variable$, value,\n" - " GetArenaNoVirtual());\n" - "}\n" - "inline void $classname$::set_$name$(std::string&& value) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.Set$lite$(\n" - " $default_variable$, ::std::move(value), GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" - "}\n" - "inline void $classname$::set_$name$(const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.Set$lite$($default_variable$,\n" - " $string_piece$(value), GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void $classname$::set_$name$(::StringPiece value) {\n" - "$annotate_accessor$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.Set$lite$($default_variable$, value,\n" - " GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline " - "void $classname$::set_$name$(const $pointer_type$* value,\n" - " size_t size) {\n" - "$annotate_accessor$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.Set$lite$(\n" - " $default_variable$, $string_piece$(\n" - " reinterpret_cast(value), size),\n" - " GetArenaNoVirtual());\n" - " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" - "}\n" - "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " return $field_member$.Mutable($default_variable$,\n" - " GetArenaNoVirtual());\n" - "}\n" - "inline std::string* $classname$::$release_name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " return $field_member$.Release($default_variable$,\n" - " GetArenaNoVirtual());\n" - " } else {\n" - " return nullptr;\n" - " }\n" - "}\n" - "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" - "$annotate_accessor$" - " if (has_$oneof_name$()) {\n" - " clear_$oneof_name$();\n" - " }\n" - " if ($name$ != nullptr) {\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($name$);\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); - if (options_.opensource_runtime) { - format( - "inline std::string* $classname$::unsafe_arena_release_$name$() {\n" - "$annotate_accessor$" - " // " - "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n" - " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " return $field_member$.UnsafeArenaRelease(\n" - " $default_variable$, GetArenaNoVirtual());\n" - " } else {\n" - " return nullptr;\n" - " }\n" - "}\n" - "inline void $classname$::unsafe_arena_set_allocated_$name$(" - "std::string* $name$) {\n" - "$annotate_accessor$" - " $DCHK$(GetArenaNoVirtual() != nullptr);\n" - " if (!_internal_has_$name$()) {\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " clear_$oneof_name$();\n" - " if ($name$) {\n" - " set_has_$name$();\n" - " $field_member$.UnsafeArenaSetAllocated($default_variable$, " - "$name$, GetArenaNoVirtual());\n" - " }\n" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" - "$full_name$)\n" - "}\n"); - } - } else { - // No-arena case. - format( - "inline const std::string& $classname$::_internal_$name$() const {\n" - " if (_internal_has_$name$()) {\n" - " return $field_member$.GetNoArena();\n" - " }\n" - " return *$default_variable$;\n" - "}\n" - "inline void $classname$::_internal_set_$name$(const std::string& " - "value) {\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.SetNoArena($default_variable$, value);\n" - "}\n" - "inline void $classname$::set_$name$(std::string&& value) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.SetNoArena($default_variable$, ::std::move(value));\n" - " // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n" - "}\n" - "inline void $classname$::set_$name$(const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.SetNoArena($default_variable$,\n" - " $string_piece$(value));\n" - " // @@protoc_insertion_point(field_set_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void $classname$::set_$name$(::StringPiece value) {\n" - "$annotate_accessor$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.SetNoArena($default_variable$, value);\n" - " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline " - "void $classname$::set_$name$(const $pointer_type$* value, size_t " - "size) {\n" - "$annotate_accessor$" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " $field_member$.SetNoArena($default_variable$, $string_piece$(\n" - " reinterpret_cast(value), size));\n" - " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" - "}\n" - "inline std::string* $classname$::_internal_mutable_$name$() {\n" - " if (!_internal_has_$name$()) {\n" - " clear_$oneof_name$();\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($default_variable$);\n" - " }\n" - " return $field_member$.MutableNoArena($default_variable$);\n" - "}\n" - "inline std::string* $classname$::$release_name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_release:$full_name$)\n" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " return $field_member$.ReleaseNoArena($default_variable$);\n" - " } else {\n" - " return nullptr;\n" - " }\n" - "}\n" - "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" - "$annotate_accessor$" - " if (has_$oneof_name$()) {\n" - " clear_$oneof_name$();\n" - " }\n" - " if ($name$ != nullptr) {\n" - " set_has_$name$();\n" - " $field_member$.UnsafeSetDefault($name$);\n" - " }\n" - " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" - "}\n"); - } -} - -void StringOneofFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (SupportsArenas(descriptor_)) { - format( - "$field_member$.Destroy($default_variable$,\n" - " GetArenaNoVirtual());\n"); - } else { - format("$field_member$.DestroyNoArena($default_variable$);\n"); - } -} - -void StringOneofFieldGenerator::GenerateMessageClearingCode( - io::Printer* printer) const { - return GenerateClearingCode(printer); -} - -void StringOneofFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - // Don't print any swapping code. Swapping the union will swap this field. -} - -void StringOneofFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "$ns$::_$classname$_default_instance_.$name$_.UnsafeSetDefault(\n" - " $default_variable$);\n"); -} - -void StringOneofFieldGenerator::GenerateDestructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "if (_internal_has_$name$()) {\n" - " $field_member$.DestroyNoArena($default_variable$);\n" - "}\n"); -} - -// =================================================================== - -RepeatedStringFieldGenerator::RepeatedStringFieldGenerator( - const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(descriptor, options) { - SetStringVariables(descriptor, &variables_, options); -} - -RepeatedStringFieldGenerator::~RepeatedStringFieldGenerator() {} - -void RepeatedStringFieldGenerator::GeneratePrivateMembers( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("::$proto_ns$::RepeatedPtrField $name$_;\n"); -} - -void RepeatedStringFieldGenerator::GenerateAccessorDeclarations( - io::Printer* printer) const { - Formatter format(printer, variables_); - // See comment above about unknown ctypes. - bool unknown_ctype = descriptor_->options().ctype() != - EffectiveStringCType(descriptor_, options_); - - if (unknown_ctype) { - format.Outdent(); - format( - " private:\n" - " // Hidden due to unknown ctype option.\n"); - format.Indent(); - } - - format( - "$deprecated_attr$const std::string& ${1$$name$$}$(int index) const;\n" - "$deprecated_attr$std::string* ${1$mutable_$name$$}$(int index);\n" - "$deprecated_attr$void ${1$set_$name$$}$(int index, const " - "std::string& value);\n" - "$deprecated_attr$void ${1$set_$name$$}$(int index, std::string&& " - "value);\n" - "$deprecated_attr$void ${1$set_$name$$}$(int index, const " - "char* value);\n", - descriptor_); - if (!options_.opensource_runtime) { - format( - "$deprecated_attr$void ${1$set_$name$$}$(int index, " - "StringPiece value);\n", - descriptor_); - } - format( - "$deprecated_attr$void ${1$set_$name$$}$(" - "int index, const $pointer_type$* value, size_t size);\n" - "$deprecated_attr$std::string* ${1$add_$name$$}$();\n" - "$deprecated_attr$void ${1$add_$name$$}$(const std::string& value);\n" - "$deprecated_attr$void ${1$add_$name$$}$(std::string&& value);\n" - "$deprecated_attr$void ${1$add_$name$$}$(const char* value);\n", - descriptor_); - if (!options_.opensource_runtime) { - format( - "$deprecated_attr$void ${1$add_$name$$}$(StringPiece value);\n", - descriptor_); - } - format( - "$deprecated_attr$void ${1$add_$name$$}$(const $pointer_type$* " - "value, size_t size)" - ";\n" - "$deprecated_attr$const ::$proto_ns$::RepeatedPtrField& " - "${1$$name$$}$() " - "const;\n" - "$deprecated_attr$::$proto_ns$::RepeatedPtrField* " - "${1$mutable_$name$$}$()" - ";\n" - "private:\n" - "const std::string& ${1$_internal_$name$$}$(int index) const;\n" - "std::string* _internal_add_$name$();\n" - "public:\n", - descriptor_); - - if (unknown_ctype) { - format.Outdent(); - format(" public:\n"); - format.Indent(); - } -} - -void RepeatedStringFieldGenerator::GenerateInlineAccessorDefinitions( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "inline std::string* $classname$::add_$name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_add_mutable:$full_name$)\n" - " return _internal_add_$name$();\n" - "}\n"); - if (options_.safe_boundary_check) { - format( - "inline const std::string& $classname$::_internal_$name$(int index) " - "const {\n" - " return $name$_.InternalCheckedGet(\n" - " index, ::$proto_ns$::internal::GetEmptyStringAlreadyInited());\n" - "}\n"); - } else { - format( - "inline const std::string& $classname$::_internal_$name$(int index) " - "const {\n" - " return $name$_.Get(index);\n" - "}\n"); - } - format( - "inline const std::string& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_get:$full_name$)\n" - " return _internal_$name$(index);\n" - "}\n" - "inline std::string* $classname$::mutable_$name$(int index) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return $name$_.Mutable(index);\n" - "}\n" - "inline void $classname$::set_$name$(int index, const std::string& " - "value) " - "{\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - " $name$_.Mutable(index)->assign(value);\n" - "}\n" - "inline void $classname$::set_$name$(int index, std::string&& value) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - " $name$_.Mutable(index)->assign(std::move(value));\n" - "}\n" - "inline void $classname$::set_$name$(int index, const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " $name$_.Mutable(index)->assign(value);\n" - " // @@protoc_insertion_point(field_set_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void " - "$classname$::set_$name$(int index, StringPiece value) {\n" - "$annotate_accessor$" - " $name$_.Mutable(index)->assign(value.data(), value.size());\n" - " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline void " - "$classname$::set_$name$" - "(int index, const $pointer_type$* value, size_t size) {\n" - "$annotate_accessor$" - " $name$_.Mutable(index)->assign(\n" - " reinterpret_cast(value), size);\n" - " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" - "}\n" - "inline std::string* $classname$::_internal_add_$name$() {\n" - " return $name$_.Add();\n" - "}\n" - "inline void $classname$::add_$name$(const std::string& value) {\n" - "$annotate_accessor$" - " $name$_.Add()->assign(value);\n" - " // @@protoc_insertion_point(field_add:$full_name$)\n" - "}\n" - "inline void $classname$::add_$name$(std::string&& value) {\n" - "$annotate_accessor$" - " $name$_.Add(std::move(value));\n" - " // @@protoc_insertion_point(field_add:$full_name$)\n" - "}\n" - "inline void $classname$::add_$name$(const char* value) {\n" - "$annotate_accessor$" - " $null_check$" - " $name$_.Add()->assign(value);\n" - " // @@protoc_insertion_point(field_add_char:$full_name$)\n" - "}\n"); - if (!options_.opensource_runtime) { - format( - "inline void $classname$::add_$name$(StringPiece value) {\n" - "$annotate_accessor$" - " $name$_.Add()->assign(value.data(), value.size());\n" - " // @@protoc_insertion_point(field_add_string_piece:$full_name$)\n" - "}\n"); - } - format( - "inline void " - "$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n" - "$annotate_accessor$" - " $name$_.Add()->assign(reinterpret_cast(value), size);\n" - " // @@protoc_insertion_point(field_add_pointer:$full_name$)\n" - "}\n" - "inline const ::$proto_ns$::RepeatedPtrField&\n" - "$classname$::$name$() const {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_list:$full_name$)\n" - " return $name$_;\n" - "}\n" - "inline ::$proto_ns$::RepeatedPtrField*\n" - "$classname$::mutable_$name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" - " return &$name$_;\n" - "}\n"); -} - -void RepeatedStringFieldGenerator::GenerateClearingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$name$_.Clear();\n"); -} - -void RepeatedStringFieldGenerator::GenerateMergingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$name$_.MergeFrom(from.$name$_);\n"); -} - -void RepeatedStringFieldGenerator::GenerateSwappingCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$name$_.InternalSwap(&other->$name$_);\n"); -} - -void RepeatedStringFieldGenerator::GenerateConstructorCode( - io::Printer* printer) const { - // Not needed for repeated fields. -} - -void RepeatedStringFieldGenerator::GenerateCopyConstructorCode( - io::Printer* printer) const { - Formatter format(printer, variables_); - format("$name$_.CopyFrom(from.$name$_);"); -} - -void RepeatedStringFieldGenerator::GenerateSerializeWithCachedSizesToArray( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" - " const auto& s = this->_internal_$name$(i);\n"); - // format("for (const std::string& s : this->$name$()) {\n"); - format.Indent(); - if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { - GenerateUtf8CheckCodeForString(descriptor_, options_, false, - "s.data(), static_cast(s.length()),\n", - format); - } - format.Outdent(); - format( - " target = stream->Write$declared_type$($number$, s, target);\n" - "}\n"); -} - -void RepeatedStringFieldGenerator::GenerateByteSize( - io::Printer* printer) const { - Formatter format(printer, variables_); - format( - "total_size += $tag_size$ *\n" - " ::$proto_ns$::internal::FromIntSize($name$_.size());\n" - "for (int i = 0, n = $name$_.size(); i < n; i++) {\n" - " total_size += " - "::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " $name$_.Get(i));\n" - "}\n"); -} - -} // namespace cpp -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.cc deleted file mode 100644 index 354b4c8bc..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.cc +++ /dev/null @@ -1,1443 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/compiler/plugin.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fdescriptor_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<6> scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fcompiler_2fplugin_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fcompiler_2fplugin_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto; -PROTOBUF_NAMESPACE_OPEN -namespace compiler { -class VersionDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Version_default_instance_; -class CodeGeneratorRequestDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _CodeGeneratorRequest_default_instance_; -class CodeGeneratorResponse_FileDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _CodeGeneratorResponse_File_default_instance_; -class CodeGeneratorResponseDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _CodeGeneratorResponse_default_instance_; -} // namespace compiler -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest::InitAsDefaultInstance(); -} - -PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, { - &scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base, - &scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base,}}; - -static void InitDefaultsscc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse::InitAsDefaultInstance(); -} - -PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, { - &scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base,}}; - -static void InitDefaultsscc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File::InitAsDefaultInstance(); -} - -PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}}; - -static void InitDefaultsscc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::compiler::Version(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::compiler::Version::InitAsDefaultInstance(); -} - -PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[4]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, major_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, minor_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, patch_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, suffix_), - 1, - 2, - 3, - 0, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, file_to_generate_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, parameter_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, proto_file_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, compiler_version_), - ~0u, - 0, - ~0u, - 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, insertion_point_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, content_), - 0, - 1, - 2, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, error_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, file_), - 0, - ~0u, -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 9, sizeof(PROTOBUF_NAMESPACE_ID::compiler::Version)}, - { 13, 22, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, - { 26, 34, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, - { 37, 44, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n%google/protobuf/compiler/plugin.proto\022" - "\030google.protobuf.compiler\032 google/protob" - "uf/descriptor.proto\"F\n\007Version\022\r\n\005major\030" - "\001 \001(\005\022\r\n\005minor\030\002 \001(\005\022\r\n\005patch\030\003 \001(\005\022\016\n\006s" - "uffix\030\004 \001(\t\"\272\001\n\024CodeGeneratorRequest\022\030\n\020" - "file_to_generate\030\001 \003(\t\022\021\n\tparameter\030\002 \001(" - "\t\0228\n\nproto_file\030\017 \003(\0132$.google.protobuf." - "FileDescriptorProto\022;\n\020compiler_version\030" - "\003 \001(\0132!.google.protobuf.compiler.Version" - "\"\252\001\n\025CodeGeneratorResponse\022\r\n\005error\030\001 \001(" - "\t\022B\n\004file\030\017 \003(\01324.google.protobuf.compil" - "er.CodeGeneratorResponse.File\032>\n\004File\022\014\n" - "\004name\030\001 \001(\t\022\027\n\017insertion_point\030\002 \001(\t\022\017\n\007" - "content\030\017 \001(\tBg\n\034com.google.protobuf.com" - "pilerB\014PluginProtosZ9github.com/golang/p" - "rotobuf/protoc-gen-go/plugin;plugin_go" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = { - &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_sccs[4] = { - &scc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base, - &scc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base, - &scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base, - &scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto = { - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto, "google/protobuf/compiler/plugin.proto", 638, - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_sccs, descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps, 4, 1, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto, 4, file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto, file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fcompiler_2fplugin_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto), true); -PROTOBUF_NAMESPACE_OPEN -namespace compiler { - -// =================================================================== - -void Version::InitAsDefaultInstance() { -} -class Version::_Internal { - public: - using HasBits = decltype(std::declval()._has_bits_); - static void set_has_major(HasBits* has_bits) { - (*has_bits)[0] |= 2u; - } - static void set_has_minor(HasBits* has_bits) { - (*has_bits)[0] |= 4u; - } - static void set_has_patch(HasBits* has_bits) { - (*has_bits)[0] |= 8u; - } - static void set_has_suffix(HasBits* has_bits) { - (*has_bits)[0] |= 1u; - } -}; - -Version::Version() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.compiler.Version) -} -Version::Version(const Version& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), - _has_bits_(from._has_bits_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_suffix()) { - suffix_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.suffix_); - } - ::memcpy(&major_, &from.major_, - static_cast(reinterpret_cast(&patch_) - - reinterpret_cast(&major_)) + sizeof(patch_)); - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) -} - -void Version::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - ::memset(&major_, 0, static_cast( - reinterpret_cast(&patch_) - - reinterpret_cast(&major_)) + sizeof(patch_)); -} - -Version::~Version() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.Version) - SharedDtor(); -} - -void Version::SharedDtor() { - suffix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void Version::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Version& Version::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - return *internal_default_instance(); -} - - -void Version::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - suffix_.ClearNonDefaultToEmptyNoArena(); - } - if (cached_has_bits & 0x0000000eu) { - ::memset(&major_, 0, static_cast( - reinterpret_cast(&patch_) - - reinterpret_cast(&major_)) + sizeof(patch_)); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // optional int32 major = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - _Internal::set_has_major(&has_bits); - major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional int32 minor = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { - _Internal::set_has_minor(&has_bits); - minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional int32 patch = 3; - case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { - _Internal::set_has_patch(&has_bits); - patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional string suffix = 4; - case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { - auto str = _internal_mutable_suffix(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.Version.suffix"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - _has_bits_.Or(has_bits); - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Version::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // optional int32 major = 1; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_major(), target); - } - - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_minor(), target); - } - - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_patch(), target); - } - - // optional string suffix = 4; - if (cached_has_bits & 0x00000001u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_suffix().data(), static_cast(this->_internal_suffix().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.Version.suffix"); - target = stream->WriteStringMaybeAliased( - 4, this->_internal_suffix(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.Version) - return target; -} - -size_t Version::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string suffix = 4; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_suffix()); - } - - // optional int32 major = 1; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_major()); - } - - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_minor()); - } - - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_patch()); - } - - } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Version::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.compiler.Version) - GOOGLE_DCHECK_NE(&from, this); - const Version* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.compiler.Version) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.compiler.Version) - MergeFrom(*source); - } -} - -void Version::MergeFrom(const Version& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { - _has_bits_[0] |= 0x00000001u; - suffix_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.suffix_); - } - if (cached_has_bits & 0x00000002u) { - major_ = from.major_; - } - if (cached_has_bits & 0x00000004u) { - minor_ = from.minor_; - } - if (cached_has_bits & 0x00000008u) { - patch_ = from.patch_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void Version::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.compiler.Version) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Version::CopyFrom(const Version& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.Version) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Version::IsInitialized() const { - return true; -} - -void Version::InternalSwap(Version* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_has_bits_[0], other->_has_bits_[0]); - suffix_.Swap(&other->suffix_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - swap(major_, other->major_); - swap(minor_, other->minor_); - swap(patch_, other->patch_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Version::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void CodeGeneratorRequest::InitAsDefaultInstance() { - PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< PROTOBUF_NAMESPACE_ID::compiler::Version*>( - PROTOBUF_NAMESPACE_ID::compiler::Version::internal_default_instance()); -} -class CodeGeneratorRequest::_Internal { - public: - using HasBits = decltype(std::declval()._has_bits_); - static void set_has_parameter(HasBits* has_bits) { - (*has_bits)[0] |= 1u; - } - static const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version(const CodeGeneratorRequest* msg); - static void set_has_compiler_version(HasBits* has_bits) { - (*has_bits)[0] |= 2u; - } -}; - -const PROTOBUF_NAMESPACE_ID::compiler::Version& -CodeGeneratorRequest::_Internal::compiler_version(const CodeGeneratorRequest* msg) { - return *msg->compiler_version_; -} -void CodeGeneratorRequest::clear_proto_file() { - proto_file_.Clear(); -} -CodeGeneratorRequest::CodeGeneratorRequest() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorRequest) -} -CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), - _has_bits_(from._has_bits_), - file_to_generate_(from.file_to_generate_), - proto_file_(from.proto_file_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_parameter()) { - parameter_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parameter_); - } - if (from._internal_has_compiler_version()) { - compiler_version_ = new PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_); - } else { - compiler_version_ = nullptr; - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) -} - -void CodeGeneratorRequest::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - compiler_version_ = nullptr; -} - -CodeGeneratorRequest::~CodeGeneratorRequest() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorRequest) - SharedDtor(); -} - -void CodeGeneratorRequest::SharedDtor() { - parameter_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (this != internal_default_instance()) delete compiler_version_; -} - -void CodeGeneratorRequest::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - return *internal_default_instance(); -} - - -void CodeGeneratorRequest::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - file_to_generate_.Clear(); - proto_file_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { - parameter_.ClearNonDefaultToEmptyNoArena(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(compiler_version_ != nullptr); - compiler_version_->Clear(); - } - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // repeated string file_to_generate = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - ptr -= 1; - do { - ptr += 1; - auto str = _internal_add_file_to_generate(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); - #endif // !NDEBUG - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; - continue; - // optional string parameter = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - auto str = _internal_mutable_parameter(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional .google.protobuf.compiler.Version compiler_version = 3; - case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { - ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_proto_file(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - _has_bits_.Or(has_bits); - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated string file_to_generate = 1; - for (int i = 0, n = this->_internal_file_to_generate_size(); i < n; i++) { - const auto& s = this->_internal_file_to_generate(i); - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - s.data(), static_cast(s.length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); - target = stream->WriteString(1, s, target); - } - - cached_has_bits = _has_bits_[0]; - // optional string parameter = 2; - if (cached_has_bits & 0x00000001u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_parameter().data(), static_cast(this->_internal_parameter().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorRequest.parameter"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_parameter(), target); - } - - // optional .google.protobuf.compiler.Version compiler_version = 3; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage( - 3, _Internal::compiler_version(this), target, stream); - } - - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - for (unsigned int i = 0, - n = static_cast(this->_internal_proto_file_size()); i < n; i++) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(15, this->_internal_proto_file(i), target, stream); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorRequest) - return target; -} - -size_t CodeGeneratorRequest::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // repeated string file_to_generate = 1; - total_size += 1 * - ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(file_to_generate_.size()); - for (int i = 0, n = file_to_generate_.size(); i < n; i++) { - total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - file_to_generate_.Get(i)); - } - - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - total_size += 1UL * this->_internal_proto_file_size(); - for (const auto& msg : this->proto_file_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string parameter = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_parameter()); - } - - // optional .google.protobuf.compiler.Version compiler_version = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( - *compiler_version_); - } - - } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void CodeGeneratorRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest) - GOOGLE_DCHECK_NE(&from, this); - const CodeGeneratorRequest* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.compiler.CodeGeneratorRequest) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.compiler.CodeGeneratorRequest) - MergeFrom(*source); - } -} - -void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - file_to_generate_.MergeFrom(from.file_to_generate_); - proto_file_.MergeFrom(from.proto_file_); - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { - _has_bits_[0] |= 0x00000001u; - parameter_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parameter_); - } - if (cached_has_bits & 0x00000002u) { - _internal_mutable_compiler_version()->PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version()); - } - } -} - -void CodeGeneratorRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.compiler.CodeGeneratorRequest) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorRequest) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool CodeGeneratorRequest::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_)) return false; - return true; -} - -void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_has_bits_[0], other->_has_bits_[0]); - file_to_generate_.InternalSwap(&other->file_to_generate_); - proto_file_.InternalSwap(&other->proto_file_); - parameter_.Swap(&other->parameter_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - swap(compiler_version_, other->compiler_version_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorRequest::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void CodeGeneratorResponse_File::InitAsDefaultInstance() { -} -class CodeGeneratorResponse_File::_Internal { - public: - using HasBits = decltype(std::declval()._has_bits_); - static void set_has_name(HasBits* has_bits) { - (*has_bits)[0] |= 1u; - } - static void set_has_insertion_point(HasBits* has_bits) { - (*has_bits)[0] |= 2u; - } - static void set_has_content(HasBits* has_bits) { - (*has_bits)[0] |= 4u; - } -}; - -CodeGeneratorResponse_File::CodeGeneratorResponse_File() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse.File) -} -CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), - _has_bits_(from._has_bits_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_name()) { - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); - } - insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_insertion_point()) { - insertion_point_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.insertion_point_); - } - content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_content()) { - content_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.content_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) -} - -void CodeGeneratorResponse_File::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -CodeGeneratorResponse_File::~CodeGeneratorResponse_File() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse.File) - SharedDtor(); -} - -void CodeGeneratorResponse_File::SharedDtor() { - name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - insertion_point_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - content_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void CodeGeneratorResponse_File::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - return *internal_default_instance(); -} - - -void CodeGeneratorResponse_File::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { - name_.ClearNonDefaultToEmptyNoArena(); - } - if (cached_has_bits & 0x00000002u) { - insertion_point_.ClearNonDefaultToEmptyNoArena(); - } - if (cached_has_bits & 0x00000004u) { - content_.ClearNonDefaultToEmptyNoArena(); - } - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // optional string name = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_name(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional string insertion_point = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { - auto str = _internal_mutable_insertion_point(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - // optional string content = 15; - case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { - auto str = _internal_mutable_content(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - _has_bits_.Or(has_bits); - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_name().data(), static_cast(this->_internal_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.name"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_name(), target); - } - - // optional string insertion_point = 2; - if (cached_has_bits & 0x00000002u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_insertion_point().data(), static_cast(this->_internal_insertion_point().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); - target = stream->WriteStringMaybeAliased( - 2, this->_internal_insertion_point(), target); - } - - // optional string content = 15; - if (cached_has_bits & 0x00000004u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_content().data(), static_cast(this->_internal_content().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.content"); - target = stream->WriteStringMaybeAliased( - 15, this->_internal_content(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse.File) - return target; -} - -size_t CodeGeneratorResponse_File::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_name()); - } - - // optional string insertion_point = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_insertion_point()); - } - - // optional string content = 15; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_content()); - } - - } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void CodeGeneratorResponse_File::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) - GOOGLE_DCHECK_NE(&from, this); - const CodeGeneratorResponse_File* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.compiler.CodeGeneratorResponse.File) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.compiler.CodeGeneratorResponse.File) - MergeFrom(*source); - } -} - -void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { - _has_bits_[0] |= 0x00000001u; - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); - } - if (cached_has_bits & 0x00000002u) { - _has_bits_[0] |= 0x00000002u; - insertion_point_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.insertion_point_); - } - if (cached_has_bits & 0x00000004u) { - _has_bits_[0] |= 0x00000004u; - content_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.content_); - } - } -} - -void CodeGeneratorResponse_File::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool CodeGeneratorResponse_File::IsInitialized() const { - return true; -} - -void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_has_bits_[0], other->_has_bits_[0]); - name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - insertion_point_.Swap(&other->insertion_point_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - content_.Swap(&other->content_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse_File::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void CodeGeneratorResponse::InitAsDefaultInstance() { -} -class CodeGeneratorResponse::_Internal { - public: - using HasBits = decltype(std::declval()._has_bits_); - static void set_has_error(HasBits* has_bits) { - (*has_bits)[0] |= 1u; - } -}; - -CodeGeneratorResponse::CodeGeneratorResponse() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.compiler.CodeGeneratorResponse) -} -CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), - _has_bits_(from._has_bits_), - file_(from.file_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (from._internal_has_error()) { - error_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.error_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) -} - -void CodeGeneratorResponse::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -CodeGeneratorResponse::~CodeGeneratorResponse() { - // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse) - SharedDtor(); -} - -void CodeGeneratorResponse::SharedDtor() { - error_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void CodeGeneratorResponse::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base); - return *internal_default_instance(); -} - - -void CodeGeneratorResponse::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - file_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - error_.ClearNonDefaultToEmptyNoArena(); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - _Internal::HasBits has_bits{}; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // optional string error = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_error(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - #ifndef NDEBUG - ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.error"); - #endif // !NDEBUG - CHK_(ptr); - } else goto handle_unusual; - continue; - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { - ptr -= 1; - do { - ptr += 1; - ptr = ctx->ParseMessage(_internal_add_file(), ptr); - CHK_(ptr); - if (!ctx->DataAvailable(ptr)) break; - } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - _has_bits_.Or(has_bits); - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // optional string error = 1; - if (cached_has_bits & 0x00000001u) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( - this->_internal_error().data(), static_cast(this->_internal_error().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.error"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_error(), target); - } - - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - for (unsigned int i = 0, - n = static_cast(this->_internal_file_size()); i < n; i++) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: - InternalWriteMessage(15, this->_internal_file(i), target, stream); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse) - return target; -} - -size_t CodeGeneratorResponse::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - total_size += 1UL * this->_internal_file_size(); - for (const auto& msg : this->file_) { - total_size += - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); - } - - // optional string error = 1; - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_error()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void CodeGeneratorResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse) - GOOGLE_DCHECK_NE(&from, this); - const CodeGeneratorResponse* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.compiler.CodeGeneratorResponse) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.compiler.CodeGeneratorResponse) - MergeFrom(*source); - } -} - -void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - file_.MergeFrom(from.file_); - if (from._internal_has_error()) { - _has_bits_[0] |= 0x00000001u; - error_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.error_); - } -} - -void CodeGeneratorResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool CodeGeneratorResponse::IsInitialized() const { - return true; -} - -void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_has_bits_[0], other->_has_bits_[0]); - file_.InternalSwap(&other->file_); - error_.Swap(&other->error_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -} // namespace compiler -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::Version >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::compiler::Version >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.h deleted file mode 100644 index a99bb78ce..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.h +++ /dev/null @@ -1,93 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) - -#include -#include -#include - -namespace google { -namespace protobuf { -namespace compiler { - -class ZipWriter { - public: - ZipWriter(io::ZeroCopyOutputStream* raw_output); - ~ZipWriter(); - - bool Write(const std::string& filename, const std::string& contents); - bool WriteDirectory(); - - private: - struct FileInfo { - std::string name; - uint32 offset; - uint32 size; - uint32 crc32; - }; - - io::ZeroCopyOutputStream* raw_output_; - std::vector files_; -}; - -} // namespace compiler -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/duration.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/duration.pb.cc deleted file mode 100644 index 56775065e..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/duration.pb.cc +++ /dev/null @@ -1,324 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/duration.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class DurationDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Duration_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Duration_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Duration(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Duration::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Duration_google_2fprotobuf_2fduration_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fduration_2eproto[1]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, seconds_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, nanos_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Duration)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Duration_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\036google/protobuf/duration.proto\022\017google" - ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r" - "\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu" - "rationProtoP\001Z*github.com/golang/protobu" - "f/ptypes/duration\370\001\001\242\002\003GPB\252\002\036Google.Prot" - "obuf.WellKnownTypesb\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fduration_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs[1] = { - &scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fduration_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fduration_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto = { - &descriptor_table_google_2fprotobuf_2fduration_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto, "google/protobuf/duration.proto", 227, - &descriptor_table_google_2fprotobuf_2fduration_2eproto_once, descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs, descriptor_table_google_2fprotobuf_2fduration_2eproto_deps, 1, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fduration_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fduration_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto, file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fduration_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fduration_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void Duration::InitAsDefaultInstance() { -} -class Duration::_Internal { - public: -}; - -Duration::Duration() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Duration) -} -Duration::Duration(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration) -} -Duration::Duration(const Duration& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::memcpy(&seconds_, &from.seconds_, - static_cast(reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); - // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) -} - -void Duration::SharedCtor() { - ::memset(&seconds_, 0, static_cast( - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); -} - -Duration::~Duration() { - // @@protoc_insertion_point(destructor:google.protobuf.Duration) - SharedDtor(); -} - -void Duration::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void Duration::ArenaDtor(void* object) { - Duration* _this = reinterpret_cast< Duration* >(object); - (void)_this; -} -void Duration::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Duration::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Duration& Duration::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base); - return *internal_default_instance(); -} - - -void Duration::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - ::memset(&seconds_, 0, static_cast( - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); - _internal_metadata_.Clear(); -} - -const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // int64 seconds = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // int32 nanos = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { - nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Duration::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int64 seconds = 1; - if (this->seconds() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_seconds(), target); - } - - // int32 nanos = 2; - if (this->nanos() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_nanos(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration) - return target; -} - -size_t Duration::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // int64 seconds = 1; - if (this->seconds() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_seconds()); - } - - // int32 nanos = 2; - if (this->nanos() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_nanos()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Duration::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Duration) - GOOGLE_DCHECK_NE(&from, this); - const Duration* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Duration) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Duration) - MergeFrom(*source); - } -} - -void Duration::MergeFrom(const Duration& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.seconds() != 0) { - _internal_set_seconds(from._internal_seconds()); - } - if (from.nanos() != 0) { - _internal_set_nanos(from._internal_nanos()); - } -} - -void Duration::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Duration) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Duration::CopyFrom(const Duration& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Duration) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Duration::IsInitialized() const { - return true; -} - -void Duration::InternalSwap(Duration* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(seconds_, other->seconds_); - swap(nanos_, other->nanos_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Duration::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Duration >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Duration >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/empty.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/empty.pb.cc deleted file mode 100644 index 5fb199393..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/empty.pb.cc +++ /dev/null @@ -1,259 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class EmptyDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Empty_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_Empty_google_2fprotobuf_2fempty_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Empty_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Empty(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Empty::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Empty_google_2fprotobuf_2fempty_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Empty_google_2fprotobuf_2fempty_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fempty_2eproto[1]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Empty)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Empty_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fempty_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\033google/protobuf/empty.proto\022\017google.pr" - "otobuf\"\007\n\005EmptyBv\n\023com.google.protobufB\n" - "EmptyProtoP\001Z\'github.com/golang/protobuf" - "/ptypes/empty\370\001\001\242\002\003GPB\252\002\036Google.Protobuf" - ".WellKnownTypesb\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fempty_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fempty_2eproto_sccs[1] = { - &scc_info_Empty_google_2fprotobuf_2fempty_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fempty_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fempty_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto = { - &descriptor_table_google_2fprotobuf_2fempty_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fempty_2eproto, "google/protobuf/empty.proto", 183, - &descriptor_table_google_2fprotobuf_2fempty_2eproto_once, descriptor_table_google_2fprotobuf_2fempty_2eproto_sccs, descriptor_table_google_2fprotobuf_2fempty_2eproto_deps, 1, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fempty_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fempty_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto, file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fempty_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fempty_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void Empty::InitAsDefaultInstance() { -} -class Empty::_Internal { - public: -}; - -Empty::Empty() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Empty) -} -Empty::Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Empty) -} -Empty::Empty(const Empty& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:google.protobuf.Empty) -} - -void Empty::SharedCtor() { -} - -Empty::~Empty() { - // @@protoc_insertion_point(destructor:google.protobuf.Empty) - SharedDtor(); -} - -void Empty::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void Empty::ArenaDtor(void* object) { - Empty* _this = reinterpret_cast< Empty* >(object); - (void)_this; -} -void Empty::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Empty::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Empty& Empty::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Empty_google_2fprotobuf_2fempty_2eproto.base); - return *internal_default_instance(); -} - - -void Empty::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Empty) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _internal_metadata_.Clear(); -} - -const char* Empty::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Empty::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Empty) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Empty) - return target; -} - -size_t Empty::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Empty) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Empty::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Empty) - GOOGLE_DCHECK_NE(&from, this); - const Empty* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Empty) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Empty) - MergeFrom(*source); - } -} - -void Empty::MergeFrom(const Empty& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Empty) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - -} - -void Empty::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Empty) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Empty::CopyFrom(const Empty& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Empty) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Empty::IsInitialized() const { - return true; -} - -void Empty::InternalSwap(Empty* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Empty::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Empty >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Empty >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/inlined_string_field.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/inlined_string_field.h deleted file mode 100644 index 991c0e1f3..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/inlined_string_field.h +++ /dev/null @@ -1,260 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ -#define GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ - -#include -#include - -#include -#include - -// Must be included last. -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -namespace google { -namespace protobuf { - -class Arena; - -namespace internal { - -// InlinedStringField wraps a std::string instance and exposes an API similar to -// ArenaStringPtr's wrapping of a std::string* instance. As std::string is -// never allocated on the Arena, we expose only the *NoArena methods of -// ArenaStringPtr. -// -// default_value parameters are taken for consistency with ArenaStringPtr, but -// are not used for most methods. With inlining, these should be removed from -// the generated binary. -class PROTOBUF_EXPORT InlinedStringField { - public: - InlinedStringField() PROTOBUF_ALWAYS_INLINE; - explicit InlinedStringField(const std::string& default_value); - - void AssignWithDefault(const std::string* default_value, - const InlinedStringField& from) PROTOBUF_ALWAYS_INLINE; - - void ClearToEmpty(const std::string* default_value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - ClearToEmptyNoArena(default_value); - } - void ClearNonDefaultToEmpty() PROTOBUF_ALWAYS_INLINE { - ClearNonDefaultToEmptyNoArena(); - } - void ClearToEmptyNoArena(const std::string* /*default_value*/) - PROTOBUF_ALWAYS_INLINE { - ClearNonDefaultToEmptyNoArena(); - } - void ClearNonDefaultToEmptyNoArena() PROTOBUF_ALWAYS_INLINE; - - void ClearToDefault(const std::string* default_value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - ClearToDefaultNoArena(default_value); - } - void ClearToDefaultNoArena(const std::string* default_value) - PROTOBUF_ALWAYS_INLINE; - - void Destroy(const std::string* default_value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - DestroyNoArena(default_value); - } - void DestroyNoArena(const std::string* default_value) PROTOBUF_ALWAYS_INLINE; - - const std::string& Get() const PROTOBUF_ALWAYS_INLINE { return GetNoArena(); } - const std::string& GetNoArena() const PROTOBUF_ALWAYS_INLINE; - - std::string* Mutable(const std::string* default_value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - return MutableNoArena(default_value); - } - std::string* MutableNoArena(const std::string* default_value) - PROTOBUF_ALWAYS_INLINE; - - std::string* Release(const std::string* default_value, Arena* /*arena*/) { - return ReleaseNoArena(default_value); - } - std::string* ReleaseNonDefault(const std::string* default_value, - Arena* /*arena*/) { - return ReleaseNonDefaultNoArena(default_value); - } - std::string* ReleaseNoArena(const std::string* default_value) { - return ReleaseNonDefaultNoArena(default_value); - } - std::string* ReleaseNonDefaultNoArena(const std::string* default_value); - - void Set(const std::string* default_value, StringPiece value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - SetNoArena(default_value, value); - } - void SetLite(const std::string* default_value, StringPiece value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - SetNoArena(default_value, value); - } - void SetNoArena(const std::string* default_value, - StringPiece value) PROTOBUF_ALWAYS_INLINE; - - void Set(const std::string* default_value, const std::string& value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - SetNoArena(default_value, value); - } - void SetLite(const std::string* default_value, const std::string& value, - Arena* /*arena*/) PROTOBUF_ALWAYS_INLINE { - SetNoArena(default_value, value); - } - void SetNoArena(const std::string* default_value, - const std::string& value) PROTOBUF_ALWAYS_INLINE; - - void SetNoArena(const std::string* default_value, - std::string&& value) PROTOBUF_ALWAYS_INLINE; - void SetAllocated(const std::string* default_value, std::string* value, - Arena* /*arena*/) { - SetAllocatedNoArena(default_value, value); - } - void SetAllocatedNoArena(const std::string* default_value, - std::string* value); - void Swap(InlinedStringField* from) PROTOBUF_ALWAYS_INLINE; - std::string* UnsafeMutablePointer(); - void UnsafeSetDefault(const std::string* default_value); - std::string* UnsafeArenaRelease(const std::string* default_value, - Arena* arena); - void UnsafeArenaSetAllocated(const std::string* default_value, - std::string* value, Arena* arena); - - bool IsDefault(const std::string* /*default_value*/) { return false; } - - private: - std::string value_; -}; - -inline InlinedStringField::InlinedStringField() {} - -inline InlinedStringField::InlinedStringField(const std::string& default_value) - : value_(default_value) {} - -inline void InlinedStringField::AssignWithDefault( - const std::string* /*default_value*/, const InlinedStringField& from) { - value_ = from.value_; -} - -inline const std::string& InlinedStringField::GetNoArena() const { - return value_; -} - -inline std::string* InlinedStringField::MutableNoArena(const std::string*) { - return &value_; -} - -inline void InlinedStringField::SetAllocatedNoArena( - const std::string* default_value, std::string* value) { - if (value == NULL) { - value_.assign(*default_value); - } else { - value_.assign(std::move(*value)); - delete value; - } -} - -inline void InlinedStringField::DestroyNoArena(const std::string*) { - // This is invoked from the generated message's ArenaDtor, which is used to - // clean up objects not allocated on the Arena. - this->~InlinedStringField(); -} - -inline void InlinedStringField::ClearNonDefaultToEmptyNoArena() { - value_.clear(); -} - -inline void InlinedStringField::ClearToDefaultNoArena( - const std::string* default_value) { - value_.assign(*default_value); -} - -inline std::string* InlinedStringField::ReleaseNonDefaultNoArena( - const std::string* default_value) { - std::string* released = new std::string(*default_value); - value_.swap(*released); - return released; -} - -inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/, - StringPiece value) { - value_.assign(value.data(), value.length()); -} - -inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/, - const std::string& value) { - value_.assign(value); -} - -inline void InlinedStringField::SetNoArena(const std::string* /*default_value*/, - std::string&& value) { - value_.assign(std::move(value)); -} - -inline void InlinedStringField::Swap(InlinedStringField* from) { - value_.swap(from->value_); -} - -inline std::string* InlinedStringField::UnsafeMutablePointer() { - return &value_; -} - -inline void InlinedStringField::UnsafeSetDefault( - const std::string* default_value) { - value_.assign(*default_value); -} - -inline std::string* InlinedStringField::UnsafeArenaRelease( - const std::string* default_value, Arena* /*arena*/) { - return ReleaseNoArena(default_value); -} - -inline void InlinedStringField::UnsafeArenaSetAllocated( - const std::string* default_value, std::string* value, Arena* /*arena*/) { - if (value == NULL) { - value_.assign(*default_value); - } else { - value_.assign(*value); - } -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/message.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/message.cc deleted file mode 100644 index 5d768b953..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/message.cc +++ /dev/null @@ -1,735 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace google { -namespace protobuf { - -namespace internal { - -// TODO(gerbens) make this factorized better. This should not have to hop -// to reflection. Currently uses GeneratedMessageReflection and thus is -// defined in generated_message_reflection.cc -void RegisterFileLevelMetadata(const DescriptorTable* descriptor_table); - -} // namespace internal - -using internal::ReflectionOps; -using internal::WireFormat; -using internal::WireFormatLite; - -void Message::MergeFrom(const Message& from) { - const Descriptor* descriptor = GetDescriptor(); - GOOGLE_CHECK_EQ(from.GetDescriptor(), descriptor) - << ": Tried to merge from a message with a different type. " - "to: " - << descriptor->full_name() - << ", " - "from: " - << from.GetDescriptor()->full_name(); - ReflectionOps::Merge(from, this); -} - -void Message::CheckTypeAndMergeFrom(const MessageLite& other) { - MergeFrom(*down_cast(&other)); -} - -void Message::CopyFrom(const Message& from) { - const Descriptor* descriptor = GetDescriptor(); - GOOGLE_CHECK_EQ(from.GetDescriptor(), descriptor) - << ": Tried to copy from a message with a different type. " - "to: " - << descriptor->full_name() - << ", " - "from: " - << from.GetDescriptor()->full_name(); - ReflectionOps::Copy(from, this); -} - -std::string Message::GetTypeName() const { - return GetDescriptor()->full_name(); -} - -void Message::Clear() { ReflectionOps::Clear(this); } - -bool Message::IsInitialized() const { - return ReflectionOps::IsInitialized(*this); -} - -void Message::FindInitializationErrors(std::vector* errors) const { - return ReflectionOps::FindInitializationErrors(*this, "", errors); -} - -std::string Message::InitializationErrorString() const { - std::vector errors; - FindInitializationErrors(&errors); - return Join(errors, ", "); -} - -void Message::CheckInitialized() const { - GOOGLE_CHECK(IsInitialized()) << "Message of type \"" << GetDescriptor()->full_name() - << "\" is missing required fields: " - << InitializationErrorString(); -} - -void Message::DiscardUnknownFields() { - return ReflectionOps::DiscardUnknownFields(this); -} - -namespace internal { - -class ReflectionAccessor { - public: - static void* GetOffset(void* msg, const google::protobuf::FieldDescriptor* f, - const google::protobuf::Reflection* r) { - return static_cast(msg) + r->schema_.GetFieldOffset(f); - } - - static void* GetRepeatedEnum(const Reflection* reflection, - const FieldDescriptor* field, Message* msg) { - return reflection->MutableRawRepeatedField( - msg, field, FieldDescriptor::CPPTYPE_ENUM, 0, nullptr); - } - - static InternalMetadataWithArena* MutableInternalMetadataWithArena( - const Reflection* reflection, Message* msg) { - return reflection->MutableInternalMetadataWithArena(msg); - } -}; - -} // namespace internal - -void SetField(uint64 val, const FieldDescriptor* field, Message* msg, - const Reflection* reflection) { -#define STORE_TYPE(CPPTYPE_METHOD) \ - do \ - if (field->is_repeated()) { \ - reflection->Add##CPPTYPE_METHOD(msg, field, value); \ - } else { \ - reflection->Set##CPPTYPE_METHOD(msg, field, value); \ - } \ - while (0) - - switch (field->type()) { -#define HANDLE_TYPE(TYPE, CPPTYPE, CPPTYPE_METHOD) \ - case FieldDescriptor::TYPE_##TYPE: { \ - CPPTYPE value = val; \ - STORE_TYPE(CPPTYPE_METHOD); \ - break; \ - } - - // Varints - HANDLE_TYPE(INT32, int32, Int32) - HANDLE_TYPE(INT64, int64, Int64) - HANDLE_TYPE(UINT32, uint32, UInt32) - HANDLE_TYPE(UINT64, uint64, UInt64) - case FieldDescriptor::TYPE_SINT32: { - int32 value = WireFormatLite::ZigZagDecode32(val); - STORE_TYPE(Int32); - break; - } - case FieldDescriptor::TYPE_SINT64: { - int64 value = WireFormatLite::ZigZagDecode64(val); - STORE_TYPE(Int64); - break; - } - HANDLE_TYPE(BOOL, bool, Bool) - - // Fixed - HANDLE_TYPE(FIXED32, uint32, UInt32) - HANDLE_TYPE(FIXED64, uint64, UInt64) - HANDLE_TYPE(SFIXED32, int32, Int32) - HANDLE_TYPE(SFIXED64, int64, Int64) - - case FieldDescriptor::TYPE_FLOAT: { - float value; - uint32 bit_rep = val; - std::memcpy(&value, &bit_rep, sizeof(value)); - STORE_TYPE(Float); - break; - } - case FieldDescriptor::TYPE_DOUBLE: { - double value; - uint64 bit_rep = val; - std::memcpy(&value, &bit_rep, sizeof(value)); - STORE_TYPE(Double); - break; - } - case FieldDescriptor::TYPE_ENUM: { - int value = val; - if (field->is_repeated()) { - reflection->AddEnumValue(msg, field, value); - } else { - reflection->SetEnumValue(msg, field, value); - } - break; - } - default: - GOOGLE_LOG(FATAL) << "Error in descriptors, primitve field with field type " - << field->type(); - } -#undef STORE_TYPE -#undef HANDLE_TYPE -} - -bool ReflectiveValidator(const void* arg, int val) { - auto d = static_cast(arg); - return d->FindValueByNumber(val) != nullptr; -} - -const char* ParsePackedField(const FieldDescriptor* field, Message* msg, - const Reflection* reflection, const char* ptr, - internal::ParseContext* ctx) { - switch (field->type()) { -#define HANDLE_PACKED_TYPE(TYPE, CPPTYPE, METHOD_NAME) \ - case FieldDescriptor::TYPE_##TYPE: \ - return internal::Packed##METHOD_NAME##Parser( \ - reflection->MutableRepeatedFieldInternal(msg, field), ptr, \ - ctx) - HANDLE_PACKED_TYPE(INT32, int32, Int32); - HANDLE_PACKED_TYPE(INT64, int64, Int64); - HANDLE_PACKED_TYPE(SINT32, int32, SInt32); - HANDLE_PACKED_TYPE(SINT64, int64, SInt64); - HANDLE_PACKED_TYPE(UINT32, uint32, UInt32); - HANDLE_PACKED_TYPE(UINT64, uint64, UInt64); - HANDLE_PACKED_TYPE(BOOL, bool, Bool); - case FieldDescriptor::TYPE_ENUM: { - auto object = - internal::ReflectionAccessor::GetRepeatedEnum(reflection, field, msg); - if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3) { - return internal::PackedEnumParser(object, ptr, ctx); - } else { - return internal::PackedEnumParserArg( - object, ptr, ctx, ReflectiveValidator, field->enum_type(), - internal::ReflectionAccessor::MutableInternalMetadataWithArena( - reflection, msg), - field->number()); - } - } - HANDLE_PACKED_TYPE(FIXED32, uint32, Fixed32); - HANDLE_PACKED_TYPE(FIXED64, uint64, Fixed64); - HANDLE_PACKED_TYPE(SFIXED32, int32, SFixed32); - HANDLE_PACKED_TYPE(SFIXED64, int64, SFixed64); - HANDLE_PACKED_TYPE(FLOAT, float, Float); - HANDLE_PACKED_TYPE(DOUBLE, double, Double); -#undef HANDLE_PACKED_TYPE - - default: - GOOGLE_LOG(FATAL) << "Type is not packable " << field->type(); - return nullptr; // Make compiler happy - } -} - -const char* ParseLenDelim(int field_number, const FieldDescriptor* field, - Message* msg, const Reflection* reflection, - const char* ptr, internal::ParseContext* ctx) { - if (WireFormat::WireTypeForFieldType(field->type()) != - WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - GOOGLE_DCHECK(field->is_packable()); - return ParsePackedField(field, msg, reflection, ptr, ctx); - } - enum { kNone = 0, kVerify, kStrict } utf8_level = kNone; - const char* field_name = nullptr; - auto parse_string = [ptr, ctx, &utf8_level, - &field_name](std::string* s) -> const char* { - auto res = internal::InlineGreedyStringParser(s, ptr, ctx); - if (utf8_level != kNone) { - if (!internal::VerifyUTF8(s, field_name) && utf8_level == kStrict) { - return nullptr; - } - } - return res; - }; - switch (field->type()) { - case FieldDescriptor::TYPE_STRING: { - bool enforce_utf8 = true; - bool utf8_verification = true; - if (enforce_utf8 && - field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3) { - utf8_level = kStrict; - } else if (utf8_verification) { - utf8_level = kVerify; - } - field_name = field->full_name().c_str(); - PROTOBUF_FALLTHROUGH_INTENDED; - } - case FieldDescriptor::TYPE_BYTES: { - if (field->is_repeated()) { - int index = reflection->FieldSize(*msg, field); - // Add new empty value. - reflection->AddString(msg, field, ""); - if (field->options().ctype() == FieldOptions::STRING || - field->is_extension()) { - auto object = - reflection - ->MutableRepeatedPtrFieldInternal(msg, field) - ->Mutable(index); - return parse_string(object); - } else { - auto object = - reflection - ->MutableRepeatedPtrFieldInternal(msg, field) - ->Mutable(index); - return parse_string(object); - } - } else { - // Clear value and make sure it's set. - reflection->SetString(msg, field, ""); - if (field->options().ctype() == FieldOptions::STRING || - field->is_extension()) { - // HACK around inability to get mutable_string in reflection - std::string* object = &const_cast( - reflection->GetStringReference(*msg, field, nullptr)); - return parse_string(object); - } else { - // HACK around inability to get mutable_string in reflection - std::string* object = &const_cast( - reflection->GetStringReference(*msg, field, nullptr)); - return parse_string(object); - } - } - GOOGLE_LOG(FATAL) << "No other type than string supported"; - } - case FieldDescriptor::TYPE_MESSAGE: { - Message* object; - if (field->is_repeated()) { - object = reflection->AddMessage(msg, field, ctx->data().factory); - } else { - object = reflection->MutableMessage(msg, field, ctx->data().factory); - } - return ctx->ParseMessage(object, ptr); - } - default: - GOOGLE_LOG(FATAL) << "Wrong type for length delim " << field->type(); - } - return nullptr; // Make compiler happy. -} - -Message* GetGroup(int field_number, const FieldDescriptor* field, Message* msg, - const Reflection* reflection) { - if (field->is_repeated()) { - return reflection->AddMessage(msg, field, nullptr); - } else { - return reflection->MutableMessage(msg, field, nullptr); - } -} - -const char* Message::_InternalParse(const char* ptr, - internal::ParseContext* ctx) { - class ReflectiveFieldParser { - public: - ReflectiveFieldParser(Message* msg, internal::ParseContext* ctx) - : ReflectiveFieldParser(msg, ctx, false) {} - - void AddVarint(uint32 num, uint64 value) { - if (is_item_ && num == 2) { - if (!payload_.empty()) { - auto field = Field(value, 2); - if (field && field->message_type()) { - auto child = reflection_->MutableMessage(msg_, field); - // TODO(gerbens) signal error - child->ParsePartialFromString(payload_); - } else { - MutableUnknown()->AddLengthDelimited(value)->swap(payload_); - } - return; - } - type_id_ = value; - return; - } - auto field = Field(num, 0); - if (field) { - SetField(value, field, msg_, reflection_); - } else { - MutableUnknown()->AddVarint(num, value); - } - } - void AddFixed64(uint32 num, uint64 value) { - auto field = Field(num, 1); - if (field) { - SetField(value, field, msg_, reflection_); - } else { - MutableUnknown()->AddFixed64(num, value); - } - } - const char* ParseLengthDelimited(uint32 num, const char* ptr, - internal::ParseContext* ctx) { - if (is_item_ && num == 3) { - if (type_id_ == 0) { - return InlineGreedyStringParser(&payload_, ptr, ctx); - } - num = type_id_; - type_id_ = 0; - } - auto field = Field(num, 2); - if (field) { - return ParseLenDelim(num, field, msg_, reflection_, ptr, ctx); - } else { - return InlineGreedyStringParser( - MutableUnknown()->AddLengthDelimited(num), ptr, ctx); - } - } - const char* ParseGroup(uint32 num, const char* ptr, - internal::ParseContext* ctx) { - if (!is_item_ && descriptor_->options().message_set_wire_format() && - num == 1) { - is_item_ = true; - ptr = ctx->ParseGroup(this, ptr, num * 8 + 3); - is_item_ = false; - type_id_ = 0; - return ptr; - } - auto field = Field(num, 3); - if (field) { - auto msg = GetGroup(num, field, msg_, reflection_); - return ctx->ParseGroup(msg, ptr, num * 8 + 3); - } else { - return UnknownFieldParse(num * 8 + 3, MutableUnknown(), ptr, ctx); - } - } - void AddFixed32(uint32 num, uint32 value) { - auto field = Field(num, 5); - if (field) { - SetField(value, field, msg_, reflection_); - } else { - MutableUnknown()->AddFixed32(num, value); - } - } - - const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) { - // We're parsing the a MessageSetItem - GOOGLE_DCHECK(is_item_); - return internal::WireFormatParser(*this, ptr, ctx); - } - - private: - Message* msg_; - const Descriptor* descriptor_; - const Reflection* reflection_; - internal::ParseContext* ctx_; - UnknownFieldSet* unknown_ = nullptr; - bool is_item_ = false; - uint32 type_id_ = 0; - std::string payload_; - - ReflectiveFieldParser(Message* msg, internal::ParseContext* ctx, - bool is_item) - : msg_(msg), - descriptor_(msg->GetDescriptor()), - reflection_(msg->GetReflection()), - ctx_(ctx), - is_item_(is_item) { - GOOGLE_CHECK(descriptor_) << msg->GetTypeName(); - GOOGLE_CHECK(reflection_) << msg->GetTypeName(); - } - - const FieldDescriptor* Field(int num, int wire_type) { - auto field = descriptor_->FindFieldByNumber(num); - - // If that failed, check if the field is an extension. - if (field == nullptr && descriptor_->IsExtensionNumber(num)) { - const DescriptorPool* pool = ctx_->data().pool; - if (pool == nullptr) { - field = reflection_->FindKnownExtensionByNumber(num); - } else { - field = pool->FindExtensionByNumber(descriptor_, num); - } - } - if (field == nullptr) return nullptr; - - if (internal::WireFormat::WireTypeForFieldType(field->type()) != - wire_type) { - if (field->is_packable()) { - if (wire_type == - internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - return field; - } - } - return nullptr; - } - return field; - } - - UnknownFieldSet* MutableUnknown() { - if (unknown_) return unknown_; - return unknown_ = reflection_->MutableUnknownFields(msg_); - } - }; - - ReflectiveFieldParser field_parser(this, ctx); - return internal::WireFormatParser(field_parser, ptr, ctx); -} - -uint8* Message::_InternalSerialize(uint8* target, - io::EpsCopyOutputStream* stream) const { - return WireFormat::_InternalSerialize(*this, target, stream); -} - -size_t Message::ByteSizeLong() const { - size_t size = WireFormat::ByteSize(*this); - SetCachedSize(internal::ToCachedSize(size)); - return size; -} - -void Message::SetCachedSize(int /* size */) const { - GOOGLE_LOG(FATAL) << "Message class \"" << GetDescriptor()->full_name() - << "\" implements neither SetCachedSize() nor ByteSize(). " - "Must implement one or the other."; -} - -size_t Message::SpaceUsedLong() const { - return GetReflection()->SpaceUsedLong(*this); -} - -// ============================================================================= -// MessageFactory - -MessageFactory::~MessageFactory() {} - -namespace { - -class GeneratedMessageFactory : public MessageFactory { - public: - static GeneratedMessageFactory* singleton(); - - void RegisterFile(const google::protobuf::internal::DescriptorTable* table); - void RegisterType(const Descriptor* descriptor, const Message* prototype); - - // implements MessageFactory --------------------------------------- - const Message* GetPrototype(const Descriptor* type) override; - - private: - // Only written at static init time, so does not require locking. - std::unordered_map, streq> - file_map_; - - internal::WrappedMutex mutex_; - // Initialized lazily, so requires locking. - std::unordered_map type_map_; -}; - -GeneratedMessageFactory* GeneratedMessageFactory::singleton() { - static auto instance = - internal::OnShutdownDelete(new GeneratedMessageFactory); - return instance; -} - -void GeneratedMessageFactory::RegisterFile( - const google::protobuf::internal::DescriptorTable* table) { - if (!InsertIfNotPresent(&file_map_, table->filename, table)) { - GOOGLE_LOG(FATAL) << "File is already registered: " << table->filename; - } -} - -void GeneratedMessageFactory::RegisterType(const Descriptor* descriptor, - const Message* prototype) { - GOOGLE_DCHECK_EQ(descriptor->file()->pool(), DescriptorPool::generated_pool()) - << "Tried to register a non-generated type with the generated " - "type registry."; - - // This should only be called as a result of calling a file registration - // function during GetPrototype(), in which case we already have locked - // the mutex. - mutex_.AssertHeld(); - if (!InsertIfNotPresent(&type_map_, descriptor, prototype)) { - GOOGLE_LOG(DFATAL) << "Type is already registered: " << descriptor->full_name(); - } -} - - -const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) { - { - ReaderMutexLock lock(&mutex_); - const Message* result = FindPtrOrNull(type_map_, type); - if (result != NULL) return result; - } - - // If the type is not in the generated pool, then we can't possibly handle - // it. - if (type->file()->pool() != DescriptorPool::generated_pool()) return NULL; - - // Apparently the file hasn't been registered yet. Let's do that now. - const internal::DescriptorTable* registration_data = - FindPtrOrNull(file_map_, type->file()->name().c_str()); - if (registration_data == NULL) { - GOOGLE_LOG(DFATAL) << "File appears to be in generated pool but wasn't " - "registered: " - << type->file()->name(); - return NULL; - } - - WriterMutexLock lock(&mutex_); - - // Check if another thread preempted us. - const Message* result = FindPtrOrNull(type_map_, type); - if (result == NULL) { - // Nope. OK, register everything. - internal::RegisterFileLevelMetadata(registration_data); - // Should be here now. - result = FindPtrOrNull(type_map_, type); - } - - if (result == NULL) { - GOOGLE_LOG(DFATAL) << "Type appears to be in generated pool but wasn't " - << "registered: " << type->full_name(); - } - - return result; -} - -} // namespace - -MessageFactory* MessageFactory::generated_factory() { - return GeneratedMessageFactory::singleton(); -} - -void MessageFactory::InternalRegisterGeneratedFile( - const google::protobuf::internal::DescriptorTable* table) { - GeneratedMessageFactory::singleton()->RegisterFile(table); -} - -void MessageFactory::InternalRegisterGeneratedMessage( - const Descriptor* descriptor, const Message* prototype) { - GeneratedMessageFactory::singleton()->RegisterType(descriptor, prototype); -} - - -namespace { -template -T* GetSingleton() { - static T singleton; - return &singleton; -} -} // namespace - -const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( - const FieldDescriptor* field) const { - GOOGLE_CHECK(field->is_repeated()); - switch (field->cpp_type()) { -#define HANDLE_PRIMITIVE_TYPE(TYPE, type) \ - case FieldDescriptor::CPPTYPE_##TYPE: \ - return GetSingleton >(); - HANDLE_PRIMITIVE_TYPE(INT32, int32) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32) - HANDLE_PRIMITIVE_TYPE(INT64, int64) - HANDLE_PRIMITIVE_TYPE(UINT64, uint64) - HANDLE_PRIMITIVE_TYPE(FLOAT, float) - HANDLE_PRIMITIVE_TYPE(DOUBLE, double) - HANDLE_PRIMITIVE_TYPE(BOOL, bool) - HANDLE_PRIMITIVE_TYPE(ENUM, int32) -#undef HANDLE_PRIMITIVE_TYPE - case FieldDescriptor::CPPTYPE_STRING: - switch (field->options().ctype()) { - default: - case FieldOptions::STRING: - return GetSingleton(); - } - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - if (field->is_map()) { - return GetSingleton(); - } else { - return GetSingleton(); - } - } - GOOGLE_LOG(FATAL) << "Should not reach here."; - return NULL; -} - -namespace internal { -template <> -#if defined(_MSC_VER) && (_MSC_VER >= 1800) -// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue -// #240 -PROTOBUF_NOINLINE -#endif - Message* - GenericTypeHandler::NewFromPrototype(const Message* prototype, - Arena* arena) { - return prototype->New(arena); -} -template <> -#if defined(_MSC_VER) && (_MSC_VER >= 1800) -// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue -// #240 -PROTOBUF_NOINLINE -#endif - Arena* - GenericTypeHandler::GetArena(Message* value) { - return value->GetArena(); -} -template <> -#if defined(_MSC_VER) && (_MSC_VER >= 1800) -// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue -// #240 -PROTOBUF_NOINLINE -#endif - void* - GenericTypeHandler::GetMaybeArenaPointer(Message* value) { - return value->GetMaybeArenaPointer(); -} -} // namespace internal - -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/metadata_lite.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/metadata_lite.h deleted file mode 100644 index 40c7ea785..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/metadata_lite.h +++ /dev/null @@ -1,235 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLE_PROTOBUF_METADATA_LITE_H__ -#define GOOGLE_PROTOBUF_METADATA_LITE_H__ - -#include -#include -#include -#include -#include -#include - -#include - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -namespace google { -namespace protobuf { -namespace internal { - -// This is the representation for messages that support arena allocation. It -// uses a tagged pointer to either store the Arena pointer, if there are no -// unknown fields, or a pointer to a block of memory with both the Arena pointer -// and the UnknownFieldSet, if there are unknown fields. This optimization -// allows for "zero-overhead" storage of the Arena pointer, relative to the -// above baseline implementation. -// -// The tagged pointer uses the LSB to disambiguate cases, and uses bit 0 == 0 to -// indicate an arena pointer and bit 0 == 1 to indicate a UFS+Arena-container -// pointer. -template -class InternalMetadataWithArenaBase { - public: - InternalMetadataWithArenaBase() : ptr_(NULL) {} - explicit InternalMetadataWithArenaBase(Arena* arena) : ptr_(arena) {} - - ~InternalMetadataWithArenaBase() { - if (have_unknown_fields() && arena() == NULL) { - delete PtrValue(); - } - ptr_ = NULL; - } - - PROTOBUF_ALWAYS_INLINE const T& unknown_fields() const { - if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) { - return PtrValue()->unknown_fields; - } else { - return Derived::default_instance(); - } - } - - PROTOBUF_ALWAYS_INLINE T* mutable_unknown_fields() { - if (PROTOBUF_PREDICT_TRUE(have_unknown_fields())) { - return &PtrValue()->unknown_fields; - } else { - return mutable_unknown_fields_slow(); - } - } - - PROTOBUF_ALWAYS_INLINE Arena* arena() const { - if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) { - return PtrValue()->arena; - } else { - return PtrValue(); - } - } - - PROTOBUF_ALWAYS_INLINE bool have_unknown_fields() const { - return PtrTag() == kTagContainer; - } - - PROTOBUF_ALWAYS_INLINE void Swap(Derived* other) { - // Semantics here are that we swap only the unknown fields, not the arena - // pointer. We cannot simply swap ptr_ with other->ptr_ because we need to - // maintain our own arena ptr. Also, our ptr_ and other's ptr_ may be in - // different states (direct arena pointer vs. container with UFS) so we - // cannot simply swap ptr_ and then restore the arena pointers. We reuse - // UFS's swap implementation instead. - if (have_unknown_fields() || other->have_unknown_fields()) { - static_cast(this)->DoSwap(other->mutable_unknown_fields()); - } - } - - PROTOBUF_ALWAYS_INLINE void MergeFrom(const Derived& other) { - if (other.have_unknown_fields()) { - static_cast(this)->DoMergeFrom(other.unknown_fields()); - } - } - - PROTOBUF_ALWAYS_INLINE void Clear() { - if (have_unknown_fields()) { - static_cast(this)->DoClear(); - } - } - - PROTOBUF_ALWAYS_INLINE void* raw_arena_ptr() const { return ptr_; } - - private: - void* ptr_; - - // Tagged pointer implementation. - enum { - // ptr_ is an Arena*. - kTagArena = 0, - // ptr_ is a Container*. - kTagContainer = 1, - }; - static const intptr_t kPtrTagMask = 1; - static const intptr_t kPtrValueMask = ~kPtrTagMask; - - // Accessors for pointer tag and pointer value. - PROTOBUF_ALWAYS_INLINE int PtrTag() const { - return reinterpret_cast(ptr_) & kPtrTagMask; - } - - template - U* PtrValue() const { - return reinterpret_cast(reinterpret_cast(ptr_) & - kPtrValueMask); - } - - // If ptr_'s tag is kTagContainer, it points to an instance of this struct. - struct Container { - T unknown_fields; - Arena* arena; - }; - - PROTOBUF_NOINLINE T* mutable_unknown_fields_slow() { - Arena* my_arena = arena(); - Container* container = Arena::Create(my_arena); - // Two-step assignment works around a bug in clang's static analyzer: - // https://bugs.llvm.org/show_bug.cgi?id=34198. - ptr_ = container; - ptr_ = reinterpret_cast(reinterpret_cast(ptr_) | - kTagContainer); - container->arena = my_arena; - return &(container->unknown_fields); - } -}; - -// We store unknown fields as a std::string right now, because there is -// currently no good interface for reading unknown fields into an ArenaString. -// We may want to revisit this to allow unknown fields to be parsed onto the -// Arena. -class InternalMetadataWithArenaLite - : public InternalMetadataWithArenaBase { - public: - InternalMetadataWithArenaLite() {} - - explicit InternalMetadataWithArenaLite(Arena* arena) - : InternalMetadataWithArenaBase(arena) {} - - void DoSwap(std::string* other) { mutable_unknown_fields()->swap(*other); } - - void DoMergeFrom(const std::string& other) { - mutable_unknown_fields()->append(other); - } - - void DoClear() { mutable_unknown_fields()->clear(); } - - static const std::string& default_instance() { - // Can't use GetEmptyStringAlreadyInited() here because empty string - // may not have been initalized yet. This happens when protocol compiler - // statically determines the user can't access defaults and omits init code - // from proto constructors. However unknown fields are always part of a - // proto so it needs to be lazily initailzed. See b/112613846. - return GetEmptyString(); - } -}; - -// This helper RAII class is needed to efficiently parse unknown fields. We -// should only call mutable_unknown_fields if there are actual unknown fields. -// The obvious thing to just use a stack string and swap it at the end of -// the parse won't work, because the destructor of StringOutputStream needs to -// be called before we can modify the string (it check-fails). Using -// LiteUnknownFieldSetter setter(&_internal_metadata_); -// StringOutputStream stream(setter.buffer()); -// guarantees that the string is only swapped after stream is destroyed. -class PROTOBUF_EXPORT LiteUnknownFieldSetter { - public: - explicit LiteUnknownFieldSetter(InternalMetadataWithArenaLite* metadata) - : metadata_(metadata) { - if (metadata->have_unknown_fields()) { - buffer_.swap(*metadata->mutable_unknown_fields()); - } - } - ~LiteUnknownFieldSetter() { - if (!buffer_.empty()) metadata_->mutable_unknown_fields()->swap(buffer_); - } - std::string* buffer() { return &buffer_; } - - private: - InternalMetadataWithArenaLite* metadata_; - std::string buffer_; -}; - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_METADATA_LITE_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/port_def.inc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/port_def.inc deleted file mode 100644 index 5e619ba3f..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/port_def.inc +++ /dev/null @@ -1,422 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This file defines common macros that are used in protobuf. -// -// To hide these definitions from the outside world (and to prevent collisions -// if more than one version of protobuf is #included in the same project) you -// must follow this pattern when #including port_def.inc in a header file: -// -// #include "other_header.h" -// #include "message.h" -// // etc. -// -// #include "port_def.inc" // MUST be last header included -// -// // Definitions for this header. -// -// #include "port_undef.inc" -// -// This is a textual header with no include guard, because we want to -// detect/prohibit anytime it is #included twice without a corresponding -// #undef. - -// These macros are private and should always be -// ::util::RetrieveErrorSpace(*this) headers. If any of these errors fire, you -// should either properly #include port_undef.h at the end of your header that -// #includes port.h, or don't #include port.h twice in a .cc file. -#ifdef PROTOBUF_NAMESPACE -#error PROTOBUF_NAMESPACE was previously defined -#endif -#ifdef PROTOBUF_NAMESPACE_ID -#error PROTOBUF_NAMESPACE_ID was previously defined -#endif -#ifdef PROTOBUF_ALWAYS_INLINE -#error PROTOBUF_ALWAYS_INLINE was previously defined -#endif -#ifdef PROTOBUF_COLD -#error PROTOBUF_COLD was previously defined -#endif -#ifdef PROTOBUF_NOINLINE -#error PROTOBUF_NOINLINE was previously defined -#endif -#ifdef PROTOBUF_SECTION_VARIABLE -#error PROTOBUF_SECTION_VARIABLE was previously defined -#endif -#ifdef PROTOBUF_DEPRECATED -#error PROTOBUF_DEPRECATED was previously defined -#endif -#ifdef PROTOBUF_DEPRECATED_MSG -#error PROTOBUF_DEPRECATED_MSG was previously defined -#endif -#ifdef PROTOBUF_FUNC_ALIGN -#error PROTOBUF_FUNC_ALIGN was previously defined -#endif -#ifdef PROTOBUF_RETURNS_NONNULL -#error PROTOBUF_RETURNS_NONNULL was previously defined -#endif -#ifdef PROTOBUF_ATTRIBUTE_REINITIALIZES -#error PROTOBUF_ATTRIBUTE_REINITIALIZES was previously defined -#endif -#ifdef PROTOBUF_RTTI -#error PROTOBUF_RTTI was previously defined -#endif -#ifdef PROTOBUF_VERSION -#error PROTOBUF_VERSION was previously defined -#endif -#ifdef PROTOBUF_VERSION_SUFFIX -#error PROTOBUF_VERSION_SUFFIX was previously defined -#endif -#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC -#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined -#endif -#ifdef PROTOBUF_MIN_PROTOC_VERSION -#error PROTOBUF_MIN_PROTOC_VERSION was previously defined -#endif -#ifdef PROTOBUF_PREDICT_TRUE -#error PROTOBUF_PREDICT_TRUE was previously defined -#endif -#ifdef PROTOBUF_PREDICT_FALSE -#error PROTOBUF_PREDICT_FALSE was previously defined -#endif -#ifdef PROTOBUF_FIELD_OFFSET -#error PROTOBUF_FIELD_OFFSET was previously defined -#endif -#ifdef PROTOBUF_LL_FORMAT -#error PROTOBUF_LL_FORMAT was previously defined -#endif -#ifdef PROTOBUF_GUARDED_BY -#error PROTOBUF_GUARDED_BY was previously defined -#endif -#ifdef PROTOBUF_LONGLONG -#error PROTOBUF_LONGLONG was previously defined -#endif -#ifdef PROTOBUF_ULONGLONG -#error PROTOBUF_ULONGLONG was previously defined -#endif -#ifdef PROTOBUF_FALLTHROUGH_INTENDED -#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined -#endif -#ifdef PROTOBUF_EXPORT -#error PROTOBUF_EXPORT was previously defined -#endif -#ifdef PROTOC_EXPORT -#error PROTOC_EXPORT was previously defined -#endif -#ifdef PROTOBUF_MUST_USE_RESULT -#error PROTOBUF_MUST_USE_RESULT was previously defined -#endif -#ifdef PROTOBUF_UNUSED -#error PROTOBUF_UNUSED was previously defined -#endif - - -#define PROTOBUF_NAMESPACE "google::protobuf" -#define PROTOBUF_NAMESPACE_ID google::protobuf -#define PROTOBUF_NAMESPACE_OPEN \ - namespace google { \ - namespace protobuf { -#define PROTOBUF_NAMESPACE_CLOSE \ - } /* namespace protobuf */ \ - } /* namespace google */ - -#if defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_CC) -#define PROTOBUF_DEPRECATED __attribute__((deprecated)) -#define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated)) -#define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) -#elif defined(_MSC_VER) -#define PROTOBUF_DEPRECATED __declspec(deprecated) -#define PROTOBUF_DEPRECATED_ENUM -#define PROTOBUF_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) -#endif - -#define PROTOBUF_SECTION_VARIABLE(x) -#define PROTOBUF_MUST_USE_RESULT - -// ---------------------------------------------------------------------------- -// Annotations: Some parts of the code have been annotated in ways that might -// be useful to some compilers or tools, but are not supported universally. -// You can #define these annotations yourself if the default implementation -// is not right for you. - -#ifdef GOOGLE_ATTRIBUTE_ALWAYS_INLINE -#define PROTOBUF_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE -#else -#if defined(__GNUC__) && \ - (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -// For functions we want to force inline. -// Introduced in gcc 3.1. -#define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline)) -#else -// Other compilers will have to figure it out for themselves. -#define PROTOBUF_ALWAYS_INLINE -#endif -#endif - -#ifdef GOOGLE_ATTRIBUTE_NOINLINE -#define PROTOBUF_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE -#else -#if defined(__GNUC__) && \ - (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -// For functions we want to force not inline. -// Introduced in gcc 3.1. -#define PROTOBUF_NOINLINE __attribute__((noinline)) -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) -// Seems to have been around since at least Visual Studio 2005 -#define PROTOBUF_NOINLINE __declspec(noinline) -#else -// Other compilers will have to figure it out for themselves. -#define PROTOBUF_NOINLINE -#endif -#endif - -#ifdef GOOGLE_ATTRIBUTE_FUNC_ALIGN -#define PROTOBUF_FUNC_ALIGN GOOGLE_ATTRIBUTE_FUNC_ALIGN -#else -#if defined(__clang__) || \ - defined(__GNUC__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) -// Function alignment attribute introduced in gcc 4.3 -#define PROTOBUF_FUNC_ALIGN(bytes) __attribute__((aligned(bytes))) -#else -#define PROTOBUF_FUNC_ALIGN(bytes) -#endif -#endif - -#ifdef GOOGLE_PREDICT_TRUE -#define PROTOBUF_PREDICT_TRUE GOOGLE_PREDICT_TRUE -#else -#ifdef __GNUC__ -// Provided at least since GCC 3.0. -#define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -#else -#define PROTOBUF_PREDICT_TRUE(x) (x) -#endif -#endif - -#ifdef GOOGLE_PREDICT_FALSE -#define PROTOBUF_PREDICT_FALSE GOOGLE_PREDICT_FALSE -#else -#ifdef __GNUC__ -// Provided at least since GCC 3.0. -#define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect(x, 0)) -#else -#define PROTOBUF_PREDICT_FALSE(x) (x) -#endif -#endif - -#ifdef GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL -#define PROTOBUF_RETURNS_NONNULL GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL -#else -#ifdef __GNUC__ -#define PROTOBUF_RETURNS_NONNULL __attribute__((returns_nonnull)) -#else -#define PROTOBUF_RETURNS_NONNULL -#endif -#endif - -#if defined(__has_cpp_attribute) -#if __has_cpp_attribute(clang::reinitializes) -#define PROTOBUF_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]] -#endif -#endif -#ifndef PROTOBUF_ATTRIBUTE_REINITIALIZES -#define PROTOBUF_ATTRIBUTE_REINITIALIZES -#endif - -#define PROTOBUF_GUARDED_BY(x) -#define PROTOBUF_COLD - -// Copied from ABSL. -#if defined(__clang__) && defined(__has_warning) -#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") -#define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]] -#endif -#elif defined(__GNUC__) && __GNUC__ >= 7 -#define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]] -#endif - -#ifndef PROTOBUF_FALLTHROUGH_INTENDED -#define PROTOBUF_FALLTHROUGH_INTENDED -#endif - -#if defined(__has_cpp_attribute) -#define HAS_ATTRIBUTE(attr) __has_cpp_attribute(attr) -#else -#define HAS_ATTRIBUTE(attr) 0 -#endif - -#if HAS_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__)) -#define PROTOBUF_UNUSED __attribute__((__unused__)) -#else -#define PROTOBUF_UNUSED -#endif - -#undef HAS_ATTRIBUTE - -#ifdef _MSC_VER -#define PROTOBUF_LONGLONG(x) x##I64 -#define PROTOBUF_ULONGLONG(x) x##UI64 -#define PROTOBUF_LL_FORMAT "I64" // As in printf("%I64d", ...) -#else -// By long long, we actually mean int64. -#define PROTOBUF_LONGLONG(x) x##LL -#define PROTOBUF_ULONGLONG(x) x##ULL -// Used to format real long long integers. -#define PROTOBUF_LL_FORMAT \ - "ll" // As in "%lld". Note that "q" is poor form also. -#endif - - -// Shared google3/opensource definitions. ////////////////////////////////////// - -#define PROTOBUF_VERSION 3011004 -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3011000 -#define PROTOBUF_MIN_PROTOC_VERSION 3011000 -#define PROTOBUF_VERSION_SUFFIX "" - -// The minimum library version which works with the current version of the -// headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3011000 - -#if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI -#define PROTOBUF_RTTI 0 -#else -#define PROTOBUF_RTTI 1 -#endif - -// Returns the offset of the given field within the given aggregate type. -// This is equivalent to the ANSI C offsetof() macro. However, according -// to the C++ standard, offsetof() only works on POD types, and GCC -// enforces this requirement with a warning. In practice, this rule is -// unnecessarily strict; there is probably no compiler or platform on -// which the offsets of the direct fields of a class are non-constant. -// Fields inherited from superclasses *can* have non-constant offsets, -// but that's not what this macro will be used for. -#if defined(__clang__) -// For Clang we use __builtin_offsetof() and suppress the warning, -// to avoid Control Flow Integrity and UBSan vptr sanitizers from -// crashing while trying to validate the invalid reinterpet_casts. -#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \ - __builtin_offsetof(TYPE, FIELD) \ - _Pragma("clang diagnostic pop") -#else -// Note that we calculate relative to the pointer value 16 here since if we -// just use zero, GCC complains about dereferencing a NULL pointer. We -// choose 16 rather than some other number just in case the compiler would -// be confused by an unaligned pointer. -#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \ - static_cast< ::google::protobuf::uint32>(reinterpret_cast( \ - &reinterpret_cast(16)->FIELD) - \ - reinterpret_cast(16)) -#endif - -#if defined(PROTOBUF_USE_DLLS) - #if defined(_MSC_VER) - #ifdef LIBPROTOBUF_EXPORTS - #define PROTOBUF_EXPORT __declspec(dllexport) - #define PROTOBUF_EXPORT_TEMPLATE_DECLARE - #define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllexport) - #else - #define PROTOBUF_EXPORT __declspec(dllimport) - #define PROTOBUF_EXPORT_TEMPLATE_DECLARE - #define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllimport) - #endif - #ifdef LIBPROTOC_EXPORTS - #define PROTOC_EXPORT __declspec(dllexport) - #else - #define PROTOC_EXPORT __declspec(dllimport) - #endif - #else // defined(_MSC_VER) - #ifdef LIBPROTOBUF_EXPORTS - #define PROTOBUF_EXPORT __attribute__((visibility("default"))) - #define PROTOBUF_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default"))) - #define PROTOBUF_EXPORT_TEMPLATE_DEFINE - #else - #define PROTOBUF_EXPORT - #define PROTOBUF_EXPORT_TEMPLATE_DECLARE - #define PROTOBUF_EXPORT_TEMPLATE_DEFINE - #endif - #ifdef LIBPROTOC_EXPORTS - #define PROTOC_EXPORT __attribute__((visibility("default"))) - #else - #define PROTOC_EXPORT - #endif - #endif -#else // defined(PROTOBUF_USE_DLLS) - #define PROTOBUF_EXPORT - #define PROTOC_EXPORT - #define PROTOBUF_EXPORT_TEMPLATE_DECLARE - #define PROTOBUF_EXPORT_TEMPLATE_DEFINE -#endif - -// Windows declares several inconvenient macro names. We #undef them and then -// restore them in port_undef.inc. -#ifdef _MSC_VER -#pragma push_macro("GetMessage") -#undef GetMessage -#pragma push_macro("IGNORE") -#undef IGNORE -#pragma push_macro("IN") -#undef IN -#pragma push_macro("OUT") -#undef OUT -#pragma push_macro("OPTIONAL") -#undef OPTIONAL -#pragma push_macro("min") -#undef min -#pragma push_macro("max") -#undef max -#endif // _MSC_VER - -#if defined(__clang__) -#pragma clang diagnostic push -// TODO(gerbens) ideally we cleanup the code. But a cursory try shows many -// violations. So let's ignore for now. -#pragma clang diagnostic ignored "-Wshorten-64-to-32" -#endif - -// PROTOBUF_ASSUME(pred) tells the compiler that it can assume pred is true. To -// be safe, we also validate the assumption with a GOOGLE_DCHECK in unoptimized -// builds. The macro does not do anything useful if the compiler does not -// support __builtin_assume. -#ifdef __has_builtin -#if __has_builtin(__builtin_assume) -#define PROTOBUF_ASSUME(pred) \ - GOOGLE_DCHECK(pred); \ - __builtin_assume(pred) -#else -#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred) -#endif -#else -#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred) -#endif diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/proto3_arena_unittest.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/proto3_arena_unittest.cc deleted file mode 100644 index 75da9eb7a..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/proto3_arena_unittest.cc +++ /dev/null @@ -1,199 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using proto3_arena_unittest::TestAllTypes; - -namespace google { -namespace protobuf { -namespace { -// We selectively set/check a few representative fields rather than all fields -// as this test is only expected to cover the basics of arena support. -void SetAllFields(TestAllTypes* m) { - m->set_optional_int32(100); - m->set_optional_string("asdf"); - m->set_optional_bytes("jkl;"); - m->mutable_optional_nested_message()->set_bb(42); - m->mutable_optional_foreign_message()->set_c(43); - m->set_optional_nested_enum(proto3_arena_unittest::TestAllTypes::BAZ); - m->set_optional_foreign_enum(proto3_arena_unittest::FOREIGN_BAZ); - m->mutable_optional_lazy_message()->set_bb(45); - m->add_repeated_int32(100); - m->add_repeated_string("asdf"); - m->add_repeated_bytes("jkl;"); - m->add_repeated_nested_message()->set_bb(46); - m->add_repeated_foreign_message()->set_c(47); - m->add_repeated_nested_enum(proto3_arena_unittest::TestAllTypes::BAZ); - m->add_repeated_foreign_enum(proto3_arena_unittest::FOREIGN_BAZ); - m->add_repeated_lazy_message()->set_bb(49); - - m->set_oneof_uint32(1); - m->mutable_oneof_nested_message()->set_bb(50); - m->set_oneof_string("test"); // only this one remains set -} - -void ExpectAllFieldsSet(const TestAllTypes& m) { - EXPECT_EQ(100, m.optional_int32()); - EXPECT_EQ("asdf", m.optional_string()); - EXPECT_EQ("jkl;", m.optional_bytes()); - EXPECT_EQ(true, m.has_optional_nested_message()); - EXPECT_EQ(42, m.optional_nested_message().bb()); - EXPECT_EQ(true, m.has_optional_foreign_message()); - EXPECT_EQ(43, m.optional_foreign_message().c()); - EXPECT_EQ(proto3_arena_unittest::TestAllTypes::BAZ, m.optional_nested_enum()); - EXPECT_EQ(proto3_arena_unittest::FOREIGN_BAZ, m.optional_foreign_enum()); - EXPECT_EQ(true, m.has_optional_lazy_message()); - EXPECT_EQ(45, m.optional_lazy_message().bb()); - - EXPECT_EQ(1, m.repeated_int32_size()); - EXPECT_EQ(100, m.repeated_int32(0)); - EXPECT_EQ(1, m.repeated_string_size()); - EXPECT_EQ("asdf", m.repeated_string(0)); - EXPECT_EQ(1, m.repeated_bytes_size()); - EXPECT_EQ("jkl;", m.repeated_bytes(0)); - EXPECT_EQ(1, m.repeated_nested_message_size()); - EXPECT_EQ(46, m.repeated_nested_message(0).bb()); - EXPECT_EQ(1, m.repeated_foreign_message_size()); - EXPECT_EQ(47, m.repeated_foreign_message(0).c()); - EXPECT_EQ(1, m.repeated_nested_enum_size()); - EXPECT_EQ(proto3_arena_unittest::TestAllTypes::BAZ, - m.repeated_nested_enum(0)); - EXPECT_EQ(1, m.repeated_foreign_enum_size()); - EXPECT_EQ(proto3_arena_unittest::FOREIGN_BAZ, m.repeated_foreign_enum(0)); - EXPECT_EQ(1, m.repeated_lazy_message_size()); - EXPECT_EQ(49, m.repeated_lazy_message(0).bb()); - - EXPECT_EQ(proto3_arena_unittest::TestAllTypes::kOneofString, - m.oneof_field_case()); - EXPECT_EQ("test", m.oneof_string()); -} - -// In this file we only test some basic functionalities of arena support in -// proto3 and expect the arena support to be fully tested in proto2 unittests -// because proto3 shares most code with proto2. - -TEST(Proto3ArenaTest, Parsing) { - TestAllTypes original; - SetAllFields(&original); - - Arena arena; - TestAllTypes* arena_message = Arena::CreateMessage(&arena); - arena_message->ParseFromString(original.SerializeAsString()); - ExpectAllFieldsSet(*arena_message); -} - -TEST(Proto3ArenaTest, UnknownFields) { - TestAllTypes original; - SetAllFields(&original); - - Arena arena; - TestAllTypes* arena_message = Arena::CreateMessage(&arena); - arena_message->ParseFromString(original.SerializeAsString()); - ExpectAllFieldsSet(*arena_message); - - // In proto3 we can still get a pointer to the UnknownFieldSet through - // reflection API. - UnknownFieldSet* unknown_fields = - arena_message->GetReflection()->MutableUnknownFields(arena_message); - // We can modify this UnknownFieldSet. - unknown_fields->AddVarint(1, 2); - // And the unknown fields should be changed. - ASSERT_NE(original.ByteSize(), arena_message->ByteSize()); - ASSERT_FALSE( - arena_message->GetReflection()->GetUnknownFields(*arena_message).empty()); -} - -TEST(Proto3ArenaTest, Swap) { - Arena arena1; - Arena arena2; - - // Test Swap(). - TestAllTypes* arena1_message = Arena::CreateMessage(&arena1); - TestAllTypes* arena2_message = Arena::CreateMessage(&arena2); - arena1_message->Swap(arena2_message); - EXPECT_EQ(&arena1, arena1_message->GetArena()); - EXPECT_EQ(&arena2, arena2_message->GetArena()); -} - -TEST(Proto3ArenaTest, SetAllocatedMessage) { - Arena arena; - TestAllTypes* arena_message = Arena::CreateMessage(&arena); - TestAllTypes::NestedMessage* nested = new TestAllTypes::NestedMessage; - nested->set_bb(118); - arena_message->set_allocated_optional_nested_message(nested); - EXPECT_EQ(118, arena_message->optional_nested_message().bb()); -} - -TEST(Proto3ArenaTest, ReleaseMessage) { - Arena arena; - TestAllTypes* arena_message = Arena::CreateMessage(&arena); - arena_message->mutable_optional_nested_message()->set_bb(118); - std::unique_ptr nested( - arena_message->release_optional_nested_message()); - EXPECT_EQ(118, nested->bb()); -} - -TEST(Proto3ArenaTest, MessageFieldClear) { - // GitHub issue #310: https://github.com/protocolbuffers/protobuf/issues/310 - Arena arena; - TestAllTypes* arena_message = Arena::CreateMessage(&arena); - arena_message->mutable_optional_nested_message()->set_bb(118); - // This should not crash, but prior to the bugfix, it tried to use `operator - // delete` the nested message (which is on the arena): - arena_message->Clear(); -} - -TEST(Proto3ArenaTest, MessageFieldClearViaReflection) { - Arena arena; - TestAllTypes* message = Arena::CreateMessage(&arena); - const Reflection* r = message->GetReflection(); - const Descriptor* d = message->GetDescriptor(); - const FieldDescriptor* msg_field = - d->FindFieldByName("optional_nested_message"); - - message->mutable_optional_nested_message()->set_bb(1); - r->ClearField(message, msg_field); - EXPECT_FALSE(message->has_optional_nested_message()); - EXPECT_EQ(0, message->optional_nested_message().bb()); -} - -} // namespace -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/source_context.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/source_context.pb.cc deleted file mode 100644 index 7ae94456f..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/source_context.pb.cc +++ /dev/null @@ -1,292 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/source_context.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class SourceContextDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _SourceContext_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::SourceContext(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::SourceContext::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fsource_5fcontext_2eproto[1]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceContext, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceContext, file_name_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::SourceContext)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fsource_5fcontext_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n$google/protobuf/source_context.proto\022\017" - "google.protobuf\"\"\n\rSourceContext\022\021\n\tfile" - "_name\030\001 \001(\tB\225\001\n\023com.google.protobufB\022Sou" - "rceContextProtoP\001ZAgoogle.golang.org/gen" - "proto/protobuf/source_context;source_con" - "text\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTy" - "pesb\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_sccs[1] = { - &scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto = { - &descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fsource_5fcontext_2eproto, "google/protobuf/source_context.proto", 251, - &descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_once, descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_sccs, descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto_deps, 1, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fsource_5fcontext_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto, file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fsource_5fcontext_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void SourceContext::InitAsDefaultInstance() { -} -class SourceContext::_Internal { - public: -}; - -SourceContext::SourceContext() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.SourceContext) -} -SourceContext::SourceContext(const SourceContext& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_file_name().empty()) { - file_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.file_name_); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext) -} - -void SourceContext::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base); - file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -SourceContext::~SourceContext() { - // @@protoc_insertion_point(destructor:google.protobuf.SourceContext) - SharedDtor(); -} - -void SourceContext::SharedDtor() { - file_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void SourceContext::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const SourceContext& SourceContext::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base); - return *internal_default_instance(); -} - - -void SourceContext::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - file_name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - _internal_metadata_.Clear(); -} - -const char* SourceContext::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // string file_name = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_file_name(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceContext.file_name")); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* SourceContext::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // string file_name = 1; - if (this->file_name().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_file_name().data(), static_cast(this->_internal_file_name().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "google.protobuf.SourceContext.file_name"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_file_name(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceContext) - return target; -} - -size_t SourceContext::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // string file_name = 1; - if (this->file_name().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_file_name()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void SourceContext::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.SourceContext) - GOOGLE_DCHECK_NE(&from, this); - const SourceContext* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.SourceContext) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.SourceContext) - MergeFrom(*source); - } -} - -void SourceContext::MergeFrom(const SourceContext& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.file_name().size() > 0) { - - file_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.file_name_); - } -} - -void SourceContext::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.SourceContext) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void SourceContext::CopyFrom(const SourceContext& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.SourceContext) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool SourceContext::IsInitialized() const { - return true; -} - -void SourceContext::InternalSwap(SourceContext* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - file_name_.Swap(&other->file_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata SourceContext::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::SourceContext >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::SourceContext >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/fastmem.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/fastmem.h deleted file mode 100644 index 76c8a3aea..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/fastmem.h +++ /dev/null @@ -1,157 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2014 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Fast memory copying and comparison routines. -// strings::fastmemcmp_inlined() replaces memcmp() -// strings::memcpy_inlined() replaces memcpy() -// strings::memeq(a, b, n) replaces memcmp(a, b, n) == 0 -// -// strings::*_inlined() routines are inline versions of the -// routines exported by this module. Sometimes using the inlined -// versions is faster. Measure before using the inlined versions. -// -// Performance measurement: -// strings::fastmemcmp_inlined -// Analysis: memcmp, fastmemcmp_inlined, fastmemcmp -// 2012-01-30 - -#ifndef GOOGLE_PROTOBUF_STUBS_FASTMEM_H_ -#define GOOGLE_PROTOBUF_STUBS_FASTMEM_H_ - -#include -#include -#include - -#include - -#include - -namespace google { -namespace protobuf { -namespace internal { - -// Return true if the n bytes at a equal the n bytes at b. -// The regions are allowed to overlap. -// -// The performance is similar to the performance memcmp(), but faster for -// moderately-sized inputs, or inputs that share a common prefix and differ -// somewhere in their last 8 bytes. Further optimizations can be added later -// if it makes sense to do so.:w -inline bool memeq(const char* a, const char* b, size_t n) { - size_t n_rounded_down = n & ~static_cast(7); - if (PROTOBUF_PREDICT_FALSE(n_rounded_down == 0)) { // n <= 7 - return memcmp(a, b, n) == 0; - } - // n >= 8 - uint64 u = GOOGLE_UNALIGNED_LOAD64(a) ^ GOOGLE_UNALIGNED_LOAD64(b); - uint64 v = GOOGLE_UNALIGNED_LOAD64(a + n - 8) ^ GOOGLE_UNALIGNED_LOAD64(b + n - 8); - if ((u | v) != 0) { // The first or last 8 bytes differ. - return false; - } - a += 8; - b += 8; - n = n_rounded_down - 8; - if (n > 128) { - // As of 2012, memcmp on x86-64 uses a big unrolled loop with SSE2 - // instructions, and while we could try to do something faster, it - // doesn't seem worth pursuing. - return memcmp(a, b, n) == 0; - } - for (; n >= 16; n -= 16) { - uint64 x = GOOGLE_UNALIGNED_LOAD64(a) ^ GOOGLE_UNALIGNED_LOAD64(b); - uint64 y = GOOGLE_UNALIGNED_LOAD64(a + 8) ^ GOOGLE_UNALIGNED_LOAD64(b + 8); - if ((x | y) != 0) { - return false; - } - a += 16; - b += 16; - } - // n must be 0 or 8 now because it was a multiple of 8 at the top of the loop. - return n == 0 || GOOGLE_UNALIGNED_LOAD64(a) == GOOGLE_UNALIGNED_LOAD64(b); -} - -inline int fastmemcmp_inlined(const char *a, const char *b, size_t n) { - if (n >= 64) { - return memcmp(a, b, n); - } - const char* a_limit = a + n; - while (a + sizeof(uint64) <= a_limit && - GOOGLE_UNALIGNED_LOAD64(a) == GOOGLE_UNALIGNED_LOAD64(b)) { - a += sizeof(uint64); - b += sizeof(uint64); - } - if (a + sizeof(uint32) <= a_limit && - GOOGLE_UNALIGNED_LOAD32(a) == GOOGLE_UNALIGNED_LOAD32(b)) { - a += sizeof(uint32); - b += sizeof(uint32); - } - while (a < a_limit) { - int d = - static_cast(static_cast(*a++) - static_cast(*b++)); - if (d) return d; - } - return 0; -} - -// The standard memcpy operation is slow for variable small sizes. -// This implementation inlines the optimal realization for sizes 1 to 16. -// To avoid code bloat don't use it in case of not performance-critical spots, -// nor when you don't expect very frequent values of size <= 16. -inline void memcpy_inlined(char *dst, const char *src, size_t size) { - // Compiler inlines code with minimal amount of data movement when third - // parameter of memcpy is a constant. - switch (size) { - case 1: memcpy(dst, src, 1); break; - case 2: memcpy(dst, src, 2); break; - case 3: memcpy(dst, src, 3); break; - case 4: memcpy(dst, src, 4); break; - case 5: memcpy(dst, src, 5); break; - case 6: memcpy(dst, src, 6); break; - case 7: memcpy(dst, src, 7); break; - case 8: memcpy(dst, src, 8); break; - case 9: memcpy(dst, src, 9); break; - case 10: memcpy(dst, src, 10); break; - case 11: memcpy(dst, src, 11); break; - case 12: memcpy(dst, src, 12); break; - case 13: memcpy(dst, src, 13); break; - case 14: memcpy(dst, src, 14); break; - case 15: memcpy(dst, src, 15); break; - case 16: memcpy(dst, src, 16); break; - default: memcpy(dst, src, size); break; - } -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_STUBS_FASTMEM_H_ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.cc deleted file mode 100644 index 2bfbe0b42..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.cc +++ /dev/null @@ -1,134 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include - -#include -#include -#include -#include - -namespace google { -namespace protobuf { -namespace util { -namespace error { -inline string CodeEnumToString(error::Code code) { - switch (code) { - case OK: - return "OK"; - case CANCELLED: - return "CANCELLED"; - case UNKNOWN: - return "UNKNOWN"; - case INVALID_ARGUMENT: - return "INVALID_ARGUMENT"; - case DEADLINE_EXCEEDED: - return "DEADLINE_EXCEEDED"; - case NOT_FOUND: - return "NOT_FOUND"; - case ALREADY_EXISTS: - return "ALREADY_EXISTS"; - case PERMISSION_DENIED: - return "PERMISSION_DENIED"; - case UNAUTHENTICATED: - return "UNAUTHENTICATED"; - case RESOURCE_EXHAUSTED: - return "RESOURCE_EXHAUSTED"; - case FAILED_PRECONDITION: - return "FAILED_PRECONDITION"; - case ABORTED: - return "ABORTED"; - case OUT_OF_RANGE: - return "OUT_OF_RANGE"; - case UNIMPLEMENTED: - return "UNIMPLEMENTED"; - case INTERNAL: - return "INTERNAL"; - case UNAVAILABLE: - return "UNAVAILABLE"; - case DATA_LOSS: - return "DATA_LOSS"; - } - - // No default clause, clang will abort if a code is missing from - // above switch. - return "UNKNOWN"; -} -} // namespace error. - -const Status Status::OK = Status(); -const Status Status::CANCELLED = Status(error::CANCELLED, ""); -const Status Status::UNKNOWN = Status(error::UNKNOWN, ""); - -Status::Status() : error_code_(error::OK) { -} - -Status::Status(error::Code error_code, StringPiece error_message) - : error_code_(error_code) { - if (error_code != error::OK) { - error_message_ = error_message.ToString(); - } -} - -Status::Status(const Status& other) - : error_code_(other.error_code_), error_message_(other.error_message_) { -} - -Status& Status::operator=(const Status& other) { - error_code_ = other.error_code_; - error_message_ = other.error_message_; - return *this; -} - -bool Status::operator==(const Status& x) const { - return error_code_ == x.error_code_ && - error_message_ == x.error_message_; -} - -string Status::ToString() const { - if (error_code_ == error::OK) { - return "OK"; - } else { - if (error_message_.empty()) { - return error::CodeEnumToString(error_code_); - } else { - return error::CodeEnumToString(error_code_) + ":" + - error_message_; - } - } -} - -std::ostream& operator<<(std::ostream& os, const Status& x) { - os << x.ToString(); - return os; -} - -} // namespace util -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.h b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.h deleted file mode 100644 index 04ecc633b..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status.h +++ /dev/null @@ -1,125 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLE_PROTOBUF_STUBS_STATUS_H_ -#define GOOGLE_PROTOBUF_STUBS_STATUS_H_ - -#include -#include - -#include -#include - -#include - -namespace google { -namespace protobuf { -namespace util { -namespace error { -// These values must match error codes defined in google/rpc/code.proto. -enum Code { - OK = 0, - CANCELLED = 1, - UNKNOWN = 2, - INVALID_ARGUMENT = 3, - DEADLINE_EXCEEDED = 4, - NOT_FOUND = 5, - ALREADY_EXISTS = 6, - PERMISSION_DENIED = 7, - UNAUTHENTICATED = 16, - RESOURCE_EXHAUSTED = 8, - FAILED_PRECONDITION = 9, - ABORTED = 10, - OUT_OF_RANGE = 11, - UNIMPLEMENTED = 12, - INTERNAL = 13, - UNAVAILABLE = 14, - DATA_LOSS = 15, -}; -} // namespace error - -class PROTOBUF_EXPORT Status { - public: - // Creates a "successful" status. - Status(); - - // Create a status in the canonical error space with the specified - // code, and error message. If "code == 0", error_message is - // ignored and a Status object identical to Status::OK is - // constructed. - Status(error::Code error_code, StringPiece error_message); - Status(const Status&); - Status& operator=(const Status& x); - ~Status() {} - - // Some pre-defined Status objects - static const Status OK; // Identical to 0-arg constructor - static const Status CANCELLED; - static const Status UNKNOWN; - - // Accessor - bool ok() const { - return error_code_ == error::OK; - } - int error_code() const { - return error_code_; - } - error::Code code() const { - return error_code_; - } - StringPiece error_message() const { - return error_message_; - } - StringPiece message() const { - return error_message_; - } - - bool operator==(const Status& x) const; - bool operator!=(const Status& x) const { - return !operator==(x); - } - - // Return a combination of the error code name and message. - string ToString() const; - - private: - error::Code error_code_; - string error_message_; -}; - -// Prints a human-readable representation of 'x' to 'os'. -PROTOBUF_EXPORT std::ostream& operator<<(std::ostream& os, const Status& x); - -} // namespace util -} // namespace protobuf -} // namespace google - -#include - -#endif // GOOGLE_PROTOBUF_STUBS_STATUS_H_ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status_test.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status_test.cc deleted file mode 100644 index 9a18778fb..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/stubs/status_test.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include - -#include - -#include -#include - -namespace google { -namespace protobuf { -namespace { -TEST(Status, Empty) { - util::Status status; - EXPECT_EQ(util::error::OK, util::Status::OK.error_code()); - EXPECT_EQ(util::error::OK, util::Status::OK.code()); - EXPECT_EQ("OK", util::Status::OK.ToString()); -} - -TEST(Status, GenericCodes) { - EXPECT_EQ(util::error::OK, util::Status::OK.error_code()); - EXPECT_EQ(util::error::OK, util::Status::OK.code()); - EXPECT_EQ(util::error::CANCELLED, util::Status::CANCELLED.error_code()); - EXPECT_EQ(util::error::CANCELLED, util::Status::CANCELLED.code()); - EXPECT_EQ(util::error::UNKNOWN, util::Status::UNKNOWN.error_code()); - EXPECT_EQ(util::error::UNKNOWN, util::Status::UNKNOWN.code()); -} - -TEST(Status, ConstructorZero) { - util::Status status(util::error::OK, "msg"); - EXPECT_TRUE(status.ok()); - EXPECT_EQ("OK", status.ToString()); -} - -TEST(Status, CheckOK) { - util::Status status; - GOOGLE_CHECK_OK(status); - GOOGLE_CHECK_OK(status) << "Failed"; - GOOGLE_DCHECK_OK(status) << "Failed"; -} - -TEST(Status, ErrorMessage) { - util::Status status(util::error::INVALID_ARGUMENT, ""); - EXPECT_FALSE(status.ok()); - EXPECT_EQ("", status.error_message().ToString()); - EXPECT_EQ("", status.message().ToString()); - EXPECT_EQ("INVALID_ARGUMENT", status.ToString()); - status = util::Status(util::error::INVALID_ARGUMENT, "msg"); - EXPECT_FALSE(status.ok()); - EXPECT_EQ("msg", status.error_message().ToString()); - EXPECT_EQ("msg", status.message().ToString()); - EXPECT_EQ("INVALID_ARGUMENT:msg", status.ToString()); - status = util::Status(util::error::OK, "msg"); - EXPECT_TRUE(status.ok()); - EXPECT_EQ("", status.error_message().ToString()); - EXPECT_EQ("", status.message().ToString()); - EXPECT_EQ("OK", status.ToString()); -} - -TEST(Status, Copy) { - util::Status a(util::error::UNKNOWN, "message"); - util::Status b(a); - ASSERT_EQ(a.ToString(), b.ToString()); -} - -TEST(Status, Assign) { - util::Status a(util::error::UNKNOWN, "message"); - util::Status b; - b = a; - ASSERT_EQ(a.ToString(), b.ToString()); -} - -TEST(Status, AssignEmpty) { - util::Status a(util::error::UNKNOWN, "message"); - util::Status b; - a = b; - ASSERT_EQ(string("OK"), a.ToString()); - ASSERT_TRUE(b.ok()); - ASSERT_TRUE(a.ok()); -} - -TEST(Status, EqualsOK) { - ASSERT_EQ(util::Status::OK, util::Status()); -} - -TEST(Status, EqualsSame) { - const util::Status a = util::Status(util::error::CANCELLED, "message"); - const util::Status b = util::Status(util::error::CANCELLED, "message"); - ASSERT_EQ(a, b); -} - -TEST(Status, EqualsCopy) { - const util::Status a = util::Status(util::error::CANCELLED, "message"); - const util::Status b = a; - ASSERT_EQ(a, b); -} - -TEST(Status, EqualsDifferentCode) { - const util::Status a = util::Status(util::error::CANCELLED, "message"); - const util::Status b = util::Status(util::error::UNKNOWN, "message"); - ASSERT_NE(a, b); -} - -TEST(Status, EqualsDifferentMessage) { - const util::Status a = util::Status(util::error::CANCELLED, "message"); - const util::Status b = util::Status(util::error::CANCELLED, "another"); - ASSERT_NE(a, b); -} -} // namespace -} // namespace protobuf -} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/timestamp.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/timestamp.pb.cc deleted file mode 100644 index 24a299ef0..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/timestamp.pb.cc +++ /dev/null @@ -1,324 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/timestamp.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class TimestampDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Timestamp_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Timestamp(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Timestamp::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2ftimestamp_2eproto[1]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, seconds_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, nanos_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Timestamp)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2ftimestamp_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\037google/protobuf/timestamp.proto\022\017googl" - "e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003" - "\022\r\n\005nanos\030\002 \001(\005B~\n\023com.google.protobufB\016" - "TimestampProtoP\001Z+github.com/golang/prot" - "obuf/ptypes/timestamp\370\001\001\242\002\003GPB\252\002\036Google." - "Protobuf.WellKnownTypesb\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_sccs[1] = { - &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftimestamp_2eproto = { - &descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2ftimestamp_2eproto, "google/protobuf/timestamp.proto", 231, - &descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_once, descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_sccs, descriptor_table_google_2fprotobuf_2ftimestamp_2eproto_deps, 1, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2ftimestamp_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto, file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2ftimestamp_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2ftimestamp_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void Timestamp::InitAsDefaultInstance() { -} -class Timestamp::_Internal { - public: -}; - -Timestamp::Timestamp() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Timestamp) -} -Timestamp::Timestamp(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Timestamp) -} -Timestamp::Timestamp(const Timestamp& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::memcpy(&seconds_, &from.seconds_, - static_cast(reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); - // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) -} - -void Timestamp::SharedCtor() { - ::memset(&seconds_, 0, static_cast( - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); -} - -Timestamp::~Timestamp() { - // @@protoc_insertion_point(destructor:google.protobuf.Timestamp) - SharedDtor(); -} - -void Timestamp::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void Timestamp::ArenaDtor(void* object) { - Timestamp* _this = reinterpret_cast< Timestamp* >(object); - (void)_this; -} -void Timestamp::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Timestamp::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Timestamp& Timestamp::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base); - return *internal_default_instance(); -} - - -void Timestamp::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - ::memset(&seconds_, 0, static_cast( - reinterpret_cast(&nanos_) - - reinterpret_cast(&seconds_)) + sizeof(nanos_)); - _internal_metadata_.Clear(); -} - -const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // int64 seconds = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - // int32 nanos = 2; - case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { - nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Timestamp::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int64 seconds = 1; - if (this->seconds() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_seconds(), target); - } - - // int32 nanos = 2; - if (this->nanos() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_nanos(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Timestamp) - return target; -} - -size_t Timestamp::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // int64 seconds = 1; - if (this->seconds() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_seconds()); - } - - // int32 nanos = 2; - if (this->nanos() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_nanos()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Timestamp::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Timestamp) - GOOGLE_DCHECK_NE(&from, this); - const Timestamp* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Timestamp) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Timestamp) - MergeFrom(*source); - } -} - -void Timestamp::MergeFrom(const Timestamp& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.seconds() != 0) { - _internal_set_seconds(from._internal_seconds()); - } - if (from.nanos() != 0) { - _internal_set_nanos(from._internal_nanos()); - } -} - -void Timestamp::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Timestamp) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Timestamp::CopyFrom(const Timestamp& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Timestamp) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Timestamp::IsInitialized() const { - return true; -} - -void Timestamp::InternalSwap(Timestamp* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(seconds_, other->seconds_); - swap(nanos_, other->nanos_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Timestamp::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Timestamp >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Timestamp >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/unittest_no_arena.proto b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/unittest_no_arena.proto deleted file mode 100644 index adc8656f7..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/unittest_no_arena.proto +++ /dev/null @@ -1,206 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// This proto file contains copies of TestAllTypes and friends, but with arena -// support disabled in code generation. It allows us to test the performance -// impact against baseline (non-arena) google.protobuf. - -syntax = "proto2"; - -// Some generic_services option(s) added automatically. -// See: http://go/proto2-generic-services-default -option cc_generic_services = true; // auto-added -option java_generic_services = true; // auto-added -option py_generic_services = true; // auto-added -option cc_enable_arenas = false; -option objc_class_prefix = "NOARN"; - -import "google/protobuf/unittest_import.proto"; -import "google/protobuf/unittest_arena.proto"; - -// We don't put this in a package within proto2 because we need to make sure -// that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest_no_arena; - -// Protos optimized for SPEED use a strict superset of the generated code -// of equivalent ones optimized for CODE_SIZE, so we should optimize all our -// tests for speed unless explicitly testing code size optimization. -option optimize_for = SPEED; - -option java_outer_classname = "UnittestProto"; - -// This proto includes every type of field in both singular and repeated -// forms. -message TestAllTypes { - message NestedMessage { - // The field name "b" fails to compile in proto1 because it conflicts with - // a local variable named "b" in one of the generated methods. Doh. - // This file needs to compile in proto1 to test backwards-compatibility. - optional int32 bb = 1; - } - - enum NestedEnum { - FOO = 1; - BAR = 2; - BAZ = 3; - NEG = -1; // Intentionally negative. - } - - // Singular - optional int32 optional_int32 = 1; - optional int64 optional_int64 = 2; - optional uint32 optional_uint32 = 3; - optional uint64 optional_uint64 = 4; - optional sint32 optional_sint32 = 5; - optional sint64 optional_sint64 = 6; - optional fixed32 optional_fixed32 = 7; - optional fixed64 optional_fixed64 = 8; - optional sfixed32 optional_sfixed32 = 9; - optional sfixed64 optional_sfixed64 = 10; - optional float optional_float = 11; - optional double optional_double = 12; - optional bool optional_bool = 13; - optional string optional_string = 14; - optional bytes optional_bytes = 15; - - optional group OptionalGroup = 16 { - optional int32 a = 17; - } - - optional NestedMessage optional_nested_message = 18; - optional ForeignMessage optional_foreign_message = 19; - optional protobuf_unittest_import.ImportMessage optional_import_message = 20; - - optional NestedEnum optional_nested_enum = 21; - optional ForeignEnum optional_foreign_enum = 22; - optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; - - optional string optional_string_piece = 24 [ctype=STRING_PIECE]; - optional string optional_cord = 25 [ctype=CORD]; - - // Defined in unittest_import_public.proto - optional protobuf_unittest_import.PublicImportMessage - optional_public_import_message = 26; - - optional NestedMessage optional_message = 27 [lazy=true]; - - // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; - repeated sfixed32 repeated_sfixed32 = 39; - repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; - - repeated group RepeatedGroup = 46 { - optional int32 a = 47; - } - - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; - - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; - repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; - - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; - - repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; - - // Singular with defaults - optional int32 default_int32 = 61 [default = 41 ]; - optional int64 default_int64 = 62 [default = 42 ]; - optional uint32 default_uint32 = 63 [default = 43 ]; - optional uint64 default_uint64 = 64 [default = 44 ]; - optional sint32 default_sint32 = 65 [default = -45 ]; - optional sint64 default_sint64 = 66 [default = 46 ]; - optional fixed32 default_fixed32 = 67 [default = 47 ]; - optional fixed64 default_fixed64 = 68 [default = 48 ]; - optional sfixed32 default_sfixed32 = 69 [default = 49 ]; - optional sfixed64 default_sfixed64 = 70 [default = -50 ]; - optional float default_float = 71 [default = 51.5 ]; - optional double default_double = 72 [default = 52e3 ]; - optional bool default_bool = 73 [default = true ]; - optional string default_string = 74 [default = "hello"]; - optional bytes default_bytes = 75 [default = "world"]; - - optional NestedEnum default_nested_enum = 81 [default = BAR ]; - optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; - optional protobuf_unittest_import.ImportEnum - default_import_enum = 83 [default = IMPORT_BAR]; - - optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; - optional string default_cord = 85 [ctype=CORD,default="123"]; - - // For oneof test - oneof oneof_field { - uint32 oneof_uint32 = 111; - NestedMessage oneof_nested_message = 112; - string oneof_string = 113; - bytes oneof_bytes = 114; - NestedMessage lazy_oneof_nested_message = 115 [lazy=true]; - } -} - -// Define these after TestAllTypes to make sure the compiler can handle -// that. -message ForeignMessage { - optional int32 c = 1; -} - -enum ForeignEnum { - FOREIGN_FOO = 4; - FOREIGN_BAR = 5; - FOREIGN_BAZ = 6; -} - -message TestNoArenaMessage { - optional proto2_arena_unittest.ArenaMessage arena_message = 1; -}; - -message OneString { - optional string data = 1; -} diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/wrappers.pb.cc b/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/wrappers.pb.cc deleted file mode 100644 index 8c8ce6846..000000000 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/wrappers.pb.cc +++ /dev/null @@ -1,2162 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/wrappers.proto - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include -PROTOBUF_NAMESPACE_OPEN -class DoubleValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _DoubleValue_default_instance_; -class FloatValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _FloatValue_default_instance_; -class Int64ValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Int64Value_default_instance_; -class UInt64ValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _UInt64Value_default_instance_; -class Int32ValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Int32Value_default_instance_; -class UInt32ValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _UInt32Value_default_instance_; -class BoolValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _BoolValue_default_instance_; -class StringValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _StringValue_default_instance_; -class BytesValueDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _BytesValue_default_instance_; -PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_BoolValue_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::BoolValue(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::BoolValue::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_BytesValue_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::BytesValue(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::BytesValue::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_DoubleValue_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::DoubleValue(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::DoubleValue::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_FloatValue_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::FloatValue(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::FloatValue::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Int32Value_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Int32Value(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Int32Value::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Int64Value_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Int64Value(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Int64Value::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_StringValue_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::StringValue(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::StringValue::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_UInt32Value_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::UInt32Value(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::UInt32Value::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static void InitDefaultsscc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_UInt64Value_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::UInt64Value(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::UInt64Value::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto}, {}}; - -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fwrappers_2eproto[9]; -static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; -static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; - -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DoubleValue, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FloatValue, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FloatValue, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int64Value, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int64Value, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt64Value, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt64Value, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int32Value, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int32Value, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt32Value, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt32Value, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BoolValue, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BoolValue, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::StringValue, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::StringValue, value_), - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BytesValue, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BytesValue, value_), -}; -static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::DoubleValue)}, - { 6, -1, sizeof(PROTOBUF_NAMESPACE_ID::FloatValue)}, - { 12, -1, sizeof(PROTOBUF_NAMESPACE_ID::Int64Value)}, - { 18, -1, sizeof(PROTOBUF_NAMESPACE_ID::UInt64Value)}, - { 24, -1, sizeof(PROTOBUF_NAMESPACE_ID::Int32Value)}, - { 30, -1, sizeof(PROTOBUF_NAMESPACE_ID::UInt32Value)}, - { 36, -1, sizeof(PROTOBUF_NAMESPACE_ID::BoolValue)}, - { 42, -1, sizeof(PROTOBUF_NAMESPACE_ID::StringValue)}, - { 48, -1, sizeof(PROTOBUF_NAMESPACE_ID::BytesValue)}, -}; - -static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_DoubleValue_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_FloatValue_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Int64Value_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_UInt64Value_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Int32Value_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_UInt32Value_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_BoolValue_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_StringValue_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_BytesValue_default_instance_), -}; - -const char descriptor_table_protodef_google_2fprotobuf_2fwrappers_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\036google/protobuf/wrappers.proto\022\017google" - ".protobuf\"\034\n\013DoubleValue\022\r\n\005value\030\001 \001(\001\"" - "\033\n\nFloatValue\022\r\n\005value\030\001 \001(\002\"\033\n\nInt64Val" - "ue\022\r\n\005value\030\001 \001(\003\"\034\n\013UInt64Value\022\r\n\005valu" - "e\030\001 \001(\004\"\033\n\nInt32Value\022\r\n\005value\030\001 \001(\005\"\034\n\013" - "UInt32Value\022\r\n\005value\030\001 \001(\r\"\032\n\tBoolValue\022" - "\r\n\005value\030\001 \001(\010\"\034\n\013StringValue\022\r\n\005value\030\001" - " \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014B|\n\023com" - ".google.protobufB\rWrappersProtoP\001Z*githu" - "b.com/golang/protobuf/ptypes/wrappers\370\001\001" - "\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypesb" - "\006proto3" - ; -static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fwrappers_2eproto_deps[1] = { -}; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fwrappers_2eproto_sccs[9] = { - &scc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto.base, - &scc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto.base, -}; -static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fwrappers_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fwrappers_2eproto_initialized = false; -const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fwrappers_2eproto = { - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fwrappers_2eproto, "google/protobuf/wrappers.proto", 447, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto_once, descriptor_table_google_2fprotobuf_2fwrappers_2eproto_sccs, descriptor_table_google_2fprotobuf_2fwrappers_2eproto_deps, 9, 0, - schemas, file_default_instances, TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fwrappers_2eproto, 9, file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto, file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto, -}; - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fwrappers_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fwrappers_2eproto), true); -PROTOBUF_NAMESPACE_OPEN - -// =================================================================== - -void DoubleValue::InitAsDefaultInstance() { -} -class DoubleValue::_Internal { - public: -}; - -DoubleValue::DoubleValue() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.DoubleValue) -} -DoubleValue::DoubleValue(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.DoubleValue) -} -DoubleValue::DoubleValue(const DoubleValue& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue) -} - -void DoubleValue::SharedCtor() { - value_ = 0; -} - -DoubleValue::~DoubleValue() { - // @@protoc_insertion_point(destructor:google.protobuf.DoubleValue) - SharedDtor(); -} - -void DoubleValue::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void DoubleValue::ArenaDtor(void* object) { - DoubleValue* _this = reinterpret_cast< DoubleValue* >(object); - (void)_this; -} -void DoubleValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void DoubleValue::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const DoubleValue& DoubleValue::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void DoubleValue::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = 0; - _internal_metadata_.Clear(); -} - -const char* DoubleValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // double value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); - ptr += sizeof(double); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* DoubleValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // double value = 1; - if (!(this->value() <= 0 && this->value() >= 0)) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DoubleValue) - return target; -} - -size_t DoubleValue::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // double value = 1; - if (!(this->value() <= 0 && this->value() >= 0)) { - total_size += 1 + 8; - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void DoubleValue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.DoubleValue) - GOOGLE_DCHECK_NE(&from, this); - const DoubleValue* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.DoubleValue) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.DoubleValue) - MergeFrom(*source); - } -} - -void DoubleValue::MergeFrom(const DoubleValue& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (!(from.value() <= 0 && from.value() >= 0)) { - _internal_set_value(from._internal_value()); - } -} - -void DoubleValue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.DoubleValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void DoubleValue::CopyFrom(const DoubleValue& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.DoubleValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool DoubleValue::IsInitialized() const { - return true; -} - -void DoubleValue::InternalSwap(DoubleValue* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata DoubleValue::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void FloatValue::InitAsDefaultInstance() { -} -class FloatValue::_Internal { - public: -}; - -FloatValue::FloatValue() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.FloatValue) -} -FloatValue::FloatValue(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.FloatValue) -} -FloatValue::FloatValue(const FloatValue& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue) -} - -void FloatValue::SharedCtor() { - value_ = 0; -} - -FloatValue::~FloatValue() { - // @@protoc_insertion_point(destructor:google.protobuf.FloatValue) - SharedDtor(); -} - -void FloatValue::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void FloatValue::ArenaDtor(void* object) { - FloatValue* _this = reinterpret_cast< FloatValue* >(object); - (void)_this; -} -void FloatValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void FloatValue::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const FloatValue& FloatValue::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void FloatValue::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = 0; - _internal_metadata_.Clear(); -} - -const char* FloatValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // float value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); - ptr += sizeof(float); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* FloatValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // float value = 1; - if (!(this->value() <= 0 && this->value() >= 0)) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FloatValue) - return target; -} - -size_t FloatValue::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // float value = 1; - if (!(this->value() <= 0 && this->value() >= 0)) { - total_size += 1 + 4; - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void FloatValue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.FloatValue) - GOOGLE_DCHECK_NE(&from, this); - const FloatValue* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.FloatValue) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.FloatValue) - MergeFrom(*source); - } -} - -void FloatValue::MergeFrom(const FloatValue& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (!(from.value() <= 0 && from.value() >= 0)) { - _internal_set_value(from._internal_value()); - } -} - -void FloatValue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.FloatValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void FloatValue::CopyFrom(const FloatValue& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.FloatValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool FloatValue::IsInitialized() const { - return true; -} - -void FloatValue::InternalSwap(FloatValue* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata FloatValue::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void Int64Value::InitAsDefaultInstance() { -} -class Int64Value::_Internal { - public: -}; - -Int64Value::Int64Value() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Int64Value) -} -Int64Value::Int64Value(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Int64Value) -} -Int64Value::Int64Value(const Int64Value& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value) -} - -void Int64Value::SharedCtor() { - value_ = PROTOBUF_LONGLONG(0); -} - -Int64Value::~Int64Value() { - // @@protoc_insertion_point(destructor:google.protobuf.Int64Value) - SharedDtor(); -} - -void Int64Value::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void Int64Value::ArenaDtor(void* object) { - Int64Value* _this = reinterpret_cast< Int64Value* >(object); - (void)_this; -} -void Int64Value::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Int64Value::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Int64Value& Int64Value::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void Int64Value::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = PROTOBUF_LONGLONG(0); - _internal_metadata_.Clear(); -} - -const char* Int64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // int64 value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Int64Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int64 value = 1; - if (this->value() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int64Value) - return target; -} - -size_t Int64Value::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // int64 value = 1; - if (this->value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Int64Value::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Int64Value) - GOOGLE_DCHECK_NE(&from, this); - const Int64Value* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Int64Value) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Int64Value) - MergeFrom(*source); - } -} - -void Int64Value::MergeFrom(const Int64Value& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value() != 0) { - _internal_set_value(from._internal_value()); - } -} - -void Int64Value::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Int64Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Int64Value::CopyFrom(const Int64Value& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Int64Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Int64Value::IsInitialized() const { - return true; -} - -void Int64Value::InternalSwap(Int64Value* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Int64Value::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void UInt64Value::InitAsDefaultInstance() { -} -class UInt64Value::_Internal { - public: -}; - -UInt64Value::UInt64Value() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.UInt64Value) -} -UInt64Value::UInt64Value(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt64Value) -} -UInt64Value::UInt64Value(const UInt64Value& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value) -} - -void UInt64Value::SharedCtor() { - value_ = PROTOBUF_ULONGLONG(0); -} - -UInt64Value::~UInt64Value() { - // @@protoc_insertion_point(destructor:google.protobuf.UInt64Value) - SharedDtor(); -} - -void UInt64Value::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void UInt64Value::ArenaDtor(void* object) { - UInt64Value* _this = reinterpret_cast< UInt64Value* >(object); - (void)_this; -} -void UInt64Value::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void UInt64Value::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const UInt64Value& UInt64Value::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void UInt64Value::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = PROTOBUF_ULONGLONG(0); - _internal_metadata_.Clear(); -} - -const char* UInt64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // uint64 value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* UInt64Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // uint64 value = 1; - if (this->value() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt64Value) - return target; -} - -size_t UInt64Value::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // uint64 value = 1; - if (this->value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void UInt64Value::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.UInt64Value) - GOOGLE_DCHECK_NE(&from, this); - const UInt64Value* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.UInt64Value) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.UInt64Value) - MergeFrom(*source); - } -} - -void UInt64Value::MergeFrom(const UInt64Value& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value() != 0) { - _internal_set_value(from._internal_value()); - } -} - -void UInt64Value::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.UInt64Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void UInt64Value::CopyFrom(const UInt64Value& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.UInt64Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool UInt64Value::IsInitialized() const { - return true; -} - -void UInt64Value::InternalSwap(UInt64Value* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata UInt64Value::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void Int32Value::InitAsDefaultInstance() { -} -class Int32Value::_Internal { - public: -}; - -Int32Value::Int32Value() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Int32Value) -} -Int32Value::Int32Value(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.Int32Value) -} -Int32Value::Int32Value(const Int32Value& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value) -} - -void Int32Value::SharedCtor() { - value_ = 0; -} - -Int32Value::~Int32Value() { - // @@protoc_insertion_point(destructor:google.protobuf.Int32Value) - SharedDtor(); -} - -void Int32Value::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void Int32Value::ArenaDtor(void* object) { - Int32Value* _this = reinterpret_cast< Int32Value* >(object); - (void)_this; -} -void Int32Value::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Int32Value::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Int32Value& Int32Value::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void Int32Value::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = 0; - _internal_metadata_.Clear(); -} - -const char* Int32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // int32 value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* Int32Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // int32 value = 1; - if (this->value() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int32Value) - return target; -} - -size_t Int32Value::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // int32 value = 1; - if (this->value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Int32Value::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Int32Value) - GOOGLE_DCHECK_NE(&from, this); - const Int32Value* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Int32Value) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Int32Value) - MergeFrom(*source); - } -} - -void Int32Value::MergeFrom(const Int32Value& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value() != 0) { - _internal_set_value(from._internal_value()); - } -} - -void Int32Value::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Int32Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Int32Value::CopyFrom(const Int32Value& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Int32Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Int32Value::IsInitialized() const { - return true; -} - -void Int32Value::InternalSwap(Int32Value* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata Int32Value::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void UInt32Value::InitAsDefaultInstance() { -} -class UInt32Value::_Internal { - public: -}; - -UInt32Value::UInt32Value() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.UInt32Value) -} -UInt32Value::UInt32Value(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt32Value) -} -UInt32Value::UInt32Value(const UInt32Value& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value) -} - -void UInt32Value::SharedCtor() { - value_ = 0u; -} - -UInt32Value::~UInt32Value() { - // @@protoc_insertion_point(destructor:google.protobuf.UInt32Value) - SharedDtor(); -} - -void UInt32Value::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void UInt32Value::ArenaDtor(void* object) { - UInt32Value* _this = reinterpret_cast< UInt32Value* >(object); - (void)_this; -} -void UInt32Value::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void UInt32Value::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const UInt32Value& UInt32Value::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void UInt32Value::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = 0u; - _internal_metadata_.Clear(); -} - -const char* UInt32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // uint32 value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* UInt32Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // uint32 value = 1; - if (this->value() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt32Value) - return target; -} - -size_t UInt32Value::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // uint32 value = 1; - if (this->value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void UInt32Value::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.UInt32Value) - GOOGLE_DCHECK_NE(&from, this); - const UInt32Value* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.UInt32Value) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.UInt32Value) - MergeFrom(*source); - } -} - -void UInt32Value::MergeFrom(const UInt32Value& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value() != 0) { - _internal_set_value(from._internal_value()); - } -} - -void UInt32Value::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.UInt32Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void UInt32Value::CopyFrom(const UInt32Value& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.UInt32Value) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool UInt32Value::IsInitialized() const { - return true; -} - -void UInt32Value::InternalSwap(UInt32Value* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata UInt32Value::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void BoolValue::InitAsDefaultInstance() { -} -class BoolValue::_Internal { - public: -}; - -BoolValue::BoolValue() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.BoolValue) -} -BoolValue::BoolValue(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.BoolValue) -} -BoolValue::BoolValue(const BoolValue& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_ = from.value_; - // @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue) -} - -void BoolValue::SharedCtor() { - value_ = false; -} - -BoolValue::~BoolValue() { - // @@protoc_insertion_point(destructor:google.protobuf.BoolValue) - SharedDtor(); -} - -void BoolValue::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); -} - -void BoolValue::ArenaDtor(void* object) { - BoolValue* _this = reinterpret_cast< BoolValue* >(object); - (void)_this; -} -void BoolValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void BoolValue::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const BoolValue& BoolValue::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void BoolValue::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_ = false; - _internal_metadata_.Clear(); -} - -const char* BoolValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // bool value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* BoolValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bool value = 1; - if (this->value() != 0) { - target = stream->EnsureSpace(target); - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BoolValue) - return target; -} - -size_t BoolValue::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // bool value = 1; - if (this->value() != 0) { - total_size += 1 + 1; - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void BoolValue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.BoolValue) - GOOGLE_DCHECK_NE(&from, this); - const BoolValue* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.BoolValue) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.BoolValue) - MergeFrom(*source); - } -} - -void BoolValue::MergeFrom(const BoolValue& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value() != 0) { - _internal_set_value(from._internal_value()); - } -} - -void BoolValue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.BoolValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void BoolValue::CopyFrom(const BoolValue& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.BoolValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool BoolValue::IsInitialized() const { - return true; -} - -void BoolValue::InternalSwap(BoolValue* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(value_, other->value_); -} - -::PROTOBUF_NAMESPACE_ID::Metadata BoolValue::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void StringValue::InitAsDefaultInstance() { -} -class StringValue::_Internal { - public: -}; - -StringValue::StringValue() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.StringValue) -} -StringValue::StringValue(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.StringValue) -} -StringValue::StringValue(const StringValue& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_value().empty()) { - value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_value(), - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue) -} - -void StringValue::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto.base); - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -StringValue::~StringValue() { - // @@protoc_insertion_point(destructor:google.protobuf.StringValue) - SharedDtor(); -} - -void StringValue::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); - value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void StringValue::ArenaDtor(void* object) { - StringValue* _this = reinterpret_cast< StringValue* >(object); - (void)_this; -} -void StringValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void StringValue::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const StringValue& StringValue::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void StringValue::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); - _internal_metadata_.Clear(); -} - -const char* StringValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // string value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_value(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.StringValue.value")); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* StringValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // string value = 1; - if (this->value().size() > 0) { - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( - this->_internal_value().data(), static_cast(this->_internal_value().length()), - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, - "google.protobuf.StringValue.value"); - target = stream->WriteStringMaybeAliased( - 1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.StringValue) - return target; -} - -size_t StringValue::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // string value = 1; - if (this->value().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void StringValue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.StringValue) - GOOGLE_DCHECK_NE(&from, this); - const StringValue* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.StringValue) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.StringValue) - MergeFrom(*source); - } -} - -void StringValue::MergeFrom(const StringValue& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value().size() > 0) { - _internal_set_value(from._internal_value()); - } -} - -void StringValue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.StringValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void StringValue::CopyFrom(const StringValue& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.StringValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool StringValue::IsInitialized() const { - return true; -} - -void StringValue::InternalSwap(StringValue* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata StringValue::GetMetadata() const { - return GetMetadataStatic(); -} - - -// =================================================================== - -void BytesValue::InitAsDefaultInstance() { -} -class BytesValue::_Internal { - public: -}; - -BytesValue::BytesValue() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.BytesValue) -} -BytesValue::BytesValue(::PROTOBUF_NAMESPACE_ID::Arena* arena) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(arena) { - SharedCtor(); - RegisterArenaDtor(arena); - // @@protoc_insertion_point(arena_constructor:google.protobuf.BytesValue) -} -BytesValue::BytesValue(const BytesValue& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (!from._internal_value().empty()) { - value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_value(), - GetArenaNoVirtual()); - } - // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue) -} - -void BytesValue::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto.base); - value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -BytesValue::~BytesValue() { - // @@protoc_insertion_point(destructor:google.protobuf.BytesValue) - SharedDtor(); -} - -void BytesValue::SharedDtor() { - GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr); - value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); -} - -void BytesValue::ArenaDtor(void* object) { - BytesValue* _this = reinterpret_cast< BytesValue* >(object); - (void)_this; -} -void BytesValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void BytesValue::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const BytesValue& BytesValue::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto.base); - return *internal_default_instance(); -} - - -void BytesValue::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); - _internal_metadata_.Clear(); -} - -const char* BytesValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena; - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); - switch (tag >> 3) { - // bytes value = 1; - case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { - auto str = _internal_mutable_value(); - ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); - CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } - } // switch - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} - -::PROTOBUF_NAMESPACE_ID::uint8* BytesValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // bytes value = 1; - if (this->value().size() > 0) { - target = stream->WriteBytesMaybeAliased( - 1, this->_internal_value(), target); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BytesValue) - return target; -} - -size_t BytesValue::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // bytes value = 1; - if (this->value().size() > 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( - this->_internal_value()); - } - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void BytesValue::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.BytesValue) - GOOGLE_DCHECK_NE(&from, this); - const BytesValue* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.BytesValue) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.BytesValue) - MergeFrom(*source); - } -} - -void BytesValue::MergeFrom(const BytesValue& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (from.value().size() > 0) { - _internal_set_value(from._internal_value()); - } -} - -void BytesValue::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.BytesValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void BytesValue::CopyFrom(const BytesValue& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.BytesValue) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool BytesValue::IsInitialized() const { - return true; -} - -void BytesValue::InternalSwap(BytesValue* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); -} - -::PROTOBUF_NAMESPACE_ID::Metadata BytesValue::GetMetadata() const { - return GetMetadataStatic(); -} - - -// @@protoc_insertion_point(namespace_scope) -PROTOBUF_NAMESPACE_CLOSE -PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::DoubleValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::DoubleValue >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FloatValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FloatValue >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Int64Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Int64Value >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UInt64Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UInt64Value >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Int32Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Int32Value >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UInt32Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UInt32Value >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::BoolValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::BoolValue >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::StringValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::StringValue >(arena); -} -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::BytesValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::BytesValue >(arena); -} -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) -#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/BUILD b/cdk/extra/protobuf/protobuf-3.19.6/BUILD similarity index 73% rename from cdk/extra/protobuf/protobuf-3.11.4/BUILD rename to cdk/extra/protobuf/protobuf-3.19.6/BUILD index 79871d621..1690d4219 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/BUILD +++ b/cdk/extra/protobuf/protobuf-3.19.6/BUILD @@ -1,10 +1,10 @@ # Bazel (https://bazel.build/) BUILD file for Protobuf. +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library") -load("@rules_java//java:defs.bzl", "java_library") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") -load("@rules_proto//proto/private:native.bzl", "native_proto_common") load("@rules_python//python:defs.bzl", "py_library") +load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library") load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") licenses(["notice"]) @@ -12,16 +12,9 @@ licenses(["notice"]) exports_files(["LICENSE"]) ################################################################################ -# Java 9 configuration +# build configuration ################################################################################ -config_setting( - name = "jdk9", - values = { - "java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9", - }, -) - ################################################################################ # ZLIB configuration ################################################################################ @@ -33,7 +26,6 @@ ZLIB_DEPS = ["@zlib//:zlib"] ################################################################################ MSVC_COPTS = [ - "/DHAVE_PTHREAD", "/wd4018", # -Wno-sign-compare "/wd4065", # switch statement contains 'default' but no 'case' labels "/wd4146", # unary minus operator applied to unsigned type, result still unsigned @@ -46,7 +38,6 @@ MSVC_COPTS = [ "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) "/wd4355", # 'this' : used in base member initializer list "/wd4506", # no definition for inline function 'function' - "/wd4514", # -Wno-unused-function "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) "/wd4996", # The compiler encountered a deprecated declaration. ] @@ -54,14 +45,10 @@ MSVC_COPTS = [ COPTS = select({ ":msvc": MSVC_COPTS, "//conditions:default": [ - "-DHAVE_PTHREAD", "-DHAVE_ZLIB", + "-Wmissing-field-initializers", "-Woverloaded-virtual", "-Wno-sign-compare", - "-Wno-unused-function", - # Prevents ISO C++ const string assignment warnings for pyext sources. - "-Wno-write-strings", - "-Wno-deprecated-declarations", ], }) @@ -70,13 +57,39 @@ load(":compiler_config_setting.bzl", "create_compiler_config_setting") create_compiler_config_setting( name = "msvc", value = "msvc-cl", + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) +# Android NDK builds can specify different crosstool_top flags to choose which +# STL they use for C++. We need these multiple variants to catch all of those +# versions of crosstool_top and reliably detect Android. +# +# For more info on the various crosstool_tops used by NDK Bazel builds, see: +# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl + config_setting( name = "android", values = { "crosstool_top": "//external:android/crosstool", }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], +) + +config_setting( + name = "android-stlport", + values = { + "crosstool_top": "@androidndk//:toolchain-stlport", + }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) config_setting( @@ -84,6 +97,10 @@ config_setting( values = { "crosstool_top": "@androidndk//:toolchain-libcpp", }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) config_setting( @@ -91,13 +108,30 @@ config_setting( values = { "crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp", }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], +) + +config_setting( + name = "android-default", + values = { + "crosstool_top": "@androidndk//:default_crosstool", + }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) # Android and MSVC builds do not need to link in a separate pthread library. LINK_OPTS = select({ ":android": [], + ":android-stlport": [], ":android-libcpp": [], ":android-gnu-libstdcpp": [], + ":android-default": [], ":msvc": [ # Suppress linker warnings about files with no symbols defined. "-ignore:4221", @@ -110,6 +144,7 @@ LINK_OPTS = select({ load( ":protobuf.bzl", + "adapt_proto_library", "cc_proto_library", "internal_copied_filegroup", "internal_gen_well_known_protos_java", @@ -123,20 +158,25 @@ cc_library( # AUTOGEN(protobuf_lite_srcs) "src/google/protobuf/any_lite.cc", "src/google/protobuf/arena.cc", + "src/google/protobuf/arenastring.cc", "src/google/protobuf/extension_set.cc", "src/google/protobuf/generated_enum_util.cc", "src/google/protobuf/generated_message_table_driven_lite.cc", + "src/google/protobuf/generated_message_tctable_lite.cc", "src/google/protobuf/generated_message_util.cc", "src/google/protobuf/implicit_weak_message.cc", + "src/google/protobuf/inlined_string_field.cc", "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/io_win32.cc", "src/google/protobuf/io/strtod.cc", "src/google/protobuf/io/zero_copy_stream.cc", "src/google/protobuf/io/zero_copy_stream_impl.cc", "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "src/google/protobuf/map.cc", "src/google/protobuf/message_lite.cc", "src/google/protobuf/parse_context.cc", "src/google/protobuf/repeated_field.cc", + "src/google/protobuf/repeated_ptr_field.cc", "src/google/protobuf/stubs/bytestream.cc", "src/google/protobuf/stubs/common.cc", "src/google/protobuf/stubs/int128.cc", @@ -181,8 +221,10 @@ cc_library( "src/google/protobuf/empty.pb.cc", "src/google/protobuf/extension_set_heavy.cc", "src/google/protobuf/field_mask.pb.cc", + "src/google/protobuf/generated_message_bases.cc", "src/google/protobuf/generated_message_reflection.cc", "src/google/protobuf/generated_message_table_driven.cc", + "src/google/protobuf/generated_message_tctable_full.cc", "src/google/protobuf/io/gzip_stream.cc", "src/google/protobuf/io/printer.cc", "src/google/protobuf/io/tokenizer.cc", @@ -212,7 +254,6 @@ cc_library( "src/google/protobuf/util/internal/protostream_objectsource.cc", "src/google/protobuf/util/internal/protostream_objectwriter.cc", "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/type_info_test_helper.cc", "src/google/protobuf/util/internal/utility.cc", "src/google/protobuf/util/json_util.cc", "src/google/protobuf/util/message_differencer.cc", @@ -280,19 +321,54 @@ WELL_KNOWN_PROTO_MAP = { WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()] +LITE_WELL_KNOWN_PROTO_MAP = { + "any": ("src/google/protobuf/any.proto", []), + "api": ( + "src/google/protobuf/api.proto", + [ + "source_context", + "type", + ], + ), + "duration": ("src/google/protobuf/duration.proto", []), + "empty": ("src/google/protobuf/empty.proto", []), + "field_mask": ("src/google/protobuf/field_mask.proto", []), + "source_context": ("src/google/protobuf/source_context.proto", []), + "struct": ("src/google/protobuf/struct.proto", []), + "timestamp": ("src/google/protobuf/timestamp.proto", []), + "type": ( + "src/google/protobuf/type.proto", + [ + "any", + "source_context", + ], + ), + "wrappers": ("src/google/protobuf/wrappers.proto", []), +} + +LITE_WELL_KNOWN_PROTOS = [value[0] for value in LITE_WELL_KNOWN_PROTO_MAP.values()] + filegroup( name = "well_known_protos", srcs = WELL_KNOWN_PROTOS, visibility = ["//visibility:public"], ) -cc_proto_library( +filegroup( + name = "lite_well_known_protos", + srcs = LITE_WELL_KNOWN_PROTOS, + visibility = ["//visibility:public"], +) + +adapt_proto_library( + name = "cc_wkt_protos_genproto", + visibility = ["//visibility:public"], + deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], +) + +cc_library( name = "cc_wkt_protos", - srcs = WELL_KNOWN_PROTOS, - include = "src", - default_runtime = ":protobuf", - internal_bootstrap_hack = 1, - protoc = ":protoc", + deprecation = "Only for backward compatibility. Do not use.", visibility = ["//visibility:public"], ) @@ -318,13 +394,21 @@ cc_proto_library( [native_cc_proto_library( name = proto + "_cc_proto", - deps = [proto + "_proto"], visibility = ["//visibility:private"], + deps = [proto + "_proto"], ) for proto in WELL_KNOWN_PROTO_MAP.keys()] cc_proto_blacklist_test( name = "cc_proto_blacklist_test", - deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()] + tags = [ + # Exclude this target from wildcard expansion (//...). Due to + # https://github.com/bazelbuild/bazel/issues/10590, this test has to + # be nominated using the `@com_google_protobuf//` prefix. We do that, + # e.g., in kokoro/linux/bazel/build.sh. + # See also https://github.com/protocolbuffers/protobuf/pull/7096. + "manual", + ], + deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], ) ################################################################################ @@ -348,6 +432,7 @@ cc_library( "src/google/protobuf/compiler/cpp/cpp_message.cc", "src/google/protobuf/compiler/cpp/cpp_message_field.cc", "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", + "src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc", "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", "src/google/protobuf/compiler/cpp/cpp_service.cc", "src/google/protobuf/compiler/cpp/cpp_string_field.cc", @@ -380,6 +465,7 @@ cc_library( "src/google/protobuf/compiler/java/java_generator.cc", "src/google/protobuf/compiler/java/java_generator_factory.cc", "src/google/protobuf/compiler/java/java_helpers.cc", + "src/google/protobuf/compiler/java/java_kotlin_generator.cc", "src/google/protobuf/compiler/java/java_map_field.cc", "src/google/protobuf/compiler/java/java_map_field_lite.cc", "src/google/protobuf/compiler/java/java_message.cc", @@ -436,13 +522,18 @@ cc_binary( # Tests ################################################################################ +filegroup( + name = "testdata", + srcs = glob(["src/google/protobuf/testdata/**/*"]), + visibility = ["//:__subpackages__"], +) + RELATIVE_LITE_TEST_PROTOS = [ # AUTOGEN(lite_test_protos) "google/protobuf/map_lite_unittest.proto", "google/protobuf/unittest_import_lite.proto", "google/protobuf/unittest_import_public_lite.proto", "google/protobuf/unittest_lite.proto", - "google/protobuf/unittest_no_arena_lite.proto", ] LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS] @@ -469,8 +560,6 @@ RELATIVE_TEST_PROTOS = [ "google/protobuf/unittest_lite_imports_nonlite.proto", "google/protobuf/unittest_mset.proto", "google/protobuf/unittest_mset_wire_format.proto", - "google/protobuf/unittest_no_arena.proto", - "google/protobuf/unittest_no_arena_import.proto", "google/protobuf/unittest_no_field_presence.proto", "google/protobuf/unittest_no_generic_services.proto", "google/protobuf/unittest_optimize_for.proto", @@ -480,6 +569,7 @@ RELATIVE_TEST_PROTOS = [ "google/protobuf/unittest_proto3_arena.proto", "google/protobuf/unittest_proto3_arena_lite.proto", "google/protobuf/unittest_proto3_lite.proto", + "google/protobuf/unittest_proto3_optional.proto", "google/protobuf/unittest_well_known_types.proto", "google/protobuf/util/internal/testdata/anys.proto", "google/protobuf/util/internal/testdata/books.proto", @@ -499,6 +589,57 @@ RELATIVE_TEST_PROTOS = [ TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS] +GENERIC_RELATIVE_TEST_PROTOS = [ + "google/protobuf/unittest.proto", + "google/protobuf/unittest_arena.proto", + "google/protobuf/unittest_custom_options.proto", + "google/protobuf/unittest_drop_unknown_fields.proto", + "google/protobuf/unittest_embed_optimize_for.proto", + "google/protobuf/unittest_empty.proto", + "google/protobuf/unittest_enormous_descriptor.proto", + "google/protobuf/unittest_import.proto", + "google/protobuf/unittest_import_public.proto", + "google/protobuf/unittest_lazy_dependencies.proto", + "google/protobuf/unittest_lazy_dependencies_custom_option.proto", + "google/protobuf/unittest_lazy_dependencies_enum.proto", + "google/protobuf/unittest_lite_imports_nonlite.proto", + "google/protobuf/unittest_mset.proto", + "google/protobuf/unittest_mset_wire_format.proto", + "google/protobuf/unittest_no_field_presence.proto", + "google/protobuf/unittest_no_generic_services.proto", + "google/protobuf/unittest_optimize_for.proto", + "google/protobuf/unittest_preserve_unknown_enum.proto", + "google/protobuf/unittest_preserve_unknown_enum2.proto", + "google/protobuf/unittest_proto3.proto", + "google/protobuf/unittest_proto3_arena.proto", + "google/protobuf/unittest_proto3_arena_lite.proto", + "google/protobuf/unittest_proto3_lite.proto", + "google/protobuf/unittest_proto3_optional.proto", + "google/protobuf/unittest_well_known_types.proto", +] + +GENERIC_TEST_PROTOS = ["src/" + s for s in GENERIC_RELATIVE_TEST_PROTOS] + +proto_library( + name = "generic_test_protos", + srcs = LITE_TEST_PROTOS + GENERIC_TEST_PROTOS, + strip_import_prefix = "src", + visibility = ["//:__subpackages__"], + deps = [ + "//:any_proto", + "//:api_proto", + "//:descriptor_proto", + "//:duration_proto", + "//:empty_proto", + "//:field_mask_proto", + "//:source_context_proto", + "//:struct_proto", + "//:timestamp_proto", + "//:type_proto", + "//:wrappers_proto", + ], +) + cc_proto_library( name = "cc_test_protos", srcs = LITE_TEST_PROTOS + TEST_PROTOS, @@ -511,7 +652,10 @@ cc_proto_library( COMMON_TEST_SRCS = [ # AUTOGEN(common_test_srcs) "src/google/protobuf/arena_test_util.cc", + "src/google/protobuf/map_lite_test_util.cc", + "src/google/protobuf/test_util_lite.cc", "src/google/protobuf/map_test_util.inc", + "src/google/protobuf/reflection_tester.cc", "src/google/protobuf/test_util.cc", "src/google/protobuf/test_util.inc", "src/google/protobuf/testing/file.cc", @@ -520,6 +664,7 @@ COMMON_TEST_SRCS = [ cc_binary( name = "test_plugin", + testonly = True, srcs = [ # AUTOGEN(test_plugin_srcs) "src/google/protobuf/compiler/mock_code_generator.cc", @@ -529,7 +674,7 @@ cc_binary( deps = [ ":protobuf", ":protoc_lib", - "//external:gtest", + "@com_google_googletest//:gtest", ], ) @@ -542,7 +687,8 @@ cc_test( ], deps = [ ":protobuf_lite", - "//external:gtest_main", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -554,6 +700,7 @@ cc_test( "src/google/protobuf/arena_unittest.cc", "src/google/protobuf/arenastring_unittest.cc", "src/google/protobuf/compiler/annotation_test_util.cc", + "src/google/protobuf/compiler/command_line_interface_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc", @@ -576,6 +723,7 @@ cc_test( "src/google/protobuf/dynamic_message_unittest.cc", "src/google/protobuf/extension_set_unittest.cc", "src/google/protobuf/generated_message_reflection_unittest.cc", + "src/google/protobuf/inlined_string_field_unittest.cc", "src/google/protobuf/io/coded_stream_unittest.cc", "src/google/protobuf/io/io_win32_unittest.cc", "src/google/protobuf/io/printer_unittest.cc", @@ -583,6 +731,7 @@ cc_test( "src/google/protobuf/io/zero_copy_stream_unittest.cc", "src/google/protobuf/map_field_test.cc", "src/google/protobuf/map_test.cc", + "src/google/protobuf/map_test.inc", "src/google/protobuf/message_unittest.cc", "src/google/protobuf/message_unittest.inc", "src/google/protobuf/no_field_presence_test.cc", @@ -622,14 +771,19 @@ cc_test( "src/google/protobuf/util/type_resolver_util_test.cc", "src/google/protobuf/well_known_types_unittest.cc", "src/google/protobuf/wire_format_unittest.cc", + "src/google/protobuf/wire_format_unittest.inc", ] + select({ "//conditions:default": [ # AUTOGEN(non_msvc_test_srcs) - "src/google/protobuf/compiler/command_line_interface_unittest.cc", ], ":msvc": [], }), - copts = COPTS, + copts = COPTS + select({ + ":msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), data = [ ":test_plugin", ] + glob([ @@ -646,151 +800,60 @@ cc_test( ":cc_test_protos", ":protobuf", ":protoc_lib", - "//external:gtest_main", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ] + PROTOBUF_DEPS, ) ################################################################################ # Java support ################################################################################ + internal_gen_well_known_protos_java( - srcs = WELL_KNOWN_PROTOS, + name = "gen_well_known_protos_java", + visibility = [ + "//java:__subpackages__", + ], + deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], ) -java_library( - name = "protobuf_java", - srcs = glob([ - "java/core/src/main/java/com/google/protobuf/*.java", - ]) + [ - ":gen_well_known_protos_java", +internal_gen_well_known_protos_java( + name = "gen_well_known_protos_javalite", + javalite = True, + visibility = [ + "//java:__subpackages__", ], - javacopts = select({ - "//:jdk9": ["--add-modules=jdk.unsupported"], - "//conditions:default": [ - "-source 7", - "-target 7", - ], - }), + deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()], +) + +alias( + name = "protobuf_java", + actual = "//java/core", visibility = ["//visibility:public"], ) -java_library( +alias( name = "protobuf_javalite", - srcs = [ - # Keep in sync with java/lite/pom.xml - "java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java", - "java/core/src/main/java/com/google/protobuf/AbstractParser.java", - "java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java", - "java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java", - "java/core/src/main/java/com/google/protobuf/Android.java", - "java/core/src/main/java/com/google/protobuf/ArrayDecoders.java", - "java/core/src/main/java/com/google/protobuf/BinaryReader.java", - "java/core/src/main/java/com/google/protobuf/BinaryWriter.java", - "java/core/src/main/java/com/google/protobuf/BooleanArrayList.java", - "java/core/src/main/java/com/google/protobuf/BufferAllocator.java", - "java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java", - "java/core/src/main/java/com/google/protobuf/ByteOutput.java", - "java/core/src/main/java/com/google/protobuf/ByteString.java", - "java/core/src/main/java/com/google/protobuf/CodedInputStream.java", - "java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java", - "java/core/src/main/java/com/google/protobuf/CodedOutputStream.java", - "java/core/src/main/java/com/google/protobuf/CodedOutputStreamWriter.java", - "java/core/src/main/java/com/google/protobuf/DoubleArrayList.java", - "java/core/src/main/java/com/google/protobuf/ExperimentalApi.java", - "java/core/src/main/java/com/google/protobuf/ExtensionLite.java", - "java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java", - "java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java", - "java/core/src/main/java/com/google/protobuf/ExtensionSchema.java", - "java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java", - "java/core/src/main/java/com/google/protobuf/ExtensionSchemas.java", - "java/core/src/main/java/com/google/protobuf/FieldInfo.java", - "java/core/src/main/java/com/google/protobuf/FieldSet.java", - "java/core/src/main/java/com/google/protobuf/FieldType.java", - "java/core/src/main/java/com/google/protobuf/FloatArrayList.java", - "java/core/src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java", - "java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java", - "java/core/src/main/java/com/google/protobuf/IntArrayList.java", - "java/core/src/main/java/com/google/protobuf/Internal.java", - "java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java", - "java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java", - "java/core/src/main/java/com/google/protobuf/JavaType.java", - "java/core/src/main/java/com/google/protobuf/LazyField.java", - "java/core/src/main/java/com/google/protobuf/LazyFieldLite.java", - "java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java", - "java/core/src/main/java/com/google/protobuf/LazyStringList.java", - "java/core/src/main/java/com/google/protobuf/ListFieldSchema.java", - "java/core/src/main/java/com/google/protobuf/LongArrayList.java", - "java/core/src/main/java/com/google/protobuf/ManifestSchemaFactory.java", - "java/core/src/main/java/com/google/protobuf/MapEntryLite.java", - "java/core/src/main/java/com/google/protobuf/MapFieldLite.java", - "java/core/src/main/java/com/google/protobuf/MapFieldSchema.java", - "java/core/src/main/java/com/google/protobuf/MapFieldSchemaLite.java", - "java/core/src/main/java/com/google/protobuf/MapFieldSchemas.java", - "java/core/src/main/java/com/google/protobuf/MessageInfo.java", - "java/core/src/main/java/com/google/protobuf/MessageInfoFactory.java", - "java/core/src/main/java/com/google/protobuf/MessageLite.java", - "java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java", - "java/core/src/main/java/com/google/protobuf/MessageLiteToString.java", - "java/core/src/main/java/com/google/protobuf/MessageSchema.java", - "java/core/src/main/java/com/google/protobuf/MessageSetSchema.java", - "java/core/src/main/java/com/google/protobuf/MutabilityOracle.java", - "java/core/src/main/java/com/google/protobuf/NewInstanceSchema.java", - "java/core/src/main/java/com/google/protobuf/NewInstanceSchemaLite.java", - "java/core/src/main/java/com/google/protobuf/NewInstanceSchemas.java", - "java/core/src/main/java/com/google/protobuf/NioByteString.java", - "java/core/src/main/java/com/google/protobuf/OneofInfo.java", - "java/core/src/main/java/com/google/protobuf/Parser.java", - "java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java", - "java/core/src/main/java/com/google/protobuf/ProtoSyntax.java", - "java/core/src/main/java/com/google/protobuf/Protobuf.java", - "java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java", - "java/core/src/main/java/com/google/protobuf/ProtobufLists.java", - "java/core/src/main/java/com/google/protobuf/ProtocolStringList.java", - "java/core/src/main/java/com/google/protobuf/RawMessageInfo.java", - "java/core/src/main/java/com/google/protobuf/Reader.java", - "java/core/src/main/java/com/google/protobuf/RopeByteString.java", - "java/core/src/main/java/com/google/protobuf/Schema.java", - "java/core/src/main/java/com/google/protobuf/SchemaFactory.java", - "java/core/src/main/java/com/google/protobuf/SchemaUtil.java", - "java/core/src/main/java/com/google/protobuf/SmallSortedMap.java", - "java/core/src/main/java/com/google/protobuf/StructuralMessageInfo.java", - "java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java", - "java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java", - "java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java", - "java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java", - "java/core/src/main/java/com/google/protobuf/UnknownFieldSetLiteSchema.java", - "java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java", - "java/core/src/main/java/com/google/protobuf/UnsafeUtil.java", - "java/core/src/main/java/com/google/protobuf/Utf8.java", - "java/core/src/main/java/com/google/protobuf/WireFormat.java", - "java/core/src/main/java/com/google/protobuf/Writer.java", - ], - javacopts = select({ - "//:jdk9": ["--add-modules=jdk.unsupported"], - "//conditions:default": [ - "-source 7", - "-target 7", - ], - }), + actual = "//java/lite", visibility = ["//visibility:public"], ) -java_library( +alias( name = "protobuf_java_util", - srcs = glob([ - "java/util/src/main/java/com/google/protobuf/util/*.java", - ]), - javacopts = [ - "-source 7", - "-target 7", - ], + actual = "//java/util", + visibility = ["//visibility:public"], +) + +alias( + name = "java_toolchain", + actual = "//java/core:toolchain", + visibility = ["//visibility:public"], +) + +alias( + name = "javalite_toolchain", + actual = "//java/lite:toolchain", visibility = ["//visibility:public"], - deps = [ - "protobuf_java", - "//external:error_prone_annotations", - "//external:gson", - "//external:guava", - ], ) ################################################################################ @@ -801,10 +864,9 @@ py_library( name = "python_srcs", srcs = glob( [ - "python/google/**/*.py", + "python/google/protobuf/**/*.py", ], exclude = [ - "python/google/protobuf/**/__init__.py", "python/google/protobuf/internal/*_test.py", "python/google/protobuf/internal/test_util.py", ], @@ -821,6 +883,13 @@ cc_binary( ], linkshared = 1, linkstatic = 1, + tags = [ + # Exclude this target from wildcard expansion (//...) because it may + # not even be buildable. It will be built if it is needed according + # to :use_fast_cpp_protos. + # https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes + "manual", + ], deps = select({ "//conditions:default": [], ":use_fast_cpp_protos": ["//external:python_headers"], @@ -845,6 +914,13 @@ cc_binary( ], linkshared = 1, linkstatic = 1, + tags = [ + # Exclude this target from wildcard expansion (//...) because it may + # not even be buildable. It will be built if it is needed according + # to :use_fast_cpp_protos. + # https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes + "manual", + ], deps = [ ":protobuf", ":proto_api", @@ -859,6 +935,10 @@ config_setting( values = { "define": "use_fast_cpp_protos=true", }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) config_setting( @@ -866,6 +946,10 @@ config_setting( values = { "define": "allow_oversize_protos=true", }, + visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], ) # Copy the builtin proto files from src/google/protobuf to @@ -897,10 +981,8 @@ py_proto_library( }), default_runtime = "", protoc = ":protoc", - py_extra_srcs = glob(["python/**/__init__.py"]), py_libs = [ ":python_srcs", - "@six//:six", ], srcs_version = "PY2AND3", visibility = ["//visibility:public"], @@ -999,114 +1081,23 @@ cc_library( ], ) -# Note: We use `native_proto_common` here because we depend on an implementation-detail of -# `proto_lang_toolchain`, which may not be available on `proto_common`. -reject_blacklisted_files = hasattr(native_proto_common, "proto_lang_toolchain_rejects_files_do_not_use_or_we_will_break_you_without_mercy") -cc_toolchain_blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()] if reject_blacklisted_files else [":well_known_protos"] proto_lang_toolchain( name = "cc_toolchain", - blacklisted_protos = cc_toolchain_blacklisted_protos, + blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], command_line = "--cpp_out=$(OUT)", runtime = ":protobuf", visibility = ["//visibility:public"], ) -proto_lang_toolchain( - name = "java_toolchain", - command_line = "--java_out=$(OUT)", - runtime = ":protobuf_java", - visibility = ["//visibility:public"], -) - -proto_lang_toolchain( - name = "javalite_toolchain", - command_line = "--java_out=lite:$(OUT)", - runtime = ":protobuf_javalite", - visibility = ["//visibility:public"], -) - alias( name = "objectivec", - actual = ":protobuf_objc", + actual = "//objectivec", visibility = ["//visibility:public"], ) -objc_library( +alias( name = "protobuf_objc", - hdrs = [ - "objectivec/GPBArray.h", - "objectivec/GPBBootstrap.h", - "objectivec/GPBCodedInputStream.h", - "objectivec/GPBCodedOutputStream.h", - "objectivec/GPBDescriptor.h", - "objectivec/GPBDictionary.h", - "objectivec/GPBExtensionInternals.h", - "objectivec/GPBExtensionRegistry.h", - "objectivec/GPBMessage.h", - "objectivec/GPBProtocolBuffers.h", - "objectivec/GPBProtocolBuffers_RuntimeSupport.h", - "objectivec/GPBRootObject.h", - "objectivec/GPBRuntimeTypes.h", - "objectivec/GPBUnknownField.h", - "objectivec/GPBUnknownFieldSet.h", - "objectivec/GPBUtilities.h", - "objectivec/GPBWellKnownTypes.h", - "objectivec/GPBWireFormat.h", - "objectivec/google/protobuf/Any.pbobjc.h", - "objectivec/google/protobuf/Api.pbobjc.h", - "objectivec/google/protobuf/Duration.pbobjc.h", - "objectivec/google/protobuf/Empty.pbobjc.h", - "objectivec/google/protobuf/FieldMask.pbobjc.h", - "objectivec/google/protobuf/SourceContext.pbobjc.h", - "objectivec/google/protobuf/Struct.pbobjc.h", - "objectivec/google/protobuf/Timestamp.pbobjc.h", - "objectivec/google/protobuf/Type.pbobjc.h", - "objectivec/google/protobuf/Wrappers.pbobjc.h", - # Package private headers, but exposed because the generated sources - # need to use them. - "objectivec/GPBArray_PackagePrivate.h", - "objectivec/GPBCodedInputStream_PackagePrivate.h", - "objectivec/GPBCodedOutputStream_PackagePrivate.h", - "objectivec/GPBDescriptor_PackagePrivate.h", - "objectivec/GPBDictionary_PackagePrivate.h", - "objectivec/GPBMessage_PackagePrivate.h", - "objectivec/GPBRootObject_PackagePrivate.h", - "objectivec/GPBUnknownFieldSet_PackagePrivate.h", - "objectivec/GPBUnknownField_PackagePrivate.h", - "objectivec/GPBUtilities_PackagePrivate.h", - ], - copts = [ - "-Wno-vla", - ], - includes = [ - "objectivec", - ], - non_arc_srcs = [ - "objectivec/GPBArray.m", - "objectivec/GPBCodedInputStream.m", - "objectivec/GPBCodedOutputStream.m", - "objectivec/GPBDescriptor.m", - "objectivec/GPBDictionary.m", - "objectivec/GPBExtensionInternals.m", - "objectivec/GPBExtensionRegistry.m", - "objectivec/GPBMessage.m", - "objectivec/GPBRootObject.m", - "objectivec/GPBUnknownField.m", - "objectivec/GPBUnknownFieldSet.m", - "objectivec/GPBUtilities.m", - "objectivec/GPBWellKnownTypes.m", - "objectivec/GPBWireFormat.m", - "objectivec/google/protobuf/Any.pbobjc.m", - "objectivec/google/protobuf/Api.pbobjc.m", - "objectivec/google/protobuf/Duration.pbobjc.m", - "objectivec/google/protobuf/Empty.pbobjc.m", - "objectivec/google/protobuf/FieldMask.pbobjc.m", - "objectivec/google/protobuf/SourceContext.pbobjc.m", - "objectivec/google/protobuf/Struct.pbobjc.m", - "objectivec/google/protobuf/Timestamp.pbobjc.m", - "objectivec/google/protobuf/Type.pbobjc.m", - "objectivec/google/protobuf/Wrappers.pbobjc.m", - ], + actual = "//objectivec", visibility = ["//visibility:public"], ) @@ -1244,19 +1235,115 @@ cc_binary( ], ) -sh_test( - name = "build_files_updated_unittest", - srcs = [ - "build_files_updated_unittest.sh", +# TODO: re-enable this test if appropriate, or replace with something that +# uses the new setup. +# sh_test( +# name = "build_files_updated_unittest", +# srcs = [ +# "build_files_updated_unittest.sh", +# ], +# data = [ +# "BUILD", +# "cmake/extract_includes.bat.in", +# "cmake/libprotobuf.cmake", +# "cmake/libprotobuf-lite.cmake", +# "cmake/libprotoc.cmake", +# "cmake/tests.cmake", +# "src/Makefile.am", +# "update_file_lists.sh", +# ], +# ) + +java_proto_library( + name = "test_messages_proto2_java_proto", + visibility = [ + "//java:__subpackages__", ], - data = [ - "BUILD", - "cmake/extract_includes.bat.in", - "cmake/libprotobuf.cmake", - "cmake/libprotobuf-lite.cmake", - "cmake/libprotoc.cmake", - "cmake/tests.cmake", - "src/Makefile.am", - "update_file_lists.sh", + deps = [":test_messages_proto2_proto"], +) + +java_proto_library( + name = "test_messages_proto3_java_proto", + visibility = [ + "//java:__subpackages__", + ], + deps = [":test_messages_proto3_proto"], +) + +java_proto_library( + name = "conformance_java_proto", + visibility = [ + "//java:__subpackages__", + ], + deps = [":conformance_proto"], +) + +java_lite_proto_library( + name = "test_messages_proto2_java_proto_lite", + visibility = [ + "//java:__subpackages__", + ], + deps = [":test_messages_proto2_proto"], +) + +java_lite_proto_library( + name = "conformance_java_proto_lite", + visibility = [ + "//java:__subpackages__", + ], + deps = [":conformance_proto"], +) + +java_lite_proto_library( + name = "test_messages_proto3_java_proto_lite", + visibility = [ + "//java:__subpackages__", + ], + deps = [":test_messages_proto3_proto"], +) + +java_binary( + name = "conformance_java", + srcs = ["conformance/ConformanceJava.java"], + main_class = "ConformanceJava", + visibility = [ + "//java:__subpackages__", ], + deps = [ + ":conformance_java_proto", + ":test_messages_proto2_java_proto", + ":test_messages_proto3_java_proto", + "//:protobuf_java", + "//:protobuf_java_util", + ], +) + +java_binary( + name = "conformance_java_lite", + srcs = ["conformance/ConformanceJavaLite.java"], + main_class = "ConformanceJavaLite", + visibility = [ + "//java:__subpackages__", + ], + deps = [ + ":conformance_java_proto_lite", + ":test_messages_proto2_java_proto_lite", + ":test_messages_proto3_java_proto_lite", + "//:protobuf_java_util", + "//:protobuf_javalite", + ], +) + +exports_files([ + "conformance/conformance_test_runner.sh", + "conformance/failure_list_java.txt", + "conformance/failure_list_java_lite.txt", + "conformance/text_format_failure_list_java.txt", + "conformance/text_format_failure_list_java_lite.txt", +]) + +filegroup( + name = "bzl_srcs", + srcs = glob(["**/*.bzl"]), + visibility = ["//visibility:public"], ) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/CHANGES.txt b/cdk/extra/protobuf/protobuf-3.19.6/CHANGES.txt similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/CHANGES.txt rename to cdk/extra/protobuf/protobuf-3.19.6/CHANGES.txt index 67c5a3d6c..1724240df 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/CHANGES.txt +++ b/cdk/extra/protobuf/protobuf-3.19.6/CHANGES.txt @@ -1,3 +1,825 @@ +2022-09-27 version 3.19.6 (C++/Java/Python/PHP/Objective-C/C#/Ruby) + Java + * Refactoring java full runtime to reuse sub-message builders and prepare to + migrate parsing logic from parse constructor to builder. + * Move proto wireformat parsing functionality from the private "parsing + constructor" to the Builder class. + * Change the Lite runtime to prefer merging from the wireformat into mutable + messages rather than building up a new immutable object before merging. This + way results in fewer allocations and copy operations. + * Make message-type extensions merge from wire-format instead of building up + instances and merging afterwards. This has much better performance. + * Fix TextFormat parser to build up recurring (but supposedly not repeated) + sub-messages directly from text rather than building a new sub-message and + merging the fully formed message into the existing field. + + +2022-09-13 version 3.19.5 (C++/Java/Python/PHP/Objective-C/C#/Ruby) + + C++ + * Reduce memory consumption of MessageSet parsing + +2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Make libprotobuf symbols local on OSX to fix issue #9395 (#9435) + + Ruby + * Fixed a data loss bug that could occur when the number of `optional` + fields in a message is an exact multiple of 32. (#9440). + + PHP + * Fixed a data loss bug that could occur when the number of `optional` + fields in a message is an exact multiple of 32. (#9440). + +2022-01-10 version 3.19.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Fix missing Windows wheel for Python 3.10 on PyPI + +2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Java + * Improve performance characteristics of UnknownFieldSet parsing (#9371) + +2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Bazel + * Ensure that release archives contain everything needed for Bazel (#9131) + * Align dependency handling with Bazel best practices (#9165) + + JavaScript + * Fix `ReferenceError: window is not defined` when getting the global object (#9156) + + Ruby + * Fix memory leak in MessageClass.encode (#9150) + +2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Make proto2::Message::DiscardUnknownFields() non-virtual + * Separate RepeatedPtrField into its own header file + * For default floating point values of 0, consider all bits significant + * cmake: support `MSVC_RUNTIME_LIBRARY` property (#8851) + * Fix shadowing warnings (#8926) + * Fix for issue #8484, constant initialization doesn't compile in msvc clang-cl environment (#8993) + * Fix build on AIX and SunOS (#8373) (#9065) + * Add Android stlport and default toolchains to BUILD. (#8290) + + Java + * For default floating point values of 0, consider all bits significant + * Annotate `//java/com/google/protobuf/util/...` with nullness annotations + * Use ArrayList copy constructor (#7853) + + Kotlin + * Switch Kotlin proto DSLs to be implemented with inline value classes + * Fix inlining and deprecation for repeated string fields in kotlin (#9120) + + Python + * Proto2 DecodeError now includes message name in error message + * Make MessageToDict convert map keys to strings (#8122) + * Add python-requires in setup.py (#8989) + * Add python 3.10 (#9034) + + JavaScript + * Skip exports if not available by CommonJS (#8856) + * JS: Comply with CSP no-unsafe-eval. (#8864) + + PHP + * Added "object" as a reserved name for PHP (#8962) + + Ruby + * Override Map.clone to use Map's dup method (#7938) + * Ruby: build extensions for arm64-darwin (#8232) + * Add class method Timestamp.from_time to ruby well known types (#8562) + * Adopt pure ruby DSL implementation for JRuby (#9047) + * Add size to Map class (#8068) + * Fix for descriptor_pb.rb: google/protobuf should be required first (#9121) + + C# + * Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246) + * [C#] Make FieldDescriptor propertyName public (#7642) + +2021-10-04 version 3.18.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Update setup.py to reflect that we now require at least Python 3.5 (#8989) + * Performance fix for DynamicMessage: force GetRaw() to be inlined (#9023) + + Ruby + * Update ruby_generator.cc to allow proto2 imports in proto3 (#9003) + +2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Removed Python 2.x support. + * Pure python descriptor_pool.AddSerializedFile() will always build the + file and return FileDescriptor which is same with python c++ extension + * type errors thrown by MergeFrom now report fully qualified class names + * Protobuf python generated code are simplified. Some platforms that uses + "is"("is not") to compare the enum or descriptor's label/type may fail, + should use "=="("!=") instead. + + C++ + * Generated code now uses the c++11 standard integer types int{32,64}_t and + uint{32,64}_t + * Reduce memory usage of the DescriptorPool type. + * Moved the zero-argument New() method on messages to the base class (internal + optimization). + * Unused return values marked with `PROTOBUF_MUST_USE_RESULT` are now + correctly attributed. + * Demotes PrintPath log for maps in MessageDifferencer down from WARNING to + INFO. + * Make sure FullMessageName() is always private. + * Fix race condition in EnumDescriptor. + * Remove MessageLite::GetMaybeArenaPointer. + + Java + * Add @deprecated javadoc for set/get/has methods + * correctly decode \? escape sequence in text protos + * Avoid depending on Objects.requireNonNull() until we can verify that no + users are depending on older Android versions. + * disallow null string map values in put and putAll + * Add `@CheckReturnValue` to `ByteString` API. + * Make the `hasPresence` method public in `FieldDescriptor`. + * Report more detailed messages in Duration and Timestamp proto parsing + errors. + * New Timestamps.fromDate utility method that converts a java.util.Date to a + Timestamp proto object. + + Kotlin + * Generated Kotlin code is Explicit API mode compatible + +2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + C++ + * Fix warnings raised by clang 11 (#8664) + * Make StringPiece constructible from std::string_view (#8707) + * Add missing capability attributes for LLVM 12 (#8714) + * Stop using std::iterator (deprecated in C++17). (#8741) + * Move field_access_listener from libprotobuf-lite to libprotobuf (#8775) + * Fix #7047 Safely handle setlocale (#8735) + * Remove deprecated version of SetTotalBytesLimit() (#8794) + * Support arena allocation of google::protobuf::AnyMetadata (#8758) + * Fix undefined symbol error around SharedCtor() (#8827) + * Fix default value of enum(int) in json_util with proto2 (#8835) + * Better Smaller ByteSizeLong + * Introduce event filters for inject_field_listener_events + * Reduce memory usage of DescriptorPool + * For lazy fields copy serialized form when allowed. + * Re-introduce the InlinedStringField class + * v2 access listener + * Reduce padding in the proto's ExtensionRegistry map. + * GetExtension performance optimizations + * Make tracker a static variable rather than call static functions + * Support extensions in field access listener + * Annotate MergeFrom for field access listener + * Fix incomplete types for field access listener + * Add map_entry/new_map_entry to SpecificField in MessageDifferencer. They + record the map items which are different in MessageDifferencer's reporter. + * Reduce binary size due to fieldless proto messages + * TextFormat: ParseInfoTree supports getting field end location in addition to + start. + * Fix repeated enum extension size in field listener + * Enable Any Text Expansion for Descriptors::DebugString() + * Switch from int{8,16,32,64} to int{8,16,32,64}_t + * Reduce memory usage of the DescriptorPool type. + + Java + * Fix errorprone conflict (#8723) + * Removing deprecated TimeUtil class. (#8749) + * Optimized FieldDescriptor.valueOf() to avoid array copying. + * Removing deprecated TimeUtil class. + * Add Durations.parseUnchecked(String) and Timestamps.parseUnchecked(String) + * FieldMaskUtil: Add convenience method to mask the fields out of a given proto. + + JavaScript + * Optimize binary parsing of repeated float64 + * Fix for optimization when reading doubles from binary wire format + * Replace toArray implementation with toJSON. + + Python + * Drops support for 2.7 and 3.5. + + PHP + * Migrate PHP & Ruby to ABSL wyhash (#8854) + * Added support for PHP 8.1 (currently in RC1) to the C extension (#8964) + * Fixed PHP SEGV when constructing messages from a destructor. (#8969) + + Ruby + * Move DSL implementation from C to pure Ruby (#8850) + * Fixed a memory bug with RepeatedField#+. (#8970) + + Other + * [csharp] ByteString.CreateCodedInput should use ArraySegment offset and count (#8740) + * [ObjC] Add support for using the proto package to prefix symbols. (#8760) + * field_presence.md: fix Go example (#8788) + + + Kotlin + * Suppress NOTHING_TO_INLINE in Kotlin generated inline functions. + +2021-06-04 version 3.17.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Python + * Note: This is the last release to support Python 2.7. Future releases will + require Python >= 3.5. + + C++ + * Introduce FieldAccessListener. + * Stop emitting boilerplate {Copy/Merge}From in each ProtoBuf class + * Fixed some uninitialized variable warnings in generated_message_reflection.cc. + + Kotlin + * Fix duplicate proto files error (#8699) + + Java + * Fixed parser to check that we are at a proper limit when a sub-message has + finished parsing. + +2021-05-25 version 3.17.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Kotlin + * Fix duplicate class error (#8653) + + PHP + * Fixed SEGV in sub-message getters for well-known types when message is unset + (#8670) + +2021-05-07 version 3.17.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + PHP + * Fixed PHP memory leaks and arginfo errors. (#8614) + * Fixed JSON parser to allow multiple values from the same oneof as long as + all but one are null. + + Ruby + * Fixed memory bug: properly root repeated/map field when assigning. (#8639) + * Fixed JSON parser to allow multiple values from the same oneof as long as + all but one are null. + + +2021-05-07 version 3.17.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Protocol Compiler + * Fix the generated source information for reserved values in Enums. + + C++ + * Fix -Wunused-parameter in map fields (fixes #8494) (#8500) + * Use byteswap.h when building against musl libc (#8503) + * Fix -Wundefined-inline error when using SharedCtor() or SharedDtor() (#8532) + * Fix bug where `Descriptor::DebugString()` printed proto3 synthetic oneofs. + * Provide stable versions of `SortAndUnique()`. + * Make sure to cache proto3 optional message fields when they are cleared. + * Expose UnsafeArena methods to Reflection. + * Use std::string::empty() rather than std::string::size() > 0. + + Kotlin + * Restrict extension setter and getter operators to non-nullable T. + + Java + * updating GSON and Guava to more recent versions (#8524) + * Reduce the time spent evaluating isExtensionNumber by storing the extension + ranges in a TreeMap for faster queries. This is particularly relevant for + protos which define a large number of extension ranges, for example when + each tag is defined as an extension. + * Fix java bytecode estimation logic for optional fields. + * Optimize Descriptor.isExtensionNumber. + + Python + * Add MethodDescriptor.CopyToProto() (#8327) + * Remove unused python_protobuf.{cc,h} (#8513) + * Start publishing python aarch64 manylinux wheels normally (#8530) + * Fix constness issue detected by MSVC standard conforming mode (#8568) + * Make JSON parsing match C++ and Java when multiple fields from the same + oneof are present and all but one is null. + + Ruby + * Add support for proto3 json_name in compiler and field definitions (#8356) + * Fixed memory leak of Ruby arena objects. (#8461) + * Fix source gem compilation (#8471) + * Fix various exceptions in Ruby on 64-bit Windows (#8563) + * Fix crash when calculating Message hash values on 64-bit Windows (#8565) + + Conformance Tests + * Added a conformance test for the case of multiple fields from the same + oneof. + +2021-04-06 version 3.16.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Other + * Opensourcing kotlin protos (#8272) + * Use a newer version of rules_proto, with the new rule `proto_descriptor_set` (#8469) + + C++ + * Fix compiler warnings issue found in conformance_test_runner #8189 (#8190) + * Fix MinGW-w64 build issues. (#8286) + * [Protoc] C++ Resolved an issue where NO_DESTROY and CONSTINIT are in incorrect order (#8296) + * Fix PROTOBUF_CONSTINIT macro redefinition (#8323) + * Delete StringPiecePod (#8353) + * Fix gcc error: comparison of unsigned expression in '>= 0' is always … (#8309) + * Fix cmake install on iOS (#8301) + * Create a CMake option to control whether or not RTTI is enabled (#8347) + * Fix endian.h location on FreeBSD (#8351) + * Refactor util::Status (#8354) + * Make util::Status more similar to absl::Status (#8405) + * Fix -Wsuggest-destructor-override for generated C++ proto classes. (#8408) + * Refactor StatusOr and StringPiece (#8406) + * Refactor uint128 (#8416) + * The ::pb namespace is no longer exposed due to conflicts. + * Allow MessageDifferencer::TreatAsSet() (and friends) to override previous + calls instead of crashing. + * Reduce the size of generated proto headers for protos with `string` or + `bytes` fields. + * Move arena() operation on uncommon path to out-of-line routine + * For iterator-pair function parameter types, take both iterators by value. + * Code-space savings and perhaps some modest performance improvements in + RepeatedPtrField. + * Eliminate nullptr check from every tag parse. + * Remove unused _$name$_cached_byte_size_ fields. + * Serialize extension ranges together when not broken by a proto field in the + middle. + * Do out-of-line allocation and deallocation of string object in ArenaString. + * Streamline ParseContext::ParseMessage to avoid code bloat and improve + performance. + * New member functions RepeatedField::Assign, RepeatedPtrField::{Add, Assign}. + * Fix undefined behavior warning due to innocuous uninitialization of value + on an error path. + * Avoid expensive inlined code space for encoding message length for messages + >= 128 bytes and instead do a procedure call to a shared out-of-line routine. + * util::DefaultFieldComparator will be final in a future version of protobuf. + Subclasses should inherit from SimpleFieldComparator instead. + + C# + * Add .NET 5 target and improve WriteString performance with SIMD (#8147) + + Java + * deps: update JUnit and Truth (#8319) + * Detect invalid overflow of byteLimit and return InvalidProtocolBufferException as documented. + * Exceptions thrown while reading from an InputStream in parseFrom are now + included as causes. + * Support potentially more efficient proto parsing from RopeByteStrings. + * Clarify runtime of ByteString.Output.toStringBuffer(). + * Added UnsafeByteOperations to protobuf-lite (#8426) + + JavaScript + * Make Any.pack() chainable. + + Python + * Fix some constness / char literal issues being found by MSVC standard conforming mode (#8344) + * Switch on "new" buffer API (#8339) + * Enable crosscompiling aarch64 python wheels under dockcross manylinux docker image (#8280) + * Fixed a bug in text format where a trailing colon was printed for repeated field. + * When TextFormat encounters a duplicate message map key, replace the current + one instead of merging. + + Objective-C + * Move the class map to a CFDictionary. (#8328) + + PHP + * read_property() handler is not supposed to return NULL (#8362) + * Changed parameter type from long to integer (#7613) + * fix: README supported PHP version for C extension (#8236) + + Ruby + * Fixed quadratic memory usage when appending to arrays. (#8364) + * Fixed memory leak of Ruby arena objects. (#8461) + * Add support for proto3 json_name in compiler and field definitions. (#8356) + + Other + * Some doc on AOT compilation and protobuf (#8294) + * [CMake] Ability to pass options to protoc executable from cmake (#8374) + * Add --fatal_warnings flag to treat warnings as errors (#8131) + * [bazel] Remove deprecated way to depend on googletest (#8396) + * add error returns missing from protoc to prevent it from exiting with… (#8409) + + +2021-04-07 version 3.15.8 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Fixed memory leak of Ruby arena objects (#8461) + +2021-04-02 version 3.15.7 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Remove the ::pb namespace (alias) (#8423) + + Ruby + * Fix unbounded memory growth for Ruby <2.7 (#8429) + * Fixed message equality in cases where the message type is different (#8434) + +2021-03-10 version 3.15.6 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Fixed bug in string comparison logic (#8386) + +2021-03-04 version 3.15.5 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Fixed quadratic memory use in array append (#8379) + + PHP + * Fixed quadratic memory use in array append (#8379) + + C++ + * Do not disable RTTI by default in the CMake build (#8377) + +2021-03-02 version 3.15.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Fixed SEGV when users pass nil messages (#8363) + * Fixed quadratic memory usage when appending to arrays (#8364) + + C++ + * Create a CMake option to control whether or not RTTI is enabled (#8361) + + PHP + * read_property() handler is not supposed to return NULL (#8362) + +2021-02-25 version 3.15.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Ruby <2.7 now uses WeakMap too, which prevents memory leaks. (#8341) + +2021-02-23 version 3.15.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Fix for FieldDescriptor.get(msg) (#8330) + + C++ + * Fix PROTOBUF_CONSTINIT macro redefinition (#8323) + +2021-02-05 version 3.15.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Bugfix for Message.[] for repeated or map fields (#8313) + +2021-02-05 version 3.15.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Protocol Compiler + * Optional fields for proto3 are enabled by default, and no longer require + the --experimental_allow_proto3_optional flag. + + C++ + * MessageDifferencer: fixed bug when using custom ignore with multiple + unknown fields + * Use init_seg in MSVC to push initialization to an earlier phase. + * Runtime no longer triggers -Wsign-compare warnings. + * Fixed -Wtautological-constant-out-of-range-compare warning. + * DynamicCastToGenerated works for nullptr input for even if RTTI is disabled + * Arena is refactored and optimized. + * Clarified/specified that the exact value of Arena::SpaceAllocated() is an + implementation detail users must not rely on. It should not be used in + unit tests. + * Change the signature of Any::PackFrom() to return false on error. + * Add fast reflection getter API for strings. + * Constant initialize the global message instances + * Avoid potential for missed wakeup in UnknownFieldSet + * Now Proto3 Oneof fields have "has" methods for checking their presence in + C++. + * Bugfix for NVCC + * Return early in _InternalSerialize for empty maps. + * Adding functionality for outputting map key values in proto path logging + output (does not affect comparison logic) and stop printing 'value' in the + path. The modified print functionality is in the + MessageDifferencer::StreamReporter. + * Fixed https://github.com/protocolbuffers/protobuf/issues/8129 + * Ensure that null char symbol, package and file names do not result in a + crash. + * Constant initialize the global message instances + * Pretty print 'max' instead of numeric values in reserved ranges. + * Removed remaining instances of std::is_pod, which is deprecated in C++20. + * Changes to reduce code size for unknown field handling by making uncommon + cases out of line. + * Fix std::is_pod deprecated in C++20 (#7180) + * Fix some -Wunused-parameter warnings (#8053) + * Fix detecting file as directory on zOS issue #8051 (#8052) + * Don't include sys/param.h for _BYTE_ORDER (#8106) + * remove CMAKE_THREAD_LIBS_INIT from pkgconfig CFLAGS (#8154) + * Fix TextFormatMapTest.DynamicMessage issue#5136 (#8159) + * Fix for compiler warning issue#8145 (#8160) + * fix: support deprecated enums for GCC < 6 (#8164) + * Fix some warning when compiling with Visual Studio 2019 on x64 target (#8125) + + Python + * Provided an override for the reverse() method that will reverse the internal + collection directly instead of using the other methods of the BaseContainer. + * MessageFactory.CreateProtoype can be overridden to customize class creation. + * Fix PyUnknownFields memory leak (#7928) + * Add macOS Big Sur compatibility (#8126) + + JavaScript + * Generate `getDescriptor` methods with `*` as their `this` type. + * Enforce `let/const` for generated messages. + * js/binary/utils.js: Fix jspb.utils.joinUnsignedDecimalString to work with negative bitsLow and low but non-zero bitsHigh parameter. (#8170) + + PHP + * Added support for PHP 8. (#8105) + * unregister INI entries and fix invalid read on shutdown (#8042) + * Fix PhpDoc comments for message accessors to include "|null". (#8136) + * fix: convert native PHP floats to single precision (#8187) + * Fixed PHP to support field numbers >=2**28. (#8235) + * feat: add support for deprecated fields to PHP compiler (#8223) + * Protect against stack overflow if the user derives from Message. (#8248) + * Fixed clone for Message, RepeatedField, and MapField. (#8245) + * Updated upb to allow nonzero offset minutes in JSON timestamps. (#8258) + + Ruby + * Added support for Ruby 3. (#8184) + * Rewrote the data storage layer to be based on upb_msg objects from the + upb library. This should lead to much better parsing performance, + particularly for large messages. (#8184). + * Fill out JRuby support (#7923) + * [Ruby] Fix: (SIGSEGV) gRPC-Ruby issue on Windows. memory alloc infinite + recursion/run out of memory (#8195) + * Fix jruby support to handle messages nested more than 1 level deep (#8194) + + Java + * Avoid possible UnsupportedOperationException when using CodedInputSteam + with a direct ByteBuffer. + * Make Durations.comparator() and Timestamps.comparator() Serializable. + * Add more detailed error information for dynamic message field type + validation failure + * Removed declarations of functions declared in java_names.h from + java_helpers.h. + * Now Proto3 Oneof fields have "has" methods for checking their presence in + Java. + * Annotates Java proto generated *_FIELD_NUMBER constants. + * Add -assumevalues to remove JvmMemoryAccessor on Android. + + C# + * Fix parsing negative Int32Value that crosses segment boundary (#8035) + * Change ByteString to use memory and support unsafe create without copy (#7645) + * Optimize MapField serialization by removing MessageAdapter (#8143) + * Allow FileDescriptors to be parsed with extension registries (#8220) + * Optimize writing small strings (#8149) + +2020-11-11 version 3.14.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Protocol Compiler + * The proto compiler no longer requires a .proto filename when it is not + generating code. + * Added flag `--deterministic_output` to `protoc --encode=...`. + * Fixed deadlock when using google.protobuf.Any embedded in aggregate options. + + C++ + * Arenas are now unconditionally enabled. cc_enable_arenas no longer has + any effect. + * Removed inlined string support, which is incompatible with arenas. + * Fix a memory corruption bug in reflection when mixing optional and + non-optional fields. + * Make SpaceUsed() calculation more thorough for map fields. + * Add stack overflow protection for text format with unknown field values. + * FieldPath::FollowAll() now returns a bool to signal if an out-of-bounds + error was encountered. + * Performance improvements for Map. + * Minor formatting fix when dumping a descriptor to .proto format with + DebugString. + * UBSAN fix in RepeatedField (#2073). + * When running under ASAN, skip a test that makes huge allocations. + * Fixed a crash that could happen when creating more than 256 extensions in + a single message. + * Fix a crash in BuildFile when passing in invalid descriptor proto. + * Parser security fix when operating with CodedInputStream. + * Warn against the use of AllowUnknownExtension. + * Migrated to C++11 for-range loops instead of index-based loops where + possible. This fixes a lot of warnings when compiling with -Wsign-compare. + * Fix segment fault for proto3 optional (#7805) + * Adds a CMake option to build `libprotoc` separately (#7949) + + Java + * Bugfix in mergeFrom() when a oneof has multiple message fields. + * Fix RopeByteString.RopeInputStream.read() returning -1 when told to read + 0 bytes when not at EOF. + * Redefine remove(Object) on primitive repeated field Lists to avoid + autoboxing. + * Support "\u" escapes in textformat string literals. + * Trailing empty spaces are no longer ignored for FieldMask. + * Fix FieldMaskUtil.subtract to recursively remove mask. + * Mark enums with `@java.lang.Deprecated` if the proto enum has option + `deprecated = true;`. + * Adding forgotten duration.proto to the lite library (#7738) + + Python + * Print google.protobuf.NullValue as null instead of "NULL_VALUE" when it is + used outside WKT Value/Struct. + * Fix bug occurring when attempting to deep copy an enum type in python 3. + * Add a setuptools extension for generating Python protobufs (#7783) + * Remove uses of pkg_resources in non-namespace packages. (#7902) + * [bazel/py] Omit google/__init__.py from the Protobuf runtime. (#7908) + * Removed the unnecessary setuptools package dependency for Python package (#7511) + * Fix PyUnknownFields memory leak (#7928) + + PHP + * Added support for "==" to the PHP C extension (#7883) + * Added `==` operators for Map and Array. (#7900) + * Native C well-known types (#7944) + * Optimized away hex2bin() call in generated code (#8006) + * New version of upb, and a new hash function wyhash in third_party. (#8000) + * add missing hasOneof method to check presence of oneof fields (#8003) + + Go: + * Update go_package options to reference google.golang.org/protobuf module. + + C#: + * annotate ByteString.CopyFrom(ReadOnlySpan) as SecuritySafeCritical (#7701) + * Fix C# optional field reflection when there are regular fields too (#7705) + * Fix parsing negative Int32Value that crosses segment boundary (#8035) + + Javascript: + * JS: parse (un)packed fields conditionally (#7379) + +2020-07-14 version 3.13.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + PHP: + * The C extension is completely rewritten. The new C extension has significantly + better parsing performance and fixes a handful of conformance issues. It will + also make it easier to add support for more features like proto2 and proto3 presence. + * The new C extension does not support PHP 5.x. PHP 5.x users can still use pure-PHP. + + C++: + * Removed deprecated unsafe arena string accessors + * Enabled heterogeneous lookup for std::string keys in maps. + * Removed implicit conversion from StringPiece to std::string + * Fix use-after-destroy bug when the Map is allocated in the arena. + * Improved the randomness of map ordering + * Added stack overflow protection for text format with unknown fields + * Use std::hash for proto maps to help with portability. + * Added more Windows macros to proto whitelist. + * Arena constructors for map entry messages are now marked "explicit" + (for regular messages they were already explicit). + * Fix subtle aliasing bug in RepeatedField::Add + * Fix mismatch between MapEntry ByteSize and Serialize with respect to unset + fields. + + Python: + * JSON format conformance fixes: + * Reject lowercase t for Timestamp json format. + * Print full_name directly for extensions (no camelCase). + * Reject boolean values for integer fields. + * Reject NaN, Infinity, -Infinity that is not quoted. + * Base64 fixes for bytes fields: accept URL-safe base64 and missing padding. + * Bugfix for fields/files named "async" or "await". + * Improved the error message when AttributeError is returned from __getattr__ + in EnumTypeWrapper. + + Java: + * Fixed a bug where setting optional proto3 enums with setFooValue() would + not mark the value as present. + * Add Subtract function to FieldMaskUtil. + + C#: + * Dropped support for netstandard1.0 (replaced by support for netstandard1.1). + This was required to modernize the parsing stack to use the `Span` + type internally. (#7351) + * Add `ParseFrom(ReadOnlySequence)` method to enable GC friendly + parsing with reduced allocations and buffer copies. (#7351) + * Add support for serialization directly to a `IBufferWriter` or + to a `Span` to enable GC friendly serialization. + The new API is available as extension methods on the `IMessage` type. (#7576) + * Add `GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE` define to make + generated code compatible with old C# compilers (pre-roslyn compilers + from .NET framework and old versions of mono) that do not support + ref structs. Users that are still on a legacy stack that does + not support C# 7.2 compiler might need to use the new define + in their projects to be able to build the newly generated code. (#7490) + * Due to the major overhaul of parsing and serialization internals (#7351 and #7576), + it is recommended to regenerate your generated code to achieve the best + performance (the legacy generated code will still work, but might incur + a slight performance penalty). + +2020-07-28 version 3.12.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + +This release contains no significant changes, but exists because 3.12.3 was +mistakenly tagged at the wrong commit. + +2020-06-01 version 3.12.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Objective-C + * Tweak the union used for Extensions to support old generated code. #7573 + +2020-05-26 version 3.12.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Simplified the template export macros to fix the build for mingw32. (#7539) + + Objective-C + * Fix for the :protobuf_objc target in the Bazel BUILD file. (#7538) + +2020-05-20 version 3.12.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Ruby + * Re-add binary gems for Ruby 2.3 and 2.4. These are EOL upstream, however + many people still use them and dropping support will require more + coordination. + +2020-05-12 version 3.12.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Protocol Compiler + * [experimental] Singular, non-message typed fields in proto3 now support + presence tracking. This is enabled by adding the "optional" field label and + passing the --experimental_allow_proto3_optional flag to protoc. + * For usage info, see docs/field_presence.md. + * During this experimental phase, code generators should update to support + proto3 presence, see docs/implementing_proto3_presence.md for instructions. + * Allow duplicate symbol names when multiple descriptor sets are passed on + the command-line, to match the behavior when multiple .proto files are passed. + * Deterministic `protoc --descriptor_set_out` (#7175) + + C++ + * [experimental] Added proto3 presence support. + * New descriptor APIs to support proto3 presence. + * Enable Arenas by default on all .proto files. + * Documented that users are not allowed to subclass Message or MessageLite. + * Mark generated classes as final; inheriting from protos is strongly discouraged. + * Add stack overflow protection for text format with unknown fields. + * Add accessors for map key and value FieldDescriptors. + * Add FieldMaskUtil::FromFieldNumbers(). + * MessageDifferencer: use ParsePartial() on Any fields so the diff does not + fail when there are missing required fields. + * ReflectionOps::Merge(): lookup messages in the right factory, if it can. + * Added Descriptor::WellKnownTypes enum and Descriptor::well_known_type() + accessor as an easier way of determining if a message is a Well-Known Type. + * Optimized RepeatedField::Add() when it is used in a loop. + * Made proto move/swap more efficient. + * De-virtualize the GetArena() method in MessageLite. + * Improves performance of json_stream_parser.cc by factor 1000 (#7230) + * bug: #7076 undefine Windows OUT and OPTIONAL macros (#7087) + * Fixed a bug in FieldDescriptor::DebugString() that would erroneously print + an "optional" label for a field in a oneof. + * Fix bug in parsing bool extensions that assumed they are always 1 byte. + * Fix off-by-one error in FieldOptions::ByteSize() when extensions are present. + * Clarified the comments to show an example of the difference between + Descriptor::extension and DescriptorPool::FindAllExtensions. + * Add a compiler option 'code_size' to force optimize_for=code_size on all + protos where this is possible. + + Java + * [experimental] Added proto3 presence support. + * Mark java enum _VALUE constants as @Deprecated if the enum field is deprecated + * reduce size for enums with allow_alias set to true. + * Sort map fields alphabetically by the field's key when printing textproto. + * Fixed a bug in map sorting that appeared in -rc1 and -rc2 (#7508). + * TextFormat.merge() handles Any as top level type. + * Throw a descriptive IllegalArgumentException when calling + getValueDescriptor() on enum special value UNRECOGNIZED instead of + ArrayIndexOutOfBoundsException. + * Fixed an issue with JsonFormat.printer() where setting printingEnumsAsInts() + would override the configuration passed into includingDefaultValueFields(). + * Implement overrides of indexOf() and contains() on primitive lists returned + for repeated fields to avoid autoboxing the list contents. + * Add overload to FieldMaskUtil.fromStringList that accepts a descriptor. + * [bazel] Move Java runtime/toolchains into //java (#7190) + + Python + * [experimental] Added proto3 presence support. + * [experimental] fast import protobuf module, only works with cpp generated code linked in. + * Truncate 'float' fields to 4 bytes of precision in setters for pure-Python + implementation (C++ extension was already doing this). + * Fixed a memory leak in C++ bindings. + * Added a deprecation warning when code tries to create Descriptor objects + directly. + * Fix unintended comparison between bytes and string in descriptor.py. + * Avoid printing excess digits for float fields in TextFormat. + * Remove Python 2.5 syntax compatibility from the proto compiler generated _pb2.py module code. + * Drop 3.3, 3.4 and use single version docker images for all python tests (#7396) + + JavaScript + * Fix js message pivot selection (#6813) + + PHP + * Persistent Descriptor Pool (#6899) + * Implement lazy loading of php class for proto messages (#6911) + * Correct @return in Any.unpack docblock (#7089) + * Ignore unknown enum value when ignore_unknown specified (#7455) + + Ruby + * [experimental] Implemented proto3 presence for Ruby. (#7406) + * Stop building binary gems for ruby <2.5 (#7453) + * Fix for wrappers with a zero value (#7195) + * Fix for JSON serialization of 0/empty-valued wrapper types (#7198) + * Call "Class#new" over rb_class_new_instance in decoding (#7352) + * Build extensions for Ruby 2.7 (#7027) + * assigning 'nil' to submessage should clear the field. (#7397) + + C# + * [experimental] Add support for proto3 presence fields in C# (#7382) + * Mark GetOption API as obsolete and expose the "GetOptions()" method on descriptors instead (#7491) + * Remove Has/Clear members for C# message fields in proto2 (#7429) + * Enforce recursion depth checking for unknown fields (#7132) + * Fix conformance test failures for Google.Protobuf (#6910) + * Cleanup various bits of Google.Protobuf (#6674) + * Fix latest ArgumentException for C# extensions (#6938) + * Remove unnecessary branch from ReadTag (#7289) + + Objective-C + * [experimental] ObjC Proto3 optional support (#7421) + * Block subclassing of generated classes (#7124) + * Use references to Obj C classes instead of names in descriptors. (#7026) + * Revisit how the WKTs are bundled with ObjC. (#7173) + + Other + * Add a proto_lang_toolchain for javalite (#6882) + * [bazel] Update gtest and deprecate //external:{gtest,gtest_main} (#7237) + * Add application note for explicit presence tracking. (#7390) + * Howto doc for implementing proto3 presence in a code generator. (#7407) + + 2020-02-14 version 3.11.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) C# @@ -299,7 +1121,7 @@ * Introduce Proto C API. * FindFileContainingSymbol in descriptor pool is now able to find field and enum values. * reflection.MakeClass() and reflection.ParseMessage() are deprecated. - * Added DescriptorPool.FindMethodByName() method in pure python (c extension alreay has it) + * Added DescriptorPool.FindMethodByName() method in pure python (c extension already has it) * Flipped proto3 to preserve unknown fields by default. * Added support for memoryview in python3 proto message parsing. * Added MergeFrom for repeated scalar fields in c extension (pure python already has it) @@ -462,7 +1284,7 @@ PHP * Fixed memory leak in C-extension implementation. * Added discardUnknokwnFields API. - * Removed duplicatd typedef in C-extension headers. + * Removed duplicated typedef in C-extension headers. * Avoided calling private php methods (timelib_update_ts). * Fixed Any.php to use fully-qualified name for DescriptorPool. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/CONTRIBUTORS.txt b/cdk/extra/protobuf/protobuf-3.19.6/CONTRIBUTORS.txt similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/CONTRIBUTORS.txt rename to cdk/extra/protobuf/protobuf-3.19.6/CONTRIBUTORS.txt diff --git a/cdk/extra/protobuf/protobuf-3.11.4/LICENSE b/cdk/extra/protobuf/protobuf-3.19.6/LICENSE similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/LICENSE rename to cdk/extra/protobuf/protobuf-3.19.6/LICENSE diff --git a/cdk/extra/protobuf/protobuf-3.11.4/Makefile.am b/cdk/extra/protobuf/protobuf-3.19.6/Makefile.am similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/Makefile.am rename to cdk/extra/protobuf/protobuf-3.19.6/Makefile.am index cca346e9c..41d4061a9 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/Makefile.am +++ b/cdk/extra/protobuf/protobuf-3.19.6/Makefile.am @@ -78,6 +78,7 @@ csharp_EXTRA_DIST= \ csharp/protos/unittest_import.proto \ csharp/protos/unittest_issues.proto \ csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_selfreferential_options.proto \ csharp/protos/unittest.proto \ csharp/src/AddressBook/AddPerson.cs \ csharp/src/AddressBook/Addressbook.cs \ @@ -85,20 +86,25 @@ csharp_EXTRA_DIST= \ csharp/src/AddressBook/ListPeople.cs \ csharp/src/AddressBook/Program.cs \ csharp/src/AddressBook/SampleUsage.cs \ + csharp/src/Google.Protobuf.Benchmarks/BenchmarkDatasetConfig.cs \ csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs \ csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs \ + csharp/src/Google.Protobuf.Benchmarks/ByteStringBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj \ + csharp/src/Google.Protobuf.Benchmarks/GoogleMessageBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/ParseRawPrimitivesBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/Program.cs \ - csharp/src/Google.Protobuf.Benchmarks/SerializationBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/SerializationConfig.cs \ csharp/src/Google.Protobuf.Benchmarks/wrapper_benchmark_messages.proto \ - csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs \ + csharp/src/Google.Protobuf.Benchmarks/WriteMessagesBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/WriteRawPrimitivesBenchmark.cs \ csharp/src/Google.Protobuf.Conformance/Conformance.cs \ csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \ csharp/src/Google.Protobuf.Conformance/Program.cs \ csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \ csharp/src/Google.Protobuf.JsonDump/Program.cs \ + csharp/src/Google.Protobuf.Test/Buffers/ArrayBufferWriter.cs \ csharp/src/Google.Protobuf.Test/ByteStringTest.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ @@ -121,6 +127,11 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \ csharp/src/Google.Protobuf.Test/JsonParserTest.cs \ csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \ + csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs \ + csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs \ + csharp/src/Google.Protobuf.Test/Proto3OptionalTest.cs \ + csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs \ + csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \ @@ -147,6 +158,8 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs \ csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \ @@ -159,6 +172,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.sln \ csharp/src/Google.Protobuf/ByteArray.cs \ csharp/src/Google.Protobuf/ByteString.cs \ + csharp/src/Google.Protobuf/ByteStringAsync.cs \ csharp/src/Google.Protobuf/CodedInputStream.cs \ csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs \ csharp/src/Google.Protobuf/CodedOutputStream.cs \ @@ -179,6 +193,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/FieldMaskTree.cs \ csharp/src/Google.Protobuf/FrameworkPortability.cs \ csharp/src/Google.Protobuf/Google.Protobuf.csproj \ + csharp/src/Google.Protobuf/IBufferMessage.cs \ csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs \ csharp/src/Google.Protobuf/IDeepCloneable.cs \ csharp/src/Google.Protobuf/IExtendableMessage.cs \ @@ -193,7 +208,13 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/MessageExtensions.cs \ csharp/src/Google.Protobuf/MessageParser.cs \ csharp/src/Google.Protobuf/ObjectIntPair.cs \ + csharp/src/Google.Protobuf/ParseContext.cs \ + csharp/src/Google.Protobuf/ParserInternalState.cs \ + csharp/src/Google.Protobuf/ParsingPrimitives.cs \ + csharp/src/Google.Protobuf/ParsingPrimitivesMessages.cs \ + csharp/src/Google.Protobuf/ParsingPrimitivesWrappers.cs \ csharp/src/Google.Protobuf/ProtoPreconditions.cs \ + csharp/src/Google.Protobuf/SegmentedBufferHelper.cs \ csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs \ csharp/src/Google.Protobuf/Reflection/CustomOptions.cs \ csharp/src/Google.Protobuf/Reflection/Descriptor.cs \ @@ -243,15 +264,23 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ csharp/src/Google.Protobuf/WireFormat.cs \ + csharp/src/Google.Protobuf/WritingPrimitivesMessages.cs \ + csharp/src/Google.Protobuf/WritingPrimitives.cs \ + csharp/src/Google.Protobuf/WriterInternalState.cs \ + csharp/src/Google.Protobuf/WriteContext.cs \ + csharp/src/Google.Protobuf/WriteBufferHelper.cs \ csharp/src/Google.Protobuf/UnknownField.cs \ - csharp/src/Google.Protobuf/UnknownFieldSet.cs + csharp/src/Google.Protobuf/UnknownFieldSet.cs \ + csharp/src/Google.Protobuf/UnsafeByteOperations.cs java_EXTRA_DIST= \ java/README.md \ java/bom/pom.xml \ + java/core/BUILD \ java/core/generate-sources-build.xml \ java/core/generate-test-sources-build.xml \ java/core/pom.xml \ + java/core/pom_template.xml \ java/core/src/main/java/com/google/protobuf/AbstractMessage.java \ java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \ java/core/src/main/java/com/google/protobuf/AbstractParser.java \ @@ -268,6 +297,8 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java \ java/core/src/main/java/com/google/protobuf/ByteOutput.java \ java/core/src/main/java/com/google/protobuf/ByteString.java \ + java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java \ + java/core/src/main/java/com/google/protobuf/CheckReturnValue.java \ java/core/src/main/java/com/google/protobuf/CodedInputStream.java \ java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java \ java/core/src/main/java/com/google/protobuf/CodedOutputStream.java \ @@ -462,6 +493,7 @@ java_EXTRA_DIST= java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java \ java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java \ java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java \ + java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java \ java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java \ java/core/src/test/java/com/google/protobuf/Utf8Test.java \ java/core/src/test/java/com/google/protobuf/Utf8Utils.java \ @@ -501,35 +533,72 @@ java_EXTRA_DIST= java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto \ java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \ java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \ - java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto \ java/core/src/test/proto/com/google/protobuf/wrappers_test.proto \ + java/internal/BUILD \ + java/internal/testing.bzl \ + java/kotlin/generate-sources-build.xml \ + java/kotlin/generate-test-sources-build.xml \ + java/kotlin/pom.xml \ + java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\ + java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\ + java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt \ + java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto \ + java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto \ + java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto \ + java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto \ + java/kotlin-lite/generate-sources-build.xml \ + java/kotlin-lite/generate-test-sources-build.xml \ + java/kotlin-lite/lite.awk \ + java/kotlin-lite/pom.xml \ + java/kotlin-lite/process-lite-sources-build.xml \ + java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt\ + java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt \ java/lite.md \ + java/lite/BUILD \ java/lite/generate-sources-build.xml \ java/lite/generate-test-sources-build.xml \ java/lite/lite.awk \ java/lite/pom.xml \ + java/lite/pom_template.xml \ java/lite/process-lite-sources-build.xml \ java/lite/src/test/java/com/google/protobuf/LiteTest.java \ java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \ + java/BUILD \ java/pom.xml \ + java/util/BUILD \ java/util/pom.xml \ + java/util/pom_template.xml \ java/util/src/main/java/com/google/protobuf/util/Durations.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \ java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \ - java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \ java/util/src/main/java/com/google/protobuf/util/Structs.java \ java/util/src/main/java/com/google/protobuf/util/Timestamps.java \ java/util/src/main/java/com/google/protobuf/util/Values.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \ java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \ - java/util/src/test/java/com/google/protobuf/util/StructsTest.java \ - java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \ + java/util/src/test/java/com/google/protobuf/util/StructsTest.java \ java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \ java/util/src/test/proto/com/google/protobuf/util/json_test.proto objectivec_EXTRA_DIST= \ + objectivec/.clang-format \ + objectivec/BUILD \ objectivec/DevTools/check_version_stamps.sh \ objectivec/DevTools/compile_testing_protos.sh \ objectivec/DevTools/full_mac_build.sh \ @@ -537,25 +606,19 @@ objectivec_EXTRA_DIST= \ objectivec/DevTools/pddm_tests.py \ objectivec/generate_well_known_types.sh \ objectivec/google/protobuf/Any.pbobjc.h \ - objectivec/google/protobuf/Any.pbobjc.m \ objectivec/google/protobuf/Api.pbobjc.h \ - objectivec/google/protobuf/Api.pbobjc.m \ objectivec/google/protobuf/Duration.pbobjc.h \ - objectivec/google/protobuf/Duration.pbobjc.m \ objectivec/google/protobuf/Empty.pbobjc.h \ - objectivec/google/protobuf/Empty.pbobjc.m \ objectivec/google/protobuf/FieldMask.pbobjc.h \ - objectivec/google/protobuf/FieldMask.pbobjc.m \ objectivec/google/protobuf/SourceContext.pbobjc.h \ - objectivec/google/protobuf/SourceContext.pbobjc.m \ objectivec/google/protobuf/Struct.pbobjc.h \ - objectivec/google/protobuf/Struct.pbobjc.m \ objectivec/google/protobuf/Timestamp.pbobjc.h \ - objectivec/google/protobuf/Timestamp.pbobjc.m \ objectivec/google/protobuf/Type.pbobjc.h \ - objectivec/google/protobuf/Type.pbobjc.m \ objectivec/google/protobuf/Wrappers.pbobjc.h \ - objectivec/google/protobuf/Wrappers.pbobjc.m \ + objectivec/GPBAny.pbobjc.h \ + objectivec/GPBAny.pbobjc.m \ + objectivec/GPBApi.pbobjc.h \ + objectivec/GPBApi.pbobjc.m \ objectivec/GPBArray.h \ objectivec/GPBArray.m \ objectivec/GPBArray_PackagePrivate.h \ @@ -572,10 +635,16 @@ objectivec_EXTRA_DIST= \ objectivec/GPBDictionary.h \ objectivec/GPBDictionary.m \ objectivec/GPBDictionary_PackagePrivate.h \ + objectivec/GPBDuration.pbobjc.h \ + objectivec/GPBDuration.pbobjc.m \ + objectivec/GPBEmpty.pbobjc.h \ + objectivec/GPBEmpty.pbobjc.m \ objectivec/GPBExtensionInternals.h \ objectivec/GPBExtensionInternals.m \ objectivec/GPBExtensionRegistry.h \ objectivec/GPBExtensionRegistry.m \ + objectivec/GPBFieldMask.pbobjc.h \ + objectivec/GPBFieldMask.pbobjc.m \ objectivec/GPBMessage.h \ objectivec/GPBMessage.m \ objectivec/GPBMessage_PackagePrivate.h \ @@ -586,6 +655,14 @@ objectivec_EXTRA_DIST= \ objectivec/GPBRootObject.m \ objectivec/GPBRootObject_PackagePrivate.h \ objectivec/GPBRuntimeTypes.h \ + objectivec/GPBSourceContext.pbobjc.h \ + objectivec/GPBSourceContext.pbobjc.m \ + objectivec/GPBStruct.pbobjc.h \ + objectivec/GPBStruct.pbobjc.m \ + objectivec/GPBTimestamp.pbobjc.h \ + objectivec/GPBTimestamp.pbobjc.m \ + objectivec/GPBType.pbobjc.h \ + objectivec/GPBType.pbobjc.m \ objectivec/GPBUnknownField.h \ objectivec/GPBUnknownField.m \ objectivec/GPBUnknownField_PackagePrivate.h \ @@ -599,6 +676,8 @@ objectivec_EXTRA_DIST= \ objectivec/GPBWellKnownTypes.m \ objectivec/GPBWireFormat.h \ objectivec/GPBWireFormat.m \ + objectivec/GPBWrappers.pbobjc.h \ + objectivec/GPBWrappers.pbobjc.m \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ @@ -687,6 +766,7 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/GPBDictionaryTests.m \ objectivec/Tests/GPBDictionaryTests.pddm \ objectivec/Tests/GPBExtensionRegistryTest.m \ + objectivec/Tests/GPBMessageTests+ClassNames.m \ objectivec/Tests/GPBMessageTests+Merge.m \ objectivec/Tests/GPBMessageTests+Runtime.m \ objectivec/Tests/GPBMessageTests+Serialization.m \ @@ -727,25 +807,31 @@ objectivec_EXTRA_DIST= \ php_EXTRA_DIST= \ composer.json \ php/README.md \ + php/REFCOUNTING.md \ php/composer.json \ + php/ext/google/protobuf/arena.c \ + php/ext/google/protobuf/arena.h \ php/ext/google/protobuf/array.c \ - php/ext/google/protobuf/builtin_descriptors.inc \ + php/ext/google/protobuf/array.h \ php/ext/google/protobuf/config.m4 \ + php/ext/google/protobuf/convert.c \ + php/ext/google/protobuf/convert.h \ php/ext/google/protobuf/def.c \ - php/ext/google/protobuf/encode_decode.c \ + php/ext/google/protobuf/def.h \ php/ext/google/protobuf/map.c \ + php/ext/google/protobuf/map.h \ php/ext/google/protobuf/message.c \ + php/ext/google/protobuf/message.h \ + php/ext/google/protobuf/names.c \ + php/ext/google/protobuf/names.h \ php/ext/google/protobuf/package.xml \ + php/ext/google/protobuf/php-upb.c \ + php/ext/google/protobuf/php-upb.h \ php/ext/google/protobuf/protobuf.c \ php/ext/google/protobuf/protobuf.h \ - php/ext/google/protobuf/storage.c \ - php/ext/google/protobuf/type_check.c \ - php/ext/google/protobuf/upb.c \ - php/ext/google/protobuf/upb.h \ - php/ext/google/protobuf/utf8.c \ - php/ext/google/protobuf/utf8.h \ + php/ext/google/protobuf/wkt.inc \ php/generate_descriptor_protos.sh \ - php/phpunit.xml \ + php/generate_test_protos.sh \ php/release.sh \ php/src/GPBMetadata/Google/Protobuf/Any.php \ php/src/GPBMetadata/Google/Protobuf/Api.php \ @@ -781,6 +867,7 @@ php_EXTRA_DIST= \ php/src/Google/Protobuf/GPBEmpty.php \ php/src/Google/Protobuf/Int32Value.php \ php/src/Google/Protobuf/Int64Value.php \ + php/src/Google/Protobuf/Internal/AnyBase.php \ php/src/Google/Protobuf/Internal/CodedInputStream.php \ php/src/Google/Protobuf/Internal/CodedOutputStream.php \ php/src/Google/Protobuf/Internal/Descriptor.php \ @@ -840,6 +927,7 @@ php_EXTRA_DIST= \ php/src/Google/Protobuf/Internal/ServiceOptions.php \ php/src/Google/Protobuf/Internal/SourceCodeInfo.php \ php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php \ + php/src/Google/Protobuf/Internal/TimestampBase.php \ php/src/Google/Protobuf/Internal/UninterpretedOption.php \ php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php \ php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \ @@ -870,22 +958,22 @@ php_EXTRA_DIST= \ php/src/Google/Protobuf/UInt64Value.php \ php/src/Google/Protobuf/Value.php \ php/src/phpdoc.dist.xml \ - php/tests/array_test.php \ - php/tests/autoload.php \ - php/tests/bootstrap_phpunit.php \ + php/tests/ArrayTest.php \ php/tests/compatibility_test.sh \ php/tests/compile_extension.sh \ - php/tests/descriptors_test.php \ - php/tests/encode_decode_test.php \ + php/tests/DescriptorsTest.php \ + php/tests/EncodeDecodeTest.php \ + php/tests/force_c_ext.php \ php/tests/gdb_test.sh \ - php/tests/generated_class_test.php \ - php/tests/generated_phpdoc_test.php \ - php/tests/generated_service_test.php \ - php/tests/map_field_test.php \ + php/tests/GeneratedClassTest.php \ + php/tests/GeneratedPhpdocTest.php \ + php/tests/GeneratedServiceTest.php \ + php/tests/MapFieldTest.php \ php/tests/memory_leak_test.php \ + php/tests/memory_leak_test.sh \ php/tests/multirequest.php \ php/tests/multirequest.sh \ - php/tests/php_implementation_test.php \ + php/tests/PhpImplementationTest.php \ php/tests/proto/empty/echo.proto \ php/tests/proto/test.proto \ php/tests/proto/test_descriptors.proto \ @@ -904,12 +992,11 @@ php_EXTRA_DIST= \ php/tests/proto/test_service.proto \ php/tests/proto/test_service_namespace.proto \ php/tests/proto/test_wrapper_type_setters.proto \ - php/tests/test.sh \ php/tests/test_base.php \ php/tests/test_util.php \ - php/tests/undefined_test.php \ - php/tests/well_known_test.php \ - php/tests/wrapper_type_setters_test.php + php/tests/valgrind.supp \ + php/tests/WellKnownTest.php \ + php/tests/WrapperTypeSettersTest.php python_EXTRA_DIST= \ python/MANIFEST.in \ @@ -961,6 +1048,7 @@ python_EXTRA_DIST= \ python/google/protobuf/internal/service_reflection_test.py \ python/google/protobuf/internal/symbol_database_test.py \ python/google/protobuf/internal/test_bad_identifiers.proto \ + python/google/protobuf/internal/test_proto3_optional.proto \ python/google/protobuf/internal/test_util.py \ python/google/protobuf/internal/testing_refleaks.py \ python/google/protobuf/internal/text_encoding_test.py \ @@ -976,7 +1064,6 @@ python_EXTRA_DIST= \ python/google/protobuf/json_format.py \ python/google/protobuf/message.py \ python/google/protobuf/message_factory.py \ - python/google/protobuf/python_protobuf.h \ python/google/protobuf/proto_api.h \ python/google/protobuf/proto_builder.py \ python/google/protobuf/pyext/README \ @@ -1011,6 +1098,7 @@ python_EXTRA_DIST= \ python/google/protobuf/pyext/repeated_scalar_container.h \ python/google/protobuf/pyext/safe_numerics.h \ python/google/protobuf/pyext/scoped_pyobject_ptr.h \ + python/google/protobuf/python_protobuf.h \ python/google/protobuf/reflection.py \ python/google/protobuf/service.py \ python/google/protobuf/service_reflection.py \ @@ -1040,35 +1128,37 @@ ruby_EXTRA_DIST= \ ruby/compatibility_tests/v3.0.0/test.sh \ ruby/compatibility_tests/v3.0.0/Rakefile \ ruby/compatibility_tests/v3.0.0/README.md \ + ruby/ext/google/protobuf_c/convert.c \ + ruby/ext/google/protobuf_c/convert.h \ ruby/ext/google/protobuf_c/defs.c \ - ruby/ext/google/protobuf_c/encode_decode.c \ + ruby/ext/google/protobuf_c/defs.h \ ruby/ext/google/protobuf_c/extconf.rb \ ruby/ext/google/protobuf_c/map.c \ + ruby/ext/google/protobuf_c/map.h \ ruby/ext/google/protobuf_c/message.c \ + ruby/ext/google/protobuf_c/message.h \ ruby/ext/google/protobuf_c/protobuf.c \ ruby/ext/google/protobuf_c/protobuf.h \ ruby/ext/google/protobuf_c/repeated_field.c \ - ruby/ext/google/protobuf_c/storage.c \ - ruby/ext/google/protobuf_c/upb.c \ - ruby/ext/google/protobuf_c/upb.h \ + ruby/ext/google/protobuf_c/repeated_field.h \ + ruby/ext/google/protobuf_c/ruby-upb.c \ + ruby/ext/google/protobuf_c/ruby-upb.h \ ruby/ext/google/protobuf_c/wrap_memcpy.c \ ruby/google-protobuf.gemspec \ + ruby/lib/google/protobuf/descriptor_dsl.rb \ ruby/lib/google/protobuf/message_exts.rb \ ruby/lib/google/protobuf/repeated_field.rb \ ruby/lib/google/protobuf/well_known_types.rb \ ruby/lib/google/protobuf.rb \ ruby/pom.xml \ - ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java \ + ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java \ + ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java \ @@ -1088,6 +1178,8 @@ ruby_EXTRA_DIST= \ ruby/tests/generated_code_proto2_test.rb \ ruby/tests/generated_code_proto2.proto \ ruby/tests/generated_code.proto \ + ruby/tests/multi_level_nesting_test.proto \ + ruby/tests/multi_level_nesting_test.rb \ ruby/tests/test_import_proto2.proto \ ruby/tests/test_import.proto \ ruby/tests/test_ruby_package_proto2.proto \ @@ -1175,6 +1267,10 @@ js_EXTRA_DIST= \ js/data.proto \ js/debug.js \ js/debug_test.js \ + js/experimental/runtime/kernel/message_set.js \ + js/experimental/runtime/kernel/message_set_test.js \ + js/experimental/runtime/kernel/tag.js \ + js/experimental/runtime/kernel/tag_test.js \ js/gulpfile.js \ js/jasmine.json \ js/map.js \ @@ -1200,7 +1296,79 @@ js_EXTRA_DIST= \ js/test15.proto \ js/test_bootstrap.js \ js/testbinary.proto \ - js/testempty.proto + js/testempty.proto \ + js/testlargenumbers.proto \ + js/experimental/runtime/testing/jasmine_protobuf.js \ + js/experimental/runtime/testing/ensure_custom_equality_test.js \ + js/experimental/runtime/testing/binary/test_message.js \ + js/experimental/runtime/kernel/writer_test.js \ + js/experimental/runtime/kernel/writer.js \ + js/experimental/runtime/kernel/wire_type.js \ + js/experimental/runtime/kernel/uint8arrays_test.js \ + js/experimental/runtime/kernel/uint8arrays.js \ + js/experimental/runtime/kernel/uint32_test_pairs.js \ + js/experimental/runtime/kernel/typed_arrays_test.js \ + js/experimental/runtime/kernel/typed_arrays.js \ + js/experimental/runtime/kernel/textencoding_test.js \ + js/experimental/runtime/kernel/textencoding.js \ + js/experimental/runtime/kernel/storage.js \ + js/experimental/runtime/kernel/sint64_test_pairs.js \ + js/experimental/runtime/kernel/sint32_test_pairs.js \ + js/experimental/runtime/kernel/sfixed64_test_pairs.js \ + js/experimental/runtime/kernel/sfixed32_test_pairs.js \ + js/experimental/runtime/kernel/reader_test.js \ + js/experimental/runtime/kernel/reader.js \ + js/experimental/runtime/kernel/packed_uint32_test_pairs.js \ + js/experimental/runtime/kernel/packed_sint64_test_pairs.js \ + js/experimental/runtime/kernel/packed_sint32_test_pairs.js \ + js/experimental/runtime/kernel/packed_sfixed64_test_pairs.js \ + js/experimental/runtime/kernel/packed_sfixed32_test_pairs.js \ + js/experimental/runtime/kernel/packed_int64_test_pairs.js \ + js/experimental/runtime/kernel/packed_int32_test_pairs.js \ + js/experimental/runtime/kernel/packed_float_test_pairs.js \ + js/experimental/runtime/kernel/packed_fixed32_test_pairs.js \ + js/experimental/runtime/kernel/packed_double_test_pairs.js \ + js/experimental/runtime/kernel/packed_bool_test_pairs.js \ + js/experimental/runtime/kernel/kernel_test.js \ + js/experimental/runtime/kernel/kernel_repeated_test.js \ + js/experimental/runtime/kernel/kernel_compatibility_test.js \ + js/experimental/runtime/kernel/kernel.js \ + js/experimental/runtime/kernel/internal_message.js \ + js/experimental/runtime/kernel/int64_test_pairs.js \ + js/experimental/runtime/kernel/int32_test_pairs.js \ + js/experimental/runtime/kernel/indexer_test.js \ + js/experimental/runtime/kernel/indexer.js \ + js/experimental/runtime/kernel/float_test_pairs.js \ + js/experimental/runtime/kernel/fixed32_test_pairs.js \ + js/experimental/runtime/kernel/field.js \ + js/experimental/runtime/kernel/double_test_pairs.js \ + js/experimental/runtime/kernel/conformance/wire_format.js \ + js/experimental/runtime/kernel/conformance/test_all_types_proto3.js \ + js/experimental/runtime/kernel/conformance/test_all_types_proto2.js \ + js/experimental/runtime/kernel/conformance/conformance_testee_runner_node.js \ + js/experimental/runtime/kernel/conformance/conformance_testee.js \ + js/experimental/runtime/kernel/conformance/conformance_response.js \ + js/experimental/runtime/kernel/conformance/conformance_request.js \ + js/experimental/runtime/kernel/buffer_decoder_test.js \ + js/experimental/runtime/kernel/buffer_decoder_helper.js \ + js/experimental/runtime/kernel/buffer_decoder.js \ + js/experimental/runtime/kernel/bool_test_pairs.js \ + js/experimental/runtime/kernel/binary_storage_test.js \ + js/experimental/runtime/kernel/binary_storage.js \ + js/experimental/runtime/internal/checks_test.js \ + js/experimental/runtime/internal/checks.js \ + js/experimental/runtime/int64_test.js \ + js/experimental/runtime/int64.js \ + js/experimental/runtime/bytestring_test.js \ + js/experimental/runtime/bytestring_internal.js \ + js/experimental/runtime/bytestring.js \ + js/experimental/benchmarks/code_size/kernel/popular_types.js \ + js/experimental/benchmarks/code_size/kernel/all_types.js \ + js/experimental/benchmarks/code_size/code_size_base.js \ + js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto3.js \ + js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto2.js \ + js/experimental/benchmarks/code_size/apps_jspb/all_types_proto3.js \ + js/experimental/benchmarks/code_size/apps_jspb/all_types_proto2.js all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST) @@ -1216,7 +1384,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ WORKSPACE \ cmake/CMakeLists.txt \ cmake/README.md \ - cmake/conformance.cmake \ + cmake/conformance.cmake \ cmake/examples.cmake \ cmake/extract_includes.bat.in \ cmake/install.cmake \ @@ -1233,6 +1401,8 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ cmake/tests.cmake \ cmake/version.rc.in \ compiler_config_setting.bzl \ + build_files_updated_unittest.sh \ + cc_proto_blacklist_test.bzl \ editors/README.txt \ editors/proto.vim \ editors/protobuf-mode.el \ @@ -1255,15 +1425,13 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ examples/list_people.py \ examples/list_people_test.go \ examples/pubspec.yaml \ + maven_install.json \ protobuf.bzl \ protobuf_deps.bzl \ - python/release/wheel/build_wheel_manylinux.sh \ - python/release/wheel/Dockerfile \ - python/release/wheel/protobuf_optimized_pip.sh \ - python/release/wheel/README.md \ - third_party/six.BUILD \ + protobuf_version.bzl \ third_party/zlib.BUILD \ - util/python/BUILD + util/python/BUILD \ + internal.bzl # Deletes all the files generated by autogen.sh. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/Makefile.in b/cdk/extra/protobuf/protobuf-3.19.6/Makefile.in similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/Makefile.in rename to cdk/extra/protobuf/protobuf-3.19.6/Makefile.in index 346845789..b469edee1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/Makefile.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -174,8 +174,8 @@ am__recursive_targets = \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -192,12 +192,10 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/protobuf-lite.pc.in $(srcdir)/protobuf.pc.in ar-lib \ - compile config.guess config.sub install-sh ltmain.sh missing + $(srcdir)/protobuf-lite.pc.in $(srcdir)/protobuf.pc.in \ + README.md ar-lib compile config.guess config.sub install-sh \ + ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -236,6 +234,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -259,6 +259,8 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXCPPFLAGS_FOR_BUILD = @CXXCPPFLAGS_FOR_BUILD@ @@ -278,6 +280,7 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ @@ -292,6 +295,7 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ LIBATOMIC_LIBS = @LIBATOMIC_LIBS@ +LIBLOG_LIBS = @LIBLOG_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -436,6 +440,7 @@ csharp_EXTRA_DIST = \ csharp/protos/unittest_import.proto \ csharp/protos/unittest_issues.proto \ csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_selfreferential_options.proto \ csharp/protos/unittest.proto \ csharp/src/AddressBook/AddPerson.cs \ csharp/src/AddressBook/Addressbook.cs \ @@ -443,20 +448,25 @@ csharp_EXTRA_DIST = \ csharp/src/AddressBook/ListPeople.cs \ csharp/src/AddressBook/Program.cs \ csharp/src/AddressBook/SampleUsage.cs \ + csharp/src/Google.Protobuf.Benchmarks/BenchmarkDatasetConfig.cs \ csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs \ csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs \ + csharp/src/Google.Protobuf.Benchmarks/ByteStringBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj \ + csharp/src/Google.Protobuf.Benchmarks/GoogleMessageBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/ParseRawPrimitivesBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/Program.cs \ - csharp/src/Google.Protobuf.Benchmarks/SerializationBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/SerializationConfig.cs \ csharp/src/Google.Protobuf.Benchmarks/wrapper_benchmark_messages.proto \ - csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmark.cs \ csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs \ + csharp/src/Google.Protobuf.Benchmarks/WriteMessagesBenchmark.cs \ + csharp/src/Google.Protobuf.Benchmarks/WriteRawPrimitivesBenchmark.cs \ csharp/src/Google.Protobuf.Conformance/Conformance.cs \ csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \ csharp/src/Google.Protobuf.Conformance/Program.cs \ csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \ csharp/src/Google.Protobuf.JsonDump/Program.cs \ + csharp/src/Google.Protobuf.Test/Buffers/ArrayBufferWriter.cs \ csharp/src/Google.Protobuf.Test/ByteStringTest.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ @@ -479,6 +489,11 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \ csharp/src/Google.Protobuf.Test/JsonParserTest.cs \ csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \ + csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs \ + csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs \ + csharp/src/Google.Protobuf.Test/Proto3OptionalTest.cs \ + csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs \ + csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \ @@ -505,6 +520,8 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs \ csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs \ csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \ @@ -517,6 +534,7 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf.sln \ csharp/src/Google.Protobuf/ByteArray.cs \ csharp/src/Google.Protobuf/ByteString.cs \ + csharp/src/Google.Protobuf/ByteStringAsync.cs \ csharp/src/Google.Protobuf/CodedInputStream.cs \ csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs \ csharp/src/Google.Protobuf/CodedOutputStream.cs \ @@ -537,6 +555,7 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf/FieldMaskTree.cs \ csharp/src/Google.Protobuf/FrameworkPortability.cs \ csharp/src/Google.Protobuf/Google.Protobuf.csproj \ + csharp/src/Google.Protobuf/IBufferMessage.cs \ csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs \ csharp/src/Google.Protobuf/IDeepCloneable.cs \ csharp/src/Google.Protobuf/IExtendableMessage.cs \ @@ -551,7 +570,13 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf/MessageExtensions.cs \ csharp/src/Google.Protobuf/MessageParser.cs \ csharp/src/Google.Protobuf/ObjectIntPair.cs \ + csharp/src/Google.Protobuf/ParseContext.cs \ + csharp/src/Google.Protobuf/ParserInternalState.cs \ + csharp/src/Google.Protobuf/ParsingPrimitives.cs \ + csharp/src/Google.Protobuf/ParsingPrimitivesMessages.cs \ + csharp/src/Google.Protobuf/ParsingPrimitivesWrappers.cs \ csharp/src/Google.Protobuf/ProtoPreconditions.cs \ + csharp/src/Google.Protobuf/SegmentedBufferHelper.cs \ csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs \ csharp/src/Google.Protobuf/Reflection/CustomOptions.cs \ csharp/src/Google.Protobuf/Reflection/Descriptor.cs \ @@ -601,15 +626,23 @@ csharp_EXTRA_DIST = \ csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ csharp/src/Google.Protobuf/WireFormat.cs \ + csharp/src/Google.Protobuf/WritingPrimitivesMessages.cs \ + csharp/src/Google.Protobuf/WritingPrimitives.cs \ + csharp/src/Google.Protobuf/WriterInternalState.cs \ + csharp/src/Google.Protobuf/WriteContext.cs \ + csharp/src/Google.Protobuf/WriteBufferHelper.cs \ csharp/src/Google.Protobuf/UnknownField.cs \ - csharp/src/Google.Protobuf/UnknownFieldSet.cs + csharp/src/Google.Protobuf/UnknownFieldSet.cs \ + csharp/src/Google.Protobuf/UnsafeByteOperations.cs java_EXTRA_DIST = \ java/README.md \ java/bom/pom.xml \ + java/core/BUILD \ java/core/generate-sources-build.xml \ java/core/generate-test-sources-build.xml \ java/core/pom.xml \ + java/core/pom_template.xml \ java/core/src/main/java/com/google/protobuf/AbstractMessage.java \ java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \ java/core/src/main/java/com/google/protobuf/AbstractParser.java \ @@ -626,6 +659,8 @@ java_EXTRA_DIST = \ java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java \ java/core/src/main/java/com/google/protobuf/ByteOutput.java \ java/core/src/main/java/com/google/protobuf/ByteString.java \ + java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java \ + java/core/src/main/java/com/google/protobuf/CheckReturnValue.java \ java/core/src/main/java/com/google/protobuf/CodedInputStream.java \ java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java \ java/core/src/main/java/com/google/protobuf/CodedOutputStream.java \ @@ -820,6 +855,7 @@ java_EXTRA_DIST = \ java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java \ java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java \ java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java \ + java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java \ java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java \ java/core/src/test/java/com/google/protobuf/Utf8Test.java \ java/core/src/test/java/com/google/protobuf/Utf8Utils.java \ @@ -859,35 +895,72 @@ java_EXTRA_DIST = \ java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto \ java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \ java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \ - java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto \ java/core/src/test/proto/com/google/protobuf/wrappers_test.proto \ + java/internal/BUILD \ + java/internal/testing.bzl \ + java/kotlin/generate-sources-build.xml \ + java/kotlin/generate-test-sources-build.xml \ + java/kotlin/pom.xml \ + java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\ + java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\ + java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \ + java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\ + java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt \ + java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt \ + java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto \ + java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto \ + java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto \ + java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto \ + java/kotlin-lite/generate-sources-build.xml \ + java/kotlin-lite/generate-test-sources-build.xml \ + java/kotlin-lite/lite.awk \ + java/kotlin-lite/pom.xml \ + java/kotlin-lite/process-lite-sources-build.xml \ + java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt\ + java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt \ java/lite.md \ + java/lite/BUILD \ java/lite/generate-sources-build.xml \ java/lite/generate-test-sources-build.xml \ java/lite/lite.awk \ java/lite/pom.xml \ + java/lite/pom_template.xml \ java/lite/process-lite-sources-build.xml \ java/lite/src/test/java/com/google/protobuf/LiteTest.java \ java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \ + java/BUILD \ java/pom.xml \ + java/util/BUILD \ java/util/pom.xml \ + java/util/pom_template.xml \ java/util/src/main/java/com/google/protobuf/util/Durations.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \ java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \ - java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \ java/util/src/main/java/com/google/protobuf/util/Structs.java \ java/util/src/main/java/com/google/protobuf/util/Timestamps.java \ java/util/src/main/java/com/google/protobuf/util/Values.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \ java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \ - java/util/src/test/java/com/google/protobuf/util/StructsTest.java \ - java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \ + java/util/src/test/java/com/google/protobuf/util/StructsTest.java \ java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \ java/util/src/test/proto/com/google/protobuf/util/json_test.proto objectivec_EXTRA_DIST = \ + objectivec/.clang-format \ + objectivec/BUILD \ objectivec/DevTools/check_version_stamps.sh \ objectivec/DevTools/compile_testing_protos.sh \ objectivec/DevTools/full_mac_build.sh \ @@ -895,25 +968,19 @@ objectivec_EXTRA_DIST = \ objectivec/DevTools/pddm_tests.py \ objectivec/generate_well_known_types.sh \ objectivec/google/protobuf/Any.pbobjc.h \ - objectivec/google/protobuf/Any.pbobjc.m \ objectivec/google/protobuf/Api.pbobjc.h \ - objectivec/google/protobuf/Api.pbobjc.m \ objectivec/google/protobuf/Duration.pbobjc.h \ - objectivec/google/protobuf/Duration.pbobjc.m \ objectivec/google/protobuf/Empty.pbobjc.h \ - objectivec/google/protobuf/Empty.pbobjc.m \ objectivec/google/protobuf/FieldMask.pbobjc.h \ - objectivec/google/protobuf/FieldMask.pbobjc.m \ objectivec/google/protobuf/SourceContext.pbobjc.h \ - objectivec/google/protobuf/SourceContext.pbobjc.m \ objectivec/google/protobuf/Struct.pbobjc.h \ - objectivec/google/protobuf/Struct.pbobjc.m \ objectivec/google/protobuf/Timestamp.pbobjc.h \ - objectivec/google/protobuf/Timestamp.pbobjc.m \ objectivec/google/protobuf/Type.pbobjc.h \ - objectivec/google/protobuf/Type.pbobjc.m \ objectivec/google/protobuf/Wrappers.pbobjc.h \ - objectivec/google/protobuf/Wrappers.pbobjc.m \ + objectivec/GPBAny.pbobjc.h \ + objectivec/GPBAny.pbobjc.m \ + objectivec/GPBApi.pbobjc.h \ + objectivec/GPBApi.pbobjc.m \ objectivec/GPBArray.h \ objectivec/GPBArray.m \ objectivec/GPBArray_PackagePrivate.h \ @@ -930,10 +997,16 @@ objectivec_EXTRA_DIST = \ objectivec/GPBDictionary.h \ objectivec/GPBDictionary.m \ objectivec/GPBDictionary_PackagePrivate.h \ + objectivec/GPBDuration.pbobjc.h \ + objectivec/GPBDuration.pbobjc.m \ + objectivec/GPBEmpty.pbobjc.h \ + objectivec/GPBEmpty.pbobjc.m \ objectivec/GPBExtensionInternals.h \ objectivec/GPBExtensionInternals.m \ objectivec/GPBExtensionRegistry.h \ objectivec/GPBExtensionRegistry.m \ + objectivec/GPBFieldMask.pbobjc.h \ + objectivec/GPBFieldMask.pbobjc.m \ objectivec/GPBMessage.h \ objectivec/GPBMessage.m \ objectivec/GPBMessage_PackagePrivate.h \ @@ -944,6 +1017,14 @@ objectivec_EXTRA_DIST = \ objectivec/GPBRootObject.m \ objectivec/GPBRootObject_PackagePrivate.h \ objectivec/GPBRuntimeTypes.h \ + objectivec/GPBSourceContext.pbobjc.h \ + objectivec/GPBSourceContext.pbobjc.m \ + objectivec/GPBStruct.pbobjc.h \ + objectivec/GPBStruct.pbobjc.m \ + objectivec/GPBTimestamp.pbobjc.h \ + objectivec/GPBTimestamp.pbobjc.m \ + objectivec/GPBType.pbobjc.h \ + objectivec/GPBType.pbobjc.m \ objectivec/GPBUnknownField.h \ objectivec/GPBUnknownField.m \ objectivec/GPBUnknownField_PackagePrivate.h \ @@ -957,6 +1038,8 @@ objectivec_EXTRA_DIST = \ objectivec/GPBWellKnownTypes.m \ objectivec/GPBWireFormat.h \ objectivec/GPBWireFormat.m \ + objectivec/GPBWrappers.pbobjc.h \ + objectivec/GPBWrappers.pbobjc.m \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ @@ -1045,6 +1128,7 @@ objectivec_EXTRA_DIST = \ objectivec/Tests/GPBDictionaryTests.m \ objectivec/Tests/GPBDictionaryTests.pddm \ objectivec/Tests/GPBExtensionRegistryTest.m \ + objectivec/Tests/GPBMessageTests+ClassNames.m \ objectivec/Tests/GPBMessageTests+Merge.m \ objectivec/Tests/GPBMessageTests+Runtime.m \ objectivec/Tests/GPBMessageTests+Serialization.m \ @@ -1085,25 +1169,31 @@ objectivec_EXTRA_DIST = \ php_EXTRA_DIST = \ composer.json \ php/README.md \ + php/REFCOUNTING.md \ php/composer.json \ + php/ext/google/protobuf/arena.c \ + php/ext/google/protobuf/arena.h \ php/ext/google/protobuf/array.c \ - php/ext/google/protobuf/builtin_descriptors.inc \ + php/ext/google/protobuf/array.h \ php/ext/google/protobuf/config.m4 \ + php/ext/google/protobuf/convert.c \ + php/ext/google/protobuf/convert.h \ php/ext/google/protobuf/def.c \ - php/ext/google/protobuf/encode_decode.c \ + php/ext/google/protobuf/def.h \ php/ext/google/protobuf/map.c \ + php/ext/google/protobuf/map.h \ php/ext/google/protobuf/message.c \ + php/ext/google/protobuf/message.h \ + php/ext/google/protobuf/names.c \ + php/ext/google/protobuf/names.h \ php/ext/google/protobuf/package.xml \ + php/ext/google/protobuf/php-upb.c \ + php/ext/google/protobuf/php-upb.h \ php/ext/google/protobuf/protobuf.c \ php/ext/google/protobuf/protobuf.h \ - php/ext/google/protobuf/storage.c \ - php/ext/google/protobuf/type_check.c \ - php/ext/google/protobuf/upb.c \ - php/ext/google/protobuf/upb.h \ - php/ext/google/protobuf/utf8.c \ - php/ext/google/protobuf/utf8.h \ + php/ext/google/protobuf/wkt.inc \ php/generate_descriptor_protos.sh \ - php/phpunit.xml \ + php/generate_test_protos.sh \ php/release.sh \ php/src/GPBMetadata/Google/Protobuf/Any.php \ php/src/GPBMetadata/Google/Protobuf/Api.php \ @@ -1139,6 +1229,7 @@ php_EXTRA_DIST = \ php/src/Google/Protobuf/GPBEmpty.php \ php/src/Google/Protobuf/Int32Value.php \ php/src/Google/Protobuf/Int64Value.php \ + php/src/Google/Protobuf/Internal/AnyBase.php \ php/src/Google/Protobuf/Internal/CodedInputStream.php \ php/src/Google/Protobuf/Internal/CodedOutputStream.php \ php/src/Google/Protobuf/Internal/Descriptor.php \ @@ -1198,6 +1289,7 @@ php_EXTRA_DIST = \ php/src/Google/Protobuf/Internal/ServiceOptions.php \ php/src/Google/Protobuf/Internal/SourceCodeInfo.php \ php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php \ + php/src/Google/Protobuf/Internal/TimestampBase.php \ php/src/Google/Protobuf/Internal/UninterpretedOption.php \ php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php \ php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \ @@ -1228,22 +1320,22 @@ php_EXTRA_DIST = \ php/src/Google/Protobuf/UInt64Value.php \ php/src/Google/Protobuf/Value.php \ php/src/phpdoc.dist.xml \ - php/tests/array_test.php \ - php/tests/autoload.php \ - php/tests/bootstrap_phpunit.php \ + php/tests/ArrayTest.php \ php/tests/compatibility_test.sh \ php/tests/compile_extension.sh \ - php/tests/descriptors_test.php \ - php/tests/encode_decode_test.php \ + php/tests/DescriptorsTest.php \ + php/tests/EncodeDecodeTest.php \ + php/tests/force_c_ext.php \ php/tests/gdb_test.sh \ - php/tests/generated_class_test.php \ - php/tests/generated_phpdoc_test.php \ - php/tests/generated_service_test.php \ - php/tests/map_field_test.php \ + php/tests/GeneratedClassTest.php \ + php/tests/GeneratedPhpdocTest.php \ + php/tests/GeneratedServiceTest.php \ + php/tests/MapFieldTest.php \ php/tests/memory_leak_test.php \ + php/tests/memory_leak_test.sh \ php/tests/multirequest.php \ php/tests/multirequest.sh \ - php/tests/php_implementation_test.php \ + php/tests/PhpImplementationTest.php \ php/tests/proto/empty/echo.proto \ php/tests/proto/test.proto \ php/tests/proto/test_descriptors.proto \ @@ -1262,12 +1354,11 @@ php_EXTRA_DIST = \ php/tests/proto/test_service.proto \ php/tests/proto/test_service_namespace.proto \ php/tests/proto/test_wrapper_type_setters.proto \ - php/tests/test.sh \ php/tests/test_base.php \ php/tests/test_util.php \ - php/tests/undefined_test.php \ - php/tests/well_known_test.php \ - php/tests/wrapper_type_setters_test.php + php/tests/valgrind.supp \ + php/tests/WellKnownTest.php \ + php/tests/WrapperTypeSettersTest.php python_EXTRA_DIST = \ python/MANIFEST.in \ @@ -1319,6 +1410,7 @@ python_EXTRA_DIST = \ python/google/protobuf/internal/service_reflection_test.py \ python/google/protobuf/internal/symbol_database_test.py \ python/google/protobuf/internal/test_bad_identifiers.proto \ + python/google/protobuf/internal/test_proto3_optional.proto \ python/google/protobuf/internal/test_util.py \ python/google/protobuf/internal/testing_refleaks.py \ python/google/protobuf/internal/text_encoding_test.py \ @@ -1334,7 +1426,6 @@ python_EXTRA_DIST = \ python/google/protobuf/json_format.py \ python/google/protobuf/message.py \ python/google/protobuf/message_factory.py \ - python/google/protobuf/python_protobuf.h \ python/google/protobuf/proto_api.h \ python/google/protobuf/proto_builder.py \ python/google/protobuf/pyext/README \ @@ -1369,6 +1460,7 @@ python_EXTRA_DIST = \ python/google/protobuf/pyext/repeated_scalar_container.h \ python/google/protobuf/pyext/safe_numerics.h \ python/google/protobuf/pyext/scoped_pyobject_ptr.h \ + python/google/protobuf/python_protobuf.h \ python/google/protobuf/reflection.py \ python/google/protobuf/service.py \ python/google/protobuf/service_reflection.py \ @@ -1398,35 +1490,37 @@ ruby_EXTRA_DIST = \ ruby/compatibility_tests/v3.0.0/test.sh \ ruby/compatibility_tests/v3.0.0/Rakefile \ ruby/compatibility_tests/v3.0.0/README.md \ + ruby/ext/google/protobuf_c/convert.c \ + ruby/ext/google/protobuf_c/convert.h \ ruby/ext/google/protobuf_c/defs.c \ - ruby/ext/google/protobuf_c/encode_decode.c \ + ruby/ext/google/protobuf_c/defs.h \ ruby/ext/google/protobuf_c/extconf.rb \ ruby/ext/google/protobuf_c/map.c \ + ruby/ext/google/protobuf_c/map.h \ ruby/ext/google/protobuf_c/message.c \ + ruby/ext/google/protobuf_c/message.h \ ruby/ext/google/protobuf_c/protobuf.c \ ruby/ext/google/protobuf_c/protobuf.h \ ruby/ext/google/protobuf_c/repeated_field.c \ - ruby/ext/google/protobuf_c/storage.c \ - ruby/ext/google/protobuf_c/upb.c \ - ruby/ext/google/protobuf_c/upb.h \ + ruby/ext/google/protobuf_c/repeated_field.h \ + ruby/ext/google/protobuf_c/ruby-upb.c \ + ruby/ext/google/protobuf_c/ruby-upb.h \ ruby/ext/google/protobuf_c/wrap_memcpy.c \ ruby/google-protobuf.gemspec \ + ruby/lib/google/protobuf/descriptor_dsl.rb \ ruby/lib/google/protobuf/message_exts.rb \ ruby/lib/google/protobuf/repeated_field.rb \ ruby/lib/google/protobuf/well_known_types.rb \ ruby/lib/google/protobuf.rb \ ruby/pom.xml \ - ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java \ + ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java \ + ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java \ ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java \ @@ -1446,6 +1540,8 @@ ruby_EXTRA_DIST = \ ruby/tests/generated_code_proto2_test.rb \ ruby/tests/generated_code_proto2.proto \ ruby/tests/generated_code.proto \ + ruby/tests/multi_level_nesting_test.proto \ + ruby/tests/multi_level_nesting_test.rb \ ruby/tests/test_import_proto2.proto \ ruby/tests/test_import.proto \ ruby/tests/test_ruby_package_proto2.proto \ @@ -1533,6 +1629,10 @@ js_EXTRA_DIST = \ js/data.proto \ js/debug.js \ js/debug_test.js \ + js/experimental/runtime/kernel/message_set.js \ + js/experimental/runtime/kernel/message_set_test.js \ + js/experimental/runtime/kernel/tag.js \ + js/experimental/runtime/kernel/tag_test.js \ js/gulpfile.js \ js/jasmine.json \ js/map.js \ @@ -1558,7 +1658,79 @@ js_EXTRA_DIST = \ js/test15.proto \ js/test_bootstrap.js \ js/testbinary.proto \ - js/testempty.proto + js/testempty.proto \ + js/testlargenumbers.proto \ + js/experimental/runtime/testing/jasmine_protobuf.js \ + js/experimental/runtime/testing/ensure_custom_equality_test.js \ + js/experimental/runtime/testing/binary/test_message.js \ + js/experimental/runtime/kernel/writer_test.js \ + js/experimental/runtime/kernel/writer.js \ + js/experimental/runtime/kernel/wire_type.js \ + js/experimental/runtime/kernel/uint8arrays_test.js \ + js/experimental/runtime/kernel/uint8arrays.js \ + js/experimental/runtime/kernel/uint32_test_pairs.js \ + js/experimental/runtime/kernel/typed_arrays_test.js \ + js/experimental/runtime/kernel/typed_arrays.js \ + js/experimental/runtime/kernel/textencoding_test.js \ + js/experimental/runtime/kernel/textencoding.js \ + js/experimental/runtime/kernel/storage.js \ + js/experimental/runtime/kernel/sint64_test_pairs.js \ + js/experimental/runtime/kernel/sint32_test_pairs.js \ + js/experimental/runtime/kernel/sfixed64_test_pairs.js \ + js/experimental/runtime/kernel/sfixed32_test_pairs.js \ + js/experimental/runtime/kernel/reader_test.js \ + js/experimental/runtime/kernel/reader.js \ + js/experimental/runtime/kernel/packed_uint32_test_pairs.js \ + js/experimental/runtime/kernel/packed_sint64_test_pairs.js \ + js/experimental/runtime/kernel/packed_sint32_test_pairs.js \ + js/experimental/runtime/kernel/packed_sfixed64_test_pairs.js \ + js/experimental/runtime/kernel/packed_sfixed32_test_pairs.js \ + js/experimental/runtime/kernel/packed_int64_test_pairs.js \ + js/experimental/runtime/kernel/packed_int32_test_pairs.js \ + js/experimental/runtime/kernel/packed_float_test_pairs.js \ + js/experimental/runtime/kernel/packed_fixed32_test_pairs.js \ + js/experimental/runtime/kernel/packed_double_test_pairs.js \ + js/experimental/runtime/kernel/packed_bool_test_pairs.js \ + js/experimental/runtime/kernel/kernel_test.js \ + js/experimental/runtime/kernel/kernel_repeated_test.js \ + js/experimental/runtime/kernel/kernel_compatibility_test.js \ + js/experimental/runtime/kernel/kernel.js \ + js/experimental/runtime/kernel/internal_message.js \ + js/experimental/runtime/kernel/int64_test_pairs.js \ + js/experimental/runtime/kernel/int32_test_pairs.js \ + js/experimental/runtime/kernel/indexer_test.js \ + js/experimental/runtime/kernel/indexer.js \ + js/experimental/runtime/kernel/float_test_pairs.js \ + js/experimental/runtime/kernel/fixed32_test_pairs.js \ + js/experimental/runtime/kernel/field.js \ + js/experimental/runtime/kernel/double_test_pairs.js \ + js/experimental/runtime/kernel/conformance/wire_format.js \ + js/experimental/runtime/kernel/conformance/test_all_types_proto3.js \ + js/experimental/runtime/kernel/conformance/test_all_types_proto2.js \ + js/experimental/runtime/kernel/conformance/conformance_testee_runner_node.js \ + js/experimental/runtime/kernel/conformance/conformance_testee.js \ + js/experimental/runtime/kernel/conformance/conformance_response.js \ + js/experimental/runtime/kernel/conformance/conformance_request.js \ + js/experimental/runtime/kernel/buffer_decoder_test.js \ + js/experimental/runtime/kernel/buffer_decoder_helper.js \ + js/experimental/runtime/kernel/buffer_decoder.js \ + js/experimental/runtime/kernel/bool_test_pairs.js \ + js/experimental/runtime/kernel/binary_storage_test.js \ + js/experimental/runtime/kernel/binary_storage.js \ + js/experimental/runtime/internal/checks_test.js \ + js/experimental/runtime/internal/checks.js \ + js/experimental/runtime/int64_test.js \ + js/experimental/runtime/int64.js \ + js/experimental/runtime/bytestring_test.js \ + js/experimental/runtime/bytestring_internal.js \ + js/experimental/runtime/bytestring.js \ + js/experimental/benchmarks/code_size/kernel/popular_types.js \ + js/experimental/benchmarks/code_size/kernel/all_types.js \ + js/experimental/benchmarks/code_size/code_size_base.js \ + js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto3.js \ + js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto2.js \ + js/experimental/benchmarks/code_size/apps_jspb/all_types_proto3.js \ + js/experimental/benchmarks/code_size/apps_jspb/all_types_proto2.js all_EXTRA_DIST = $(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST) EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ @@ -1573,7 +1745,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ WORKSPACE \ cmake/CMakeLists.txt \ cmake/README.md \ - cmake/conformance.cmake \ + cmake/conformance.cmake \ cmake/examples.cmake \ cmake/extract_includes.bat.in \ cmake/install.cmake \ @@ -1590,6 +1762,8 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ cmake/tests.cmake \ cmake/version.rc.in \ compiler_config_setting.bzl \ + build_files_updated_unittest.sh \ + cc_proto_blacklist_test.bzl \ editors/README.txt \ editors/proto.vim \ editors/protobuf-mode.el \ @@ -1612,15 +1786,13 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ examples/list_people.py \ examples/list_people_test.go \ examples/pubspec.yaml \ + maven_install.json \ protobuf.bzl \ protobuf_deps.bzl \ - python/release/wheel/build_wheel_manylinux.sh \ - python/release/wheel/Dockerfile \ - python/release/wheel/protobuf_optimized_pip.sh \ - python/release/wheel/README.md \ - third_party/six.BUILD \ + protobuf_version.bzl \ third_party/zlib.BUILD \ - util/python/BUILD + util/python/BUILD \ + internal.bzl # Deletes all the files generated by autogen.sh. @@ -1836,7 +2008,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -1920,6 +2091,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -1962,6 +2137,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -1977,7 +2154,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -2144,8 +2321,8 @@ uninstall-am: uninstall-pkgconfigDATA am--refresh check check-am check-local clean clean-cscope \ clean-generic clean-libtool clean-local cscope cscopelist-am \ ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \ - dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ - distclean-generic distclean-hdr distclean-libtool \ + dist-shar dist-tarZ dist-xz dist-zip dist-zstd distcheck \ + distclean distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ diff --git a/cdk/extra/protobuf/protobuf-3.19.6/README.md b/cdk/extra/protobuf/protobuf-3.19.6/README.md new file mode 100644 index 000000000..618dc2a77 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/README.md @@ -0,0 +1,85 @@ +Protocol Buffers - Google's data interchange format +=================================================== + +Copyright 2008 Google Inc. + +https://developers.google.com/protocol-buffers/ + +Overview +-------- + +Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, +platform-neutral, extensible mechanism for serializing structured data. You +can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/). + +This README file contains protobuf installation instructions. To install +protobuf, you need to install the protocol compiler (used to compile .proto +files) and the protobuf runtime for your chosen programming language. + +Protocol Compiler Installation +------------------------------ + +The protocol compiler is written in C++. If you are using C++, please follow +the [C++ Installation Instructions](src/README.md) to install protoc along +with the C++ runtime. + +For non-C++ users, the simplest way to install the protocol compiler is to +download a pre-built binary from our release page: + + [https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases) + +In the downloads section of each release, you can find pre-built binaries in +zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary +as well as a set of standard .proto files distributed along with protobuf. + +If you are looking for an old version that is not available in the release +page, check out the maven repo here: + + [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/) + +These pre-built binaries are only provided for released versions. If you want +to use the github master version at HEAD, or you need to modify protobuf code, +or you are using C++, it's recommended to build your own protoc binary from +source. + +If you would like to build protoc binary from source, see the [C++ Installation +Instructions](src/README.md). + +Protobuf Runtime Installation +----------------------------- + +Protobuf supports several different programming languages. For each programming +language, you can find instructions in the corresponding source directory about +how to install protobuf runtime for that specific language: + +| Language | Source | +|--------------------------------------|-------------------------------------------------------------| +| C++ (include C++ runtime and protoc) | [src](src) | +| Java | [java](java) | +| Python | [python](python) | +| Objective-C | [objectivec](objectivec) | +| C# | [csharp](csharp) | +| JavaScript | [js](js) | +| Ruby | [ruby](ruby) | +| Go | [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go)| +| PHP | [php](php) | +| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | + +Quick Start +----------- + +The best way to learn how to use protobuf is to follow the tutorials in our +developer guide: + +https://developers.google.com/protocol-buffers/docs/tutorials + +If you want to learn from code examples, take a look at the examples in the +[examples](examples) directory. + +Documentation +------------- + +The complete documentation for Protocol Buffers is available via the +web at: + +https://developers.google.com/protocol-buffers/ diff --git a/cdk/extra/protobuf/protobuf-3.19.6/WORKSPACE b/cdk/extra/protobuf/protobuf-3.19.6/WORKSPACE new file mode 100644 index 000000000..e500967fe --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/WORKSPACE @@ -0,0 +1,58 @@ +workspace(name = "com_google_protobuf") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +local_repository( + name = "com_google_protobuf_examples", + path = "examples", +) + +http_archive( + name = "com_google_googletest", + sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", + strip_prefix = "googletest-release-1.10.0", + urls = [ + "https://mirror.bazel.build/github.com/google/googletest/archive/release-1.10.0.tar.gz", + "https://github.com/google/googletest/archive/release-1.10.0.tar.gz", + ], +) + +http_archive( + name = "com_github_google_benchmark", + sha256 = "2a778d821997df7d8646c9c59b8edb9a573a6e04c534c01892a40aa524a7b68c", + strip_prefix = "benchmark-bf585a2789e30585b4e3ce6baf11ef2750b54677", + urls = [ + "https://github.com/google/benchmark/archive/bf585a2789e30585b4e3ce6baf11ef2750b54677.zip", + ], +) + +# Load common dependencies. +load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") +protobuf_deps() + +bind( + name = "python_headers", + actual = "//util/python:python_headers", +) + +load("@rules_jvm_external//:defs.bzl", "maven_install") + +maven_install( + artifacts = PROTOBUF_MAVEN_ARTIFACTS, + # For updating instructions, see: + # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson + maven_install_json = "//:maven_install.json", + repositories = [ + "https://repo1.maven.org/maven2", + "https://repo.maven.apache.org/maven2", + ], +) + +load("@maven//:defs.bzl", "pinned_maven_install") + +pinned_maven_install() + +# For `cc_proto_blacklist_test` and `build_test`. +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/aclocal.m4 b/cdk/extra/protobuf/protobuf-3.19.6/aclocal.m4 similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/aclocal.m4 rename to cdk/extra/protobuf/protobuf-3.19.6/aclocal.m4 index 340d3043b..6579e62e1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/aclocal.m4 +++ b/cdk/extra/protobuf/protobuf-3.19.6/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,12 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ AC_SUBST([AR])dnl # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -431,7 +431,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -458,7 +460,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -486,6 +488,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -522,7 +528,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -574,6 +580,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -655,7 +675,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -676,7 +696,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -698,7 +718,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -733,7 +753,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -776,7 +796,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -797,12 +817,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -815,7 +830,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -844,7 +859,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -891,7 +906,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -910,7 +925,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -991,7 +1006,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1051,7 +1066,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1079,7 +1094,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1098,7 +1113,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/cdk/extra/protobuf/protobuf-3.19.6/ar-lib b/cdk/extra/protobuf/protobuf-3.19.6/ar-lib new file mode 100755 index 000000000..c349042c3 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/ar-lib @@ -0,0 +1,271 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2019-07-04.01; # UTC + +# Copyright (C) 2010-2021 Free Software Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin | msys) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat <_FLAGS(_)? is meant to be user controlled. + # Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags + # making programmatic control difficult. Prefer the functionality in newer + # CMake versions when available. + if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) + else() + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. + # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx + # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd + # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F + if (MSVC AND protobuf_MSVC_STATIC_RUNTIME) + foreach(flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME) + endif() endif (protobuf_BUILD_SHARED_LIBS) -#MY_CHECK_CXX_COMPILER_WARNING("-Wunused-const-variable" HAS_WARN_FLAG) -#IF(HAS_WARN_FLAG) -# STRING_APPEND(CMAKE_CXX_FLAGS " ${HAS_WARN_FLAG}") -#ENDIF() - if (MSVC) - # Build with multiple processes - IF(NOT WIN32_CLANG) + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # Build with multiple processes add_definitions(/MP) - ENDIF() + endif() + # Set source file and execution character sets to UTF-8 + add_definitions(/utf-8) # MSVC warning suppressions add_definitions( /wd4018 # 'expression' : signed/unsigned mismatch @@ -224,18 +240,16 @@ if (MSVC) # Suppress linker warnings about files with no symbols defined. set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") - # clang-cl (the driver program for clang) does not understand these flags. - # So we skip the generation and usage of version.rc. - IF(NOT WIN32_CLANG) + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Configure Resource Compiler enable_language(RC) # use English language (0x409) in resource compiler set(rc_flags "/l0x409") # fix rc.exe invocations because of usage of add_definitions() set(CMAKE_RC_COMPILE_OBJECT " ${rc_flags} /fo ") + endif() - configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) - ENDIF() + configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) endif (MSVC) @@ -261,11 +275,29 @@ endif (protobuf_UNICODE) include(libprotobuf-lite.cmake) include(libprotobuf.cmake) -if (protobuf_BUILD_PROTOC_BINARIES) +if (protobuf_BUILD_LIBPROTOC) include(libprotoc.cmake) +endif (protobuf_BUILD_LIBPROTOC) +if (protobuf_BUILD_PROTOC_BINARIES) include(protoc.cmake) + if (NOT DEFINED protobuf_PROTOC_EXE) + set(protobuf_PROTOC_EXE protoc) + endif (NOT DEFINED protobuf_PROTOC_EXE) endif (protobuf_BUILD_PROTOC_BINARIES) +# Ensure we have a protoc executable if we need one +if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES) + if (NOT DEFINED protobuf_PROTOC_EXE) + find_program(protobuf_PROTOC_EXE protoc) + if (NOT protobuf_PROTOC_EXE) + message(FATAL "Build requires 'protoc' but binary not found and not building protoc.") + endif () + endif () + if(protobuf_VERBOSE) + message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}") + endif(protobuf_VERBOSE) +endif () + if (protobuf_BUILD_TESTS) include(tests.cmake) endif (protobuf_BUILD_TESTS) @@ -281,5 +313,5 @@ if (protobuf_BUILD_EXAMPLES) endif (protobuf_BUILD_EXAMPLES) if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Configuring done") -endif() + message(STATUS "Protocol Buffers Configuring done") +endif(protobuf_VERBOSE) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/README.md b/cdk/extra/protobuf/protobuf-3.19.6/cmake/README.md similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/README.md rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/README.md diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/conformance.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/conformance.cmake similarity index 78% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/conformance.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/conformance.cmake index 82b4cf580..b9485ff9d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/conformance.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/conformance.cmake @@ -1,8 +1,8 @@ add_custom_command( OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc - DEPENDS protoc ${protobuf_source_dir}/conformance/conformance.proto - COMMAND protoc ${protobuf_source_dir}/conformance/conformance.proto + DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto + COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto --proto_path=${protobuf_source_dir}/conformance --cpp_out=${protobuf_source_dir}/conformance ) @@ -10,32 +10,31 @@ add_custom_command( add_custom_command( OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc - DEPENDS protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto - protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto - COMMAND protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto + DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto + ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto + COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto --proto_path=${protobuf_source_dir}/src --cpp_out=${protobuf_source_dir}/src ) add_executable(conformance_test_runner - ${protobuf_source_dir}/conformance/conformance.pb.cc - ${protobuf_source_dir}/conformance/conformance_test.cc - ${protobuf_source_dir}/conformance/binary_json_conformance_main.cc ${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc ${protobuf_source_dir}/conformance/binary_json_conformance_suite.h + ${protobuf_source_dir}/conformance/conformance.pb.cc + ${protobuf_source_dir}/conformance/conformance_test.cc ${protobuf_source_dir}/conformance/conformance_test_runner.cc ${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h ${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc + ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc ) add_executable(conformance_cpp ${protobuf_source_dir}/conformance/conformance.pb.cc ${protobuf_source_dir}/conformance/conformance_cpp.cc - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc + ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc ) target_include_directories( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/examples.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/examples.cmake similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/examples.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/examples.cmake diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/extract_includes.bat.in b/cdk/extra/protobuf/protobuf-3.19.6/cmake/extract_includes.bat.in similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/extract_includes.bat.in rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/extract_includes.bat.in index 007cc8066..605c5f966 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/extract_includes.bat.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/extract_includes.bat.in @@ -21,14 +21,19 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_file.h" include\google\protobuf\compiler\cpp\cpp_file.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_helpers.h" include\google\protobuf\compiler\cpp\cpp_helpers.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_names.h" include\google\protobuf\compiler\cpp\cpp_names.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h @@ -43,13 +48,20 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_access_listener.h" include\google\protobuf\field_access_listener.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven_lite.h" include\google\protobuf\generated_message_table_driven_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.inc" include\google\protobuf\generated_message_tctable_impl.inc copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h @@ -81,6 +93,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" inclu copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_field.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h @@ -88,7 +101,6 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" i copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h" include\google\protobuf\stubs\fastmem.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/install.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/install.cmake similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/install.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/install.cmake index be47c54a1..4e1c5deb3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/install.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/install.cmake @@ -6,9 +6,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY) set(_protobuf_libraries libprotobuf-lite libprotobuf) -if (protobuf_BUILD_PROTOC_BINARIES) +if (protobuf_BUILD_LIBPROTOC) list(APPEND _protobuf_libraries libprotoc) -endif (protobuf_BUILD_PROTOC_BINARIES) +endif (protobuf_BUILD_LIBPROTOC) foreach(_library ${_protobuf_libraries}) set_property(TARGET ${_library} @@ -30,7 +30,8 @@ endforeach() if (protobuf_BUILD_PROTOC_BINARIES) install(TARGETS protoc EXPORT protobuf-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc + BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) if (UNIX AND NOT APPLE) set_property(TARGET protoc PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") @@ -102,12 +103,16 @@ endforeach() # Install configuration set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files") +set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples") if(NOT MSVC) set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}") + set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}") else() set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}") + set(CMAKE_INSTALL_EXAMPLEDIR "examples" CACHE STRING "${_exampledir_desc}") endif() mark_as_advanced(CMAKE_INSTALL_CMAKEDIR) +mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR) configure_file(protobuf-config.cmake.in ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY) @@ -145,6 +150,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF) if(protobuf_INSTALL_EXAMPLES) - install(DIRECTORY ../examples/ DESTINATION examples + install(DIRECTORY ../examples/ + DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}" COMPONENT protobuf-examples) endif() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf-lite.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf-lite.cmake similarity index 67% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf-lite.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf-lite.cmake index 12ecacd07..f0679825c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf-lite.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf-lite.cmake @@ -1,20 +1,25 @@ set(libprotobuf_lite_files ${protobuf_source_dir}/src/google/protobuf/any_lite.cc ${protobuf_source_dir}/src/google/protobuf/arena.cc + ${protobuf_source_dir}/src/google/protobuf/arenastring.cc ${protobuf_source_dir}/src/google/protobuf/extension_set.cc ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc + ${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc ${protobuf_source_dir}/src/google/protobuf/io/strtod.cc ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc + ${protobuf_source_dir}/src/google/protobuf/map.cc ${protobuf_source_dir}/src/google/protobuf/message_lite.cc ${protobuf_source_dir}/src/google/protobuf/parse_context.cc ${protobuf_source_dir}/src/google/protobuf/repeated_field.cc + ${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.cc ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc ${protobuf_source_dir}/src/google/protobuf/stubs/common.cc ${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc @@ -29,33 +34,60 @@ set(libprotobuf_lite_files ) set(libprotobuf_lite_includes + ${protobuf_source_dir}/src/google/protobuf/any.h ${protobuf_source_dir}/src/google/protobuf/arena.h + ${protobuf_source_dir}/src/google/protobuf/arena_impl.h ${protobuf_source_dir}/src/google/protobuf/arenastring.h + ${protobuf_source_dir}/src/google/protobuf/explicitly_constructed.h ${protobuf_source_dir}/src/google/protobuf/extension_set.h + ${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h + ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h + ${protobuf_source_dir}/src/google/protobuf/has_bits.h ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h - ${protobuf_source_dir}/src/google/protobuf/parse_context.h + ${protobuf_source_dir}/src/google/protobuf/inlined_string_field.h ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/io_win32.h ${protobuf_source_dir}/src/google/protobuf/io/strtod.h ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_source_dir}/src/google/protobuf/map.h + ${protobuf_source_dir}/src/google/protobuf/map_entry_lite.h + ${protobuf_source_dir}/src/google/protobuf/map_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/map_type_handler.h ${protobuf_source_dir}/src/google/protobuf/message_lite.h + ${protobuf_source_dir}/src/google/protobuf/metadata_lite.h + ${protobuf_source_dir}/src/google/protobuf/parse_context.h + ${protobuf_source_dir}/src/google/protobuf/port.h ${protobuf_source_dir}/src/google/protobuf/repeated_field.h + ${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.h ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h + ${protobuf_source_dir}/src/google/protobuf/stubs/callback.h + ${protobuf_source_dir}/src/google/protobuf/stubs/casts.h ${protobuf_source_dir}/src/google/protobuf/stubs/common.h - ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h + ${protobuf_source_dir}/src/google/protobuf/stubs/hash.h + ${protobuf_source_dir}/src/google/protobuf/stubs/logging.h + ${protobuf_source_dir}/src/google/protobuf/stubs/macros.h + ${protobuf_source_dir}/src/google/protobuf/stubs/map_util.h + ${protobuf_source_dir}/src/google/protobuf/stubs/mutex.h ${protobuf_source_dir}/src/google/protobuf/stubs/once.h + ${protobuf_source_dir}/src/google/protobuf/stubs/platform_macros.h + ${protobuf_source_dir}/src/google/protobuf/stubs/port.h ${protobuf_source_dir}/src/google/protobuf/stubs/status.h - ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h + ${protobuf_source_dir}/src/google/protobuf/stubs/stl_util.h ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h - ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h - ${protobuf_source_dir}/src/google/protobuf/stubs/time.h + ${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h ) -if (MSVC AND NOT WIN32_CLANG) +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(libprotobuf_lite_rc_files ${CMAKE_CURRENT_BINARY_DIR}/version.rc ) @@ -67,6 +99,9 @@ target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) if(protobuf_LINK_LIBATOMIC) target_link_libraries(libprotobuf-lite atomic) endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_link_libraries(libprotobuf-lite log) +endif() target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf-lite @@ -78,7 +113,6 @@ set_target_properties(libprotobuf-lite PROPERTIES OUTPUT_NAME ${LIB_PREFIX}protobuf-lite DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) - ### IF(protobuf_BUILD_SHARED_LIBS) @@ -107,13 +141,13 @@ IF(protobuf_BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES(libprotobuf-lite PROPERTIES DEBUG_POSTFIX "-debug") -# INSTALL_DEBUG_TARGET(libprotobuf-lite -# DESTINATION "${INSTALL_BINDIR}" -# COMPONENT SharedLibraries -# ) + INSTALL_DEBUG_TARGET(libprotobuf-lite + DESTINATION "${INSTALL_BINDIR}" + COMPONENT SharedLibraries + ) ENDIF() -# INSTALL_PRIVATE_LIBRARY(libprotobuf-lite) + INSTALL_PRIVATE_LIBRARY(libprotobuf-lite) IF(WITH_ROUTER) IF(APPLE OR WIN32) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf.cmake similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf.cmake index 857e2f297..ac14aa761 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf.cmake @@ -12,8 +12,10 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/empty.pb.cc ${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.cc ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/printer.cc ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc @@ -43,7 +45,6 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc ${protobuf_source_dir}/src/google/protobuf/util/json_util.cc ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc @@ -54,7 +55,6 @@ set(libprotobuf_files ) set(libprotobuf_includes - ${protobuf_source_dir}/src/google/protobuf/any.h ${protobuf_source_dir}/src/google/protobuf/any.pb.h ${protobuf_source_dir}/src/google/protobuf/api.pb.h ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h @@ -65,18 +65,24 @@ set(libprotobuf_includes ${protobuf_source_dir}/src/google/protobuf/duration.pb.h ${protobuf_source_dir}/src/google/protobuf/dynamic_message.h ${protobuf_source_dir}/src/google/protobuf/empty.pb.h + ${protobuf_source_dir}/src/google/protobuf/field_access_listener.h ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h + ${protobuf_source_dir}/src/google/protobuf/generated_enum_reflection.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h ${protobuf_source_dir}/src/google/protobuf/io/printer.h ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h + ${protobuf_source_dir}/src/google/protobuf/map_entry.h ${protobuf_source_dir}/src/google/protobuf/map_field.h + ${protobuf_source_dir}/src/google/protobuf/map_field_inl.h ${protobuf_source_dir}/src/google/protobuf/message.h + ${protobuf_source_dir}/src/google/protobuf/metadata.h + ${protobuf_source_dir}/src/google/protobuf/reflection.h ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h ${protobuf_source_dir}/src/google/protobuf/service.h ${protobuf_source_dir}/src/google/protobuf/source_context.pb.h ${protobuf_source_dir}/src/google/protobuf/struct.pb.h - ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h ${protobuf_source_dir}/src/google/protobuf/text_format.h ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h ${protobuf_source_dir}/src/google/protobuf/type.pb.h @@ -84,29 +90,16 @@ set(libprotobuf_includes ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h ${protobuf_source_dir}/src/google/protobuf/util/json_util.h ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h ${protobuf_source_dir}/src/google/protobuf/util/time_util.h + ${protobuf_source_dir}/src/google/protobuf/util/type_resolver.h ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h ${protobuf_source_dir}/src/google/protobuf/wire_format.h ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h ) -if (MSVC AND NOT WIN32_CLANG) +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(libprotobuf_rc_files ${CMAKE_CURRENT_BINARY_DIR}/version.rc ) @@ -121,6 +114,9 @@ endif() if(protobuf_LINK_LIBATOMIC) target_link_libraries(libprotobuf atomic) endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_link_libraries(libprotobuf log) +endif() target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf @@ -134,7 +130,7 @@ set_target_properties(libprotobuf PROPERTIES add_library(protobuf::libprotobuf ALIAS libprotobuf) ### -IF(0) #protobuf_BUILD_SHARED_LIBS) +IF(protobuf_BUILD_SHARED_LIBS) SET_TARGET_PROPERTIES(libprotobuf PROPERTIES DEBUG_POSTFIX "" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/library_output_directory diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf.ver b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf.ver similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/libprotobuf.ver rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotobuf.ver diff --git a/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotoc.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotoc.cmake new file mode 100644 index 000000000..488b99aa2 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/libprotoc.cmake @@ -0,0 +1,147 @@ +set(libprotoc_files + ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc +) + +set(libprotoc_headers + ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h + ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h + ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h +) + +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") +set(libprotoc_rc_files + ${CMAKE_CURRENT_BINARY_DIR}/version.rc +) +endif() + +add_library(libprotoc ${protobuf_SHARED_OR_STATIC} + ${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files}) +target_link_libraries(libprotoc libprotobuf) +if(MSVC AND protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libprotoc + PUBLIC PROTOBUF_USE_DLLS + PRIVATE LIBPROTOC_EXPORTS) +endif() +set_target_properties(libprotoc PROPERTIES + COMPILE_DEFINITIONS LIBPROTOC_EXPORTS + VERSION ${protobuf_VERSION} + OUTPUT_NAME ${LIB_PREFIX}protoc + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") +add_library(protobuf::libprotoc ALIAS libprotoc) + +### +IF(protobuf_BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libprotoc PROPERTIES + DEBUG_POSTFIX "" + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/library_output_directory + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/library_output_directory) + IF(WIN32) + ADD_CUSTOM_COMMAND(TARGET libprotoc POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_BINARY_DIR}/library_output_directory/${CMAKE_CFG_INTDIR}/libprotoc.dll" + "${CMAKE_BINARY_DIR}/runtime_output_directory/${CMAKE_CFG_INTDIR}/libprotoc.dll" + ) + ENDIF() +ENDIF() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-config-version.cmake.in b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-config-version.cmake.in similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-config-version.cmake.in rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-config-version.cmake.in diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-config.cmake.in b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-config.cmake.in similarity index 75% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-config.cmake.in rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-config.cmake.in index 29e39d88a..9197625dc 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-config.cmake.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-config.cmake.in @@ -11,11 +11,11 @@ function(protobuf_generate) include(CMakeParseArguments) set(_options APPEND_PATH) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") @@ -41,6 +41,10 @@ function(protobuf_generate) if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") endif() + + if(protobuf_generate_PLUGIN) + set(_plugin "--plugin=${protobuf_generate_PLUGIN}") + endif() if(NOT protobuf_generate_GENERATE_EXTENSIONS) if(protobuf_generate_LANGUAGE STREQUAL cpp) @@ -77,8 +81,6 @@ function(protobuf_generate) list(APPEND _protobuf_include_path -I ${_abs_path}) endif() endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() foreach(DIR ${protobuf_generate_IMPORT_DIRS}) @@ -89,12 +91,35 @@ function(protobuf_generate) endif() endforeach() + if(NOT _protobuf_include_path) + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_generated_srcs_all) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) get_filename_component(_abs_dir ${_abs_file} DIRECTORY) - get_filename_component(_basename ${_proto} NAME_WE) - file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir}) + + get_filename_component(_file_full_name ${_proto} NAME) + string(FIND "${_file_full_name}" "." _file_last_ext_pos REVERSE) + string(SUBSTRING "${_file_full_name}" 0 ${_file_last_ext_pos} _basename) + + set(_suitable_include_found FALSE) + foreach(DIR ${_protobuf_include_path}) + if(NOT DIR STREQUAL "-I") + file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir}) + string(FIND "${_rel_dir}" "../" _is_in_parent_folder) + if (NOT ${_is_in_parent_folder} EQUAL 0) + set(_suitable_include_found TRUE) + break() + endif() + endif() + endforeach() + + if(NOT _suitable_include_found) + message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.") + return() + endif() set(_generated_srcs) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) @@ -105,9 +130,9 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_protobuf_include_path} ${_abs_file} + ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc - COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}. Custom options: ${protobuf_generate_PROTOC_OPTIONS}" VERBATIM ) endforeach() diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-lite.pc.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-lite.pc.cmake similarity index 86% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-lite.pc.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-lite.pc.cmake index cbe5426af..9745cb89c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-lite.pc.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-lite.pc.cmake @@ -7,5 +7,5 @@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} Conflicts: protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-module.cmake.in b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-module.cmake.in similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-module.cmake.in rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-module.cmake.in index 74c548872..09b9d29c2 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-module.cmake.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-module.cmake.in @@ -97,6 +97,10 @@ function(_protobuf_find_libraries name filename) else() get_target_property(${name}_LIBRARY_RELEASE protobuf::lib${filename} LOCATION_RELEASE) + get_target_property(${name}_LIBRARY_RELWITHDEBINFO protobuf::lib${filename} + LOCATION_RELWITHDEBINFO) + get_target_property(${name}_LIBRARY_MINSIZEREL protobuf::lib${filename} + LOCATION_MINSIZEREL) get_target_property(${name}_LIBRARY_DEBUG protobuf::lib${filename} LOCATION_DEBUG) @@ -106,16 +110,6 @@ function(_protobuf_find_libraries name filename) endif() endfunction() -# Internal function: find threads library -function(_protobuf_find_threads) - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) - find_package(Threads) - if(Threads_FOUND) - list(APPEND PROTOBUF_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBRARIES}" PARENT_SCOPE) - endif() -endfunction() - # # Main. # @@ -135,10 +129,6 @@ _protobuf_find_libraries(Protobuf_LITE protobuf-lite) # The Protobuf Protoc Library _protobuf_find_libraries(Protobuf_PROTOC protoc) -if(UNIX) - _protobuf_find_threads() -endif() - # Set the include directory get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) @@ -146,6 +136,14 @@ get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf # Set the protoc Executable get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_RELEASE) +if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_RELWITHDEBINFO) +endif() +if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_MINSIZEREL) +endif() if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_DEBUG) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-options.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-options.cmake similarity index 65% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-options.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-options.cmake index 47fb15825..93ec898e4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf-options.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf-options.cmake @@ -2,6 +2,6 @@ option(protobuf_VERBOSE "Enable for verbose output" OFF) mark_as_advanced(protobuf_VERBOSE) -# FindProtobuf module compatibel -option(protobuf_MODULE_COMPATIBLE "CMake build-in FindProtobuf.cmake module compatible" OFF) +# FindProtobuf module compatible +option(protobuf_MODULE_COMPATIBLE "CMake built-in FindProtobuf.cmake module compatible" OFF) mark_as_advanced(protobuf_MODULE_COMPATIBLE) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf.pc.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf.pc.cmake similarity index 86% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf.pc.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf.pc.cmake index d33e98cca..f068e6926 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protobuf.pc.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protobuf.pc.cmake @@ -7,5 +7,5 @@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} Conflicts: protobuf-lite diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protoc.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protoc.cmake similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/protoc.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/protoc.cmake index bc6425661..dae1e1c77 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/protoc.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/protoc.cmake @@ -2,7 +2,7 @@ set(protoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/main.cc ) -if (MSVC AND NOT WIN32_CLANG) +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(protoc_rc_files ${CMAKE_CURRENT_BINARY_DIR}/version.rc ) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/tests.cmake b/cdk/extra/protobuf/protobuf-3.19.6/cmake/tests.cmake similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/tests.cmake rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/tests.cmake index d4b47c54e..529685856 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/cmake/tests.cmake +++ b/cdk/extra/protobuf/protobuf-3.19.6/cmake/tests.cmake @@ -33,7 +33,6 @@ set(lite_test_protos google/protobuf/unittest_import_lite.proto google/protobuf/unittest_import_public_lite.proto google/protobuf/unittest_lite.proto - google/protobuf/unittest_no_arena_lite.proto ) set(tests_protos @@ -56,8 +55,6 @@ set(tests_protos google/protobuf/unittest_lite_imports_nonlite.proto google/protobuf/unittest_mset.proto google/protobuf/unittest_mset_wire_format.proto - google/protobuf/unittest_no_arena.proto - google/protobuf/unittest_no_arena_import.proto google/protobuf/unittest_no_field_presence.proto google/protobuf/unittest_no_generic_services.proto google/protobuf/unittest_optimize_for.proto @@ -67,6 +64,7 @@ set(tests_protos google/protobuf/unittest_proto3_arena.proto google/protobuf/unittest_proto3_arena_lite.proto google/protobuf/unittest_proto3_lite.proto + google/protobuf/unittest_proto3_optional.proto google/protobuf/unittest_well_known_types.proto google/protobuf/util/internal/testdata/anys.proto google/protobuf/util/internal/testdata/books.proto @@ -89,10 +87,11 @@ macro(compile_proto_file filename) get_filename_component(basename ${filename} NAME_WE) add_custom_command( OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc - DEPENDS protoc ${protobuf_source_dir}/src/${dirname}/${basename}.proto - COMMAND protoc ${protobuf_source_dir}/src/${dirname}/${basename}.proto + DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto + COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto --proto_path=${protobuf_source_dir}/src --cpp_out=${protobuf_source_dir}/src + --experimental_allow_proto3_optional ) endmacro(compile_proto_file) @@ -112,26 +111,28 @@ foreach(proto_file ${tests_protos}) ${protobuf_source_dir}/src/${pb_file}) endforeach(proto_file) -set(common_test_files +set(common_lite_test_files ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc + ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc + ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc +) + +set(common_test_files + ${common_lite_test_files} ${protobuf_source_dir}/src/google/protobuf/map_test_util.inc + ${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc ${protobuf_source_dir}/src/google/protobuf/test_util.cc ${protobuf_source_dir}/src/google/protobuf/test_util.inc ${protobuf_source_dir}/src/google/protobuf/testing/file.cc ${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc ) -set(common_lite_test_files - ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc -) - set(tests_files ${protobuf_source_dir}/src/google/protobuf/any_test.cc ${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc ${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc @@ -154,6 +155,7 @@ set(tests_files ${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc ${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc + ${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc ${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc ${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc ${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc @@ -161,6 +163,7 @@ set(tests_files ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc ${protobuf_source_dir}/src/google/protobuf/map_field_test.cc ${protobuf_source_dir}/src/google/protobuf/map_test.cc + ${protobuf_source_dir}/src/google/protobuf/map_test.inc ${protobuf_source_dir}/src/google/protobuf/message_unittest.cc ${protobuf_source_dir}/src/google/protobuf/message_unittest.inc ${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc @@ -200,15 +203,7 @@ set(tests_files ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc ${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc ${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc -) - -set(non_msvc_tests_files - ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc -) - -set(all_tests_files - ${tests_files} - ${non_msvc_tests_files} + ${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.inc ) if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) @@ -216,7 +211,7 @@ if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) endif() if(MINGW) - set_source_files_properties(${all_tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing") + set_source_files_properties(${tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing") # required for tests on MinGW Win64 if (CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -226,14 +221,14 @@ if(MINGW) endif() -add_executable(tests ${all_tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files}) +add_executable(tests ${tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files}) target_link_libraries(tests libprotoc libprotobuf gmock_main) set(test_plugin_files ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc ${protobuf_source_dir}/src/google/protobuf/testing/file.cc ${protobuf_source_dir}/src/google/protobuf/testing/file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc ) add_executable(test_plugin ${test_plugin_files}) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/cmake/version.rc.in b/cdk/extra/protobuf/protobuf-3.19.6/cmake/version.rc.in similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/cmake/version.rc.in rename to cdk/extra/protobuf/protobuf-3.19.6/cmake/version.rc.in diff --git a/cdk/extra/protobuf/protobuf-3.11.4/compiler_config_setting.bzl b/cdk/extra/protobuf/protobuf-3.19.6/compiler_config_setting.bzl similarity index 85% rename from cdk/extra/protobuf/protobuf-3.11.4/compiler_config_setting.bzl rename to cdk/extra/protobuf/protobuf-3.19.6/compiler_config_setting.bzl index 5e52a6524..f4d1f7b9e 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/compiler_config_setting.bzl +++ b/cdk/extra/protobuf/protobuf-3.19.6/compiler_config_setting.bzl @@ -1,6 +1,6 @@ """Creates config_setting that allows selecting based on 'compiler' value.""" -def create_compiler_config_setting(name, value): +def create_compiler_config_setting(name, value, visibility = None): # The "do_not_use_tools_cpp_compiler_present" attribute exists to # distinguish between older versions of Bazel that do not support # "@bazel_tools//tools/cpp:compiler" flag_value, and newer ones that do. @@ -13,9 +13,11 @@ def create_compiler_config_setting(name, value): flag_values = { "@bazel_tools//tools/cpp:compiler": value, }, + visibility = visibility, ) else: native.config_setting( name = name, values = {"compiler": value}, + visibility = visibility, ) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/configure.ac b/cdk/extra/protobuf/protobuf-3.19.6/configure.ac similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/configure.ac rename to cdk/extra/protobuf/protobuf-3.19.6/configure.ac index a86499a57..e89576ffc 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/configure.ac +++ b/cdk/extra/protobuf/protobuf-3.19.6/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.11.4],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.19.6],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) @@ -125,7 +125,7 @@ AC_LINK_IFELSE( [have_ld_version_script=yes; AC_MSG_RESULT(yes)], [have_ld_version_script=no; AC_MSG_RESULT(no)]) LDFLAGS=$save_LDFLAGS -AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" == "yes"]) +AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" = "yes"]) # Checks for header files. AC_HEADER_STDC @@ -223,6 +223,19 @@ case "$target_os" in esac AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1]) +AC_MSG_CHECKING(whether -llog is needed) +ANDROID_TEST=no +case "$target_os" in + *android*) + ANDROID_TEST=yes + ;; +esac +AC_MSG_RESULT($ANDROID_TEST) +if test "x$ANDROID_TEST" = xyes; then + LIBLOG_LIBS="-llog" +fi +AC_SUBST([LIBLOG_LIBS]) + # HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS, # since the flags added by ACX_CHECK_SUNCC must be used when compiling gmock # too. diff --git a/cdk/extra/protobuf/protobuf-3.19.6/internal.bzl b/cdk/extra/protobuf/protobuf-3.19.6/internal.bzl new file mode 100644 index 000000000..a281418c9 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/internal.bzl @@ -0,0 +1,29 @@ +# PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. + +def conformance_test(name, testee, failure_list = None, text_format_failure_list = None): + args = ["--testee %s" % _strip_bazel(testee)] + failure_lists = [] + if failure_list: + args = args + ["--failure_list %s" % _strip_bazel(failure_list)] + failure_lists = failure_lists + [failure_list] + if text_format_failure_list: + args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)] + failure_lists = failure_lists + [text_format_failure_list] + + native.sh_test( + name = name, + srcs = ["//:conformance/conformance_test_runner.sh"], + data = [testee] + failure_lists + [ + "//:conformance_test_runner", + ], + args = args, + deps = [ + "@bazel_tools//tools/bash/runfiles", + ], + ) + + +def _strip_bazel(testee): + if testee.startswith("//"): + testee = testee.replace("//", "com_google_protobuf") + return testee.replace(":", "/") diff --git a/cdk/extra/protobuf/protobuf-3.11.4/protobuf-lite.pc.in b/cdk/extra/protobuf/protobuf-3.19.6/protobuf-lite.pc.in similarity index 67% rename from cdk/extra/protobuf/protobuf-3.11.4/protobuf-lite.pc.in rename to cdk/extra/protobuf/protobuf-3.19.6/protobuf-lite.pc.in index 68a2bb455..f92e4ad9d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/protobuf-lite.pc.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/protobuf-lite.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @VERSION@ -Libs: -L${libdir} -lprotobuf-lite @PTHREAD_LIBS@ -Cflags: -I${includedir} @PTHREAD_CFLAGS@ +Libs: -L${libdir} -lprotobuf-lite +Cflags: -I${includedir} Conflicts: protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/protobuf.bzl b/cdk/extra/protobuf/protobuf-3.19.6/protobuf.bzl similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/protobuf.bzl rename to cdk/extra/protobuf/protobuf-3.19.6/protobuf.bzl index 829464d44..971612812 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/protobuf.bzl +++ b/cdk/extra/protobuf/protobuf-3.19.6/protobuf.bzl @@ -1,5 +1,6 @@ load("@bazel_skylib//lib:versions.bzl", "versions") load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_proto//proto:defs.bzl", "ProtoInfo") load("@rules_python//python:defs.bzl", "py_library", "py_test") def _GetPath(ctx, path): @@ -75,18 +76,23 @@ def _RelativeOutputPath(path, include, dest = ""): def _proto_gen_impl(ctx): """General implementation for generating protos""" srcs = ctx.files.srcs - deps = [] - deps += ctx.files.srcs + deps = depset(direct=ctx.files.srcs) source_dir = _SourceDir(ctx) gen_dir = _GenDir(ctx).rstrip("/") if source_dir: - import_flags = ["-I" + source_dir, "-I" + gen_dir] + import_flags = depset(direct=["-I" + source_dir, "-I" + gen_dir]) else: - import_flags = ["-I."] + import_flags = depset(direct=["-I."]) for dep in ctx.attr.deps: - import_flags += dep.proto.import_flags - deps += dep.proto.deps + if type(dep.proto.import_flags) == "list": + import_flags = depset(transitive=[import_flags], direct=dep.proto.import_flags) + else: + import_flags = depset(transitive=[import_flags, dep.proto.import_flags]) + if type(dep.proto.deps) == "list": + deps = depset(transitive=[deps], direct=dep.proto.deps) + else: + deps = depset(transitive=[deps, dep.proto.deps]) if not ctx.attr.gen_cc and not ctx.attr.gen_py and not ctx.executable.plugin: return struct( @@ -103,7 +109,7 @@ def _proto_gen_impl(ctx): in_gen_dir = src.root.path == gen_dir if in_gen_dir: import_flags_real = [] - for f in depset(import_flags).to_list(): + for f in import_flags.to_list(): path = f.replace("-I", "") import_flags_real.append("-I$(realpath -s %s)" % path) @@ -118,7 +124,7 @@ def _proto_gen_impl(ctx): outs.extend(_PyOuts([src.basename], use_grpc_plugin = use_grpc_plugin)) outs = [ctx.actions.declare_file(out, sibling = src) for out in outs] - inputs = [src] + deps + inputs = [src] + deps.to_list() tools = [ctx.executable.protoc] if ctx.executable.plugin: plugin = ctx.executable.plugin @@ -141,7 +147,7 @@ def _proto_gen_impl(ctx): inputs = inputs, tools = tools, outputs = outs, - arguments = args + import_flags + [src.path], + arguments = args + import_flags.to_list() + [src.path], executable = ctx.executable.protoc, mnemonic = "ProtoCompile", use_default_shell_env = True, @@ -184,13 +190,13 @@ proto_gen = rule( "deps": attr.label_list(providers = ["proto"]), "includes": attr.string_list(), "protoc": attr.label( - cfg = "host", + cfg = "exec", executable = True, allow_single_file = True, mandatory = True, ), "plugin": attr.label( - cfg = "host", + cfg = "exec", allow_files = True, executable = True, ), @@ -224,6 +230,29 @@ Args: outs: a list of labels of the expected outputs from the protocol compiler. """ +def _adapt_proto_library_impl(ctx): + deps = [dep[ProtoInfo] for dep in ctx.attr.deps] + + srcs = [src for dep in deps for src in dep.direct_sources] + return struct( + proto = struct( + srcs = srcs, + import_flags = ["-I{}".format(path) for dep in deps for path in dep.transitive_proto_path.to_list()], + deps = srcs, + ), + ) + +adapt_proto_library = rule( + implementation = _adapt_proto_library_impl, + attrs = { + "deps": attr.label_list( + mandatory = True, + providers = [ProtoInfo], + ), + }, + doc = "Adapts `proto_library` from `@rules_proto` to be used with `{cc,py}_proto_library` from this file.", +) + def cc_proto_library( name, srcs = [], @@ -231,7 +260,6 @@ def cc_proto_library( cc_libs = [], include = None, protoc = "@com_google_protobuf//:protoc", - internal_bootstrap_hack = False, use_grpc_plugin = False, default_runtime = "@com_google_protobuf//:protobuf", **kargs): @@ -249,41 +277,17 @@ def cc_proto_library( cc_library. include: a string indicating the include path of the .proto files. protoc: the label of the protocol compiler to generate the sources. - internal_bootstrap_hack: a flag indicate the cc_proto_library is used only - for bootstraping. When it is set to True, no files will be generated. - The rule will simply be a provider for .proto files, so that other - cc_proto_library can depend on it. use_grpc_plugin: a flag to indicate whether to call the grpc C++ plugin when processing the proto files. default_runtime: the implicitly default runtime which will be depended on by the generated cc_library target. **kargs: other keyword arguments that are passed to cc_library. - """ includes = [] if include != None: includes = [include] - if internal_bootstrap_hack: - # For pre-checked-in generated files, we add the internal_bootstrap_hack - # which will skip the codegen action. - proto_gen( - name = name + "_genproto", - srcs = srcs, - deps = [s + "_genproto" for s in deps], - includes = includes, - protoc = protoc, - visibility = ["//visibility:public"], - ) - - # An empty cc_library to make rule dependency consistent. - cc_library( - name = name, - **kargs - ) - return - grpc_cpp_plugin = None if use_grpc_plugin: grpc_cpp_plugin = "//external:grpc_cpp_plugin" @@ -318,29 +322,67 @@ def cc_proto_library( **kargs ) -def internal_gen_well_known_protos_java(srcs): - """Bazel rule to generate the gen_well_known_protos_java genrule +def _internal_gen_well_known_protos_java_impl(ctx): + args = ctx.actions.args() - Args: - srcs: the well known protos - """ - root = Label("%s//protobuf_java" % (native.repository_name())).workspace_root - pkg = native.package_name() + "/" if native.package_name() else "" - if root == "": - include = " -I%ssrc " % pkg + deps = [d[ProtoInfo] for d in ctx.attr.deps] + + srcjar = ctx.actions.declare_file("{}.srcjar".format(ctx.attr.name)) + if ctx.attr.javalite: + java_out = "lite:%s" % srcjar.path else: - include = " -I%s/%ssrc " % (root, pkg) - native.genrule( - name = "gen_well_known_protos_java", - srcs = srcs, - outs = [ - "wellknown.srcjar", - ], - cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" + - " %s $(SRCS) " % include + - " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar", - tools = [":protoc"], + java_out = srcjar + + args.add("--java_out", java_out) + + descriptors = depset( + transitive = [dep.transitive_descriptor_sets for dep in deps], ) + args.add_joined( + "--descriptor_set_in", + descriptors, + join_with = ctx.configuration.host_path_separator, + ) + + for dep in deps: + if "." == dep.proto_source_root: + args.add_all([src.path for src in dep.direct_sources]) + else: + source_root = dep.proto_source_root + offset = len(source_root) + 1 # + '/'. + args.add_all([src.path[offset:] for src in dep.direct_sources]) + + ctx.actions.run( + executable = ctx.executable._protoc, + inputs = descriptors, + outputs = [srcjar], + arguments = [args], + use_default_shell_env = True, + ) + + return [ + DefaultInfo( + files = depset([srcjar]), + ), + ] + +internal_gen_well_known_protos_java = rule( + implementation = _internal_gen_well_known_protos_java_impl, + attrs = { + "deps": attr.label_list( + mandatory = True, + providers = [ProtoInfo], + ), + "javalite": attr.bool( + default = False, + ), + "_protoc": attr.label( + executable = True, + cfg = "exec", + default = "@com_google_protobuf//:protoc", + ), + }, +) def internal_copied_filegroup(name, srcs, strip_prefix, dest, **kwargs): """Macro to copy files to a different directory and then create a filegroup. @@ -404,7 +446,7 @@ def py_proto_library( protoc: the label of the protocol compiler to generate the sources. use_grpc_plugin: a flag to indicate whether to call the Python C++ plugin when processing the proto files. - **kargs: other keyword arguments that are passed to cc_library. + **kargs: other keyword arguments that are passed to py_library. """ outs = _PyOuts(srcs, use_grpc_plugin) diff --git a/cdk/extra/protobuf/protobuf-3.11.4/protobuf.pc.in b/cdk/extra/protobuf/protobuf-3.19.6/protobuf.pc.in similarity index 71% rename from cdk/extra/protobuf/protobuf-3.11.4/protobuf.pc.in rename to cdk/extra/protobuf/protobuf-3.19.6/protobuf.pc.in index 055a9d056..e9bef5d0f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/protobuf.pc.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/protobuf.pc.in @@ -6,8 +6,8 @@ includedir=@includedir@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @VERSION@ -Libs: -L${libdir} -lprotobuf @PTHREAD_LIBS@ +Libs: -L${libdir} -lprotobuf Libs.private: @LIBS@ -Cflags: -I${includedir} @PTHREAD_CFLAGS@ +Cflags: -I${includedir} Conflicts: protobuf-lite diff --git a/cdk/extra/protobuf/protobuf-3.11.4/protobuf_deps.bzl b/cdk/extra/protobuf/protobuf-3.19.6/protobuf_deps.bzl similarity index 62% rename from cdk/extra/protobuf/protobuf-3.11.4/protobuf_deps.bzl rename to cdk/extra/protobuf/protobuf-3.19.6/protobuf_deps.bzl index fb0c47786..32f38ebb6 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/protobuf_deps.bzl +++ b/cdk/extra/protobuf/protobuf-3.19.6/protobuf_deps.bzl @@ -2,6 +2,17 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +PROTOBUF_MAVEN_ARTIFACTS = [ + "com.google.code.findbugs:jsr305:3.0.2", + "com.google.code.gson:gson:2.8.6", + "com.google.errorprone:error_prone_annotations:2.3.2", + "com.google.j2objc:j2objc-annotations:1.3", + "com.google.guava:guava:30.1.1-jre", + "com.google.truth:truth:1.1.2", + "junit:junit:4.12", + "org.easymock:easymock:3.2", +] + def protobuf_deps(): """Loads common dependencies needed to compile the protobuf library.""" @@ -24,20 +35,12 @@ def protobuf_deps(): urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"], ) - if not native.existing_rule("six"): - http_archive( - name = "six", - build_file = "@com_google_protobuf//:third_party/six.BUILD", - sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73", - urls = ["https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz"], - ) - if not native.existing_rule("rules_cc"): http_archive( name = "rules_cc", - sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec", - strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e", - urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"], + sha256 = "9d48151ea71b3e225adfb6867e6d2c7d0dce46cbdc8710d9a9a628574dfd40a0", + strip_prefix = "rules_cc-818289e5613731ae410efb54218a4077fb9dbb03", + urls = ["https://github.com/bazelbuild/rules_cc/archive/818289e5613731ae410efb54218a4077fb9dbb03.tar.gz"], ) if not native.existing_rule("rules_java"): @@ -51,15 +54,22 @@ def protobuf_deps(): if not native.existing_rule("rules_proto"): http_archive( name = "rules_proto", - sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208", - strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313", - urls = ["https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz"], + sha256 = "a4382f78723af788f0bc19fd4c8411f44ffe0a72723670a34692ffad56ada3ac", + strip_prefix = "rules_proto-f7a30f6f80006b591fa7c437fe5a951eb10bcbcf", + urls = ["https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.zip"], ) if not native.existing_rule("rules_python"): http_archive( name = "rules_python", - sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6", - strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27", - urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"], + sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0", + urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz"], + ) + + if not native.existing_rule("rules_jvm_external"): + http_archive( + name = "rules_jvm_external", + sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140", + strip_prefix = "rules_jvm_external-4.1", + urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"], ) diff --git a/cdk/extra/protobuf/protobuf-3.19.6/protobuf_version.bzl b/cdk/extra/protobuf/protobuf-3.19.6/protobuf_version.bzl new file mode 100644 index 000000000..90bdaa2ad --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/protobuf_version.bzl @@ -0,0 +1 @@ +PROTOBUF_VERSION = '3.19.6' diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.am b/cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.am similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.am rename to cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.am index 7d5e779ce..1d9cd6fb4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.am +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 22:4:0 +PROTOBUF_VERSION = 30:6:0 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison @@ -30,7 +30,7 @@ endif AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -AM_LDFLAGS = $(PTHREAD_CFLAGS) +AM_LDFLAGS = $(PTHREAD_CFLAGS) ${LIBLOG_LIBS} # If I say "dist_include_DATA", automake complains that $(includedir) is not # a "legitimate" directory for DATA. Screw you, automake. @@ -39,18 +39,19 @@ protodir = $(includedir) # If you are adding new files here, also remember to change the build files for # all other languages, //protoc-artifacts/build-zip.sh and run # //update_file_list.sh for bazel. -nobase_dist_proto_DATA = google/protobuf/descriptor.proto \ - google/protobuf/any.proto \ - google/protobuf/api.proto \ - google/protobuf/duration.proto \ - google/protobuf/empty.proto \ - google/protobuf/field_mask.proto \ - google/protobuf/source_context.proto \ - google/protobuf/struct.proto \ - google/protobuf/timestamp.proto \ - google/protobuf/type.proto \ - google/protobuf/wrappers.proto \ - google/protobuf/compiler/plugin.proto +nobase_dist_proto_DATA = \ + google/protobuf/any.proto \ + google/protobuf/api.proto \ + google/protobuf/compiler/plugin.proto \ + google/protobuf/descriptor.proto \ + google/protobuf/duration.proto \ + google/protobuf/empty.proto \ + google/protobuf/field_mask.proto \ + google/protobuf/source_context.proto \ + google/protobuf/struct.proto \ + google/protobuf/timestamp.proto \ + google/protobuf/type.proto \ + google/protobuf/wrappers.proto # Not sure why these don't get cleaned automatically. clean-local: @@ -64,54 +65,74 @@ MAINTAINERCLEANFILES = \ Makefile.in nobase_include_HEADERS = \ - google/protobuf/stubs/callback.h \ - google/protobuf/stubs/bytestream.h \ - google/protobuf/stubs/casts.h \ - google/protobuf/stubs/common.h \ - google/protobuf/stubs/fastmem.h \ - google/protobuf/stubs/hash.h \ - google/protobuf/stubs/logging.h \ - google/protobuf/stubs/macros.h \ - google/protobuf/stubs/map_util.h \ - google/protobuf/stubs/mutex.h \ - google/protobuf/stubs/once.h \ - google/protobuf/stubs/platform_macros.h \ - google/protobuf/stubs/port.h \ - google/protobuf/stubs/status.h \ - google/protobuf/stubs/stl_util.h \ - google/protobuf/stubs/stringpiece.h \ - google/protobuf/stubs/strutil.h \ - google/protobuf/stubs/template_util.h \ + google/protobuf/any.h \ google/protobuf/any.pb.h \ google/protobuf/api.pb.h \ - google/protobuf/any.h \ google/protobuf/arena.h \ google/protobuf/arena_impl.h \ google/protobuf/arenastring.h \ - google/protobuf/descriptor_database.h \ + google/protobuf/compiler/code_generator.h \ + google/protobuf/compiler/command_line_interface.h \ + google/protobuf/compiler/cpp/cpp_file.h \ + google/protobuf/compiler/cpp/cpp_generator.h \ + google/protobuf/compiler/cpp/cpp_helpers.h \ + google/protobuf/compiler/cpp/cpp_names.h \ + google/protobuf/compiler/csharp/csharp_doc_comment.h \ + google/protobuf/compiler/csharp/csharp_generator.h \ + google/protobuf/compiler/csharp/csharp_names.h \ + google/protobuf/compiler/csharp/csharp_options.h \ + google/protobuf/compiler/importer.h \ + google/protobuf/compiler/java/java_generator.h \ + google/protobuf/compiler/java/java_kotlin_generator.h \ + google/protobuf/compiler/java/java_names.h \ + google/protobuf/compiler/js/js_generator.h \ + google/protobuf/compiler/objectivec/objectivec_generator.h \ + google/protobuf/compiler/objectivec/objectivec_helpers.h \ + google/protobuf/compiler/parser.h \ + google/protobuf/compiler/php/php_generator.h \ + google/protobuf/compiler/plugin.h \ + google/protobuf/compiler/plugin.pb.h \ + google/protobuf/compiler/python/python_generator.h \ + google/protobuf/compiler/ruby/ruby_generator.h \ google/protobuf/descriptor.h \ google/protobuf/descriptor.pb.h \ + google/protobuf/descriptor_database.h \ google/protobuf/duration.pb.h \ google/protobuf/dynamic_message.h \ google/protobuf/empty.pb.h \ + google/protobuf/explicitly_constructed.h \ google/protobuf/extension_set.h \ google/protobuf/extension_set_inl.h \ + google/protobuf/field_access_listener.h \ google/protobuf/field_mask.pb.h \ google/protobuf/generated_enum_reflection.h \ google/protobuf/generated_enum_util.h \ + google/protobuf/generated_message_bases.h \ google/protobuf/generated_message_reflection.h \ google/protobuf/generated_message_table_driven.h \ + google/protobuf/generated_message_table_driven_lite.h \ + google/protobuf/generated_message_tctable_decl.h \ + google/protobuf/generated_message_tctable_impl.h \ + google/protobuf/generated_message_tctable_impl.inc \ google/protobuf/generated_message_util.h \ google/protobuf/has_bits.h \ google/protobuf/implicit_weak_message.h \ google/protobuf/inlined_string_field.h \ - google/protobuf/io/io_win32.h \ + google/protobuf/io/coded_stream.h \ + $(GZHEADERS) \ + google/protobuf/io/io_win32.h \ + google/protobuf/io/printer.h \ + google/protobuf/io/strtod.h \ + google/protobuf/io/tokenizer.h \ + google/protobuf/io/zero_copy_stream.h \ + google/protobuf/io/zero_copy_stream_impl.h \ + google/protobuf/io/zero_copy_stream_impl_lite.h \ + google/protobuf/map.h \ google/protobuf/map_entry.h \ google/protobuf/map_entry_lite.h \ google/protobuf/map_field.h \ google/protobuf/map_field_inl.h \ google/protobuf/map_field_lite.h \ - google/protobuf/map.h \ google/protobuf/map_type_handler.h \ google/protobuf/message.h \ google/protobuf/message_lite.h \ @@ -124,50 +145,42 @@ nobase_include_HEADERS = \ google/protobuf/reflection.h \ google/protobuf/reflection_ops.h \ google/protobuf/repeated_field.h \ + google/protobuf/repeated_ptr_field.h \ google/protobuf/service.h \ google/protobuf/source_context.pb.h \ google/protobuf/struct.pb.h \ + google/protobuf/stubs/bytestream.h \ + google/protobuf/stubs/callback.h \ + google/protobuf/stubs/casts.h \ + google/protobuf/stubs/common.h \ + google/protobuf/stubs/hash.h \ + google/protobuf/stubs/logging.h \ + google/protobuf/stubs/macros.h \ + google/protobuf/stubs/map_util.h \ + google/protobuf/stubs/mutex.h \ + google/protobuf/stubs/once.h \ + google/protobuf/stubs/platform_macros.h \ + google/protobuf/stubs/port.h \ + google/protobuf/stubs/status.h \ + google/protobuf/stubs/stl_util.h \ + google/protobuf/stubs/stringpiece.h \ + google/protobuf/stubs/strutil.h \ + google/protobuf/stubs/template_util.h \ google/protobuf/text_format.h \ google/protobuf/timestamp.pb.h \ google/protobuf/type.pb.h \ google/protobuf/unknown_field_set.h \ - google/protobuf/wire_format.h \ - google/protobuf/wire_format_lite.h \ - google/protobuf/wrappers.pb.h \ - google/protobuf/io/coded_stream.h \ - $(GZHEADERS) \ - google/protobuf/io/printer.h \ - google/protobuf/io/strtod.h \ - google/protobuf/io/tokenizer.h \ - google/protobuf/io/zero_copy_stream.h \ - google/protobuf/io/zero_copy_stream_impl.h \ - google/protobuf/io/zero_copy_stream_impl_lite.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/importer.h \ - google/protobuf/compiler/parser.h \ - google/protobuf/compiler/plugin.h \ - google/protobuf/compiler/plugin.pb.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/csharp/csharp_generator.h \ - google/protobuf/compiler/csharp/csharp_names.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/java_names.h \ - google/protobuf/compiler/js/js_generator.h \ - google/protobuf/compiler/js/well_known_types_embed.h \ - google/protobuf/compiler/objectivec/objectivec_generator.h \ - google/protobuf/compiler/objectivec/objectivec_helpers.h \ - google/protobuf/compiler/php/php_generator.h \ - google/protobuf/compiler/python/python_generator.h \ - google/protobuf/compiler/ruby/ruby_generator.h \ - google/protobuf/util/type_resolver.h \ google/protobuf/util/delimited_message_util.h \ google/protobuf/util/field_comparator.h \ google/protobuf/util/field_mask_util.h \ google/protobuf/util/json_util.h \ + google/protobuf/util/message_differencer.h \ google/protobuf/util/time_util.h \ + google/protobuf/util/type_resolver.h \ google/protobuf/util/type_resolver_util.h \ - google/protobuf/util/message_differencer.h + google/protobuf/wire_format.h \ + google/protobuf/wire_format_lite.h \ + google/protobuf/wrappers.pb.h lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la @@ -178,45 +191,45 @@ libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.m EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map endif libprotobuf_lite_la_SOURCES = \ + google/protobuf/any_lite.cc \ + google/protobuf/arena.cc \ + google/protobuf/arenastring.cc \ + google/protobuf/extension_set.cc \ + google/protobuf/generated_enum_util.cc \ + google/protobuf/generated_message_table_driven_lite.cc \ + google/protobuf/generated_message_tctable_lite.cc \ + google/protobuf/generated_message_util.cc \ + google/protobuf/implicit_weak_message.cc \ + google/protobuf/inlined_string_field.cc \ + google/protobuf/io/coded_stream.cc \ + google/protobuf/io/io_win32.cc \ + google/protobuf/io/strtod.cc \ + google/protobuf/io/zero_copy_stream.cc \ + google/protobuf/io/zero_copy_stream_impl.cc \ + google/protobuf/io/zero_copy_stream_impl_lite.cc \ + google/protobuf/map.cc \ + google/protobuf/message_lite.cc \ + google/protobuf/parse_context.cc \ + google/protobuf/repeated_field.cc \ + google/protobuf/repeated_ptr_field.cc \ + google/protobuf/string_member_robber.h \ google/protobuf/stubs/bytestream.cc \ - google/protobuf/stubs/bytestream.h \ google/protobuf/stubs/common.cc \ - google/protobuf/stubs/hash.h \ google/protobuf/stubs/int128.cc \ google/protobuf/stubs/int128.h \ - google/protobuf/io/io_win32.cc \ - google/protobuf/stubs/map_util.h \ google/protobuf/stubs/mathutil.h \ google/protobuf/stubs/status.cc \ - google/protobuf/stubs/status.h \ google/protobuf/stubs/status_macros.h \ google/protobuf/stubs/statusor.cc \ google/protobuf/stubs/statusor.h \ google/protobuf/stubs/stringpiece.cc \ - google/protobuf/stubs/stringpiece.h \ google/protobuf/stubs/stringprintf.cc \ google/protobuf/stubs/stringprintf.h \ google/protobuf/stubs/structurally_valid.cc \ google/protobuf/stubs/strutil.cc \ google/protobuf/stubs/time.cc \ google/protobuf/stubs/time.h \ - google/protobuf/any_lite.cc \ - google/protobuf/arena.cc \ - google/protobuf/extension_set.cc \ - google/protobuf/generated_enum_util.cc \ - google/protobuf/generated_message_util.cc \ - google/protobuf/generated_message_table_driven_lite.h \ - google/protobuf/generated_message_table_driven_lite.cc \ - google/protobuf/implicit_weak_message.cc \ - google/protobuf/message_lite.cc \ - google/protobuf/parse_context.cc \ - google/protobuf/repeated_field.cc \ - google/protobuf/wire_format_lite.cc \ - google/protobuf/io/coded_stream.cc \ - google/protobuf/io/strtod.cc \ - google/protobuf/io/zero_copy_stream.cc \ - google/protobuf/io/zero_copy_stream_impl.cc \ - google/protobuf/io/zero_copy_stream_impl_lite.cc + google/protobuf/wire_format_lite.cc libprotobuf_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) -export-dynamic -no-undefined @@ -226,20 +239,26 @@ EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map endif libprotobuf_la_SOURCES = \ $(libprotobuf_lite_la_SOURCES) \ + google/protobuf/any.cc \ google/protobuf/any.pb.cc \ google/protobuf/api.pb.cc \ - google/protobuf/any.cc \ + google/protobuf/compiler/importer.cc \ + google/protobuf/compiler/parser.cc \ google/protobuf/descriptor.cc \ - google/protobuf/descriptor_database.cc \ google/protobuf/descriptor.pb.cc \ + google/protobuf/descriptor_database.cc \ google/protobuf/duration.pb.cc \ google/protobuf/dynamic_message.cc \ google/protobuf/empty.pb.cc \ google/protobuf/extension_set_heavy.cc \ google/protobuf/field_mask.pb.cc \ + google/protobuf/generated_message_bases.cc \ google/protobuf/generated_message_reflection.cc \ - google/protobuf/generated_message_table_driven_lite.h \ google/protobuf/generated_message_table_driven.cc \ + google/protobuf/generated_message_tctable_full.cc \ + google/protobuf/io/gzip_stream.cc \ + google/protobuf/io/printer.cc \ + google/protobuf/io/tokenizer.cc \ google/protobuf/map_field.cc \ google/protobuf/message.cc \ google/protobuf/reflection_internal.h \ @@ -253,13 +272,6 @@ libprotobuf_la_SOURCES = \ google/protobuf/timestamp.pb.cc \ google/protobuf/type.pb.cc \ google/protobuf/unknown_field_set.cc \ - google/protobuf/wire_format.cc \ - google/protobuf/wrappers.pb.cc \ - google/protobuf/io/gzip_stream.cc \ - google/protobuf/io/printer.cc \ - google/protobuf/io/tokenizer.cc \ - google/protobuf/compiler/importer.cc \ - google/protobuf/compiler/parser.cc \ google/protobuf/util/delimited_message_util.cc \ google/protobuf/util/field_comparator.cc \ google/protobuf/util/field_mask_util.cc \ @@ -285,23 +297,24 @@ libprotobuf_la_SOURCES = \ google/protobuf/util/internal/object_source.h \ google/protobuf/util/internal/object_writer.cc \ google/protobuf/util/internal/object_writer.h \ + google/protobuf/util/internal/proto_writer.cc \ + google/protobuf/util/internal/proto_writer.h \ google/protobuf/util/internal/protostream_objectsource.cc \ google/protobuf/util/internal/protostream_objectsource.h \ google/protobuf/util/internal/protostream_objectwriter.cc \ google/protobuf/util/internal/protostream_objectwriter.h \ - google/protobuf/util/internal/proto_writer.cc \ - google/protobuf/util/internal/proto_writer.h \ google/protobuf/util/internal/structured_objectwriter.h \ google/protobuf/util/internal/type_info.cc \ google/protobuf/util/internal/type_info.h \ - google/protobuf/util/internal/type_info_test_helper.cc \ google/protobuf/util/internal/type_info_test_helper.h \ google/protobuf/util/internal/utility.cc \ google/protobuf/util/internal/utility.h \ google/protobuf/util/json_util.cc \ google/protobuf/util/message_differencer.cc \ google/protobuf/util/time_util.cc \ - google/protobuf/util/type_resolver_util.cc + google/protobuf/util/type_resolver_util.cc \ + google/protobuf/wire_format.cc \ + google/protobuf/wrappers.pb.cc nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) @@ -314,13 +327,6 @@ endif libprotoc_la_SOURCES = \ google/protobuf/compiler/code_generator.cc \ google/protobuf/compiler/command_line_interface.cc \ - google/protobuf/compiler/plugin.cc \ - google/protobuf/compiler/plugin.pb.cc \ - google/protobuf/compiler/scc.h \ - google/protobuf/compiler/subprocess.cc \ - google/protobuf/compiler/subprocess.h \ - google/protobuf/compiler/zip_writer.cc \ - google/protobuf/compiler/zip_writer.h \ google/protobuf/compiler/cpp/cpp_enum.cc \ google/protobuf/compiler/cpp/cpp_enum.h \ google/protobuf/compiler/cpp/cpp_enum_field.cc \ @@ -330,10 +336,8 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/cpp/cpp_field.cc \ google/protobuf/compiler/cpp/cpp_field.h \ google/protobuf/compiler/cpp/cpp_file.cc \ - google/protobuf/compiler/cpp/cpp_file.h \ google/protobuf/compiler/cpp/cpp_generator.cc \ google/protobuf/compiler/cpp/cpp_helpers.cc \ - google/protobuf/compiler/cpp/cpp_helpers.h \ google/protobuf/compiler/cpp/cpp_map_field.cc \ google/protobuf/compiler/cpp/cpp_map_field.h \ google/protobuf/compiler/cpp/cpp_message.cc \ @@ -344,21 +348,55 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/cpp/cpp_options.h \ google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \ google/protobuf/compiler/cpp/cpp_padding_optimizer.h \ + google/protobuf/compiler/cpp/cpp_parse_function_generator.cc \ + google/protobuf/compiler/cpp/cpp_parse_function_generator.h \ google/protobuf/compiler/cpp/cpp_primitive_field.cc \ google/protobuf/compiler/cpp/cpp_primitive_field.h \ google/protobuf/compiler/cpp/cpp_service.cc \ google/protobuf/compiler/cpp/cpp_service.h \ google/protobuf/compiler/cpp/cpp_string_field.cc \ google/protobuf/compiler/cpp/cpp_string_field.h \ + google/protobuf/compiler/csharp/csharp_doc_comment.cc \ + google/protobuf/compiler/csharp/csharp_enum.cc \ + google/protobuf/compiler/csharp/csharp_enum.h \ + google/protobuf/compiler/csharp/csharp_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_enum_field.h \ + google/protobuf/compiler/csharp/csharp_field_base.cc \ + google/protobuf/compiler/csharp/csharp_field_base.h \ + google/protobuf/compiler/csharp/csharp_generator.cc \ + google/protobuf/compiler/csharp/csharp_helpers.cc \ + google/protobuf/compiler/csharp/csharp_helpers.h \ + google/protobuf/compiler/csharp/csharp_map_field.cc \ + google/protobuf/compiler/csharp/csharp_map_field.h \ + google/protobuf/compiler/csharp/csharp_message.cc \ + google/protobuf/compiler/csharp/csharp_message.h \ + google/protobuf/compiler/csharp/csharp_message_field.cc \ + google/protobuf/compiler/csharp/csharp_message_field.h \ + google/protobuf/compiler/csharp/csharp_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_reflection_class.cc \ + google/protobuf/compiler/csharp/csharp_reflection_class.h \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ + google/protobuf/compiler/csharp/csharp_source_generator_base.h \ + google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ + google/protobuf/compiler/csharp/csharp_wrapper_field.h \ google/protobuf/compiler/java/java_context.cc \ google/protobuf/compiler/java/java_context.h \ + google/protobuf/compiler/java/java_doc_comment.cc \ + google/protobuf/compiler/java/java_doc_comment.h \ google/protobuf/compiler/java/java_enum.cc \ - google/protobuf/compiler/java/java_enum_lite.cc \ + google/protobuf/compiler/java/java_enum.h \ google/protobuf/compiler/java/java_enum_field.cc \ google/protobuf/compiler/java/java_enum_field.h \ google/protobuf/compiler/java/java_enum_field_lite.cc \ google/protobuf/compiler/java/java_enum_field_lite.h \ - google/protobuf/compiler/java/java_enum.h \ + google/protobuf/compiler/java/java_enum_lite.cc \ google/protobuf/compiler/java/java_enum_lite.h \ google/protobuf/compiler/java/java_extension.cc \ google/protobuf/compiler/java/java_extension.h \ @@ -373,22 +411,23 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/java/java_generator_factory.h \ google/protobuf/compiler/java/java_helpers.cc \ google/protobuf/compiler/java/java_helpers.h \ + google/protobuf/compiler/java/java_kotlin_generator.cc \ google/protobuf/compiler/java/java_map_field.cc \ google/protobuf/compiler/java/java_map_field.h \ google/protobuf/compiler/java/java_map_field_lite.cc \ google/protobuf/compiler/java/java_map_field_lite.h \ google/protobuf/compiler/java/java_message.cc \ - google/protobuf/compiler/java/java_message_lite.cc \ + google/protobuf/compiler/java/java_message.h \ google/protobuf/compiler/java/java_message_builder.cc \ + google/protobuf/compiler/java/java_message_builder.h \ google/protobuf/compiler/java/java_message_builder_lite.cc \ + google/protobuf/compiler/java/java_message_builder_lite.h \ google/protobuf/compiler/java/java_message_field.cc \ google/protobuf/compiler/java/java_message_field.h \ google/protobuf/compiler/java/java_message_field_lite.cc \ google/protobuf/compiler/java/java_message_field_lite.h \ - google/protobuf/compiler/java/java_message.h \ + google/protobuf/compiler/java/java_message_lite.cc \ google/protobuf/compiler/java/java_message_lite.h \ - google/protobuf/compiler/java/java_message_builder.h \ - google/protobuf/compiler/java/java_message_builder_lite.h \ google/protobuf/compiler/java/java_name_resolver.cc \ google/protobuf/compiler/java/java_name_resolver.h \ google/protobuf/compiler/java/java_options.h \ @@ -396,18 +435,17 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/java/java_primitive_field.h \ google/protobuf/compiler/java/java_primitive_field_lite.cc \ google/protobuf/compiler/java/java_primitive_field_lite.h \ - google/protobuf/compiler/java/java_shared_code_generator.cc \ - google/protobuf/compiler/java/java_shared_code_generator.h \ google/protobuf/compiler/java/java_service.cc \ google/protobuf/compiler/java/java_service.h \ + google/protobuf/compiler/java/java_shared_code_generator.cc \ + google/protobuf/compiler/java/java_shared_code_generator.h \ google/protobuf/compiler/java/java_string_field.cc \ google/protobuf/compiler/java/java_string_field.h \ google/protobuf/compiler/java/java_string_field_lite.cc \ google/protobuf/compiler/java/java_string_field_lite.h \ - google/protobuf/compiler/java/java_doc_comment.cc \ - google/protobuf/compiler/java/java_doc_comment.h \ google/protobuf/compiler/js/js_generator.cc \ google/protobuf/compiler/js/well_known_types_embed.cc \ + google/protobuf/compiler/js/well_known_types_embed.h \ google/protobuf/compiler/objectivec/objectivec_enum.cc \ google/protobuf/compiler/objectivec/objectivec_enum.h \ google/protobuf/compiler/objectivec/objectivec_enum_field.cc \ @@ -420,53 +458,27 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/objectivec/objectivec_file.h \ google/protobuf/compiler/objectivec/objectivec_generator.cc \ google/protobuf/compiler/objectivec/objectivec_helpers.cc \ - google/protobuf/compiler/objectivec/objectivec_helpers.h \ google/protobuf/compiler/objectivec/objectivec_map_field.cc \ google/protobuf/compiler/objectivec/objectivec_map_field.h \ google/protobuf/compiler/objectivec/objectivec_message.cc \ google/protobuf/compiler/objectivec/objectivec_message.h \ google/protobuf/compiler/objectivec/objectivec_message_field.cc \ google/protobuf/compiler/objectivec/objectivec_message_field.h \ - google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h \ + google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h \ google/protobuf/compiler/objectivec/objectivec_oneof.cc \ google/protobuf/compiler/objectivec/objectivec_oneof.h \ google/protobuf/compiler/objectivec/objectivec_primitive_field.cc \ google/protobuf/compiler/objectivec/objectivec_primitive_field.h \ google/protobuf/compiler/php/php_generator.cc \ + google/protobuf/compiler/plugin.cc \ + google/protobuf/compiler/plugin.pb.cc \ google/protobuf/compiler/python/python_generator.cc \ google/protobuf/compiler/ruby/ruby_generator.cc \ - google/protobuf/compiler/csharp/csharp_doc_comment.cc \ - google/protobuf/compiler/csharp/csharp_doc_comment.h \ - google/protobuf/compiler/csharp/csharp_enum.cc \ - google/protobuf/compiler/csharp/csharp_enum.h \ - google/protobuf/compiler/csharp/csharp_enum_field.cc \ - google/protobuf/compiler/csharp/csharp_enum_field.h \ - google/protobuf/compiler/csharp/csharp_field_base.cc \ - google/protobuf/compiler/csharp/csharp_field_base.h \ - google/protobuf/compiler/csharp/csharp_generator.cc \ - google/protobuf/compiler/csharp/csharp_helpers.cc \ - google/protobuf/compiler/csharp/csharp_helpers.h \ - google/protobuf/compiler/csharp/csharp_map_field.cc \ - google/protobuf/compiler/csharp/csharp_map_field.h \ - google/protobuf/compiler/csharp/csharp_message.cc \ - google/protobuf/compiler/csharp/csharp_message.h \ - google/protobuf/compiler/csharp/csharp_message_field.cc \ - google/protobuf/compiler/csharp/csharp_message_field.h \ - google/protobuf/compiler/csharp/csharp_options.h \ - google/protobuf/compiler/csharp/csharp_primitive_field.cc \ - google/protobuf/compiler/csharp/csharp_primitive_field.h \ - google/protobuf/compiler/csharp/csharp_reflection_class.cc \ - google/protobuf/compiler/csharp/csharp_reflection_class.h \ - google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ - google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ - google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ - google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ - google/protobuf/compiler/csharp/csharp_source_generator_base.h \ - google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ - google/protobuf/compiler/csharp/csharp_wrapper_field.h + google/protobuf/compiler/scc.h \ + google/protobuf/compiler/subprocess.cc \ + google/protobuf/compiler/subprocess.h \ + google/protobuf/compiler/zip_writer.cc \ + google/protobuf/compiler/zip_writer.h bin_PROGRAMS = protoc protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la @@ -477,39 +489,38 @@ protoc_SOURCES = google/protobuf/compiler/main.cc protoc_inputs = \ google/protobuf/any_test.proto \ google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto \ + google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto \ google/protobuf/map_lite_unittest.proto \ google/protobuf/map_proto2_unittest.proto \ google/protobuf/map_unittest.proto \ + google/protobuf/unittest.proto \ google/protobuf/unittest_arena.proto \ google/protobuf/unittest_custom_options.proto \ google/protobuf/unittest_drop_unknown_fields.proto \ google/protobuf/unittest_embed_optimize_for.proto \ google/protobuf/unittest_empty.proto \ google/protobuf/unittest_enormous_descriptor.proto \ - google/protobuf/unittest_import_lite.proto \ google/protobuf/unittest_import.proto \ - google/protobuf/unittest_import_public_lite.proto \ + google/protobuf/unittest_import_lite.proto \ google/protobuf/unittest_import_public.proto \ + google/protobuf/unittest_import_public_lite.proto \ google/protobuf/unittest_lazy_dependencies.proto \ google/protobuf/unittest_lazy_dependencies_custom_option.proto \ google/protobuf/unittest_lazy_dependencies_enum.proto \ - google/protobuf/unittest_lite_imports_nonlite.proto \ google/protobuf/unittest_lite.proto \ + google/protobuf/unittest_lite_imports_nonlite.proto \ google/protobuf/unittest_mset.proto \ google/protobuf/unittest_mset_wire_format.proto \ - google/protobuf/unittest_no_arena_lite.proto \ - google/protobuf/unittest_no_arena_import.proto \ - google/protobuf/unittest_no_arena.proto \ google/protobuf/unittest_no_field_presence.proto \ google/protobuf/unittest_no_generic_services.proto \ google/protobuf/unittest_optimize_for.proto \ - google/protobuf/unittest_preserve_unknown_enum2.proto \ google/protobuf/unittest_preserve_unknown_enum.proto \ - google/protobuf/unittest.proto \ + google/protobuf/unittest_preserve_unknown_enum2.proto \ google/protobuf/unittest_proto3.proto \ google/protobuf/unittest_proto3_arena.proto \ google/protobuf/unittest_proto3_arena_lite.proto \ google/protobuf/unittest_proto3_lite.proto \ + google/protobuf/unittest_proto3_optional.proto \ google/protobuf/unittest_well_known_types.proto \ google/protobuf/util/internal/testdata/anys.proto \ google/protobuf/util/internal/testdata/books.proto \ @@ -524,60 +535,58 @@ protoc_inputs = \ google/protobuf/util/internal/testdata/wrappers.proto \ google/protobuf/util/json_format.proto \ google/protobuf/util/json_format_proto3.proto \ - google/protobuf/util/message_differencer_unittest.proto \ - google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto + google/protobuf/util/message_differencer_unittest.proto EXTRA_DIST = \ $(protoc_inputs) \ - solaris/libstdc++.la \ - google/protobuf/test_messages_proto3.proto \ - google/protobuf/test_messages_proto2.proto \ + README.md \ + google/protobuf/compiler/package_info.h \ + google/protobuf/compiler/ruby/ruby_generated_code.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \ + google/protobuf/compiler/zip_output_unittest.sh \ google/protobuf/io/gzip_stream.h \ google/protobuf/io/gzip_stream_unittest.sh \ + google/protobuf/io/package_info.h \ + google/protobuf/package_info.h \ + google/protobuf/test_messages_proto2.proto \ + google/protobuf/test_messages_proto3.proto \ + google/protobuf/testdata/bad_utf8_string \ google/protobuf/testdata/golden_message \ google/protobuf/testdata/golden_message_maps \ google/protobuf/testdata/golden_message_oneof_implemented \ google/protobuf/testdata/golden_message_proto3 \ google/protobuf/testdata/golden_packed_fields_message \ - google/protobuf/testdata/bad_utf8_string \ google/protobuf/testdata/map_test_data.txt \ google/protobuf/testdata/text_format_unittest_data.txt \ - google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \ - google/protobuf/testdata/text_format_unittest_data_pointy.txt \ - google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \ - google/protobuf/testdata/text_format_unittest_extensions_data.txt \ - google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \ - google/protobuf/package_info.h \ - google/protobuf/io/package_info.h \ + google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \ + google/protobuf/testdata/text_format_unittest_data_pointy.txt \ + google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \ + google/protobuf/testdata/text_format_unittest_extensions_data.txt \ + google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \ google/protobuf/util/package_info.h \ - google/protobuf/compiler/ruby/ruby_generated_code.proto \ - google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \ - google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \ - google/protobuf/compiler/package_info.h \ - google/protobuf/compiler/zip_output_unittest.sh \ libprotobuf-lite.map \ libprotobuf.map \ libprotoc.map \ - README.md + solaris/libstdc++.la protoc_lite_outputs = \ google/protobuf/map_lite_unittest.pb.cc \ google/protobuf/map_lite_unittest.pb.h \ - google/protobuf/unittest_lite.pb.cc \ - google/protobuf/unittest_lite.pb.h \ - google/protobuf/unittest_no_arena_lite.pb.cc \ - google/protobuf/unittest_no_arena_lite.pb.h \ google/protobuf/unittest_import_lite.pb.cc \ google/protobuf/unittest_import_lite.pb.h \ google/protobuf/unittest_import_public_lite.pb.cc \ - google/protobuf/unittest_import_public_lite.pb.h + google/protobuf/unittest_import_public_lite.pb.h \ + google/protobuf/unittest_lite.pb.cc \ + google/protobuf/unittest_lite.pb.h protoc_outputs = \ $(protoc_lite_outputs) \ @@ -591,6 +600,8 @@ protoc_outputs = \ google/protobuf/map_proto2_unittest.pb.h \ google/protobuf/map_unittest.pb.cc \ google/protobuf/map_unittest.pb.h \ + google/protobuf/unittest.pb.cc \ + google/protobuf/unittest.pb.h \ google/protobuf/unittest_arena.pb.cc \ google/protobuf/unittest_arena.pb.h \ google/protobuf/unittest_custom_options.pb.cc \ @@ -619,22 +630,16 @@ protoc_outputs = \ google/protobuf/unittest_mset.pb.h \ google/protobuf/unittest_mset_wire_format.pb.cc \ google/protobuf/unittest_mset_wire_format.pb.h \ - google/protobuf/unittest_no_arena_import.pb.cc \ - google/protobuf/unittest_no_arena_import.pb.h \ - google/protobuf/unittest_no_arena.pb.cc \ - google/protobuf/unittest_no_arena.pb.h \ google/protobuf/unittest_no_field_presence.pb.cc \ google/protobuf/unittest_no_field_presence.pb.h \ google/protobuf/unittest_no_generic_services.pb.cc \ google/protobuf/unittest_no_generic_services.pb.h \ google/protobuf/unittest_optimize_for.pb.cc \ google/protobuf/unittest_optimize_for.pb.h \ - google/protobuf/unittest.pb.cc \ - google/protobuf/unittest.pb.h \ - google/protobuf/unittest_preserve_unknown_enum2.pb.cc \ - google/protobuf/unittest_preserve_unknown_enum2.pb.h \ google/protobuf/unittest_preserve_unknown_enum.pb.cc \ google/protobuf/unittest_preserve_unknown_enum.pb.h \ + google/protobuf/unittest_preserve_unknown_enum2.pb.cc \ + google/protobuf/unittest_preserve_unknown_enum2.pb.h \ google/protobuf/unittest_proto3.pb.cc \ google/protobuf/unittest_proto3.pb.h \ google/protobuf/unittest_proto3_arena.pb.cc \ @@ -643,6 +648,8 @@ protoc_outputs = \ google/protobuf/unittest_proto3_arena_lite.pb.h \ google/protobuf/unittest_proto3_lite.pb.cc \ google/protobuf/unittest_proto3_lite.pb.h \ + google/protobuf/unittest_proto3_optional.pb.cc \ + google/protobuf/unittest_proto3_optional.pb.h \ google/protobuf/unittest_well_known_types.pb.cc \ google/protobuf/unittest_well_known_types.pb.h \ google/protobuf/util/internal/testdata/anys.pb.cc \ @@ -686,7 +693,7 @@ else # relative to srcdir, which may not be the same as the current directory when # building out-of-tree. unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) --experimental_allow_proto3_optional ) touch unittest_proto_middleman endif @@ -694,19 +701,20 @@ endif $(protoc_outputs): unittest_proto_middleman COMMON_TEST_SOURCES = \ - google/protobuf/arena_test_util.cc \ - google/protobuf/arena_test_util.h \ - google/protobuf/map_test_util.inc \ + $(COMMON_LITE_TEST_SOURCES) \ + google/protobuf/compiler/cpp/cpp_unittest.h \ google/protobuf/map_test_util.h \ - google/protobuf/map_test_util_impl.h \ + google/protobuf/map_test_util.inc \ + google/protobuf/reflection_tester.cc \ + google/protobuf/reflection_tester.h \ google/protobuf/test_util.cc \ google/protobuf/test_util.h \ google/protobuf/test_util.inc \ google/protobuf/test_util2.h \ - google/protobuf/testing/googletest.cc \ - google/protobuf/testing/googletest.h \ google/protobuf/testing/file.cc \ - google/protobuf/testing/file.h + google/protobuf/testing/file.h \ + google/protobuf/testing/googletest.cc \ + google/protobuf/testing/googletest.h GOOGLETEST_BUILD_DIR=../third_party/googletest/googletest GOOGLEMOCK_BUILD_DIR=../third_party/googletest/googlemock @@ -725,33 +733,46 @@ protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \ # since test_util.cc takes forever to compile with optimization (with GCC). # See configure.ac for more info. protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -# Doesn't pass on Windows with MSVC -NON_MSVC_TEST_SOURCES = \ - google/protobuf/compiler/command_line_interface_unittest.cc protobuf_test_SOURCES = \ - google/protobuf/stubs/bytestream_unittest.cc \ - google/protobuf/stubs/common_unittest.cc \ - google/protobuf/stubs/int128_unittest.cc \ - google/protobuf/io/io_win32_unittest.cc \ - google/protobuf/stubs/statusor_test.cc \ - google/protobuf/stubs/status_test.cc \ - google/protobuf/stubs/stringpiece_unittest.cc \ - google/protobuf/stubs/stringprintf_unittest.cc \ - google/protobuf/stubs/structurally_valid_unittest.cc \ - google/protobuf/stubs/strutil_unittest.cc \ - google/protobuf/stubs/template_util_unittest.cc \ - google/protobuf/stubs/time_test.cc \ + $(COMMON_TEST_SOURCES) \ google/protobuf/any_test.cc \ - google/protobuf/arenastring_unittest.cc \ google/protobuf/arena_unittest.cc \ + google/protobuf/arenastring_unittest.cc \ + google/protobuf/compiler/annotation_test_util.cc \ + google/protobuf/compiler/annotation_test_util.h \ + google/protobuf/compiler/command_line_interface_unittest.cc \ + google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc \ + google/protobuf/compiler/cpp/cpp_move_unittest.cc \ + google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \ + google/protobuf/compiler/cpp/cpp_unittest.cc \ + google/protobuf/compiler/cpp/cpp_unittest.inc \ + google/protobuf/compiler/cpp/metadata_test.cc \ + google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \ + google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ + google/protobuf/compiler/importer_unittest.cc \ + google/protobuf/compiler/java/java_doc_comment_unittest.cc \ + google/protobuf/compiler/java/java_plugin_unittest.cc \ + google/protobuf/compiler/mock_code_generator.cc \ + google/protobuf/compiler/mock_code_generator.h \ + google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ + google/protobuf/compiler/parser_unittest.cc \ + google/protobuf/compiler/python/python_plugin_unittest.cc \ + google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ google/protobuf/descriptor_database_unittest.cc \ google/protobuf/descriptor_unittest.cc \ google/protobuf/drop_unknown_fields_test.cc \ google/protobuf/dynamic_message_unittest.cc \ google/protobuf/extension_set_unittest.cc \ google/protobuf/generated_message_reflection_unittest.cc \ + google/protobuf/inlined_string_field_unittest.cc \ + google/protobuf/io/coded_stream_unittest.cc \ + google/protobuf/io/io_win32_unittest.cc \ + google/protobuf/io/printer_unittest.cc \ + google/protobuf/io/tokenizer_unittest.cc \ + google/protobuf/io/zero_copy_stream_unittest.cc \ google/protobuf/map_field_test.cc \ google/protobuf/map_test.cc \ + google/protobuf/map_test.inc \ google/protobuf/message_unittest.cc \ google/protobuf/message_unittest.inc \ google/protobuf/no_field_presence_test.cc \ @@ -763,34 +784,19 @@ protobuf_test_SOURCES = \ google/protobuf/reflection_ops_unittest.cc \ google/protobuf/repeated_field_reflection_unittest.cc \ google/protobuf/repeated_field_unittest.cc \ + google/protobuf/stubs/bytestream_unittest.cc \ + google/protobuf/stubs/common_unittest.cc \ + google/protobuf/stubs/int128_unittest.cc \ + google/protobuf/stubs/status_test.cc \ + google/protobuf/stubs/statusor_test.cc \ + google/protobuf/stubs/stringpiece_unittest.cc \ + google/protobuf/stubs/stringprintf_unittest.cc \ + google/protobuf/stubs/structurally_valid_unittest.cc \ + google/protobuf/stubs/strutil_unittest.cc \ + google/protobuf/stubs/template_util_unittest.cc \ + google/protobuf/stubs/time_test.cc \ google/protobuf/text_format_unittest.cc \ google/protobuf/unknown_field_set_unittest.cc \ - google/protobuf/well_known_types_unittest.cc \ - google/protobuf/wire_format_unittest.cc \ - google/protobuf/io/coded_stream_unittest.cc \ - google/protobuf/io/printer_unittest.cc \ - google/protobuf/io/tokenizer_unittest.cc \ - google/protobuf/io/zero_copy_stream_unittest.cc \ - google/protobuf/compiler/annotation_test_util.h \ - google/protobuf/compiler/annotation_test_util.cc \ - google/protobuf/compiler/importer_unittest.cc \ - google/protobuf/compiler/mock_code_generator.cc \ - google/protobuf/compiler/mock_code_generator.h \ - google/protobuf/compiler/parser_unittest.cc \ - google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc \ - google/protobuf/compiler/cpp/cpp_move_unittest.cc \ - google/protobuf/compiler/cpp/cpp_unittest.h \ - google/protobuf/compiler/cpp/cpp_unittest.cc \ - google/protobuf/compiler/cpp/cpp_unittest.inc \ - google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \ - google/protobuf/compiler/cpp/metadata_test.cc \ - google/protobuf/compiler/java/java_plugin_unittest.cc \ - google/protobuf/compiler/java/java_doc_comment_unittest.cc \ - google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ - google/protobuf/compiler/python/python_plugin_unittest.cc \ - google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ - google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \ - google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ google/protobuf/util/delimited_message_util_test.cc \ google/protobuf/util/field_comparator_test.cc \ google/protobuf/util/field_mask_util_test.cc \ @@ -804,8 +810,10 @@ protobuf_test_SOURCES = \ google/protobuf/util/message_differencer_unittest.cc \ google/protobuf/util/time_util_test.cc \ google/protobuf/util/type_resolver_util_test.cc \ - $(NON_MSVC_TEST_SOURCES) \ - $(COMMON_TEST_SOURCES) + google/protobuf/well_known_types_unittest.cc \ + google/protobuf/wire_format_unittest.cc \ + google/protobuf/wire_format_unittest.inc + nodist_protobuf_test_SOURCES = $(protoc_outputs) $(am_protobuf_test_OBJECTS): unittest_proto_middleman @@ -830,6 +838,7 @@ COMMON_LITE_TEST_SOURCES = \ google/protobuf/arena_test_util.h \ google/protobuf/map_lite_test_util.cc \ google/protobuf/map_lite_test_util.h \ + google/protobuf/map_test_util_impl.h \ google/protobuf/test_util_lite.cc \ google/protobuf/test_util_lite.h @@ -872,9 +881,9 @@ test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ test_plugin_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include test_plugin_SOURCES = \ google/protobuf/compiler/mock_code_generator.cc \ + google/protobuf/compiler/test_plugin.cc \ google/protobuf/testing/file.cc \ - google/protobuf/testing/file.h \ - google/protobuf/compiler/test_plugin.cc + google/protobuf/testing/file.h if HAVE_ZLIB zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la @@ -890,7 +899,8 @@ endif no_warning_test.cc: echo "// Generated from Makefile.am" > no_warning_test.cc for FILE in $(nobase_include_HEADERS); do \ - echo "#include <$${FILE}>" >> no_warning_test.cc; \ + case $$FILE in *.inc) continue;; esac; \ + echo "#include <$${FILE}>" >> no_warning_test.cc; \ done echo "int main(int, char**) { return 0; }" >> no_warning_test.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.in b/cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.in similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.in rename to cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.in index 0b38ea118..3ee930f8c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/Makefile.in +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -161,30 +161,34 @@ am__DEPENDENCIES_1 = libprotobuf_lite_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__dirstamp = $(am__leading_dot)dirstamp -am_libprotobuf_lite_la_OBJECTS = google/protobuf/stubs/bytestream.lo \ - google/protobuf/stubs/common.lo \ - google/protobuf/stubs/int128.lo google/protobuf/io/io_win32.lo \ - google/protobuf/stubs/status.lo \ - google/protobuf/stubs/statusor.lo \ - google/protobuf/stubs/stringpiece.lo \ - google/protobuf/stubs/stringprintf.lo \ - google/protobuf/stubs/structurally_valid.lo \ - google/protobuf/stubs/strutil.lo google/protobuf/stubs/time.lo \ - google/protobuf/any_lite.lo google/protobuf/arena.lo \ +am_libprotobuf_lite_la_OBJECTS = google/protobuf/any_lite.lo \ + google/protobuf/arena.lo google/protobuf/arenastring.lo \ google/protobuf/extension_set.lo \ google/protobuf/generated_enum_util.lo \ - google/protobuf/generated_message_util.lo \ google/protobuf/generated_message_table_driven_lite.lo \ + google/protobuf/generated_message_tctable_lite.lo \ + google/protobuf/generated_message_util.lo \ google/protobuf/implicit_weak_message.lo \ - google/protobuf/message_lite.lo \ - google/protobuf/parse_context.lo \ - google/protobuf/repeated_field.lo \ - google/protobuf/wire_format_lite.lo \ + google/protobuf/inlined_string_field.lo \ google/protobuf/io/coded_stream.lo \ - google/protobuf/io/strtod.lo \ + google/protobuf/io/io_win32.lo google/protobuf/io/strtod.lo \ google/protobuf/io/zero_copy_stream.lo \ google/protobuf/io/zero_copy_stream_impl.lo \ - google/protobuf/io/zero_copy_stream_impl_lite.lo + google/protobuf/io/zero_copy_stream_impl_lite.lo \ + google/protobuf/map.lo google/protobuf/message_lite.lo \ + google/protobuf/parse_context.lo \ + google/protobuf/repeated_field.lo \ + google/protobuf/repeated_ptr_field.lo \ + google/protobuf/stubs/bytestream.lo \ + google/protobuf/stubs/common.lo \ + google/protobuf/stubs/int128.lo \ + google/protobuf/stubs/status.lo \ + google/protobuf/stubs/statusor.lo \ + google/protobuf/stubs/stringpiece.lo \ + google/protobuf/stubs/stringprintf.lo \ + google/protobuf/stubs/structurally_valid.lo \ + google/protobuf/stubs/strutil.lo google/protobuf/stubs/time.lo \ + google/protobuf/wire_format_lite.lo libprotobuf_lite_la_OBJECTS = $(am_libprotobuf_lite_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -196,41 +200,50 @@ libprotobuf_lite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(LDFLAGS) -o $@ libprotobuf_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -am__objects_1 = google/protobuf/stubs/bytestream.lo \ - google/protobuf/stubs/common.lo \ - google/protobuf/stubs/int128.lo google/protobuf/io/io_win32.lo \ - google/protobuf/stubs/status.lo \ - google/protobuf/stubs/statusor.lo \ - google/protobuf/stubs/stringpiece.lo \ - google/protobuf/stubs/stringprintf.lo \ - google/protobuf/stubs/structurally_valid.lo \ - google/protobuf/stubs/strutil.lo google/protobuf/stubs/time.lo \ - google/protobuf/any_lite.lo google/protobuf/arena.lo \ +am__objects_1 = google/protobuf/any_lite.lo google/protobuf/arena.lo \ + google/protobuf/arenastring.lo \ google/protobuf/extension_set.lo \ google/protobuf/generated_enum_util.lo \ - google/protobuf/generated_message_util.lo \ google/protobuf/generated_message_table_driven_lite.lo \ + google/protobuf/generated_message_tctable_lite.lo \ + google/protobuf/generated_message_util.lo \ google/protobuf/implicit_weak_message.lo \ - google/protobuf/message_lite.lo \ - google/protobuf/parse_context.lo \ - google/protobuf/repeated_field.lo \ - google/protobuf/wire_format_lite.lo \ + google/protobuf/inlined_string_field.lo \ google/protobuf/io/coded_stream.lo \ - google/protobuf/io/strtod.lo \ + google/protobuf/io/io_win32.lo google/protobuf/io/strtod.lo \ google/protobuf/io/zero_copy_stream.lo \ google/protobuf/io/zero_copy_stream_impl.lo \ - google/protobuf/io/zero_copy_stream_impl_lite.lo -am_libprotobuf_la_OBJECTS = $(am__objects_1) google/protobuf/any.pb.lo \ - google/protobuf/api.pb.lo google/protobuf/any.lo \ - google/protobuf/descriptor.lo \ + google/protobuf/io/zero_copy_stream_impl_lite.lo \ + google/protobuf/map.lo google/protobuf/message_lite.lo \ + google/protobuf/parse_context.lo \ + google/protobuf/repeated_field.lo \ + google/protobuf/repeated_ptr_field.lo \ + google/protobuf/stubs/bytestream.lo \ + google/protobuf/stubs/common.lo \ + google/protobuf/stubs/int128.lo \ + google/protobuf/stubs/status.lo \ + google/protobuf/stubs/statusor.lo \ + google/protobuf/stubs/stringpiece.lo \ + google/protobuf/stubs/stringprintf.lo \ + google/protobuf/stubs/structurally_valid.lo \ + google/protobuf/stubs/strutil.lo google/protobuf/stubs/time.lo \ + google/protobuf/wire_format_lite.lo +am_libprotobuf_la_OBJECTS = $(am__objects_1) google/protobuf/any.lo \ + google/protobuf/any.pb.lo google/protobuf/api.pb.lo \ + google/protobuf/compiler/importer.lo \ + google/protobuf/compiler/parser.lo \ + google/protobuf/descriptor.lo google/protobuf/descriptor.pb.lo \ google/protobuf/descriptor_database.lo \ - google/protobuf/descriptor.pb.lo \ google/protobuf/duration.pb.lo \ google/protobuf/dynamic_message.lo google/protobuf/empty.pb.lo \ google/protobuf/extension_set_heavy.lo \ google/protobuf/field_mask.pb.lo \ + google/protobuf/generated_message_bases.lo \ google/protobuf/generated_message_reflection.lo \ google/protobuf/generated_message_table_driven.lo \ + google/protobuf/generated_message_tctable_full.lo \ + google/protobuf/io/gzip_stream.lo \ + google/protobuf/io/printer.lo google/protobuf/io/tokenizer.lo \ google/protobuf/map_field.lo google/protobuf/message.lo \ google/protobuf/reflection_ops.lo google/protobuf/service.lo \ google/protobuf/source_context.pb.lo \ @@ -239,11 +252,6 @@ am_libprotobuf_la_OBJECTS = $(am__objects_1) google/protobuf/any.pb.lo \ google/protobuf/text_format.lo google/protobuf/timestamp.pb.lo \ google/protobuf/type.pb.lo \ google/protobuf/unknown_field_set.lo \ - google/protobuf/wire_format.lo google/protobuf/wrappers.pb.lo \ - google/protobuf/io/gzip_stream.lo \ - google/protobuf/io/printer.lo google/protobuf/io/tokenizer.lo \ - google/protobuf/compiler/importer.lo \ - google/protobuf/compiler/parser.lo \ google/protobuf/util/delimited_message_util.lo \ google/protobuf/util/field_comparator.lo \ google/protobuf/util/field_mask_util.lo \ @@ -255,16 +263,16 @@ am_libprotobuf_la_OBJECTS = $(am__objects_1) google/protobuf/any.pb.lo \ google/protobuf/util/internal/json_objectwriter.lo \ google/protobuf/util/internal/json_stream_parser.lo \ google/protobuf/util/internal/object_writer.lo \ + google/protobuf/util/internal/proto_writer.lo \ google/protobuf/util/internal/protostream_objectsource.lo \ google/protobuf/util/internal/protostream_objectwriter.lo \ - google/protobuf/util/internal/proto_writer.lo \ google/protobuf/util/internal/type_info.lo \ - google/protobuf/util/internal/type_info_test_helper.lo \ google/protobuf/util/internal/utility.lo \ google/protobuf/util/json_util.lo \ google/protobuf/util/message_differencer.lo \ google/protobuf/util/time_util.lo \ - google/protobuf/util/type_resolver_util.lo + google/protobuf/util/type_resolver_util.lo \ + google/protobuf/wire_format.lo google/protobuf/wrappers.pb.lo nodist_libprotobuf_la_OBJECTS = libprotobuf_la_OBJECTS = $(am_libprotobuf_la_OBJECTS) \ $(nodist_libprotobuf_la_OBJECTS) @@ -275,10 +283,6 @@ libprotobuf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ libprotoc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la am_libprotoc_la_OBJECTS = google/protobuf/compiler/code_generator.lo \ google/protobuf/compiler/command_line_interface.lo \ - google/protobuf/compiler/plugin.lo \ - google/protobuf/compiler/plugin.pb.lo \ - google/protobuf/compiler/subprocess.lo \ - google/protobuf/compiler/zip_writer.lo \ google/protobuf/compiler/cpp/cpp_enum.lo \ google/protobuf/compiler/cpp/cpp_enum_field.lo \ google/protobuf/compiler/cpp/cpp_extension.lo \ @@ -290,14 +294,32 @@ am_libprotoc_la_OBJECTS = google/protobuf/compiler/code_generator.lo \ google/protobuf/compiler/cpp/cpp_message.lo \ google/protobuf/compiler/cpp/cpp_message_field.lo \ google/protobuf/compiler/cpp/cpp_padding_optimizer.lo \ + google/protobuf/compiler/cpp/cpp_parse_function_generator.lo \ google/protobuf/compiler/cpp/cpp_primitive_field.lo \ google/protobuf/compiler/cpp/cpp_service.lo \ google/protobuf/compiler/cpp/cpp_string_field.lo \ + google/protobuf/compiler/csharp/csharp_doc_comment.lo \ + google/protobuf/compiler/csharp/csharp_enum.lo \ + google/protobuf/compiler/csharp/csharp_enum_field.lo \ + google/protobuf/compiler/csharp/csharp_field_base.lo \ + google/protobuf/compiler/csharp/csharp_generator.lo \ + google/protobuf/compiler/csharp/csharp_helpers.lo \ + google/protobuf/compiler/csharp/csharp_map_field.lo \ + google/protobuf/compiler/csharp/csharp_message.lo \ + google/protobuf/compiler/csharp/csharp_message_field.lo \ + google/protobuf/compiler/csharp/csharp_primitive_field.lo \ + google/protobuf/compiler/csharp/csharp_reflection_class.lo \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.lo \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.lo \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.lo \ + google/protobuf/compiler/csharp/csharp_source_generator_base.lo \ + google/protobuf/compiler/csharp/csharp_wrapper_field.lo \ google/protobuf/compiler/java/java_context.lo \ + google/protobuf/compiler/java/java_doc_comment.lo \ google/protobuf/compiler/java/java_enum.lo \ - google/protobuf/compiler/java/java_enum_lite.lo \ google/protobuf/compiler/java/java_enum_field.lo \ google/protobuf/compiler/java/java_enum_field_lite.lo \ + google/protobuf/compiler/java/java_enum_lite.lo \ google/protobuf/compiler/java/java_extension.lo \ google/protobuf/compiler/java/java_extension_lite.lo \ google/protobuf/compiler/java/java_field.lo \ @@ -305,22 +327,22 @@ am_libprotoc_la_OBJECTS = google/protobuf/compiler/code_generator.lo \ google/protobuf/compiler/java/java_generator.lo \ google/protobuf/compiler/java/java_generator_factory.lo \ google/protobuf/compiler/java/java_helpers.lo \ + google/protobuf/compiler/java/java_kotlin_generator.lo \ google/protobuf/compiler/java/java_map_field.lo \ google/protobuf/compiler/java/java_map_field_lite.lo \ google/protobuf/compiler/java/java_message.lo \ - google/protobuf/compiler/java/java_message_lite.lo \ google/protobuf/compiler/java/java_message_builder.lo \ google/protobuf/compiler/java/java_message_builder_lite.lo \ google/protobuf/compiler/java/java_message_field.lo \ google/protobuf/compiler/java/java_message_field_lite.lo \ + google/protobuf/compiler/java/java_message_lite.lo \ google/protobuf/compiler/java/java_name_resolver.lo \ google/protobuf/compiler/java/java_primitive_field.lo \ google/protobuf/compiler/java/java_primitive_field_lite.lo \ - google/protobuf/compiler/java/java_shared_code_generator.lo \ google/protobuf/compiler/java/java_service.lo \ + google/protobuf/compiler/java/java_shared_code_generator.lo \ google/protobuf/compiler/java/java_string_field.lo \ google/protobuf/compiler/java/java_string_field_lite.lo \ - google/protobuf/compiler/java/java_doc_comment.lo \ google/protobuf/compiler/js/js_generator.lo \ google/protobuf/compiler/js/well_known_types_embed.lo \ google/protobuf/compiler/objectivec/objectivec_enum.lo \ @@ -336,39 +358,27 @@ am_libprotoc_la_OBJECTS = google/protobuf/compiler/code_generator.lo \ google/protobuf/compiler/objectivec/objectivec_oneof.lo \ google/protobuf/compiler/objectivec/objectivec_primitive_field.lo \ google/protobuf/compiler/php/php_generator.lo \ + google/protobuf/compiler/plugin.lo \ + google/protobuf/compiler/plugin.pb.lo \ google/protobuf/compiler/python/python_generator.lo \ google/protobuf/compiler/ruby/ruby_generator.lo \ - google/protobuf/compiler/csharp/csharp_doc_comment.lo \ - google/protobuf/compiler/csharp/csharp_enum.lo \ - google/protobuf/compiler/csharp/csharp_enum_field.lo \ - google/protobuf/compiler/csharp/csharp_field_base.lo \ - google/protobuf/compiler/csharp/csharp_generator.lo \ - google/protobuf/compiler/csharp/csharp_helpers.lo \ - google/protobuf/compiler/csharp/csharp_map_field.lo \ - google/protobuf/compiler/csharp/csharp_message.lo \ - google/protobuf/compiler/csharp/csharp_message_field.lo \ - google/protobuf/compiler/csharp/csharp_primitive_field.lo \ - google/protobuf/compiler/csharp/csharp_reflection_class.lo \ - google/protobuf/compiler/csharp/csharp_repeated_enum_field.lo \ - google/protobuf/compiler/csharp/csharp_repeated_message_field.lo \ - google/protobuf/compiler/csharp/csharp_repeated_primitive_field.lo \ - google/protobuf/compiler/csharp/csharp_source_generator_base.lo \ - google/protobuf/compiler/csharp/csharp_wrapper_field.lo + google/protobuf/compiler/subprocess.lo \ + google/protobuf/compiler/zip_writer.lo libprotoc_la_OBJECTS = $(am_libprotoc_la_OBJECTS) libprotoc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libprotoc_la_LDFLAGS) $(LDFLAGS) -o $@ am__objects_2 = google/protobuf/no_warning_test-map_lite_unittest.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_lite.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_no_arena_lite.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_import_lite.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_import_public_lite.pb.$(OBJEXT) + google/protobuf/no_warning_test-unittest_import_public_lite.pb.$(OBJEXT) \ + google/protobuf/no_warning_test-unittest_lite.pb.$(OBJEXT) am__objects_3 = $(am__objects_2) \ google/protobuf/no_warning_test-any_test.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/no_warning_test-cpp_test_bad_identifiers.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/no_warning_test-cpp_test_large_enum_value.pb.$(OBJEXT) \ google/protobuf/no_warning_test-map_proto2_unittest.pb.$(OBJEXT) \ google/protobuf/no_warning_test-map_unittest.pb.$(OBJEXT) \ + google/protobuf/no_warning_test-unittest.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_arena.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_custom_options.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_drop_unknown_fields.pb.$(OBJEXT) \ @@ -383,18 +393,16 @@ am__objects_3 = $(am__objects_2) \ google/protobuf/no_warning_test-unittest_lite_imports_nonlite.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_mset.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_mset_wire_format.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_no_arena_import.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_no_arena.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_no_field_presence.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_no_generic_services.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_optimize_for.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest.pb.$(OBJEXT) \ - google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.$(OBJEXT) \ + google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_proto3.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_proto3_arena.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_proto3_lite.pb.$(OBJEXT) \ + google/protobuf/no_warning_test-unittest_proto3_optional.pb.$(OBJEXT) \ google/protobuf/no_warning_test-unittest_well_known_types.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/no_warning_test-anys.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/no_warning_test-books.pb.$(OBJEXT) \ @@ -420,22 +428,26 @@ no_warning_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(no_warning_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_4 = google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.$(OBJEXT) +am__objects_5 = $(am__objects_4) \ + google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-test_util.$(OBJEXT) \ - google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.$(OBJEXT) \ - google/protobuf/testing/protobuf_lazy_descriptor_test-file.$(OBJEXT) + google/protobuf/testing/protobuf_lazy_descriptor_test-file.$(OBJEXT) \ + google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.$(OBJEXT) am_protobuf_lazy_descriptor_test_OBJECTS = google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-cpp_unittest.$(OBJEXT) \ - $(am__objects_4) -am__objects_5 = google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.$(OBJEXT) \ + $(am__objects_5) +am__objects_6 = google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.$(OBJEXT) -am__objects_6 = $(am__objects_5) \ + google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.$(OBJEXT) +am__objects_7 = $(am__objects_6) \ google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-cpp_test_bad_identifiers.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-cpp_test_large_enum_value.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_custom_options.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_drop_unknown_fields.pb.$(OBJEXT) \ @@ -450,18 +462,16 @@ am__objects_6 = $(am__objects_5) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.$(OBJEXT) \ google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-anys.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/protobuf_lazy_descriptor_test-books.pb.$(OBJEXT) \ @@ -477,7 +487,7 @@ am__objects_6 = $(am__objects_5) \ google/protobuf/util/protobuf_lazy_descriptor_test-json_format.pb.$(OBJEXT) \ google/protobuf/util/protobuf_lazy_descriptor_test-json_format_proto3.pb.$(OBJEXT) \ google/protobuf/util/protobuf_lazy_descriptor_test-message_differencer_unittest.pb.$(OBJEXT) -nodist_protobuf_lazy_descriptor_test_OBJECTS = $(am__objects_6) +nodist_protobuf_lazy_descriptor_test_OBJECTS = $(am__objects_7) protobuf_lazy_descriptor_test_OBJECTS = \ $(am_protobuf_lazy_descriptor_test_OBJECTS) \ $(nodist_protobuf_lazy_descriptor_test_OBJECTS) @@ -490,17 +500,16 @@ protobuf_lazy_descriptor_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am__objects_7 = google/protobuf/protobuf_lite_arena_test-arena_test_util.$(OBJEXT) \ +am__objects_8 = google/protobuf/protobuf_lite_arena_test-arena_test_util.$(OBJEXT) \ google/protobuf/protobuf_lite_arena_test-map_lite_test_util.$(OBJEXT) \ google/protobuf/protobuf_lite_arena_test-test_util_lite.$(OBJEXT) am_protobuf_lite_arena_test_OBJECTS = google/protobuf/protobuf_lite_arena_test-lite_arena_unittest.$(OBJEXT) \ - $(am__objects_7) -am__objects_8 = google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.$(OBJEXT) \ + $(am__objects_8) +am__objects_9 = google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.$(OBJEXT) -nodist_protobuf_lite_arena_test_OBJECTS = $(am__objects_8) + google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.$(OBJEXT) +nodist_protobuf_lite_arena_test_OBJECTS = $(am__objects_9) protobuf_lite_arena_test_OBJECTS = \ $(am_protobuf_lite_arena_test_OBJECTS) \ $(nodist_protobuf_lite_arena_test_OBJECTS) @@ -512,19 +521,18 @@ protobuf_lite_arena_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -am__objects_9 = \ +am__objects_10 = \ google/protobuf/protobuf_lite_test-arena_test_util.$(OBJEXT) \ google/protobuf/protobuf_lite_test-map_lite_test_util.$(OBJEXT) \ google/protobuf/protobuf_lite_test-test_util_lite.$(OBJEXT) am_protobuf_lite_test_OBJECTS = \ google/protobuf/protobuf_lite_test-lite_unittest.$(OBJEXT) \ - $(am__objects_9) -am__objects_10 = google/protobuf/protobuf_lite_test-map_lite_unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_test-unittest_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.$(OBJEXT) \ + $(am__objects_10) +am__objects_11 = google/protobuf/protobuf_lite_test-map_lite_unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_lite_test-unittest_import_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.$(OBJEXT) -nodist_protobuf_lite_test_OBJECTS = $(am__objects_10) + google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_lite_test-unittest_lite.pb.$(OBJEXT) +nodist_protobuf_lite_test_OBJECTS = $(am__objects_11) protobuf_lite_test_OBJECTS = $(am_protobuf_lite_test_OBJECTS) \ $(nodist_protobuf_lite_test_OBJECTS) protobuf_lite_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @@ -535,33 +543,48 @@ protobuf_lite_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -am__objects_11 = google/protobuf/compiler/protobuf_test-command_line_interface_unittest.$(OBJEXT) am__objects_12 = \ google/protobuf/protobuf_test-arena_test_util.$(OBJEXT) \ + google/protobuf/protobuf_test-map_lite_test_util.$(OBJEXT) \ + google/protobuf/protobuf_test-test_util_lite.$(OBJEXT) +am__objects_13 = $(am__objects_12) \ + google/protobuf/protobuf_test-reflection_tester.$(OBJEXT) \ google/protobuf/protobuf_test-test_util.$(OBJEXT) \ - google/protobuf/testing/protobuf_test-googletest.$(OBJEXT) \ - google/protobuf/testing/protobuf_test-file.$(OBJEXT) -am_protobuf_test_OBJECTS = google/protobuf/stubs/protobuf_test-bytestream_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-common_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-int128_unittest.$(OBJEXT) \ - google/protobuf/io/protobuf_test-io_win32_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-statusor_test.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-status_test.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-stringpiece_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-stringprintf_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-structurally_valid_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-strutil_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-template_util_unittest.$(OBJEXT) \ - google/protobuf/stubs/protobuf_test-time_test.$(OBJEXT) \ + google/protobuf/testing/protobuf_test-file.$(OBJEXT) \ + google/protobuf/testing/protobuf_test-googletest.$(OBJEXT) +am_protobuf_test_OBJECTS = $(am__objects_13) \ google/protobuf/protobuf_test-any_test.$(OBJEXT) \ - google/protobuf/protobuf_test-arenastring_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-arena_unittest.$(OBJEXT) \ + google/protobuf/protobuf_test-arenastring_unittest.$(OBJEXT) \ + google/protobuf/compiler/protobuf_test-annotation_test_util.$(OBJEXT) \ + google/protobuf/compiler/protobuf_test-command_line_interface_unittest.$(OBJEXT) \ + google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.$(OBJEXT) \ + google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.$(OBJEXT) \ + google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.$(OBJEXT) \ + google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.$(OBJEXT) \ + google/protobuf/compiler/cpp/protobuf_test-metadata_test.$(OBJEXT) \ + google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.$(OBJEXT) \ + google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.$(OBJEXT) \ + google/protobuf/compiler/protobuf_test-importer_unittest.$(OBJEXT) \ + google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.$(OBJEXT) \ + google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.$(OBJEXT) \ + google/protobuf/compiler/protobuf_test-mock_code_generator.$(OBJEXT) \ + google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.$(OBJEXT) \ + google/protobuf/compiler/protobuf_test-parser_unittest.$(OBJEXT) \ + google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.$(OBJEXT) \ + google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-descriptor_database_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-descriptor_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-drop_unknown_fields_test.$(OBJEXT) \ google/protobuf/protobuf_test-dynamic_message_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-extension_set_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-generated_message_reflection_unittest.$(OBJEXT) \ + google/protobuf/protobuf_test-inlined_string_field_unittest.$(OBJEXT) \ + google/protobuf/io/protobuf_test-coded_stream_unittest.$(OBJEXT) \ + google/protobuf/io/protobuf_test-io_win32_unittest.$(OBJEXT) \ + google/protobuf/io/protobuf_test-printer_unittest.$(OBJEXT) \ + google/protobuf/io/protobuf_test-tokenizer_unittest.$(OBJEXT) \ + google/protobuf/io/protobuf_test-zero_copy_stream_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-map_field_test.$(OBJEXT) \ google/protobuf/protobuf_test-map_test.$(OBJEXT) \ google/protobuf/protobuf_test-message_unittest.$(OBJEXT) \ @@ -573,30 +596,19 @@ am_protobuf_test_OBJECTS = google/protobuf/stubs/protobuf_test-bytestream_unitte google/protobuf/protobuf_test-reflection_ops_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-repeated_field_reflection_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-repeated_field_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-bytestream_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-common_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-int128_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-status_test.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-statusor_test.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-stringpiece_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-stringprintf_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-structurally_valid_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-strutil_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-template_util_unittest.$(OBJEXT) \ + google/protobuf/stubs/protobuf_test-time_test.$(OBJEXT) \ google/protobuf/protobuf_test-text_format_unittest.$(OBJEXT) \ google/protobuf/protobuf_test-unknown_field_set_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-well_known_types_unittest.$(OBJEXT) \ - google/protobuf/protobuf_test-wire_format_unittest.$(OBJEXT) \ - google/protobuf/io/protobuf_test-coded_stream_unittest.$(OBJEXT) \ - google/protobuf/io/protobuf_test-printer_unittest.$(OBJEXT) \ - google/protobuf/io/protobuf_test-tokenizer_unittest.$(OBJEXT) \ - google/protobuf/io/protobuf_test-zero_copy_stream_unittest.$(OBJEXT) \ - google/protobuf/compiler/protobuf_test-annotation_test_util.$(OBJEXT) \ - google/protobuf/compiler/protobuf_test-importer_unittest.$(OBJEXT) \ - google/protobuf/compiler/protobuf_test-mock_code_generator.$(OBJEXT) \ - google/protobuf/compiler/protobuf_test-parser_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.$(OBJEXT) \ - google/protobuf/compiler/cpp/protobuf_test-metadata_test.$(OBJEXT) \ - google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.$(OBJEXT) \ - google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.$(OBJEXT) \ - google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.$(OBJEXT) \ - google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.$(OBJEXT) \ - google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.$(OBJEXT) \ - google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.$(OBJEXT) \ - google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.$(OBJEXT) \ google/protobuf/util/protobuf_test-delimited_message_util_test.$(OBJEXT) \ google/protobuf/util/protobuf_test-field_comparator_test.$(OBJEXT) \ google/protobuf/util/protobuf_test-field_mask_util_test.$(OBJEXT) \ @@ -610,19 +622,20 @@ am_protobuf_test_OBJECTS = google/protobuf/stubs/protobuf_test-bytestream_unitte google/protobuf/util/protobuf_test-message_differencer_unittest.$(OBJEXT) \ google/protobuf/util/protobuf_test-time_util_test.$(OBJEXT) \ google/protobuf/util/protobuf_test-type_resolver_util_test.$(OBJEXT) \ - $(am__objects_11) $(am__objects_12) -am__objects_13 = \ + google/protobuf/protobuf_test-well_known_types_unittest.$(OBJEXT) \ + google/protobuf/protobuf_test-wire_format_unittest.$(OBJEXT) +am__objects_14 = \ google/protobuf/protobuf_test-map_lite_unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_no_arena_lite.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_import_lite.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_import_public_lite.pb.$(OBJEXT) -am__objects_14 = $(am__objects_13) \ + google/protobuf/protobuf_test-unittest_import_public_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_test-unittest_lite.pb.$(OBJEXT) +am__objects_15 = $(am__objects_14) \ google/protobuf/protobuf_test-any_test.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/protobuf_test-cpp_test_bad_identifiers.pb.$(OBJEXT) \ google/protobuf/compiler/cpp/protobuf_test-cpp_test_large_enum_value.pb.$(OBJEXT) \ google/protobuf/protobuf_test-map_proto2_unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_test-map_unittest.pb.$(OBJEXT) \ + google/protobuf/protobuf_test-unittest.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_custom_options.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_drop_unknown_fields.pb.$(OBJEXT) \ @@ -637,18 +650,16 @@ am__objects_14 = $(am__objects_13) \ google/protobuf/protobuf_test-unittest_lite_imports_nonlite.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_mset.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_mset_wire_format.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_no_arena_import.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_no_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_no_field_presence.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_no_generic_services.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_optimize_for.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest.pb.$(OBJEXT) \ - google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.$(OBJEXT) \ + google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_proto3.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_proto3_arena.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_proto3_lite.pb.$(OBJEXT) \ + google/protobuf/protobuf_test-unittest_proto3_optional.pb.$(OBJEXT) \ google/protobuf/protobuf_test-unittest_well_known_types.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/protobuf_test-anys.pb.$(OBJEXT) \ google/protobuf/util/internal/testdata/protobuf_test-books.pb.$(OBJEXT) \ @@ -664,7 +675,7 @@ am__objects_14 = $(am__objects_13) \ google/protobuf/util/protobuf_test-json_format.pb.$(OBJEXT) \ google/protobuf/util/protobuf_test-json_format_proto3.pb.$(OBJEXT) \ google/protobuf/util/protobuf_test-message_differencer_unittest.pb.$(OBJEXT) -nodist_protobuf_test_OBJECTS = $(am__objects_14) +nodist_protobuf_test_OBJECTS = $(am__objects_15) protobuf_test_OBJECTS = $(am_protobuf_test_OBJECTS) \ $(nodist_protobuf_test_OBJECTS) protobuf_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \ @@ -680,8 +691,8 @@ protoc_OBJECTS = $(am_protoc_OBJECTS) protoc_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \ libprotoc.la am_test_plugin_OBJECTS = google/protobuf/compiler/test_plugin-mock_code_generator.$(OBJEXT) \ - google/protobuf/testing/test_plugin-file.$(OBJEXT) \ - google/protobuf/compiler/test_plugin-test_plugin.$(OBJEXT) + google/protobuf/compiler/test_plugin-test_plugin.$(OBJEXT) \ + google/protobuf/testing/test_plugin-file.$(OBJEXT) test_plugin_OBJECTS = $(am_test_plugin_OBJECTS) test_plugin_DEPENDENCIES = $(am__DEPENDENCIES_1) libprotobuf.la \ libprotoc.la $(GOOGLETEST_BUILD_DIR)/lib/libgtest.la @@ -718,6 +729,7 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/any_lite.Plo \ google/protobuf/$(DEPDIR)/api.pb.Plo \ google/protobuf/$(DEPDIR)/arena.Plo \ + google/protobuf/$(DEPDIR)/arenastring.Plo \ google/protobuf/$(DEPDIR)/descriptor.Plo \ google/protobuf/$(DEPDIR)/descriptor.pb.Plo \ google/protobuf/$(DEPDIR)/descriptor_database.Plo \ @@ -728,11 +740,16 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/extension_set_heavy.Plo \ google/protobuf/$(DEPDIR)/field_mask.pb.Plo \ google/protobuf/$(DEPDIR)/generated_enum_util.Plo \ + google/protobuf/$(DEPDIR)/generated_message_bases.Plo \ google/protobuf/$(DEPDIR)/generated_message_reflection.Plo \ google/protobuf/$(DEPDIR)/generated_message_table_driven.Plo \ google/protobuf/$(DEPDIR)/generated_message_table_driven_lite.Plo \ + google/protobuf/$(DEPDIR)/generated_message_tctable_full.Plo \ + google/protobuf/$(DEPDIR)/generated_message_tctable_lite.Plo \ google/protobuf/$(DEPDIR)/generated_message_util.Plo \ google/protobuf/$(DEPDIR)/implicit_weak_message.Plo \ + google/protobuf/$(DEPDIR)/inlined_string_field.Plo \ + google/protobuf/$(DEPDIR)/map.Plo \ google/protobuf/$(DEPDIR)/map_field.Plo \ google/protobuf/$(DEPDIR)/message.Plo \ google/protobuf/$(DEPDIR)/message_lite.Plo \ @@ -758,9 +775,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po \ - google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po \ @@ -770,14 +784,18 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po \ + google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po \ google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Po \ google/protobuf/$(DEPDIR)/parse_context.Plo \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po \ + google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po \ + google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Po \ + google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po \ @@ -796,9 +814,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po \ @@ -808,6 +823,7 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po \ + google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po \ @@ -817,7 +833,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Po \ @@ -826,7 +841,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po \ google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po \ @@ -838,7 +852,9 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po \ + google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po \ + google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po \ google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po \ @@ -850,9 +866,11 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po \ + google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po \ google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po \ + google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po \ google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Po \ @@ -872,9 +890,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po \ - google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po \ @@ -884,12 +899,14 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po \ + google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Po \ google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po \ google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po \ google/protobuf/$(DEPDIR)/reflection_ops.Plo \ google/protobuf/$(DEPDIR)/repeated_field.Plo \ + google/protobuf/$(DEPDIR)/repeated_ptr_field.Plo \ google/protobuf/$(DEPDIR)/service.Plo \ google/protobuf/$(DEPDIR)/source_context.pb.Plo \ google/protobuf/$(DEPDIR)/struct.pb.Plo \ @@ -927,6 +944,7 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message.Plo \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message_field.Plo \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_padding_optimizer.Plo \ + google/protobuf/compiler/cpp/$(DEPDIR)/cpp_parse_function_generator.Plo \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_primitive_field.Plo \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_service.Plo \ google/protobuf/compiler/cpp/$(DEPDIR)/cpp_string_field.Plo \ @@ -973,6 +991,7 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/compiler/java/$(DEPDIR)/java_generator.Plo \ google/protobuf/compiler/java/$(DEPDIR)/java_generator_factory.Plo \ google/protobuf/compiler/java/$(DEPDIR)/java_helpers.Plo \ + google/protobuf/compiler/java/$(DEPDIR)/java_kotlin_generator.Plo \ google/protobuf/compiler/java/$(DEPDIR)/java_map_field.Plo \ google/protobuf/compiler/java/$(DEPDIR)/java_map_field_lite.Plo \ google/protobuf/compiler/java/$(DEPDIR)/java_message.Plo \ @@ -1094,7 +1113,6 @@ am__depfiles_remade = ./$(DEPDIR)/no_warning_test-no_warning_test.Po \ google/protobuf/util/internal/$(DEPDIR)/protostream_objectsource.Plo \ google/protobuf/util/internal/$(DEPDIR)/protostream_objectwriter.Plo \ google/protobuf/util/internal/$(DEPDIR)/type_info.Plo \ - google/protobuf/util/internal/$(DEPDIR)/type_info_test_helper.Plo \ google/protobuf/util/internal/$(DEPDIR)/utility.Plo \ google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po \ google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po \ @@ -1190,87 +1208,100 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(nobase_dist_proto_DATA) -am__nobase_include_HEADERS_DIST = google/protobuf/stubs/callback.h \ - google/protobuf/stubs/bytestream.h \ - google/protobuf/stubs/casts.h google/protobuf/stubs/common.h \ - google/protobuf/stubs/fastmem.h google/protobuf/stubs/hash.h \ - google/protobuf/stubs/logging.h google/protobuf/stubs/macros.h \ - google/protobuf/stubs/map_util.h google/protobuf/stubs/mutex.h \ - google/protobuf/stubs/once.h \ - google/protobuf/stubs/platform_macros.h \ - google/protobuf/stubs/port.h google/protobuf/stubs/status.h \ - google/protobuf/stubs/stl_util.h \ - google/protobuf/stubs/stringpiece.h \ - google/protobuf/stubs/strutil.h \ - google/protobuf/stubs/template_util.h google/protobuf/any.pb.h \ - google/protobuf/api.pb.h google/protobuf/any.h \ +am__nobase_include_HEADERS_DIST = google/protobuf/any.h \ + google/protobuf/any.pb.h google/protobuf/api.pb.h \ google/protobuf/arena.h google/protobuf/arena_impl.h \ google/protobuf/arenastring.h \ - google/protobuf/descriptor_database.h \ + google/protobuf/compiler/code_generator.h \ + google/protobuf/compiler/command_line_interface.h \ + google/protobuf/compiler/cpp/cpp_file.h \ + google/protobuf/compiler/cpp/cpp_generator.h \ + google/protobuf/compiler/cpp/cpp_helpers.h \ + google/protobuf/compiler/cpp/cpp_names.h \ + google/protobuf/compiler/csharp/csharp_doc_comment.h \ + google/protobuf/compiler/csharp/csharp_generator.h \ + google/protobuf/compiler/csharp/csharp_names.h \ + google/protobuf/compiler/csharp/csharp_options.h \ + google/protobuf/compiler/importer.h \ + google/protobuf/compiler/java/java_generator.h \ + google/protobuf/compiler/java/java_kotlin_generator.h \ + google/protobuf/compiler/java/java_names.h \ + google/protobuf/compiler/js/js_generator.h \ + google/protobuf/compiler/objectivec/objectivec_generator.h \ + google/protobuf/compiler/objectivec/objectivec_helpers.h \ + google/protobuf/compiler/parser.h \ + google/protobuf/compiler/php/php_generator.h \ + google/protobuf/compiler/plugin.h \ + google/protobuf/compiler/plugin.pb.h \ + google/protobuf/compiler/python/python_generator.h \ + google/protobuf/compiler/ruby/ruby_generator.h \ google/protobuf/descriptor.h google/protobuf/descriptor.pb.h \ + google/protobuf/descriptor_database.h \ google/protobuf/duration.pb.h \ google/protobuf/dynamic_message.h google/protobuf/empty.pb.h \ + google/protobuf/explicitly_constructed.h \ google/protobuf/extension_set.h \ google/protobuf/extension_set_inl.h \ + google/protobuf/field_access_listener.h \ google/protobuf/field_mask.pb.h \ google/protobuf/generated_enum_reflection.h \ google/protobuf/generated_enum_util.h \ + google/protobuf/generated_message_bases.h \ google/protobuf/generated_message_reflection.h \ google/protobuf/generated_message_table_driven.h \ + google/protobuf/generated_message_table_driven_lite.h \ + google/protobuf/generated_message_tctable_decl.h \ + google/protobuf/generated_message_tctable_impl.h \ + google/protobuf/generated_message_tctable_impl.inc \ google/protobuf/generated_message_util.h \ google/protobuf/has_bits.h \ google/protobuf/implicit_weak_message.h \ google/protobuf/inlined_string_field.h \ - google/protobuf/io/io_win32.h google/protobuf/map_entry.h \ + google/protobuf/io/coded_stream.h \ + google/protobuf/io/gzip_stream.h google/protobuf/io/io_win32.h \ + google/protobuf/io/printer.h google/protobuf/io/strtod.h \ + google/protobuf/io/tokenizer.h \ + google/protobuf/io/zero_copy_stream.h \ + google/protobuf/io/zero_copy_stream_impl.h \ + google/protobuf/io/zero_copy_stream_impl_lite.h \ + google/protobuf/map.h google/protobuf/map_entry.h \ google/protobuf/map_entry_lite.h google/protobuf/map_field.h \ google/protobuf/map_field_inl.h \ - google/protobuf/map_field_lite.h google/protobuf/map.h \ + google/protobuf/map_field_lite.h \ google/protobuf/map_type_handler.h google/protobuf/message.h \ google/protobuf/message_lite.h google/protobuf/metadata.h \ google/protobuf/metadata_lite.h \ google/protobuf/parse_context.h google/protobuf/port.h \ google/protobuf/port_def.inc google/protobuf/port_undef.inc \ google/protobuf/reflection.h google/protobuf/reflection_ops.h \ - google/protobuf/repeated_field.h google/protobuf/service.h \ + google/protobuf/repeated_field.h \ + google/protobuf/repeated_ptr_field.h google/protobuf/service.h \ google/protobuf/source_context.pb.h \ - google/protobuf/struct.pb.h google/protobuf/text_format.h \ - google/protobuf/timestamp.pb.h google/protobuf/type.pb.h \ - google/protobuf/unknown_field_set.h \ - google/protobuf/wire_format.h \ - google/protobuf/wire_format_lite.h \ - google/protobuf/wrappers.pb.h \ - google/protobuf/io/coded_stream.h \ - google/protobuf/io/gzip_stream.h google/protobuf/io/printer.h \ - google/protobuf/io/strtod.h google/protobuf/io/tokenizer.h \ - google/protobuf/io/zero_copy_stream.h \ - google/protobuf/io/zero_copy_stream_impl.h \ - google/protobuf/io/zero_copy_stream_impl_lite.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/importer.h \ - google/protobuf/compiler/parser.h \ - google/protobuf/compiler/plugin.h \ - google/protobuf/compiler/plugin.pb.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/csharp/csharp_generator.h \ - google/protobuf/compiler/csharp/csharp_names.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/java_names.h \ - google/protobuf/compiler/js/js_generator.h \ - google/protobuf/compiler/js/well_known_types_embed.h \ - google/protobuf/compiler/objectivec/objectivec_generator.h \ - google/protobuf/compiler/objectivec/objectivec_helpers.h \ - google/protobuf/compiler/php/php_generator.h \ - google/protobuf/compiler/python/python_generator.h \ - google/protobuf/compiler/ruby/ruby_generator.h \ - google/protobuf/util/type_resolver.h \ + google/protobuf/struct.pb.h google/protobuf/stubs/bytestream.h \ + google/protobuf/stubs/callback.h google/protobuf/stubs/casts.h \ + google/protobuf/stubs/common.h google/protobuf/stubs/hash.h \ + google/protobuf/stubs/logging.h google/protobuf/stubs/macros.h \ + google/protobuf/stubs/map_util.h google/protobuf/stubs/mutex.h \ + google/protobuf/stubs/once.h \ + google/protobuf/stubs/platform_macros.h \ + google/protobuf/stubs/port.h google/protobuf/stubs/status.h \ + google/protobuf/stubs/stl_util.h \ + google/protobuf/stubs/stringpiece.h \ + google/protobuf/stubs/strutil.h \ + google/protobuf/stubs/template_util.h \ + google/protobuf/text_format.h google/protobuf/timestamp.pb.h \ + google/protobuf/type.pb.h google/protobuf/unknown_field_set.h \ google/protobuf/util/delimited_message_util.h \ google/protobuf/util/field_comparator.h \ google/protobuf/util/field_mask_util.h \ google/protobuf/util/json_util.h \ + google/protobuf/util/message_differencer.h \ google/protobuf/util/time_util.h \ + google/protobuf/util/type_resolver.h \ google/protobuf/util/type_resolver_util.h \ - google/protobuf/util/message_differencer.h + google/protobuf/wire_format.h \ + google/protobuf/wire_format_lite.h \ + google/protobuf/wrappers.pb.h HEADERS = $(nobase_include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, @@ -1289,8 +1320,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -1446,6 +1475,7 @@ am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck @HAVE_ZLIB_TRUE@am__EXEEXT_2 = \ @@ -1471,7 +1501,7 @@ TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ - $(top_srcdir)/test-driver + $(top_srcdir)/test-driver README.md DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -1492,6 +1522,8 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXCPPFLAGS_FOR_BUILD = @CXXCPPFLAGS_FOR_BUILD@ @@ -1511,6 +1543,7 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ @@ -1525,6 +1558,7 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ LIBATOMIC_LIBS = @LIBATOMIC_LIBS@ +LIBLOG_LIBS = @LIBLOG_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -1638,14 +1672,14 @@ top_srcdir = @top_srcdir@ @HAVE_ZLIB_TRUE@ZLIB_DEF = -DHAVE_ZLIB=1 @HAVE_PTHREAD_FALSE@PTHREAD_DEF = @HAVE_PTHREAD_TRUE@PTHREAD_DEF = -DHAVE_PTHREAD=1 -PROTOBUF_VERSION = 22:4:0 +PROTOBUF_VERSION = 30:4:0 @GCC_FALSE@NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) # Turn on all warnings except for sign comparison (we ignore sign comparison # in Google so our code base have tons of such warnings). @GCC_TRUE@NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) -Wall -Wno-sign-compare AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -AM_LDFLAGS = $(PTHREAD_CFLAGS) +AM_LDFLAGS = $(PTHREAD_CFLAGS) ${LIBLOG_LIBS} # If I say "dist_include_DATA", automake complains that $(includedir) is not # a "legitimate" directory for DATA. Screw you, automake. @@ -1654,18 +1688,19 @@ protodir = $(includedir) # If you are adding new files here, also remember to change the build files for # all other languages, //protoc-artifacts/build-zip.sh and run # //update_file_list.sh for bazel. -nobase_dist_proto_DATA = google/protobuf/descriptor.proto \ - google/protobuf/any.proto \ - google/protobuf/api.proto \ - google/protobuf/duration.proto \ - google/protobuf/empty.proto \ - google/protobuf/field_mask.proto \ - google/protobuf/source_context.proto \ - google/protobuf/struct.proto \ - google/protobuf/timestamp.proto \ - google/protobuf/type.proto \ - google/protobuf/wrappers.proto \ - google/protobuf/compiler/plugin.proto +nobase_dist_proto_DATA = \ + google/protobuf/any.proto \ + google/protobuf/api.proto \ + google/protobuf/compiler/plugin.proto \ + google/protobuf/descriptor.proto \ + google/protobuf/duration.proto \ + google/protobuf/empty.proto \ + google/protobuf/field_mask.proto \ + google/protobuf/source_context.proto \ + google/protobuf/struct.proto \ + google/protobuf/timestamp.proto \ + google/protobuf/type.proto \ + google/protobuf/wrappers.proto CLEANFILES = $(protoc_outputs) unittest_proto_middleman \ testzip.jar testzip.list testzip.proto testzip.zip \ @@ -1675,54 +1710,74 @@ MAINTAINERCLEANFILES = \ Makefile.in nobase_include_HEADERS = \ - google/protobuf/stubs/callback.h \ - google/protobuf/stubs/bytestream.h \ - google/protobuf/stubs/casts.h \ - google/protobuf/stubs/common.h \ - google/protobuf/stubs/fastmem.h \ - google/protobuf/stubs/hash.h \ - google/protobuf/stubs/logging.h \ - google/protobuf/stubs/macros.h \ - google/protobuf/stubs/map_util.h \ - google/protobuf/stubs/mutex.h \ - google/protobuf/stubs/once.h \ - google/protobuf/stubs/platform_macros.h \ - google/protobuf/stubs/port.h \ - google/protobuf/stubs/status.h \ - google/protobuf/stubs/stl_util.h \ - google/protobuf/stubs/stringpiece.h \ - google/protobuf/stubs/strutil.h \ - google/protobuf/stubs/template_util.h \ + google/protobuf/any.h \ google/protobuf/any.pb.h \ google/protobuf/api.pb.h \ - google/protobuf/any.h \ google/protobuf/arena.h \ google/protobuf/arena_impl.h \ google/protobuf/arenastring.h \ - google/protobuf/descriptor_database.h \ + google/protobuf/compiler/code_generator.h \ + google/protobuf/compiler/command_line_interface.h \ + google/protobuf/compiler/cpp/cpp_file.h \ + google/protobuf/compiler/cpp/cpp_generator.h \ + google/protobuf/compiler/cpp/cpp_helpers.h \ + google/protobuf/compiler/cpp/cpp_names.h \ + google/protobuf/compiler/csharp/csharp_doc_comment.h \ + google/protobuf/compiler/csharp/csharp_generator.h \ + google/protobuf/compiler/csharp/csharp_names.h \ + google/protobuf/compiler/csharp/csharp_options.h \ + google/protobuf/compiler/importer.h \ + google/protobuf/compiler/java/java_generator.h \ + google/protobuf/compiler/java/java_kotlin_generator.h \ + google/protobuf/compiler/java/java_names.h \ + google/protobuf/compiler/js/js_generator.h \ + google/protobuf/compiler/objectivec/objectivec_generator.h \ + google/protobuf/compiler/objectivec/objectivec_helpers.h \ + google/protobuf/compiler/parser.h \ + google/protobuf/compiler/php/php_generator.h \ + google/protobuf/compiler/plugin.h \ + google/protobuf/compiler/plugin.pb.h \ + google/protobuf/compiler/python/python_generator.h \ + google/protobuf/compiler/ruby/ruby_generator.h \ google/protobuf/descriptor.h \ google/protobuf/descriptor.pb.h \ + google/protobuf/descriptor_database.h \ google/protobuf/duration.pb.h \ google/protobuf/dynamic_message.h \ google/protobuf/empty.pb.h \ + google/protobuf/explicitly_constructed.h \ google/protobuf/extension_set.h \ google/protobuf/extension_set_inl.h \ + google/protobuf/field_access_listener.h \ google/protobuf/field_mask.pb.h \ google/protobuf/generated_enum_reflection.h \ google/protobuf/generated_enum_util.h \ + google/protobuf/generated_message_bases.h \ google/protobuf/generated_message_reflection.h \ google/protobuf/generated_message_table_driven.h \ + google/protobuf/generated_message_table_driven_lite.h \ + google/protobuf/generated_message_tctable_decl.h \ + google/protobuf/generated_message_tctable_impl.h \ + google/protobuf/generated_message_tctable_impl.inc \ google/protobuf/generated_message_util.h \ google/protobuf/has_bits.h \ google/protobuf/implicit_weak_message.h \ google/protobuf/inlined_string_field.h \ - google/protobuf/io/io_win32.h \ + google/protobuf/io/coded_stream.h \ + $(GZHEADERS) \ + google/protobuf/io/io_win32.h \ + google/protobuf/io/printer.h \ + google/protobuf/io/strtod.h \ + google/protobuf/io/tokenizer.h \ + google/protobuf/io/zero_copy_stream.h \ + google/protobuf/io/zero_copy_stream_impl.h \ + google/protobuf/io/zero_copy_stream_impl_lite.h \ + google/protobuf/map.h \ google/protobuf/map_entry.h \ google/protobuf/map_entry_lite.h \ google/protobuf/map_field.h \ google/protobuf/map_field_inl.h \ google/protobuf/map_field_lite.h \ - google/protobuf/map.h \ google/protobuf/map_type_handler.h \ google/protobuf/message.h \ google/protobuf/message_lite.h \ @@ -1735,50 +1790,42 @@ nobase_include_HEADERS = \ google/protobuf/reflection.h \ google/protobuf/reflection_ops.h \ google/protobuf/repeated_field.h \ + google/protobuf/repeated_ptr_field.h \ google/protobuf/service.h \ google/protobuf/source_context.pb.h \ google/protobuf/struct.pb.h \ + google/protobuf/stubs/bytestream.h \ + google/protobuf/stubs/callback.h \ + google/protobuf/stubs/casts.h \ + google/protobuf/stubs/common.h \ + google/protobuf/stubs/hash.h \ + google/protobuf/stubs/logging.h \ + google/protobuf/stubs/macros.h \ + google/protobuf/stubs/map_util.h \ + google/protobuf/stubs/mutex.h \ + google/protobuf/stubs/once.h \ + google/protobuf/stubs/platform_macros.h \ + google/protobuf/stubs/port.h \ + google/protobuf/stubs/status.h \ + google/protobuf/stubs/stl_util.h \ + google/protobuf/stubs/stringpiece.h \ + google/protobuf/stubs/strutil.h \ + google/protobuf/stubs/template_util.h \ google/protobuf/text_format.h \ google/protobuf/timestamp.pb.h \ google/protobuf/type.pb.h \ google/protobuf/unknown_field_set.h \ - google/protobuf/wire_format.h \ - google/protobuf/wire_format_lite.h \ - google/protobuf/wrappers.pb.h \ - google/protobuf/io/coded_stream.h \ - $(GZHEADERS) \ - google/protobuf/io/printer.h \ - google/protobuf/io/strtod.h \ - google/protobuf/io/tokenizer.h \ - google/protobuf/io/zero_copy_stream.h \ - google/protobuf/io/zero_copy_stream_impl.h \ - google/protobuf/io/zero_copy_stream_impl_lite.h \ - google/protobuf/compiler/code_generator.h \ - google/protobuf/compiler/command_line_interface.h \ - google/protobuf/compiler/importer.h \ - google/protobuf/compiler/parser.h \ - google/protobuf/compiler/plugin.h \ - google/protobuf/compiler/plugin.pb.h \ - google/protobuf/compiler/cpp/cpp_generator.h \ - google/protobuf/compiler/csharp/csharp_generator.h \ - google/protobuf/compiler/csharp/csharp_names.h \ - google/protobuf/compiler/java/java_generator.h \ - google/protobuf/compiler/java/java_names.h \ - google/protobuf/compiler/js/js_generator.h \ - google/protobuf/compiler/js/well_known_types_embed.h \ - google/protobuf/compiler/objectivec/objectivec_generator.h \ - google/protobuf/compiler/objectivec/objectivec_helpers.h \ - google/protobuf/compiler/php/php_generator.h \ - google/protobuf/compiler/python/python_generator.h \ - google/protobuf/compiler/ruby/ruby_generator.h \ - google/protobuf/util/type_resolver.h \ google/protobuf/util/delimited_message_util.h \ google/protobuf/util/field_comparator.h \ google/protobuf/util/field_mask_util.h \ google/protobuf/util/json_util.h \ + google/protobuf/util/message_differencer.h \ google/protobuf/util/time_util.h \ + google/protobuf/util/type_resolver.h \ google/protobuf/util/type_resolver_util.h \ - google/protobuf/util/message_differencer.h + google/protobuf/wire_format.h \ + google/protobuf/wire_format_lite.h \ + google/protobuf/wrappers.pb.h lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) @@ -1786,45 +1833,45 @@ libprotobuf_lite_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ -export-dynamic -no-undefined $(am__append_1) @HAVE_LD_VERSION_SCRIPT_TRUE@EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map libprotobuf_lite_la_SOURCES = \ + google/protobuf/any_lite.cc \ + google/protobuf/arena.cc \ + google/protobuf/arenastring.cc \ + google/protobuf/extension_set.cc \ + google/protobuf/generated_enum_util.cc \ + google/protobuf/generated_message_table_driven_lite.cc \ + google/protobuf/generated_message_tctable_lite.cc \ + google/protobuf/generated_message_util.cc \ + google/protobuf/implicit_weak_message.cc \ + google/protobuf/inlined_string_field.cc \ + google/protobuf/io/coded_stream.cc \ + google/protobuf/io/io_win32.cc \ + google/protobuf/io/strtod.cc \ + google/protobuf/io/zero_copy_stream.cc \ + google/protobuf/io/zero_copy_stream_impl.cc \ + google/protobuf/io/zero_copy_stream_impl_lite.cc \ + google/protobuf/map.cc \ + google/protobuf/message_lite.cc \ + google/protobuf/parse_context.cc \ + google/protobuf/repeated_field.cc \ + google/protobuf/repeated_ptr_field.cc \ + google/protobuf/string_member_robber.h \ google/protobuf/stubs/bytestream.cc \ - google/protobuf/stubs/bytestream.h \ google/protobuf/stubs/common.cc \ - google/protobuf/stubs/hash.h \ google/protobuf/stubs/int128.cc \ google/protobuf/stubs/int128.h \ - google/protobuf/io/io_win32.cc \ - google/protobuf/stubs/map_util.h \ google/protobuf/stubs/mathutil.h \ google/protobuf/stubs/status.cc \ - google/protobuf/stubs/status.h \ google/protobuf/stubs/status_macros.h \ google/protobuf/stubs/statusor.cc \ google/protobuf/stubs/statusor.h \ google/protobuf/stubs/stringpiece.cc \ - google/protobuf/stubs/stringpiece.h \ google/protobuf/stubs/stringprintf.cc \ google/protobuf/stubs/stringprintf.h \ google/protobuf/stubs/structurally_valid.cc \ google/protobuf/stubs/strutil.cc \ google/protobuf/stubs/time.cc \ google/protobuf/stubs/time.h \ - google/protobuf/any_lite.cc \ - google/protobuf/arena.cc \ - google/protobuf/extension_set.cc \ - google/protobuf/generated_enum_util.cc \ - google/protobuf/generated_message_util.cc \ - google/protobuf/generated_message_table_driven_lite.h \ - google/protobuf/generated_message_table_driven_lite.cc \ - google/protobuf/implicit_weak_message.cc \ - google/protobuf/message_lite.cc \ - google/protobuf/parse_context.cc \ - google/protobuf/repeated_field.cc \ - google/protobuf/wire_format_lite.cc \ - google/protobuf/io/coded_stream.cc \ - google/protobuf/io/strtod.cc \ - google/protobuf/io/zero_copy_stream.cc \ - google/protobuf/io/zero_copy_stream_impl.cc \ - google/protobuf/io/zero_copy_stream_impl_lite.cc + google/protobuf/wire_format_lite.cc libprotobuf_la_LIBADD = $(PTHREAD_LIBS) $(LIBATOMIC_LIBS) libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ @@ -1832,20 +1879,26 @@ libprotobuf_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ @HAVE_LD_VERSION_SCRIPT_TRUE@EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map libprotobuf_la_SOURCES = \ $(libprotobuf_lite_la_SOURCES) \ + google/protobuf/any.cc \ google/protobuf/any.pb.cc \ google/protobuf/api.pb.cc \ - google/protobuf/any.cc \ + google/protobuf/compiler/importer.cc \ + google/protobuf/compiler/parser.cc \ google/protobuf/descriptor.cc \ - google/protobuf/descriptor_database.cc \ google/protobuf/descriptor.pb.cc \ + google/protobuf/descriptor_database.cc \ google/protobuf/duration.pb.cc \ google/protobuf/dynamic_message.cc \ google/protobuf/empty.pb.cc \ google/protobuf/extension_set_heavy.cc \ google/protobuf/field_mask.pb.cc \ + google/protobuf/generated_message_bases.cc \ google/protobuf/generated_message_reflection.cc \ - google/protobuf/generated_message_table_driven_lite.h \ google/protobuf/generated_message_table_driven.cc \ + google/protobuf/generated_message_tctable_full.cc \ + google/protobuf/io/gzip_stream.cc \ + google/protobuf/io/printer.cc \ + google/protobuf/io/tokenizer.cc \ google/protobuf/map_field.cc \ google/protobuf/message.cc \ google/protobuf/reflection_internal.h \ @@ -1859,13 +1912,6 @@ libprotobuf_la_SOURCES = \ google/protobuf/timestamp.pb.cc \ google/protobuf/type.pb.cc \ google/protobuf/unknown_field_set.cc \ - google/protobuf/wire_format.cc \ - google/protobuf/wrappers.pb.cc \ - google/protobuf/io/gzip_stream.cc \ - google/protobuf/io/printer.cc \ - google/protobuf/io/tokenizer.cc \ - google/protobuf/compiler/importer.cc \ - google/protobuf/compiler/parser.cc \ google/protobuf/util/delimited_message_util.cc \ google/protobuf/util/field_comparator.cc \ google/protobuf/util/field_mask_util.cc \ @@ -1891,23 +1937,24 @@ libprotobuf_la_SOURCES = \ google/protobuf/util/internal/object_source.h \ google/protobuf/util/internal/object_writer.cc \ google/protobuf/util/internal/object_writer.h \ + google/protobuf/util/internal/proto_writer.cc \ + google/protobuf/util/internal/proto_writer.h \ google/protobuf/util/internal/protostream_objectsource.cc \ google/protobuf/util/internal/protostream_objectsource.h \ google/protobuf/util/internal/protostream_objectwriter.cc \ google/protobuf/util/internal/protostream_objectwriter.h \ - google/protobuf/util/internal/proto_writer.cc \ - google/protobuf/util/internal/proto_writer.h \ google/protobuf/util/internal/structured_objectwriter.h \ google/protobuf/util/internal/type_info.cc \ google/protobuf/util/internal/type_info.h \ - google/protobuf/util/internal/type_info_test_helper.cc \ google/protobuf/util/internal/type_info_test_helper.h \ google/protobuf/util/internal/utility.cc \ google/protobuf/util/internal/utility.h \ google/protobuf/util/json_util.cc \ google/protobuf/util/message_differencer.cc \ google/protobuf/util/time_util.cc \ - google/protobuf/util/type_resolver_util.cc + google/protobuf/util/type_resolver_util.cc \ + google/protobuf/wire_format.cc \ + google/protobuf/wrappers.pb.cc nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la @@ -1917,13 +1964,6 @@ libprotoc_la_LDFLAGS = -version-info $(PROTOBUF_VERSION) \ libprotoc_la_SOURCES = \ google/protobuf/compiler/code_generator.cc \ google/protobuf/compiler/command_line_interface.cc \ - google/protobuf/compiler/plugin.cc \ - google/protobuf/compiler/plugin.pb.cc \ - google/protobuf/compiler/scc.h \ - google/protobuf/compiler/subprocess.cc \ - google/protobuf/compiler/subprocess.h \ - google/protobuf/compiler/zip_writer.cc \ - google/protobuf/compiler/zip_writer.h \ google/protobuf/compiler/cpp/cpp_enum.cc \ google/protobuf/compiler/cpp/cpp_enum.h \ google/protobuf/compiler/cpp/cpp_enum_field.cc \ @@ -1933,10 +1973,8 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/cpp/cpp_field.cc \ google/protobuf/compiler/cpp/cpp_field.h \ google/protobuf/compiler/cpp/cpp_file.cc \ - google/protobuf/compiler/cpp/cpp_file.h \ google/protobuf/compiler/cpp/cpp_generator.cc \ google/protobuf/compiler/cpp/cpp_helpers.cc \ - google/protobuf/compiler/cpp/cpp_helpers.h \ google/protobuf/compiler/cpp/cpp_map_field.cc \ google/protobuf/compiler/cpp/cpp_map_field.h \ google/protobuf/compiler/cpp/cpp_message.cc \ @@ -1947,21 +1985,55 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/cpp/cpp_options.h \ google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \ google/protobuf/compiler/cpp/cpp_padding_optimizer.h \ + google/protobuf/compiler/cpp/cpp_parse_function_generator.cc \ + google/protobuf/compiler/cpp/cpp_parse_function_generator.h \ google/protobuf/compiler/cpp/cpp_primitive_field.cc \ google/protobuf/compiler/cpp/cpp_primitive_field.h \ google/protobuf/compiler/cpp/cpp_service.cc \ google/protobuf/compiler/cpp/cpp_service.h \ google/protobuf/compiler/cpp/cpp_string_field.cc \ google/protobuf/compiler/cpp/cpp_string_field.h \ + google/protobuf/compiler/csharp/csharp_doc_comment.cc \ + google/protobuf/compiler/csharp/csharp_enum.cc \ + google/protobuf/compiler/csharp/csharp_enum.h \ + google/protobuf/compiler/csharp/csharp_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_enum_field.h \ + google/protobuf/compiler/csharp/csharp_field_base.cc \ + google/protobuf/compiler/csharp/csharp_field_base.h \ + google/protobuf/compiler/csharp/csharp_generator.cc \ + google/protobuf/compiler/csharp/csharp_helpers.cc \ + google/protobuf/compiler/csharp/csharp_helpers.h \ + google/protobuf/compiler/csharp/csharp_map_field.cc \ + google/protobuf/compiler/csharp/csharp_map_field.h \ + google/protobuf/compiler/csharp/csharp_message.cc \ + google/protobuf/compiler/csharp/csharp_message.h \ + google/protobuf/compiler/csharp/csharp_message_field.cc \ + google/protobuf/compiler/csharp/csharp_message_field.h \ + google/protobuf/compiler/csharp/csharp_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_reflection_class.cc \ + google/protobuf/compiler/csharp/csharp_reflection_class.h \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ + google/protobuf/compiler/csharp/csharp_source_generator_base.h \ + google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ + google/protobuf/compiler/csharp/csharp_wrapper_field.h \ google/protobuf/compiler/java/java_context.cc \ google/protobuf/compiler/java/java_context.h \ + google/protobuf/compiler/java/java_doc_comment.cc \ + google/protobuf/compiler/java/java_doc_comment.h \ google/protobuf/compiler/java/java_enum.cc \ - google/protobuf/compiler/java/java_enum_lite.cc \ + google/protobuf/compiler/java/java_enum.h \ google/protobuf/compiler/java/java_enum_field.cc \ google/protobuf/compiler/java/java_enum_field.h \ google/protobuf/compiler/java/java_enum_field_lite.cc \ google/protobuf/compiler/java/java_enum_field_lite.h \ - google/protobuf/compiler/java/java_enum.h \ + google/protobuf/compiler/java/java_enum_lite.cc \ google/protobuf/compiler/java/java_enum_lite.h \ google/protobuf/compiler/java/java_extension.cc \ google/protobuf/compiler/java/java_extension.h \ @@ -1976,22 +2048,23 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/java/java_generator_factory.h \ google/protobuf/compiler/java/java_helpers.cc \ google/protobuf/compiler/java/java_helpers.h \ + google/protobuf/compiler/java/java_kotlin_generator.cc \ google/protobuf/compiler/java/java_map_field.cc \ google/protobuf/compiler/java/java_map_field.h \ google/protobuf/compiler/java/java_map_field_lite.cc \ google/protobuf/compiler/java/java_map_field_lite.h \ google/protobuf/compiler/java/java_message.cc \ - google/protobuf/compiler/java/java_message_lite.cc \ + google/protobuf/compiler/java/java_message.h \ google/protobuf/compiler/java/java_message_builder.cc \ + google/protobuf/compiler/java/java_message_builder.h \ google/protobuf/compiler/java/java_message_builder_lite.cc \ + google/protobuf/compiler/java/java_message_builder_lite.h \ google/protobuf/compiler/java/java_message_field.cc \ google/protobuf/compiler/java/java_message_field.h \ google/protobuf/compiler/java/java_message_field_lite.cc \ google/protobuf/compiler/java/java_message_field_lite.h \ - google/protobuf/compiler/java/java_message.h \ + google/protobuf/compiler/java/java_message_lite.cc \ google/protobuf/compiler/java/java_message_lite.h \ - google/protobuf/compiler/java/java_message_builder.h \ - google/protobuf/compiler/java/java_message_builder_lite.h \ google/protobuf/compiler/java/java_name_resolver.cc \ google/protobuf/compiler/java/java_name_resolver.h \ google/protobuf/compiler/java/java_options.h \ @@ -1999,18 +2072,17 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/java/java_primitive_field.h \ google/protobuf/compiler/java/java_primitive_field_lite.cc \ google/protobuf/compiler/java/java_primitive_field_lite.h \ - google/protobuf/compiler/java/java_shared_code_generator.cc \ - google/protobuf/compiler/java/java_shared_code_generator.h \ google/protobuf/compiler/java/java_service.cc \ google/protobuf/compiler/java/java_service.h \ + google/protobuf/compiler/java/java_shared_code_generator.cc \ + google/protobuf/compiler/java/java_shared_code_generator.h \ google/protobuf/compiler/java/java_string_field.cc \ google/protobuf/compiler/java/java_string_field.h \ google/protobuf/compiler/java/java_string_field_lite.cc \ google/protobuf/compiler/java/java_string_field_lite.h \ - google/protobuf/compiler/java/java_doc_comment.cc \ - google/protobuf/compiler/java/java_doc_comment.h \ google/protobuf/compiler/js/js_generator.cc \ google/protobuf/compiler/js/well_known_types_embed.cc \ + google/protobuf/compiler/js/well_known_types_embed.h \ google/protobuf/compiler/objectivec/objectivec_enum.cc \ google/protobuf/compiler/objectivec/objectivec_enum.h \ google/protobuf/compiler/objectivec/objectivec_enum_field.cc \ @@ -2023,53 +2095,27 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/objectivec/objectivec_file.h \ google/protobuf/compiler/objectivec/objectivec_generator.cc \ google/protobuf/compiler/objectivec/objectivec_helpers.cc \ - google/protobuf/compiler/objectivec/objectivec_helpers.h \ google/protobuf/compiler/objectivec/objectivec_map_field.cc \ google/protobuf/compiler/objectivec/objectivec_map_field.h \ google/protobuf/compiler/objectivec/objectivec_message.cc \ google/protobuf/compiler/objectivec/objectivec_message.h \ google/protobuf/compiler/objectivec/objectivec_message_field.cc \ google/protobuf/compiler/objectivec/objectivec_message_field.h \ - google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h \ + google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h \ google/protobuf/compiler/objectivec/objectivec_oneof.cc \ google/protobuf/compiler/objectivec/objectivec_oneof.h \ google/protobuf/compiler/objectivec/objectivec_primitive_field.cc \ google/protobuf/compiler/objectivec/objectivec_primitive_field.h \ google/protobuf/compiler/php/php_generator.cc \ + google/protobuf/compiler/plugin.cc \ + google/protobuf/compiler/plugin.pb.cc \ google/protobuf/compiler/python/python_generator.cc \ google/protobuf/compiler/ruby/ruby_generator.cc \ - google/protobuf/compiler/csharp/csharp_doc_comment.cc \ - google/protobuf/compiler/csharp/csharp_doc_comment.h \ - google/protobuf/compiler/csharp/csharp_enum.cc \ - google/protobuf/compiler/csharp/csharp_enum.h \ - google/protobuf/compiler/csharp/csharp_enum_field.cc \ - google/protobuf/compiler/csharp/csharp_enum_field.h \ - google/protobuf/compiler/csharp/csharp_field_base.cc \ - google/protobuf/compiler/csharp/csharp_field_base.h \ - google/protobuf/compiler/csharp/csharp_generator.cc \ - google/protobuf/compiler/csharp/csharp_helpers.cc \ - google/protobuf/compiler/csharp/csharp_helpers.h \ - google/protobuf/compiler/csharp/csharp_map_field.cc \ - google/protobuf/compiler/csharp/csharp_map_field.h \ - google/protobuf/compiler/csharp/csharp_message.cc \ - google/protobuf/compiler/csharp/csharp_message.h \ - google/protobuf/compiler/csharp/csharp_message_field.cc \ - google/protobuf/compiler/csharp/csharp_message_field.h \ - google/protobuf/compiler/csharp/csharp_options.h \ - google/protobuf/compiler/csharp/csharp_primitive_field.cc \ - google/protobuf/compiler/csharp/csharp_primitive_field.h \ - google/protobuf/compiler/csharp/csharp_reflection_class.cc \ - google/protobuf/compiler/csharp/csharp_reflection_class.h \ - google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ - google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ - google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ - google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ - google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ - google/protobuf/compiler/csharp/csharp_source_generator_base.h \ - google/protobuf/compiler/csharp/csharp_wrapper_field.cc \ - google/protobuf/compiler/csharp/csharp_wrapper_field.h + google/protobuf/compiler/scc.h \ + google/protobuf/compiler/subprocess.cc \ + google/protobuf/compiler/subprocess.h \ + google/protobuf/compiler/zip_writer.cc \ + google/protobuf/compiler/zip_writer.h protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la protoc_SOURCES = google/protobuf/compiler/main.cc @@ -2078,39 +2124,38 @@ protoc_SOURCES = google/protobuf/compiler/main.cc protoc_inputs = \ google/protobuf/any_test.proto \ google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto \ + google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto \ google/protobuf/map_lite_unittest.proto \ google/protobuf/map_proto2_unittest.proto \ google/protobuf/map_unittest.proto \ + google/protobuf/unittest.proto \ google/protobuf/unittest_arena.proto \ google/protobuf/unittest_custom_options.proto \ google/protobuf/unittest_drop_unknown_fields.proto \ google/protobuf/unittest_embed_optimize_for.proto \ google/protobuf/unittest_empty.proto \ google/protobuf/unittest_enormous_descriptor.proto \ - google/protobuf/unittest_import_lite.proto \ google/protobuf/unittest_import.proto \ - google/protobuf/unittest_import_public_lite.proto \ + google/protobuf/unittest_import_lite.proto \ google/protobuf/unittest_import_public.proto \ + google/protobuf/unittest_import_public_lite.proto \ google/protobuf/unittest_lazy_dependencies.proto \ google/protobuf/unittest_lazy_dependencies_custom_option.proto \ google/protobuf/unittest_lazy_dependencies_enum.proto \ - google/protobuf/unittest_lite_imports_nonlite.proto \ google/protobuf/unittest_lite.proto \ + google/protobuf/unittest_lite_imports_nonlite.proto \ google/protobuf/unittest_mset.proto \ google/protobuf/unittest_mset_wire_format.proto \ - google/protobuf/unittest_no_arena_lite.proto \ - google/protobuf/unittest_no_arena_import.proto \ - google/protobuf/unittest_no_arena.proto \ google/protobuf/unittest_no_field_presence.proto \ google/protobuf/unittest_no_generic_services.proto \ google/protobuf/unittest_optimize_for.proto \ - google/protobuf/unittest_preserve_unknown_enum2.proto \ google/protobuf/unittest_preserve_unknown_enum.proto \ - google/protobuf/unittest.proto \ + google/protobuf/unittest_preserve_unknown_enum2.proto \ google/protobuf/unittest_proto3.proto \ google/protobuf/unittest_proto3_arena.proto \ google/protobuf/unittest_proto3_arena_lite.proto \ google/protobuf/unittest_proto3_lite.proto \ + google/protobuf/unittest_proto3_optional.proto \ google/protobuf/unittest_well_known_types.proto \ google/protobuf/util/internal/testdata/anys.proto \ google/protobuf/util/internal/testdata/books.proto \ @@ -2125,60 +2170,58 @@ protoc_inputs = \ google/protobuf/util/internal/testdata/wrappers.proto \ google/protobuf/util/json_format.proto \ google/protobuf/util/json_format_proto3.proto \ - google/protobuf/util/message_differencer_unittest.proto \ - google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto + google/protobuf/util/message_differencer_unittest.proto EXTRA_DIST = \ $(protoc_inputs) \ - solaris/libstdc++.la \ - google/protobuf/test_messages_proto3.proto \ - google/protobuf/test_messages_proto2.proto \ + README.md \ + google/protobuf/compiler/package_info.h \ + google/protobuf/compiler/ruby/ruby_generated_code.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto \ + google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \ + google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \ + google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \ + google/protobuf/compiler/zip_output_unittest.sh \ google/protobuf/io/gzip_stream.h \ google/protobuf/io/gzip_stream_unittest.sh \ + google/protobuf/io/package_info.h \ + google/protobuf/package_info.h \ + google/protobuf/test_messages_proto2.proto \ + google/protobuf/test_messages_proto3.proto \ + google/protobuf/testdata/bad_utf8_string \ google/protobuf/testdata/golden_message \ google/protobuf/testdata/golden_message_maps \ google/protobuf/testdata/golden_message_oneof_implemented \ google/protobuf/testdata/golden_message_proto3 \ google/protobuf/testdata/golden_packed_fields_message \ - google/protobuf/testdata/bad_utf8_string \ google/protobuf/testdata/map_test_data.txt \ google/protobuf/testdata/text_format_unittest_data.txt \ - google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \ - google/protobuf/testdata/text_format_unittest_data_pointy.txt \ - google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \ - google/protobuf/testdata/text_format_unittest_extensions_data.txt \ - google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \ - google/protobuf/package_info.h \ - google/protobuf/io/package_info.h \ + google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \ + google/protobuf/testdata/text_format_unittest_data_pointy.txt \ + google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \ + google/protobuf/testdata/text_format_unittest_extensions_data.txt \ + google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \ google/protobuf/util/package_info.h \ - google/protobuf/compiler/ruby/ruby_generated_code.proto \ - google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \ - google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \ - google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \ - google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \ - google/protobuf/compiler/package_info.h \ - google/protobuf/compiler/zip_output_unittest.sh \ libprotobuf-lite.map \ libprotobuf.map \ libprotoc.map \ - README.md + solaris/libstdc++.la protoc_lite_outputs = \ google/protobuf/map_lite_unittest.pb.cc \ google/protobuf/map_lite_unittest.pb.h \ - google/protobuf/unittest_lite.pb.cc \ - google/protobuf/unittest_lite.pb.h \ - google/protobuf/unittest_no_arena_lite.pb.cc \ - google/protobuf/unittest_no_arena_lite.pb.h \ google/protobuf/unittest_import_lite.pb.cc \ google/protobuf/unittest_import_lite.pb.h \ google/protobuf/unittest_import_public_lite.pb.cc \ - google/protobuf/unittest_import_public_lite.pb.h + google/protobuf/unittest_import_public_lite.pb.h \ + google/protobuf/unittest_lite.pb.cc \ + google/protobuf/unittest_lite.pb.h protoc_outputs = \ $(protoc_lite_outputs) \ @@ -2192,6 +2235,8 @@ protoc_outputs = \ google/protobuf/map_proto2_unittest.pb.h \ google/protobuf/map_unittest.pb.cc \ google/protobuf/map_unittest.pb.h \ + google/protobuf/unittest.pb.cc \ + google/protobuf/unittest.pb.h \ google/protobuf/unittest_arena.pb.cc \ google/protobuf/unittest_arena.pb.h \ google/protobuf/unittest_custom_options.pb.cc \ @@ -2220,23 +2265,17 @@ protoc_outputs = \ google/protobuf/unittest_mset.pb.h \ google/protobuf/unittest_mset_wire_format.pb.cc \ google/protobuf/unittest_mset_wire_format.pb.h \ - google/protobuf/unittest_no_arena_import.pb.cc \ - google/protobuf/unittest_no_arena_import.pb.h \ - google/protobuf/unittest_no_arena.pb.cc \ - google/protobuf/unittest_no_arena.pb.h \ google/protobuf/unittest_no_field_presence.pb.cc \ google/protobuf/unittest_no_field_presence.pb.h \ google/protobuf/unittest_no_generic_services.pb.cc \ google/protobuf/unittest_no_generic_services.pb.h \ google/protobuf/unittest_optimize_for.pb.cc \ google/protobuf/unittest_optimize_for.pb.h \ - google/protobuf/unittest.pb.cc \ - google/protobuf/unittest.pb.h \ - google/protobuf/unittest_preserve_unknown_enum2.pb.cc \ - google/protobuf/unittest_preserve_unknown_enum2.pb.h \ google/protobuf/unittest_preserve_unknown_enum.pb.cc \ google/protobuf/unittest_preserve_unknown_enum.pb.h \ - google/protobuf/unittest_proto3.pb.cc \ + google/protobuf/unittest_preserve_unknown_enum2.pb.cc \ + google/protobuf/unittest_preserve_unknown_enum2.pb.h \ + google/protobuf/unittest_proto3.pb.cc \ google/protobuf/unittest_proto3.pb.h \ google/protobuf/unittest_proto3_arena.pb.cc \ google/protobuf/unittest_proto3_arena.pb.h \ @@ -2244,6 +2283,8 @@ protoc_outputs = \ google/protobuf/unittest_proto3_arena_lite.pb.h \ google/protobuf/unittest_proto3_lite.pb.cc \ google/protobuf/unittest_proto3_lite.pb.h \ + google/protobuf/unittest_proto3_optional.pb.cc \ + google/protobuf/unittest_proto3_optional.pb.h \ google/protobuf/unittest_well_known_types.pb.cc \ google/protobuf/unittest_well_known_types.pb.h \ google/protobuf/util/internal/testdata/anys.pb.cc \ @@ -2276,19 +2317,20 @@ protoc_outputs = \ google/protobuf/util/message_differencer_unittest.pb.h COMMON_TEST_SOURCES = \ - google/protobuf/arena_test_util.cc \ - google/protobuf/arena_test_util.h \ - google/protobuf/map_test_util.inc \ + $(COMMON_LITE_TEST_SOURCES) \ + google/protobuf/compiler/cpp/cpp_unittest.h \ google/protobuf/map_test_util.h \ - google/protobuf/map_test_util_impl.h \ + google/protobuf/map_test_util.inc \ + google/protobuf/reflection_tester.cc \ + google/protobuf/reflection_tester.h \ google/protobuf/test_util.cc \ google/protobuf/test_util.h \ google/protobuf/test_util.inc \ google/protobuf/test_util2.h \ - google/protobuf/testing/googletest.cc \ - google/protobuf/testing/googletest.h \ google/protobuf/testing/file.cc \ - google/protobuf/testing/file.h + google/protobuf/testing/file.h \ + google/protobuf/testing/googletest.cc \ + google/protobuf/testing/googletest.h GOOGLETEST_BUILD_DIR = ../third_party/googletest/googletest GOOGLEMOCK_BUILD_DIR = ../third_party/googletest/googlemock @@ -2306,34 +2348,46 @@ protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \ # since test_util.cc takes forever to compile with optimization (with GCC). # See configure.ac for more info. protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS) -# Doesn't pass on Windows with MSVC -NON_MSVC_TEST_SOURCES = \ - google/protobuf/compiler/command_line_interface_unittest.cc - protobuf_test_SOURCES = \ - google/protobuf/stubs/bytestream_unittest.cc \ - google/protobuf/stubs/common_unittest.cc \ - google/protobuf/stubs/int128_unittest.cc \ - google/protobuf/io/io_win32_unittest.cc \ - google/protobuf/stubs/statusor_test.cc \ - google/protobuf/stubs/status_test.cc \ - google/protobuf/stubs/stringpiece_unittest.cc \ - google/protobuf/stubs/stringprintf_unittest.cc \ - google/protobuf/stubs/structurally_valid_unittest.cc \ - google/protobuf/stubs/strutil_unittest.cc \ - google/protobuf/stubs/template_util_unittest.cc \ - google/protobuf/stubs/time_test.cc \ + $(COMMON_TEST_SOURCES) \ google/protobuf/any_test.cc \ - google/protobuf/arenastring_unittest.cc \ google/protobuf/arena_unittest.cc \ + google/protobuf/arenastring_unittest.cc \ + google/protobuf/compiler/annotation_test_util.cc \ + google/protobuf/compiler/annotation_test_util.h \ + google/protobuf/compiler/command_line_interface_unittest.cc \ + google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc \ + google/protobuf/compiler/cpp/cpp_move_unittest.cc \ + google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \ + google/protobuf/compiler/cpp/cpp_unittest.cc \ + google/protobuf/compiler/cpp/cpp_unittest.inc \ + google/protobuf/compiler/cpp/metadata_test.cc \ + google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \ + google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ + google/protobuf/compiler/importer_unittest.cc \ + google/protobuf/compiler/java/java_doc_comment_unittest.cc \ + google/protobuf/compiler/java/java_plugin_unittest.cc \ + google/protobuf/compiler/mock_code_generator.cc \ + google/protobuf/compiler/mock_code_generator.h \ + google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ + google/protobuf/compiler/parser_unittest.cc \ + google/protobuf/compiler/python/python_plugin_unittest.cc \ + google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ google/protobuf/descriptor_database_unittest.cc \ google/protobuf/descriptor_unittest.cc \ google/protobuf/drop_unknown_fields_test.cc \ google/protobuf/dynamic_message_unittest.cc \ google/protobuf/extension_set_unittest.cc \ google/protobuf/generated_message_reflection_unittest.cc \ + google/protobuf/inlined_string_field_unittest.cc \ + google/protobuf/io/coded_stream_unittest.cc \ + google/protobuf/io/io_win32_unittest.cc \ + google/protobuf/io/printer_unittest.cc \ + google/protobuf/io/tokenizer_unittest.cc \ + google/protobuf/io/zero_copy_stream_unittest.cc \ google/protobuf/map_field_test.cc \ google/protobuf/map_test.cc \ + google/protobuf/map_test.inc \ google/protobuf/message_unittest.cc \ google/protobuf/message_unittest.inc \ google/protobuf/no_field_presence_test.cc \ @@ -2345,34 +2399,19 @@ protobuf_test_SOURCES = \ google/protobuf/reflection_ops_unittest.cc \ google/protobuf/repeated_field_reflection_unittest.cc \ google/protobuf/repeated_field_unittest.cc \ + google/protobuf/stubs/bytestream_unittest.cc \ + google/protobuf/stubs/common_unittest.cc \ + google/protobuf/stubs/int128_unittest.cc \ + google/protobuf/stubs/status_test.cc \ + google/protobuf/stubs/statusor_test.cc \ + google/protobuf/stubs/stringpiece_unittest.cc \ + google/protobuf/stubs/stringprintf_unittest.cc \ + google/protobuf/stubs/structurally_valid_unittest.cc \ + google/protobuf/stubs/strutil_unittest.cc \ + google/protobuf/stubs/template_util_unittest.cc \ + google/protobuf/stubs/time_test.cc \ google/protobuf/text_format_unittest.cc \ google/protobuf/unknown_field_set_unittest.cc \ - google/protobuf/well_known_types_unittest.cc \ - google/protobuf/wire_format_unittest.cc \ - google/protobuf/io/coded_stream_unittest.cc \ - google/protobuf/io/printer_unittest.cc \ - google/protobuf/io/tokenizer_unittest.cc \ - google/protobuf/io/zero_copy_stream_unittest.cc \ - google/protobuf/compiler/annotation_test_util.h \ - google/protobuf/compiler/annotation_test_util.cc \ - google/protobuf/compiler/importer_unittest.cc \ - google/protobuf/compiler/mock_code_generator.cc \ - google/protobuf/compiler/mock_code_generator.h \ - google/protobuf/compiler/parser_unittest.cc \ - google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc \ - google/protobuf/compiler/cpp/cpp_move_unittest.cc \ - google/protobuf/compiler/cpp/cpp_unittest.h \ - google/protobuf/compiler/cpp/cpp_unittest.cc \ - google/protobuf/compiler/cpp/cpp_unittest.inc \ - google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \ - google/protobuf/compiler/cpp/metadata_test.cc \ - google/protobuf/compiler/java/java_plugin_unittest.cc \ - google/protobuf/compiler/java/java_doc_comment_unittest.cc \ - google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ - google/protobuf/compiler/python/python_plugin_unittest.cc \ - google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ - google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \ - google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ google/protobuf/util/delimited_message_util_test.cc \ google/protobuf/util/field_comparator_test.cc \ google/protobuf/util/field_mask_util_test.cc \ @@ -2386,8 +2425,9 @@ protobuf_test_SOURCES = \ google/protobuf/util/message_differencer_unittest.cc \ google/protobuf/util/time_util_test.cc \ google/protobuf/util/type_resolver_util_test.cc \ - $(NON_MSVC_TEST_SOURCES) \ - $(COMMON_TEST_SOURCES) + google/protobuf/well_known_types_unittest.cc \ + google/protobuf/wire_format_unittest.cc \ + google/protobuf/wire_format_unittest.inc nodist_protobuf_test_SOURCES = $(protoc_outputs) @@ -2413,6 +2453,7 @@ COMMON_LITE_TEST_SOURCES = \ google/protobuf/arena_test_util.h \ google/protobuf/map_lite_test_util.cc \ google/protobuf/map_lite_test_util.h \ + google/protobuf/map_test_util_impl.h \ google/protobuf/test_util_lite.cc \ google/protobuf/test_util_lite.h @@ -2461,9 +2502,9 @@ test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \ test_plugin_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include test_plugin_SOURCES = \ google/protobuf/compiler/mock_code_generator.cc \ + google/protobuf/compiler/test_plugin.cc \ google/protobuf/testing/file.cc \ - google/protobuf/testing/file.h \ - google/protobuf/compiler/test_plugin.cc + google/protobuf/testing/file.h @HAVE_ZLIB_TRUE@zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la @HAVE_ZLIB_TRUE@zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc @@ -2600,49 +2641,6 @@ clean-libLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } -google/protobuf/stubs/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/stubs - @: > google/protobuf/stubs/$(am__dirstamp) -google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/stubs/$(DEPDIR) - @: > google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/bytestream.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/common.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/int128.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/io - @: > google/protobuf/io/$(am__dirstamp) -google/protobuf/io/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/io/$(DEPDIR) - @: > google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/io_win32.lo: google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/status.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/statusor.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/stringpiece.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/stringprintf.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/structurally_valid.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/strutil.lo: \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/time.lo: google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) google/protobuf/$(am__dirstamp): @$(MKDIR_P) google/protobuf @: > google/protobuf/$(am__dirstamp) @@ -2653,31 +2651,39 @@ google/protobuf/any_lite.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/arena.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/arenastring.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/extension_set.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/generated_enum_util.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/generated_message_util.lo: \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/generated_message_table_driven_lite.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/implicit_weak_message.lo: \ +google/protobuf/generated_message_tctable_lite.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/message_lite.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/parse_context.lo: google/protobuf/$(am__dirstamp) \ +google/protobuf/generated_message_util.lo: \ + google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/repeated_field.lo: google/protobuf/$(am__dirstamp) \ +google/protobuf/implicit_weak_message.lo: \ + google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/wire_format_lite.lo: google/protobuf/$(am__dirstamp) \ +google/protobuf/inlined_string_field.lo: \ + google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/io + @: > google/protobuf/io/$(am__dirstamp) +google/protobuf/io/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/io/$(DEPDIR) + @: > google/protobuf/io/$(DEPDIR)/$(am__dirstamp) google/protobuf/io/coded_stream.lo: \ google/protobuf/io/$(am__dirstamp) \ google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/io_win32.lo: google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) google/protobuf/io/strtod.lo: google/protobuf/io/$(am__dirstamp) \ google/protobuf/io/$(DEPDIR)/$(am__dirstamp) google/protobuf/io/zero_copy_stream.lo: \ @@ -2689,22 +2695,82 @@ google/protobuf/io/zero_copy_stream_impl.lo: \ google/protobuf/io/zero_copy_stream_impl_lite.lo: \ google/protobuf/io/$(am__dirstamp) \ google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/map.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/message_lite.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/parse_context.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/repeated_field.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/repeated_ptr_field.lo: \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/stubs + @: > google/protobuf/stubs/$(am__dirstamp) +google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/stubs/$(DEPDIR) + @: > google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/bytestream.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/common.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/int128.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/status.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/statusor.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/stringpiece.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/stringprintf.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/structurally_valid.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/strutil.lo: \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/time.lo: google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/wire_format_lite.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) libprotobuf-lite.la: $(libprotobuf_lite_la_OBJECTS) $(libprotobuf_lite_la_DEPENDENCIES) $(EXTRA_libprotobuf_lite_la_DEPENDENCIES) $(AM_V_CXXLD)$(libprotobuf_lite_la_LINK) -rpath $(libdir) $(libprotobuf_lite_la_OBJECTS) $(libprotobuf_lite_la_LIBADD) $(LIBS) +google/protobuf/any.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/any.pb.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/api.pb.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/any.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/compiler + @: > google/protobuf/compiler/$(am__dirstamp) +google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/compiler/$(DEPDIR) + @: > google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/importer.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/parser.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) google/protobuf/descriptor.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/descriptor.pb.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/descriptor_database.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/descriptor.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/duration.pb.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/dynamic_message.lo: google/protobuf/$(am__dirstamp) \ @@ -2716,12 +2782,24 @@ google/protobuf/extension_set_heavy.lo: \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/field_mask.pb.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/generated_message_bases.lo: \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/generated_message_reflection.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/generated_message_table_driven.lo: \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/generated_message_tctable_full.lo: \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/gzip_stream.lo: google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/printer.lo: google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/tokenizer.lo: google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) google/protobuf/map_field.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/message.lo: google/protobuf/$(am__dirstamp) \ @@ -2745,28 +2823,6 @@ google/protobuf/type.pb.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/unknown_field_set.lo: google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/wire_format.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/wrappers.pb.lo: google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/gzip_stream.lo: google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/printer.lo: google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/tokenizer.lo: google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler - @: > google/protobuf/compiler/$(am__dirstamp) -google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/$(DEPDIR) - @: > google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/importer.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/parser.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) google/protobuf/util/$(am__dirstamp): @$(MKDIR_P) google/protobuf/util @: > google/protobuf/util/$(am__dirstamp) @@ -2812,21 +2868,18 @@ google/protobuf/util/internal/json_stream_parser.lo: \ google/protobuf/util/internal/object_writer.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protostream_objectsource.lo: \ +google/protobuf/util/internal/proto_writer.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/protostream_objectwriter.lo: \ +google/protobuf/util/internal/protostream_objectsource.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/proto_writer.lo: \ +google/protobuf/util/internal/protostream_objectwriter.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) google/protobuf/util/internal/type_info.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) -google/protobuf/util/internal/type_info_test_helper.lo: \ - google/protobuf/util/internal/$(am__dirstamp) \ - google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) google/protobuf/util/internal/utility.lo: \ google/protobuf/util/internal/$(am__dirstamp) \ google/protobuf/util/internal/$(DEPDIR)/$(am__dirstamp) @@ -2842,6 +2895,10 @@ google/protobuf/util/time_util.lo: \ google/protobuf/util/type_resolver_util.lo: \ google/protobuf/util/$(am__dirstamp) \ google/protobuf/util/$(DEPDIR)/$(am__dirstamp) +google/protobuf/wire_format.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/wrappers.pb.lo: google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) libprotobuf.la: $(libprotobuf_la_OBJECTS) $(libprotobuf_la_DEPENDENCIES) $(EXTRA_libprotobuf_la_DEPENDENCIES) $(AM_V_CXXLD)$(libprotobuf_la_LINK) -rpath $(libdir) $(libprotobuf_la_OBJECTS) $(libprotobuf_la_LIBADD) $(LIBS) @@ -2851,18 +2908,6 @@ google/protobuf/compiler/code_generator.lo: \ google/protobuf/compiler/command_line_interface.lo: \ google/protobuf/compiler/$(am__dirstamp) \ google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/plugin.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/plugin.pb.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/subprocess.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/zip_writer.lo: \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/cpp/$(am__dirstamp): @$(MKDIR_P) google/protobuf/compiler/cpp @: > google/protobuf/compiler/cpp/$(am__dirstamp) @@ -2902,6 +2947,9 @@ google/protobuf/compiler/cpp/cpp_message_field.lo: \ google/protobuf/compiler/cpp/cpp_padding_optimizer.lo: \ google/protobuf/compiler/cpp/$(am__dirstamp) \ google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/cpp_parse_function_generator.lo: \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/cpp/cpp_primitive_field.lo: \ google/protobuf/compiler/cpp/$(am__dirstamp) \ google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) @@ -2911,6 +2959,60 @@ google/protobuf/compiler/cpp/cpp_service.lo: \ google/protobuf/compiler/cpp/cpp_string_field.lo: \ google/protobuf/compiler/cpp/$(am__dirstamp) \ google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/compiler/csharp + @: > google/protobuf/compiler/csharp/$(am__dirstamp) +google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) google/protobuf/compiler/csharp/$(DEPDIR) + @: > google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_doc_comment.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_enum.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_enum_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_field_base.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_generator.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_helpers.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_map_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_message.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_message_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_primitive_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_reflection_class.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_repeated_enum_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_repeated_message_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_repeated_primitive_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_source_generator_base.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/csharp_wrapper_field.lo: \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/$(am__dirstamp): @$(MKDIR_P) google/protobuf/compiler/java @: > google/protobuf/compiler/java/$(am__dirstamp) @@ -2920,10 +3022,10 @@ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp): google/protobuf/compiler/java/java_context.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_enum.lo: \ +google/protobuf/compiler/java/java_doc_comment.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_enum_lite.lo: \ +google/protobuf/compiler/java/java_enum.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_enum_field.lo: \ @@ -2932,6 +3034,9 @@ google/protobuf/compiler/java/java_enum_field.lo: \ google/protobuf/compiler/java/java_enum_field_lite.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/java/java_enum_lite.lo: \ + google/protobuf/compiler/java/$(am__dirstamp) \ + google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_extension.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) @@ -2953,6 +3058,9 @@ google/protobuf/compiler/java/java_generator_factory.lo: \ google/protobuf/compiler/java/java_helpers.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/java/java_kotlin_generator.lo: \ + google/protobuf/compiler/java/$(am__dirstamp) \ + google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_map_field.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) @@ -2962,9 +3070,6 @@ google/protobuf/compiler/java/java_map_field_lite.lo: \ google/protobuf/compiler/java/java_message.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_message_lite.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_message_builder.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) @@ -2977,6 +3082,9 @@ google/protobuf/compiler/java/java_message_field.lo: \ google/protobuf/compiler/java/java_message_field_lite.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/java/java_message_lite.lo: \ + google/protobuf/compiler/java/$(am__dirstamp) \ + google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_name_resolver.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) @@ -2986,10 +3094,10 @@ google/protobuf/compiler/java/java_primitive_field.lo: \ google/protobuf/compiler/java/java_primitive_field_lite.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_shared_code_generator.lo: \ +google/protobuf/compiler/java/java_service.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_service.lo: \ +google/protobuf/compiler/java/java_shared_code_generator.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/java/java_string_field.lo: \ @@ -2998,9 +3106,6 @@ google/protobuf/compiler/java/java_string_field.lo: \ google/protobuf/compiler/java/java_string_field_lite.lo: \ google/protobuf/compiler/java/$(am__dirstamp) \ google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/java_doc_comment.lo: \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/js/$(am__dirstamp): @$(MKDIR_P) google/protobuf/compiler/js @: > google/protobuf/compiler/js/$(am__dirstamp) @@ -3064,6 +3169,12 @@ google/protobuf/compiler/php/$(DEPDIR)/$(am__dirstamp): google/protobuf/compiler/php/php_generator.lo: \ google/protobuf/compiler/php/$(am__dirstamp) \ google/protobuf/compiler/php/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/plugin.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/plugin.pb.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/python/$(am__dirstamp): @$(MKDIR_P) google/protobuf/compiler/python @: > google/protobuf/compiler/python/$(am__dirstamp) @@ -3082,78 +3193,27 @@ google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp): google/protobuf/compiler/ruby/ruby_generator.lo: \ google/protobuf/compiler/ruby/$(am__dirstamp) \ google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/csharp - @: > google/protobuf/compiler/csharp/$(am__dirstamp) -google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) google/protobuf/compiler/csharp/$(DEPDIR) - @: > google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_doc_comment.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_enum.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_enum_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_field_base.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_generator.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_helpers.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_map_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_message.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_message_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_primitive_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_reflection_class.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_repeated_enum_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_repeated_message_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_repeated_primitive_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_source_generator_base.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/csharp_wrapper_field.lo: \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/subprocess.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/zip_writer.lo: \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) libprotoc.la: $(libprotoc_la_OBJECTS) $(libprotoc_la_DEPENDENCIES) $(EXTRA_libprotoc_la_DEPENDENCIES) $(AM_V_CXXLD)$(libprotoc_la_LINK) -rpath $(libdir) $(libprotoc_la_OBJECTS) $(libprotoc_la_LIBADD) $(LIBS) google/protobuf/no_warning_test-map_lite_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_no_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_import_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_import_public_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/no_warning_test-unittest_lite.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-any_test.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3169,6 +3229,9 @@ google/protobuf/no_warning_test-map_proto2_unittest.pb.$(OBJEXT): \ google/protobuf/no_warning_test-map_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/no_warning_test-unittest.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_arena.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3211,12 +3274,6 @@ google/protobuf/no_warning_test-unittest_mset.pb.$(OBJEXT): \ google/protobuf/no_warning_test-unittest_mset_wire_format.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_no_arena_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_no_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_no_field_presence.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3226,15 +3283,12 @@ google/protobuf/no_warning_test-unittest_no_generic_services.pb.$(OBJEXT): \ google/protobuf/no_warning_test-unittest_optimize_for.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest.pb.$(OBJEXT): \ +google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_proto3.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3247,6 +3301,9 @@ google/protobuf/no_warning_test-unittest_proto3_arena_lite.pb.$(OBJEXT): \ google/protobuf/no_warning_test-unittest_proto3_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/no_warning_test-unittest_proto3_optional.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/no_warning_test-unittest_well_known_types.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3308,6 +3365,15 @@ google/protobuf/compiler/cpp/protobuf_lazy_descriptor_test-cpp_unittest.$(OBJEXT google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-test_util.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3317,27 +3383,24 @@ google/protobuf/testing/$(am__dirstamp): google/protobuf/testing/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) google/protobuf/testing/$(DEPDIR) @: > google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) -google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.$(OBJEXT): \ +google/protobuf/testing/protobuf_lazy_descriptor_test-file.$(OBJEXT): \ google/protobuf/testing/$(am__dirstamp) \ google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) -google/protobuf/testing/protobuf_lazy_descriptor_test-file.$(OBJEXT): \ +google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.$(OBJEXT): \ google/protobuf/testing/$(am__dirstamp) \ google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3353,6 +3416,9 @@ google/protobuf/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.$(OBJEXT): google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3395,12 +3461,6 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_mset.pb.$(OBJEXT): \ google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3410,15 +3470,12 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.$( google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.$(OBJEXT): \ +google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3431,6 +3488,9 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.$(OB google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3495,18 +3555,15 @@ google/protobuf/protobuf_lite_arena_test-test_util_lite.$(OBJEXT): \ google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) protobuf-lite-arena-test$(EXEEXT): $(protobuf_lite_arena_test_OBJECTS) $(protobuf_lite_arena_test_DEPENDENCIES) $(EXTRA_protobuf_lite_arena_test_DEPENDENCIES) @rm -f protobuf-lite-arena-test$(EXEEXT) @@ -3526,67 +3583,100 @@ google/protobuf/protobuf_lite_test-test_util_lite.$(OBJEXT): \ google/protobuf/protobuf_lite_test-map_lite_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_test-unittest_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lite_test-unittest_import_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_lite_test-unittest_lite.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) protobuf-lite-test$(EXEEXT): $(protobuf_lite_test_OBJECTS) $(protobuf_lite_test_DEPENDENCIES) $(EXTRA_protobuf_lite_test_DEPENDENCIES) @rm -f protobuf-lite-test$(EXEEXT) $(AM_V_CXXLD)$(protobuf_lite_test_LINK) $(protobuf_lite_test_OBJECTS) $(protobuf_lite_test_LDADD) $(LIBS) -google/protobuf/stubs/protobuf_test-bytestream_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-common_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-int128_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/protobuf_test-io_win32_unittest.$(OBJEXT): \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-statusor_test.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-status_test.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-stringpiece_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-stringprintf_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-structurally_valid_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-strutil_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-template_util_unittest.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/stubs/protobuf_test-time_test.$(OBJEXT): \ - google/protobuf/stubs/$(am__dirstamp) \ - google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-any_test.$(OBJEXT): \ +google/protobuf/protobuf_test-arena_test_util.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-arenastring_unittest.$(OBJEXT): \ +google/protobuf/protobuf_test-map_lite_test_util.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-test_util_lite.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-reflection_tester.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-test_util.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/testing/protobuf_test-file.$(OBJEXT): \ + google/protobuf/testing/$(am__dirstamp) \ + google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) +google/protobuf/testing/protobuf_test-googletest.$(OBJEXT): \ + google/protobuf/testing/$(am__dirstamp) \ + google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-any_test.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-arena_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-arenastring_unittest.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/protobuf_test-annotation_test_util.$(OBJEXT): \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/protobuf_test-command_line_interface_unittest.$(OBJEXT): \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.$(OBJEXT): \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.$(OBJEXT): \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.$(OBJEXT): \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.$(OBJEXT): \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/cpp/protobuf_test-metadata_test.$(OBJEXT): \ + google/protobuf/compiler/cpp/$(am__dirstamp) \ + google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.$(OBJEXT): \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.$(OBJEXT): \ + google/protobuf/compiler/csharp/$(am__dirstamp) \ + google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/protobuf_test-importer_unittest.$(OBJEXT): \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.$(OBJEXT): \ + google/protobuf/compiler/java/$(am__dirstamp) \ + google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.$(OBJEXT): \ + google/protobuf/compiler/java/$(am__dirstamp) \ + google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/protobuf_test-mock_code_generator.$(OBJEXT): \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.$(OBJEXT): \ + google/protobuf/compiler/objectivec/$(am__dirstamp) \ + google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/protobuf_test-parser_unittest.$(OBJEXT): \ + google/protobuf/compiler/$(am__dirstamp) \ + google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.$(OBJEXT): \ + google/protobuf/compiler/python/$(am__dirstamp) \ + google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) +google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.$(OBJEXT): \ + google/protobuf/compiler/ruby/$(am__dirstamp) \ + google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-descriptor_database_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3605,6 +3695,24 @@ google/protobuf/protobuf_test-extension_set_unittest.$(OBJEXT): \ google/protobuf/protobuf_test-generated_message_reflection_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-inlined_string_field_unittest.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/protobuf_test-coded_stream_unittest.$(OBJEXT): \ + google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/protobuf_test-io_win32_unittest.$(OBJEXT): \ + google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/protobuf_test-printer_unittest.$(OBJEXT): \ + google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/protobuf_test-tokenizer_unittest.$(OBJEXT): \ + google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) +google/protobuf/io/protobuf_test-zero_copy_stream_unittest.$(OBJEXT): \ + google/protobuf/io/$(am__dirstamp) \ + google/protobuf/io/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-map_field_test.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3638,78 +3746,45 @@ google/protobuf/protobuf_test-repeated_field_reflection_unittest.$(OBJEXT): \ google/protobuf/protobuf_test-repeated_field_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-bytestream_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-common_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-int128_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-status_test.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-statusor_test.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-stringpiece_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-stringprintf_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-structurally_valid_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-strutil_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-template_util_unittest.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) +google/protobuf/stubs/protobuf_test-time_test.$(OBJEXT): \ + google/protobuf/stubs/$(am__dirstamp) \ + google/protobuf/stubs/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-text_format_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unknown_field_set_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-well_known_types_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-wire_format_unittest.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/protobuf_test-coded_stream_unittest.$(OBJEXT): \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/protobuf_test-printer_unittest.$(OBJEXT): \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/protobuf_test-tokenizer_unittest.$(OBJEXT): \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/io/protobuf_test-zero_copy_stream_unittest.$(OBJEXT): \ - google/protobuf/io/$(am__dirstamp) \ - google/protobuf/io/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/protobuf_test-annotation_test_util.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/protobuf_test-importer_unittest.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/protobuf_test-mock_code_generator.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/protobuf_test-parser_unittest.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/cpp/protobuf_test-metadata_test.$(OBJEXT): \ - google/protobuf/compiler/cpp/$(am__dirstamp) \ - google/protobuf/compiler/cpp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.$(OBJEXT): \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.$(OBJEXT): \ - google/protobuf/compiler/java/$(am__dirstamp) \ - google/protobuf/compiler/java/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.$(OBJEXT): \ - google/protobuf/compiler/objectivec/$(am__dirstamp) \ - google/protobuf/compiler/objectivec/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.$(OBJEXT): \ - google/protobuf/compiler/python/$(am__dirstamp) \ - google/protobuf/compiler/python/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.$(OBJEXT): \ - google/protobuf/compiler/ruby/$(am__dirstamp) \ - google/protobuf/compiler/ruby/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.$(OBJEXT): \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.$(OBJEXT): \ - google/protobuf/compiler/csharp/$(am__dirstamp) \ - google/protobuf/compiler/csharp/$(DEPDIR)/$(am__dirstamp) google/protobuf/util/protobuf_test-delimited_message_util_test.$(OBJEXT): \ google/protobuf/util/$(am__dirstamp) \ google/protobuf/util/$(DEPDIR)/$(am__dirstamp) @@ -3749,36 +3824,24 @@ google/protobuf/util/protobuf_test-time_util_test.$(OBJEXT): \ google/protobuf/util/protobuf_test-type_resolver_util_test.$(OBJEXT): \ google/protobuf/util/$(am__dirstamp) \ google/protobuf/util/$(DEPDIR)/$(am__dirstamp) -google/protobuf/compiler/protobuf_test-command_line_interface_unittest.$(OBJEXT): \ - google/protobuf/compiler/$(am__dirstamp) \ - google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-arena_test_util.$(OBJEXT): \ +google/protobuf/protobuf_test-well_known_types_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-test_util.$(OBJEXT): \ +google/protobuf/protobuf_test-wire_format_unittest.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/testing/protobuf_test-googletest.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) -google/protobuf/testing/protobuf_test-file.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-map_lite_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_no_arena_lite.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_import_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_import_public_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-unittest_lite.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-any_test.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3794,6 +3857,9 @@ google/protobuf/protobuf_test-map_proto2_unittest.pb.$(OBJEXT): \ google/protobuf/protobuf_test-map_unittest.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-unittest.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_arena.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3836,12 +3902,6 @@ google/protobuf/protobuf_test-unittest_mset.pb.$(OBJEXT): \ google/protobuf/protobuf_test-unittest_mset_wire_format.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_no_arena_import.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_no_arena.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_no_field_presence.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3851,15 +3911,12 @@ google/protobuf/protobuf_test-unittest_no_generic_services.pb.$(OBJEXT): \ google/protobuf/protobuf_test-unittest_optimize_for.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest.pb.$(OBJEXT): \ +google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) -google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.$(OBJEXT): \ - google/protobuf/$(am__dirstamp) \ - google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_proto3.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3872,6 +3929,9 @@ google/protobuf/protobuf_test-unittest_proto3_arena_lite.pb.$(OBJEXT): \ google/protobuf/protobuf_test-unittest_proto3_lite.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) +google/protobuf/protobuf_test-unittest_proto3_optional.pb.$(OBJEXT): \ + google/protobuf/$(am__dirstamp) \ + google/protobuf/$(DEPDIR)/$(am__dirstamp) google/protobuf/protobuf_test-unittest_well_known_types.pb.$(OBJEXT): \ google/protobuf/$(am__dirstamp) \ google/protobuf/$(DEPDIR)/$(am__dirstamp) @@ -3931,12 +3991,12 @@ protoc$(EXEEXT): $(protoc_OBJECTS) $(protoc_DEPENDENCIES) $(EXTRA_protoc_DEPENDE google/protobuf/compiler/test_plugin-mock_code_generator.$(OBJEXT): \ google/protobuf/compiler/$(am__dirstamp) \ google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) -google/protobuf/testing/test_plugin-file.$(OBJEXT): \ - google/protobuf/testing/$(am__dirstamp) \ - google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) google/protobuf/compiler/test_plugin-test_plugin.$(OBJEXT): \ google/protobuf/compiler/$(am__dirstamp) \ google/protobuf/compiler/$(DEPDIR)/$(am__dirstamp) +google/protobuf/testing/test_plugin-file.$(OBJEXT): \ + google/protobuf/testing/$(am__dirstamp) \ + google/protobuf/testing/$(DEPDIR)/$(am__dirstamp) test_plugin$(EXEEXT): $(test_plugin_OBJECTS) $(test_plugin_DEPENDENCIES) $(EXTRA_test_plugin_DEPENDENCIES) @rm -f test_plugin$(EXEEXT) @@ -3998,6 +4058,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/any_lite.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/api.pb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/arena.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/arenastring.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/descriptor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/descriptor.pb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/descriptor_database.Plo@am__quote@ # am--include-marker @@ -4008,11 +4069,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/extension_set_heavy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/field_mask.pb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_enum_util.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_bases.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_reflection.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_table_driven.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_table_driven_lite.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_tctable_full.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_tctable_lite.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/generated_message_util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/implicit_weak_message.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/inlined_string_field.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/map.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/map_field.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/message.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/message_lite.Plo@am__quote@ # am--include-marker @@ -4038,9 +4104,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po@am__quote@ # am--include-marker @@ -4050,14 +4113,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/parse_context.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po@am__quote@ # am--include-marker @@ -4076,9 +4143,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po@am__quote@ # am--include-marker @@ -4088,6 +4152,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po@am__quote@ # am--include-marker @@ -4097,7 +4162,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Po@am__quote@ # am--include-marker @@ -4106,7 +4170,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po@am__quote@ # am--include-marker @@ -4118,7 +4181,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po@am__quote@ # am--include-marker @@ -4130,9 +4195,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Po@am__quote@ # am--include-marker @@ -4152,9 +4219,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po@am__quote@ # am--include-marker @@ -4164,12 +4228,14 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/reflection_ops.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/repeated_field.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/repeated_ptr_field.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/service.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/source_context.pb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/$(DEPDIR)/struct.pb.Plo@am__quote@ # am--include-marker @@ -4207,6 +4273,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message_field.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_padding_optimizer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_parse_function_generator.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_primitive_field.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_service.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/cpp/$(DEPDIR)/cpp_string_field.Plo@am__quote@ # am--include-marker @@ -4253,6 +4320,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_generator.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_generator_factory.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_helpers.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_kotlin_generator.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_map_field.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_map_field_lite.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/compiler/java/$(DEPDIR)/java_message.Plo@am__quote@ # am--include-marker @@ -4374,7 +4442,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protostream_objectsource.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/protostream_objectwriter.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/type_info.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/type_info_test_helper.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/$(DEPDIR)/utility.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po@am__quote@ # am--include-marker @@ -4468,38 +4535,10 @@ google/protobuf/no_warning_test-map_lite_unittest.pb.obj: google/protobuf/map_li @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-map_lite_unittest.pb.obj `if test -f 'google/protobuf/map_lite_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_unittest.pb.cc'; fi` -google/protobuf/no_warning_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc - -google/protobuf/no_warning_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_no_arena_lite.pb.o: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc - -google/protobuf/no_warning_test-unittest_no_arena_lite.pb.obj: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_import_lite.pb.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/no_warning_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_import_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_import_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_import_lite.pb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc @@ -4524,6 +4563,20 @@ google/protobuf/no_warning_test-unittest_import_public_lite.pb.obj: google/proto @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_import_public_lite.pb.obj `if test -f 'google/protobuf/unittest_import_public_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public_lite.pb.cc'; fi` +google/protobuf/no_warning_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc + +google/protobuf/no_warning_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/no_warning_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` + google/protobuf/no_warning_test-any_test.pb.o: google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-any_test.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Tpo -c -o google/protobuf/no_warning_test-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-any_test.pb.Po @@ -4594,6 +4647,20 @@ google/protobuf/no_warning_test-map_unittest.pb.obj: google/protobuf/map_unittes @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-map_unittest.pb.obj `if test -f 'google/protobuf/map_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_unittest.pb.cc'; fi` +google/protobuf/no_warning_test-unittest.pb.o: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo -c -o google/protobuf/no_warning_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/no_warning_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc + +google/protobuf/no_warning_test-unittest.pb.obj: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo -c -o google/protobuf/no_warning_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/no_warning_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` + google/protobuf/no_warning_test-unittest_arena.pb.o: google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_arena.pb.Po @@ -4790,34 +4857,6 @@ google/protobuf/no_warning_test-unittest_mset_wire_format.pb.obj: google/protobu @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_mset_wire_format.pb.obj `if test -f 'google/protobuf/unittest_mset_wire_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset_wire_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset_wire_format.pb.cc'; fi` -google/protobuf/no_warning_test-unittest_no_arena_import.pb.o: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena_import.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc - -google/protobuf/no_warning_test-unittest_no_arena_import.pb.obj: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena_import.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` - -google/protobuf/no_warning_test-unittest_no_arena.pb.o: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc - -google/protobuf/no_warning_test-unittest_no_arena.pb.obj: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/no_warning_test-unittest_no_arena.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` - google/protobuf/no_warning_test-unittest_no_field_presence.pb.o: google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_no_field_presence.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_no_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Po @@ -4860,19 +4899,19 @@ google/protobuf/no_warning_test-unittest_optimize_for.pb.obj: google/protobuf/un @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_optimize_for.pb.cc'; fi` -google/protobuf/no_warning_test-unittest.pb.o: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo -c -o google/protobuf/no_warning_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/no_warning_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -google/protobuf/no_warning_test-unittest.pb.obj: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo -c -o google/protobuf/no_warning_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/no_warning_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.o: google/protobuf/unittest_preserve_unknown_enum2.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum2.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc @@ -4888,20 +4927,6 @@ google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.obj: google/p @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum2.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; fi` -google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc - -google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` - google/protobuf/no_warning_test-unittest_proto3.pb.o: google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_proto3.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3.pb.Po @@ -4958,6 +4983,20 @@ google/protobuf/no_warning_test-unittest_proto3_lite.pb.obj: google/protobuf/uni @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_proto3_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_lite.pb.cc'; fi` +google/protobuf/no_warning_test-unittest_proto3_optional.pb.o: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_proto3_optional.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_optional.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc + +google/protobuf/no_warning_test-unittest_proto3_optional.pb.obj: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_proto3_optional.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/no_warning_test-unittest_proto3_optional.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/no_warning_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` + google/protobuf/no_warning_test-unittest_well_known_types.pb.o: google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(no_warning_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/no_warning_test-unittest_well_known_types.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Tpo -c -o google/protobuf/no_warning_test-unittest_well_known_types.pb.o `test -f 'google/protobuf/unittest_well_known_types.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Tpo google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Po @@ -5196,6 +5235,48 @@ google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.obj: google/protob @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-arena_test_util.obj `if test -f 'google/protobuf/arena_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/arena_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_test_util.cc'; fi` +google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.o: google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.o `test -f 'google/protobuf/map_lite_test_util.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.o `test -f 'google/protobuf/map_lite_test_util.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_test_util.cc + +google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.obj: google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.obj `if test -f 'google/protobuf/map_lite_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_test_util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_test_util.cc' object='google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_test_util.obj `if test -f 'google/protobuf/map_lite_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_test_util.cc'; fi` + +google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.o: google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc + +google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.obj: google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.obj `if test -f 'google/protobuf/test_util_lite.cc'; then $(CYGPATH_W) 'google/protobuf/test_util_lite.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util_lite.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util_lite.obj `if test -f 'google/protobuf/test_util_lite.cc'; then $(CYGPATH_W) 'google/protobuf/test_util_lite.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util_lite.cc'; fi` + +google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.o: google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.o `test -f 'google/protobuf/reflection_tester.cc' || echo '$(srcdir)/'`google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_tester.cc' object='google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.o `test -f 'google/protobuf/reflection_tester.cc' || echo '$(srcdir)/'`google/protobuf/reflection_tester.cc + +google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.obj: google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.obj `if test -f 'google/protobuf/reflection_tester.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_tester.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_tester.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_tester.cc' object='google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-reflection_tester.obj `if test -f 'google/protobuf/reflection_tester.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_tester.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_tester.cc'; fi` + google/protobuf/protobuf_lazy_descriptor_test-test_util.o: google/protobuf/test_util.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util.o `test -f 'google/protobuf/test_util.cc' || echo '$(srcdir)/'`google/protobuf/test_util.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Po @@ -5210,20 +5291,6 @@ google/protobuf/protobuf_lazy_descriptor_test-test_util.obj: google/protobuf/tes @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-test_util.obj `if test -f 'google/protobuf/test_util.cc'; then $(CYGPATH_W) 'google/protobuf/test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util.cc'; fi` -google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o: google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc - -google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj: google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` - google/protobuf/testing/protobuf_lazy_descriptor_test-file.o: google/protobuf/testing/file.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_lazy_descriptor_test-file.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Tpo -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-file.Po @@ -5238,6 +5305,20 @@ google/protobuf/testing/protobuf_lazy_descriptor_test-file.obj: google/protobuf/ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` +google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o: google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc + +google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj: google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_lazy_descriptor_test-googletest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_lazy_descriptor_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` + google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.o: google/protobuf/map_lite_unittest.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Po @@ -5252,34 +5333,6 @@ google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.obj: google/p @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-map_lite_unittest.pb.obj `if test -f 'google/protobuf/map_lite_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_unittest.pb.cc'; fi` -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.o: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.obj: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` - google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_import_lite.pb.Po @@ -5308,6 +5361,20 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.obj @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_import_public_lite.pb.obj `if test -f 'google/protobuf/unittest_import_public_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public_lite.pb.cc'; fi` +google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc + +google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` + google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.o: google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Po @@ -5378,6 +5445,20 @@ google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.obj: google/protob @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-map_unittest.pb.obj `if test -f 'google/protobuf/map_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_unittest.pb.cc'; fi` +google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc + +google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` + google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.o: google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Po @@ -5574,34 +5655,6 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.obj: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.obj `if test -f 'google/protobuf/unittest_mset_wire_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset_wire_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset_wire_format.pb.cc'; fi` -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.o: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.obj: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.o: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.obj: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` - google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.o: google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Po @@ -5644,19 +5697,19 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.obj: goog @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_optimize_for.pb.cc'; fi` -google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.o: google/protobuf/unittest_preserve_unknown_enum2.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc @@ -5672,20 +5725,6 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum2.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; fi` -google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc - -google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` - google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.o: google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3.pb.Po @@ -5742,6 +5781,20 @@ google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.obj: googl @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_lite.pb.cc'; fi` +google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.o: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc + +google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.obj: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` + google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.o: google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lazy_descriptor_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lazy_descriptor_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Tpo -c -o google/protobuf/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.o `test -f 'google/protobuf/unittest_well_known_types.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Po @@ -6022,34 +6075,6 @@ google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.obj: google/protob @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-map_lite_unittest.pb.obj `if test -f 'google/protobuf/map_lite_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_unittest.pb.cc'; fi` -google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc - -google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` - -google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.o: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc - -google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.obj: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` - google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Po @@ -6078,6 +6103,20 @@ google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.obj: goo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_import_public_lite.pb.obj `if test -f 'google/protobuf/unittest_import_public_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public_lite.pb.cc'; fi` +google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc + +google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_arena_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_arena_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_arena_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` + google/protobuf/protobuf_lite_test-lite_unittest.o: google/protobuf/lite_unittest.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-lite_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Tpo -c -o google/protobuf/protobuf_lite_test-lite_unittest.o `test -f 'google/protobuf/lite_unittest.cc' || echo '$(srcdir)/'`google/protobuf/lite_unittest.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Po @@ -6148,34 +6187,6 @@ google/protobuf/protobuf_lite_test-map_lite_unittest.pb.obj: google/protobuf/map @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-map_lite_unittest.pb.obj `if test -f 'google/protobuf/map_lite_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_unittest.pb.cc'; fi` -google/protobuf/protobuf_lite_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc - -google/protobuf/protobuf_lite_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` - -google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.o: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc - -google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.obj: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` - google/protobuf/protobuf_lite_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Po @@ -6204,173 +6215,117 @@ google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.obj: google/pr @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_import_public_lite.pb.obj `if test -f 'google/protobuf/unittest_import_public_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public_lite.pb.cc'; fi` -google/protobuf/stubs/protobuf_test-bytestream_unittest.o: google/protobuf/stubs/bytestream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-bytestream_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.o `test -f 'google/protobuf/stubs/bytestream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/bytestream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/bytestream_unittest.cc' object='google/protobuf/stubs/protobuf_test-bytestream_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.o `test -f 'google/protobuf/stubs/bytestream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/bytestream_unittest.cc - -google/protobuf/stubs/protobuf_test-bytestream_unittest.obj: google/protobuf/stubs/bytestream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-bytestream_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.obj `if test -f 'google/protobuf/stubs/bytestream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/bytestream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/bytestream_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/bytestream_unittest.cc' object='google/protobuf/stubs/protobuf_test-bytestream_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.obj `if test -f 'google/protobuf/stubs/bytestream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/bytestream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/bytestream_unittest.cc'; fi` - -google/protobuf/stubs/protobuf_test-common_unittest.o: google/protobuf/stubs/common_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-common_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-common_unittest.o `test -f 'google/protobuf/stubs/common_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/common_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/common_unittest.cc' object='google/protobuf/stubs/protobuf_test-common_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-common_unittest.o `test -f 'google/protobuf/stubs/common_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/common_unittest.cc - -google/protobuf/stubs/protobuf_test-common_unittest.obj: google/protobuf/stubs/common_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-common_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-common_unittest.obj `if test -f 'google/protobuf/stubs/common_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/common_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/common_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/common_unittest.cc' object='google/protobuf/stubs/protobuf_test-common_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-common_unittest.obj `if test -f 'google/protobuf/stubs/common_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/common_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/common_unittest.cc'; fi` - -google/protobuf/stubs/protobuf_test-int128_unittest.o: google/protobuf/stubs/int128_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-int128_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-int128_unittest.o `test -f 'google/protobuf/stubs/int128_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/int128_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/int128_unittest.cc' object='google/protobuf/stubs/protobuf_test-int128_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-int128_unittest.o `test -f 'google/protobuf/stubs/int128_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/int128_unittest.cc - -google/protobuf/stubs/protobuf_test-int128_unittest.obj: google/protobuf/stubs/int128_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-int128_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-int128_unittest.obj `if test -f 'google/protobuf/stubs/int128_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/int128_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/int128_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/int128_unittest.cc' object='google/protobuf/stubs/protobuf_test-int128_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-int128_unittest.obj `if test -f 'google/protobuf/stubs/int128_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/int128_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/int128_unittest.cc'; fi` - -google/protobuf/io/protobuf_test-io_win32_unittest.o: google/protobuf/io/io_win32_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-io_win32_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo -c -o google/protobuf/io/protobuf_test-io_win32_unittest.o `test -f 'google/protobuf/io/io_win32_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/io_win32_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/io_win32_unittest.cc' object='google/protobuf/io/protobuf_test-io_win32_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-io_win32_unittest.o `test -f 'google/protobuf/io/io_win32_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/io_win32_unittest.cc - -google/protobuf/io/protobuf_test-io_win32_unittest.obj: google/protobuf/io/io_win32_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-io_win32_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo -c -o google/protobuf/io/protobuf_test-io_win32_unittest.obj `if test -f 'google/protobuf/io/io_win32_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/io_win32_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/io_win32_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/io_win32_unittest.cc' object='google/protobuf/io/protobuf_test-io_win32_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-io_win32_unittest.obj `if test -f 'google/protobuf/io/io_win32_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/io_win32_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/io_win32_unittest.cc'; fi` - -google/protobuf/stubs/protobuf_test-statusor_test.o: google/protobuf/stubs/statusor_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-statusor_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo -c -o google/protobuf/stubs/protobuf_test-statusor_test.o `test -f 'google/protobuf/stubs/statusor_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/statusor_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/statusor_test.cc' object='google/protobuf/stubs/protobuf_test-statusor_test.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_lite_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-statusor_test.o `test -f 'google/protobuf/stubs/statusor_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/statusor_test.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -google/protobuf/stubs/protobuf_test-statusor_test.obj: google/protobuf/stubs/statusor_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-statusor_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo -c -o google/protobuf/stubs/protobuf_test-statusor_test.obj `if test -f 'google/protobuf/stubs/statusor_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/statusor_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/statusor_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/statusor_test.cc' object='google/protobuf/stubs/protobuf_test-statusor_test.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_lite_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_lite_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_lite_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-statusor_test.obj `if test -f 'google/protobuf/stubs/statusor_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/statusor_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/statusor_test.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_lite_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_lite_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_lite_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -google/protobuf/stubs/protobuf_test-status_test.o: google/protobuf/stubs/status_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-status_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo -c -o google/protobuf/stubs/protobuf_test-status_test.o `test -f 'google/protobuf/stubs/status_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/status_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/status_test.cc' object='google/protobuf/stubs/protobuf_test-status_test.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-arena_test_util.o: google/protobuf/arena_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arena_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_test-arena_test_util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-status_test.o `test -f 'google/protobuf/stubs/status_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/status_test.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc -google/protobuf/stubs/protobuf_test-status_test.obj: google/protobuf/stubs/status_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-status_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo -c -o google/protobuf/stubs/protobuf_test-status_test.obj `if test -f 'google/protobuf/stubs/status_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/status_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/status_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/status_test.cc' object='google/protobuf/stubs/protobuf_test-status_test.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-arena_test_util.obj: google/protobuf/arena_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arena_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_test-arena_test_util.obj `if test -f 'google/protobuf/arena_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/arena_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_test_util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_test-arena_test_util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-status_test.obj `if test -f 'google/protobuf/stubs/status_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/status_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/status_test.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arena_test_util.obj `if test -f 'google/protobuf/arena_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/arena_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_test_util.cc'; fi` -google/protobuf/stubs/protobuf_test-stringpiece_unittest.o: google/protobuf/stubs/stringpiece_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringpiece_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.o `test -f 'google/protobuf/stubs/stringpiece_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringpiece_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringpiece_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringpiece_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-map_lite_test_util.o: google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-map_lite_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_test-map_lite_test_util.o `test -f 'google/protobuf/map_lite_test_util.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_test_util.cc' object='google/protobuf/protobuf_test-map_lite_test_util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.o `test -f 'google/protobuf/stubs/stringpiece_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringpiece_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-map_lite_test_util.o `test -f 'google/protobuf/map_lite_test_util.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_test_util.cc -google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj: google/protobuf/stubs/stringpiece_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj `if test -f 'google/protobuf/stubs/stringpiece_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringpiece_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringpiece_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringpiece_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-map_lite_test_util.obj: google/protobuf/map_lite_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-map_lite_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Tpo -c -o google/protobuf/protobuf_test-map_lite_test_util.obj `if test -f 'google/protobuf/map_lite_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_test_util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_lite_test_util.cc' object='google/protobuf/protobuf_test-map_lite_test_util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj `if test -f 'google/protobuf/stubs/stringpiece_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringpiece_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringpiece_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-map_lite_test_util.obj `if test -f 'google/protobuf/map_lite_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_test_util.cc'; fi` -google/protobuf/stubs/protobuf_test-stringprintf_unittest.o: google/protobuf/stubs/stringprintf_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringprintf_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.o `test -f 'google/protobuf/stubs/stringprintf_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringprintf_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringprintf_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringprintf_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-test_util_lite.o: google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util_lite.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_test-test_util_lite.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.o `test -f 'google/protobuf/stubs/stringprintf_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringprintf_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util_lite.o `test -f 'google/protobuf/test_util_lite.cc' || echo '$(srcdir)/'`google/protobuf/test_util_lite.cc -google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj: google/protobuf/stubs/stringprintf_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj `if test -f 'google/protobuf/stubs/stringprintf_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringprintf_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringprintf_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringprintf_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-test_util_lite.obj: google/protobuf/test_util_lite.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util_lite.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Tpo -c -o google/protobuf/protobuf_test-test_util_lite.obj `if test -f 'google/protobuf/test_util_lite.cc'; then $(CYGPATH_W) 'google/protobuf/test_util_lite.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util_lite.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util_lite.cc' object='google/protobuf/protobuf_test-test_util_lite.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj `if test -f 'google/protobuf/stubs/stringprintf_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringprintf_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringprintf_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util_lite.obj `if test -f 'google/protobuf/test_util_lite.cc'; then $(CYGPATH_W) 'google/protobuf/test_util_lite.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util_lite.cc'; fi` -google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o: google/protobuf/stubs/structurally_valid_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o `test -f 'google/protobuf/stubs/structurally_valid_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/structurally_valid_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/structurally_valid_unittest.cc' object='google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-reflection_tester.o: google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-reflection_tester.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Tpo -c -o google/protobuf/protobuf_test-reflection_tester.o `test -f 'google/protobuf/reflection_tester.cc' || echo '$(srcdir)/'`google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Tpo google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_tester.cc' object='google/protobuf/protobuf_test-reflection_tester.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o `test -f 'google/protobuf/stubs/structurally_valid_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/structurally_valid_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-reflection_tester.o `test -f 'google/protobuf/reflection_tester.cc' || echo '$(srcdir)/'`google/protobuf/reflection_tester.cc -google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj: google/protobuf/stubs/structurally_valid_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj `if test -f 'google/protobuf/stubs/structurally_valid_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/structurally_valid_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/structurally_valid_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/structurally_valid_unittest.cc' object='google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-reflection_tester.obj: google/protobuf/reflection_tester.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-reflection_tester.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Tpo -c -o google/protobuf/protobuf_test-reflection_tester.obj `if test -f 'google/protobuf/reflection_tester.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_tester.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_tester.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Tpo google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/reflection_tester.cc' object='google/protobuf/protobuf_test-reflection_tester.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj `if test -f 'google/protobuf/stubs/structurally_valid_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/structurally_valid_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/structurally_valid_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-reflection_tester.obj `if test -f 'google/protobuf/reflection_tester.cc'; then $(CYGPATH_W) 'google/protobuf/reflection_tester.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/reflection_tester.cc'; fi` -google/protobuf/stubs/protobuf_test-strutil_unittest.o: google/protobuf/stubs/strutil_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-strutil_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.o `test -f 'google/protobuf/stubs/strutil_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/strutil_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/strutil_unittest.cc' object='google/protobuf/stubs/protobuf_test-strutil_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-test_util.o: google/protobuf/test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo -c -o google/protobuf/protobuf_test-test_util.o `test -f 'google/protobuf/test_util.cc' || echo '$(srcdir)/'`google/protobuf/test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_test-test_util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.o `test -f 'google/protobuf/stubs/strutil_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/strutil_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util.o `test -f 'google/protobuf/test_util.cc' || echo '$(srcdir)/'`google/protobuf/test_util.cc -google/protobuf/stubs/protobuf_test-strutil_unittest.obj: google/protobuf/stubs/strutil_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-strutil_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.obj `if test -f 'google/protobuf/stubs/strutil_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/strutil_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/strutil_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/strutil_unittest.cc' object='google/protobuf/stubs/protobuf_test-strutil_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-test_util.obj: google/protobuf/test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo -c -o google/protobuf/protobuf_test-test_util.obj `if test -f 'google/protobuf/test_util.cc'; then $(CYGPATH_W) 'google/protobuf/test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_test-test_util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.obj `if test -f 'google/protobuf/stubs/strutil_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/strutil_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/strutil_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util.obj `if test -f 'google/protobuf/test_util.cc'; then $(CYGPATH_W) 'google/protobuf/test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util.cc'; fi` -google/protobuf/stubs/protobuf_test-template_util_unittest.o: google/protobuf/stubs/template_util_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-template_util_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.o `test -f 'google/protobuf/stubs/template_util_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/template_util_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/template_util_unittest.cc' object='google/protobuf/stubs/protobuf_test-template_util_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/testing/protobuf_test-file.o: google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-file.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo -c -o google/protobuf/testing/protobuf_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_test-file.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.o `test -f 'google/protobuf/stubs/template_util_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/template_util_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc -google/protobuf/stubs/protobuf_test-template_util_unittest.obj: google/protobuf/stubs/template_util_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-template_util_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.obj `if test -f 'google/protobuf/stubs/template_util_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/template_util_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/template_util_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/template_util_unittest.cc' object='google/protobuf/stubs/protobuf_test-template_util_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/testing/protobuf_test-file.obj: google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-file.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo -c -o google/protobuf/testing/protobuf_test-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_test-file.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.obj `if test -f 'google/protobuf/stubs/template_util_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/template_util_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/template_util_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` -google/protobuf/stubs/protobuf_test-time_test.o: google/protobuf/stubs/time_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-time_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo -c -o google/protobuf/stubs/protobuf_test-time_test.o `test -f 'google/protobuf/stubs/time_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/time_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/time_test.cc' object='google/protobuf/stubs/protobuf_test-time_test.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/testing/protobuf_test-googletest.o: google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-googletest.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_test-googletest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-time_test.o `test -f 'google/protobuf/stubs/time_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/time_test.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc -google/protobuf/stubs/protobuf_test-time_test.obj: google/protobuf/stubs/time_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-time_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo -c -o google/protobuf/stubs/protobuf_test-time_test.obj `if test -f 'google/protobuf/stubs/time_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/time_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/time_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/time_test.cc' object='google/protobuf/stubs/protobuf_test-time_test.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/testing/protobuf_test-googletest.obj: google/protobuf/testing/googletest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-googletest.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_test-googletest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-time_test.obj `if test -f 'google/protobuf/stubs/time_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/time_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/time_test.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` google/protobuf/protobuf_test-any_test.o: google/protobuf/any_test.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-any_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-any_test.Tpo -c -o google/protobuf/protobuf_test-any_test.o `test -f 'google/protobuf/any_test.cc' || echo '$(srcdir)/'`google/protobuf/any_test.cc @@ -6386,20 +6341,6 @@ google/protobuf/protobuf_test-any_test.obj: google/protobuf/any_test.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-any_test.obj `if test -f 'google/protobuf/any_test.cc'; then $(CYGPATH_W) 'google/protobuf/any_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/any_test.cc'; fi` -google/protobuf/protobuf_test-arenastring_unittest.o: google/protobuf/arenastring_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arenastring_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo -c -o google/protobuf/protobuf_test-arenastring_unittest.o `test -f 'google/protobuf/arenastring_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arenastring_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenastring_unittest.cc' object='google/protobuf/protobuf_test-arenastring_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arenastring_unittest.o `test -f 'google/protobuf/arenastring_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arenastring_unittest.cc - -google/protobuf/protobuf_test-arenastring_unittest.obj: google/protobuf/arenastring_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arenastring_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo -c -o google/protobuf/protobuf_test-arenastring_unittest.obj `if test -f 'google/protobuf/arenastring_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/arenastring_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenastring_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenastring_unittest.cc' object='google/protobuf/protobuf_test-arenastring_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arenastring_unittest.obj `if test -f 'google/protobuf/arenastring_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/arenastring_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenastring_unittest.cc'; fi` - google/protobuf/protobuf_test-arena_unittest.o: google/protobuf/arena_unittest.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arena_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Tpo -c -o google/protobuf/protobuf_test-arena_unittest.o `test -f 'google/protobuf/arena_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arena_unittest.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_unittest.Po @@ -6414,33 +6355,285 @@ google/protobuf/protobuf_test-arena_unittest.obj: google/protobuf/arena_unittest @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arena_unittest.obj `if test -f 'google/protobuf/arena_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/arena_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_unittest.cc'; fi` -google/protobuf/protobuf_test-descriptor_database_unittest.o: google/protobuf/descriptor_database_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_database_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_database_unittest.o `test -f 'google/protobuf/descriptor_database_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_database_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_database_unittest.cc' object='google/protobuf/protobuf_test-descriptor_database_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-arenastring_unittest.o: google/protobuf/arenastring_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arenastring_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo -c -o google/protobuf/protobuf_test-arenastring_unittest.o `test -f 'google/protobuf/arenastring_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arenastring_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenastring_unittest.cc' object='google/protobuf/protobuf_test-arenastring_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_database_unittest.o `test -f 'google/protobuf/descriptor_database_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_database_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arenastring_unittest.o `test -f 'google/protobuf/arenastring_unittest.cc' || echo '$(srcdir)/'`google/protobuf/arenastring_unittest.cc -google/protobuf/protobuf_test-descriptor_database_unittest.obj: google/protobuf/descriptor_database_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_database_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_database_unittest.obj `if test -f 'google/protobuf/descriptor_database_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_database_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_database_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_database_unittest.cc' object='google/protobuf/protobuf_test-descriptor_database_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-arenastring_unittest.obj: google/protobuf/arenastring_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arenastring_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo -c -o google/protobuf/protobuf_test-arenastring_unittest.obj `if test -f 'google/protobuf/arenastring_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/arenastring_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenastring_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arenastring_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arenastring_unittest.cc' object='google/protobuf/protobuf_test-arenastring_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_database_unittest.obj `if test -f 'google/protobuf/descriptor_database_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_database_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_database_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arenastring_unittest.obj `if test -f 'google/protobuf/arenastring_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/arenastring_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arenastring_unittest.cc'; fi` -google/protobuf/protobuf_test-descriptor_unittest.o: google/protobuf/descriptor_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_unittest.o `test -f 'google/protobuf/descriptor_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_unittest.cc' object='google/protobuf/protobuf_test-descriptor_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/compiler/protobuf_test-annotation_test_util.o: google/protobuf/compiler/annotation_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-annotation_test_util.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.o `test -f 'google/protobuf/compiler/annotation_test_util.cc' || echo '$(srcdir)/'`google/protobuf/compiler/annotation_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/annotation_test_util.cc' object='google/protobuf/compiler/protobuf_test-annotation_test_util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_unittest.o `test -f 'google/protobuf/descriptor_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.o `test -f 'google/protobuf/compiler/annotation_test_util.cc' || echo '$(srcdir)/'`google/protobuf/compiler/annotation_test_util.cc -google/protobuf/protobuf_test-descriptor_unittest.obj: google/protobuf/descriptor_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_unittest.obj `if test -f 'google/protobuf/descriptor_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_unittest.cc' object='google/protobuf/protobuf_test-descriptor_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/compiler/protobuf_test-annotation_test_util.obj: google/protobuf/compiler/annotation_test_util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-annotation_test_util.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.obj `if test -f 'google/protobuf/compiler/annotation_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/annotation_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/annotation_test_util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/annotation_test_util.cc' object='google/protobuf/compiler/protobuf_test-annotation_test_util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_unittest.obj `if test -f 'google/protobuf/descriptor_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.obj `if test -f 'google/protobuf/compiler/annotation_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/annotation_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/annotation_test_util.cc'; fi` + +google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o: google/protobuf/compiler/command_line_interface_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o `test -f 'google/protobuf/compiler/command_line_interface_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/command_line_interface_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/command_line_interface_unittest.cc' object='google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o `test -f 'google/protobuf/compiler/command_line_interface_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/command_line_interface_unittest.cc + +google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj: google/protobuf/compiler/command_line_interface_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj `if test -f 'google/protobuf/compiler/command_line_interface_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/command_line_interface_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/command_line_interface_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/command_line_interface_unittest.cc' object='google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj `if test -f 'google/protobuf/compiler/command_line_interface_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/command_line_interface_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/command_line_interface_unittest.cc'; fi` + +google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o: google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc + +google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj: google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; fi` + +google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o: google/protobuf/compiler/cpp/cpp_move_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_move_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_move_unittest.cc + +google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj: google/protobuf/compiler/cpp/cpp_move_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_move_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_move_unittest.cc'; fi` + +google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o: google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_plugin_unittest.cc + +google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj: google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; fi` + +google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o: google/protobuf/compiler/cpp/cpp_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_unittest.cc + +google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj: google/protobuf/compiler/cpp/cpp_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_unittest.cc'; fi` + +google/protobuf/compiler/cpp/protobuf_test-metadata_test.o: google/protobuf/compiler/cpp/metadata_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-metadata_test.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.o `test -f 'google/protobuf/compiler/cpp/metadata_test.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/metadata_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/metadata_test.cc' object='google/protobuf/compiler/cpp/protobuf_test-metadata_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.o `test -f 'google/protobuf/compiler/cpp/metadata_test.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/metadata_test.cc + +google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj: google/protobuf/compiler/cpp/metadata_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj `if test -f 'google/protobuf/compiler/cpp/metadata_test.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/metadata_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/metadata_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/metadata_test.cc' object='google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj `if test -f 'google/protobuf/compiler/cpp/metadata_test.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/metadata_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/metadata_test.cc'; fi` + +google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o: google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc + +google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj: google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; fi` + +google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o: google/protobuf/compiler/csharp/csharp_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_generator_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_generator_unittest.cc + +google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj: google/protobuf/compiler/csharp/csharp_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_generator_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; fi` + +google/protobuf/compiler/protobuf_test-importer_unittest.o: google/protobuf/compiler/importer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-importer_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-importer_unittest.o `test -f 'google/protobuf/compiler/importer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/importer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/importer_unittest.cc' object='google/protobuf/compiler/protobuf_test-importer_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-importer_unittest.o `test -f 'google/protobuf/compiler/importer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/importer_unittest.cc + +google/protobuf/compiler/protobuf_test-importer_unittest.obj: google/protobuf/compiler/importer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-importer_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-importer_unittest.obj `if test -f 'google/protobuf/compiler/importer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/importer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/importer_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/importer_unittest.cc' object='google/protobuf/compiler/protobuf_test-importer_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-importer_unittest.obj `if test -f 'google/protobuf/compiler/importer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/importer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/importer_unittest.cc'; fi` + +google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o: google/protobuf/compiler/java/java_doc_comment_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_doc_comment_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_doc_comment_unittest.cc + +google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj: google/protobuf/compiler/java/java_doc_comment_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_doc_comment_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_doc_comment_unittest.cc'; fi` + +google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o: google/protobuf/compiler/java/java_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o `test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o `test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_plugin_unittest.cc + +google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj: google/protobuf/compiler/java/java_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_plugin_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_plugin_unittest.cc'; fi` + +google/protobuf/compiler/protobuf_test-mock_code_generator.o: google/protobuf/compiler/mock_code_generator.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-mock_code_generator.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.o `test -f 'google/protobuf/compiler/mock_code_generator.cc' || echo '$(srcdir)/'`google/protobuf/compiler/mock_code_generator.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/protobuf_test-mock_code_generator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.o `test -f 'google/protobuf/compiler/mock_code_generator.cc' || echo '$(srcdir)/'`google/protobuf/compiler/mock_code_generator.cc + +google/protobuf/compiler/protobuf_test-mock_code_generator.obj: google/protobuf/compiler/mock_code_generator.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-mock_code_generator.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.obj `if test -f 'google/protobuf/compiler/mock_code_generator.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/mock_code_generator.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/mock_code_generator.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/protobuf_test-mock_code_generator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.obj `if test -f 'google/protobuf/compiler/mock_code_generator.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/mock_code_generator.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/mock_code_generator.cc'; fi` + +google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o: google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o -MD -MP -MF google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o `test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' object='google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o `test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc + +google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj: google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj -MD -MP -MF google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj `if test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' object='google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj `if test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; fi` + +google/protobuf/compiler/protobuf_test-parser_unittest.o: google/protobuf/compiler/parser_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-parser_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-parser_unittest.o `test -f 'google/protobuf/compiler/parser_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/parser_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/parser_unittest.cc' object='google/protobuf/compiler/protobuf_test-parser_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-parser_unittest.o `test -f 'google/protobuf/compiler/parser_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/parser_unittest.cc + +google/protobuf/compiler/protobuf_test-parser_unittest.obj: google/protobuf/compiler/parser_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-parser_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-parser_unittest.obj `if test -f 'google/protobuf/compiler/parser_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/parser_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/parser_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/parser_unittest.cc' object='google/protobuf/compiler/protobuf_test-parser_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-parser_unittest.obj `if test -f 'google/protobuf/compiler/parser_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/parser_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/parser_unittest.cc'; fi` + +google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o: google/protobuf/compiler/python/python_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o `test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/python_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/python_plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o `test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/python_plugin_unittest.cc + +google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj: google/protobuf/compiler/python/python_plugin_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/python_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/python/python_plugin_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/python_plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/python_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/python/python_plugin_unittest.cc'; fi` + +google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o: google/protobuf/compiler/ruby/ruby_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o -MD -MP -MF google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o `test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/ruby/ruby_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/ruby/ruby_generator_unittest.cc' object='google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o `test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/ruby/ruby_generator_unittest.cc + +google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj: google/protobuf/compiler/ruby/ruby_generator_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj -MD -MP -MF google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj `if test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/ruby/ruby_generator_unittest.cc' object='google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj `if test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; fi` + +google/protobuf/protobuf_test-descriptor_database_unittest.o: google/protobuf/descriptor_database_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_database_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_database_unittest.o `test -f 'google/protobuf/descriptor_database_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_database_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_database_unittest.cc' object='google/protobuf/protobuf_test-descriptor_database_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_database_unittest.o `test -f 'google/protobuf/descriptor_database_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_database_unittest.cc + +google/protobuf/protobuf_test-descriptor_database_unittest.obj: google/protobuf/descriptor_database_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_database_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_database_unittest.obj `if test -f 'google/protobuf/descriptor_database_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_database_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_database_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_database_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_database_unittest.cc' object='google/protobuf/protobuf_test-descriptor_database_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_database_unittest.obj `if test -f 'google/protobuf/descriptor_database_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_database_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_database_unittest.cc'; fi` + +google/protobuf/protobuf_test-descriptor_unittest.o: google/protobuf/descriptor_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_unittest.o `test -f 'google/protobuf/descriptor_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_unittest.cc' object='google/protobuf/protobuf_test-descriptor_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_unittest.o `test -f 'google/protobuf/descriptor_unittest.cc' || echo '$(srcdir)/'`google/protobuf/descriptor_unittest.cc + +google/protobuf/protobuf_test-descriptor_unittest.obj: google/protobuf/descriptor_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-descriptor_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo -c -o google/protobuf/protobuf_test-descriptor_unittest.obj `if test -f 'google/protobuf/descriptor_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-descriptor_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/descriptor_unittest.cc' object='google/protobuf/protobuf_test-descriptor_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-descriptor_unittest.obj `if test -f 'google/protobuf/descriptor_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/descriptor_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/descriptor_unittest.cc'; fi` google/protobuf/protobuf_test-drop_unknown_fields_test.o: google/protobuf/drop_unknown_fields_test.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-drop_unknown_fields_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-drop_unknown_fields_test.Tpo -c -o google/protobuf/protobuf_test-drop_unknown_fields_test.o `test -f 'google/protobuf/drop_unknown_fields_test.cc' || echo '$(srcdir)/'`google/protobuf/drop_unknown_fields_test.cc @@ -6498,9 +6691,93 @@ google/protobuf/protobuf_test-generated_message_reflection_unittest.obj: google/ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-generated_message_reflection_unittest.obj `if test -f 'google/protobuf/generated_message_reflection_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/generated_message_reflection_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/generated_message_reflection_unittest.cc'; fi` -google/protobuf/protobuf_test-map_field_test.o: google/protobuf/map_field_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-map_field_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Tpo -c -o google/protobuf/protobuf_test-map_field_test.o `test -f 'google/protobuf/map_field_test.cc' || echo '$(srcdir)/'`google/protobuf/map_field_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po +google/protobuf/protobuf_test-inlined_string_field_unittest.o: google/protobuf/inlined_string_field_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-inlined_string_field_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Tpo -c -o google/protobuf/protobuf_test-inlined_string_field_unittest.o `test -f 'google/protobuf/inlined_string_field_unittest.cc' || echo '$(srcdir)/'`google/protobuf/inlined_string_field_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/inlined_string_field_unittest.cc' object='google/protobuf/protobuf_test-inlined_string_field_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-inlined_string_field_unittest.o `test -f 'google/protobuf/inlined_string_field_unittest.cc' || echo '$(srcdir)/'`google/protobuf/inlined_string_field_unittest.cc + +google/protobuf/protobuf_test-inlined_string_field_unittest.obj: google/protobuf/inlined_string_field_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-inlined_string_field_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Tpo -c -o google/protobuf/protobuf_test-inlined_string_field_unittest.obj `if test -f 'google/protobuf/inlined_string_field_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/inlined_string_field_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/inlined_string_field_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/inlined_string_field_unittest.cc' object='google/protobuf/protobuf_test-inlined_string_field_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-inlined_string_field_unittest.obj `if test -f 'google/protobuf/inlined_string_field_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/inlined_string_field_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/inlined_string_field_unittest.cc'; fi` + +google/protobuf/io/protobuf_test-coded_stream_unittest.o: google/protobuf/io/coded_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-coded_stream_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.o `test -f 'google/protobuf/io/coded_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/coded_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/coded_stream_unittest.cc' object='google/protobuf/io/protobuf_test-coded_stream_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.o `test -f 'google/protobuf/io/coded_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/coded_stream_unittest.cc + +google/protobuf/io/protobuf_test-coded_stream_unittest.obj: google/protobuf/io/coded_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-coded_stream_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.obj `if test -f 'google/protobuf/io/coded_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/coded_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/coded_stream_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/coded_stream_unittest.cc' object='google/protobuf/io/protobuf_test-coded_stream_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.obj `if test -f 'google/protobuf/io/coded_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/coded_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/coded_stream_unittest.cc'; fi` + +google/protobuf/io/protobuf_test-io_win32_unittest.o: google/protobuf/io/io_win32_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-io_win32_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo -c -o google/protobuf/io/protobuf_test-io_win32_unittest.o `test -f 'google/protobuf/io/io_win32_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/io_win32_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/io_win32_unittest.cc' object='google/protobuf/io/protobuf_test-io_win32_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-io_win32_unittest.o `test -f 'google/protobuf/io/io_win32_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/io_win32_unittest.cc + +google/protobuf/io/protobuf_test-io_win32_unittest.obj: google/protobuf/io/io_win32_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-io_win32_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo -c -o google/protobuf/io/protobuf_test-io_win32_unittest.obj `if test -f 'google/protobuf/io/io_win32_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/io_win32_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/io_win32_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-io_win32_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/io_win32_unittest.cc' object='google/protobuf/io/protobuf_test-io_win32_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-io_win32_unittest.obj `if test -f 'google/protobuf/io/io_win32_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/io_win32_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/io_win32_unittest.cc'; fi` + +google/protobuf/io/protobuf_test-printer_unittest.o: google/protobuf/io/printer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-printer_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-printer_unittest.o `test -f 'google/protobuf/io/printer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/printer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/printer_unittest.cc' object='google/protobuf/io/protobuf_test-printer_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-printer_unittest.o `test -f 'google/protobuf/io/printer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/printer_unittest.cc + +google/protobuf/io/protobuf_test-printer_unittest.obj: google/protobuf/io/printer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-printer_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-printer_unittest.obj `if test -f 'google/protobuf/io/printer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/printer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/printer_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/printer_unittest.cc' object='google/protobuf/io/protobuf_test-printer_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-printer_unittest.obj `if test -f 'google/protobuf/io/printer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/printer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/printer_unittest.cc'; fi` + +google/protobuf/io/protobuf_test-tokenizer_unittest.o: google/protobuf/io/tokenizer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-tokenizer_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.o `test -f 'google/protobuf/io/tokenizer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/tokenizer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/tokenizer_unittest.cc' object='google/protobuf/io/protobuf_test-tokenizer_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.o `test -f 'google/protobuf/io/tokenizer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/tokenizer_unittest.cc + +google/protobuf/io/protobuf_test-tokenizer_unittest.obj: google/protobuf/io/tokenizer_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-tokenizer_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.obj `if test -f 'google/protobuf/io/tokenizer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/tokenizer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/tokenizer_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/tokenizer_unittest.cc' object='google/protobuf/io/protobuf_test-tokenizer_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.obj `if test -f 'google/protobuf/io/tokenizer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/tokenizer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/tokenizer_unittest.cc'; fi` + +google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o: google/protobuf/io/zero_copy_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o `test -f 'google/protobuf/io/zero_copy_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/zero_copy_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/zero_copy_stream_unittest.cc' object='google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o `test -f 'google/protobuf/io/zero_copy_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/zero_copy_stream_unittest.cc + +google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj: google/protobuf/io/zero_copy_stream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj `if test -f 'google/protobuf/io/zero_copy_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/zero_copy_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/zero_copy_stream_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/zero_copy_stream_unittest.cc' object='google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj `if test -f 'google/protobuf/io/zero_copy_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/zero_copy_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/zero_copy_stream_unittest.cc'; fi` + +google/protobuf/protobuf_test-map_field_test.o: google/protobuf/map_field_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-map_field_test.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Tpo -c -o google/protobuf/protobuf_test-map_field_test.o `test -f 'google/protobuf/map_field_test.cc' || echo '$(srcdir)/'`google/protobuf/map_field_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Tpo google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/map_field_test.cc' object='google/protobuf/protobuf_test-map_field_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-map_field_test.o `test -f 'google/protobuf/map_field_test.cc' || echo '$(srcdir)/'`google/protobuf/map_field_test.cc @@ -6652,341 +6929,187 @@ google/protobuf/protobuf_test-repeated_field_unittest.obj: google/protobuf/repea @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-repeated_field_unittest.obj `if test -f 'google/protobuf/repeated_field_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/repeated_field_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/repeated_field_unittest.cc'; fi` -google/protobuf/protobuf_test-text_format_unittest.o: google/protobuf/text_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-text_format_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo -c -o google/protobuf/protobuf_test-text_format_unittest.o `test -f 'google/protobuf/text_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/text_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/text_format_unittest.cc' object='google/protobuf/protobuf_test-text_format_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-text_format_unittest.o `test -f 'google/protobuf/text_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/text_format_unittest.cc - -google/protobuf/protobuf_test-text_format_unittest.obj: google/protobuf/text_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-text_format_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo -c -o google/protobuf/protobuf_test-text_format_unittest.obj `if test -f 'google/protobuf/text_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/text_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/text_format_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/text_format_unittest.cc' object='google/protobuf/protobuf_test-text_format_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-text_format_unittest.obj `if test -f 'google/protobuf/text_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/text_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/text_format_unittest.cc'; fi` - -google/protobuf/protobuf_test-unknown_field_set_unittest.o: google/protobuf/unknown_field_set_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unknown_field_set_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.o `test -f 'google/protobuf/unknown_field_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/unknown_field_set_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unknown_field_set_unittest.cc' object='google/protobuf/protobuf_test-unknown_field_set_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.o `test -f 'google/protobuf/unknown_field_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/unknown_field_set_unittest.cc - -google/protobuf/protobuf_test-unknown_field_set_unittest.obj: google/protobuf/unknown_field_set_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unknown_field_set_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.obj `if test -f 'google/protobuf/unknown_field_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/unknown_field_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unknown_field_set_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unknown_field_set_unittest.cc' object='google/protobuf/protobuf_test-unknown_field_set_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.obj `if test -f 'google/protobuf/unknown_field_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/unknown_field_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unknown_field_set_unittest.cc'; fi` - -google/protobuf/protobuf_test-well_known_types_unittest.o: google/protobuf/well_known_types_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-well_known_types_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo -c -o google/protobuf/protobuf_test-well_known_types_unittest.o `test -f 'google/protobuf/well_known_types_unittest.cc' || echo '$(srcdir)/'`google/protobuf/well_known_types_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/well_known_types_unittest.cc' object='google/protobuf/protobuf_test-well_known_types_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-well_known_types_unittest.o `test -f 'google/protobuf/well_known_types_unittest.cc' || echo '$(srcdir)/'`google/protobuf/well_known_types_unittest.cc - -google/protobuf/protobuf_test-well_known_types_unittest.obj: google/protobuf/well_known_types_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-well_known_types_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo -c -o google/protobuf/protobuf_test-well_known_types_unittest.obj `if test -f 'google/protobuf/well_known_types_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/well_known_types_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/well_known_types_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/well_known_types_unittest.cc' object='google/protobuf/protobuf_test-well_known_types_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-well_known_types_unittest.obj `if test -f 'google/protobuf/well_known_types_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/well_known_types_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/well_known_types_unittest.cc'; fi` - -google/protobuf/protobuf_test-wire_format_unittest.o: google/protobuf/wire_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-wire_format_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo -c -o google/protobuf/protobuf_test-wire_format_unittest.o `test -f 'google/protobuf/wire_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/wire_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/wire_format_unittest.cc' object='google/protobuf/protobuf_test-wire_format_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-wire_format_unittest.o `test -f 'google/protobuf/wire_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/wire_format_unittest.cc - -google/protobuf/protobuf_test-wire_format_unittest.obj: google/protobuf/wire_format_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-wire_format_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo -c -o google/protobuf/protobuf_test-wire_format_unittest.obj `if test -f 'google/protobuf/wire_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/wire_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/wire_format_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/wire_format_unittest.cc' object='google/protobuf/protobuf_test-wire_format_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-wire_format_unittest.obj `if test -f 'google/protobuf/wire_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/wire_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/wire_format_unittest.cc'; fi` - -google/protobuf/io/protobuf_test-coded_stream_unittest.o: google/protobuf/io/coded_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-coded_stream_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.o `test -f 'google/protobuf/io/coded_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/coded_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/coded_stream_unittest.cc' object='google/protobuf/io/protobuf_test-coded_stream_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.o `test -f 'google/protobuf/io/coded_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/coded_stream_unittest.cc - -google/protobuf/io/protobuf_test-coded_stream_unittest.obj: google/protobuf/io/coded_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-coded_stream_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.obj `if test -f 'google/protobuf/io/coded_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/coded_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/coded_stream_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-coded_stream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/coded_stream_unittest.cc' object='google/protobuf/io/protobuf_test-coded_stream_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-coded_stream_unittest.obj `if test -f 'google/protobuf/io/coded_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/coded_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/coded_stream_unittest.cc'; fi` - -google/protobuf/io/protobuf_test-printer_unittest.o: google/protobuf/io/printer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-printer_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-printer_unittest.o `test -f 'google/protobuf/io/printer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/printer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/printer_unittest.cc' object='google/protobuf/io/protobuf_test-printer_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-printer_unittest.o `test -f 'google/protobuf/io/printer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/printer_unittest.cc - -google/protobuf/io/protobuf_test-printer_unittest.obj: google/protobuf/io/printer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-printer_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-printer_unittest.obj `if test -f 'google/protobuf/io/printer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/printer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/printer_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-printer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/printer_unittest.cc' object='google/protobuf/io/protobuf_test-printer_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-printer_unittest.obj `if test -f 'google/protobuf/io/printer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/printer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/printer_unittest.cc'; fi` - -google/protobuf/io/protobuf_test-tokenizer_unittest.o: google/protobuf/io/tokenizer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-tokenizer_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.o `test -f 'google/protobuf/io/tokenizer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/tokenizer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/tokenizer_unittest.cc' object='google/protobuf/io/protobuf_test-tokenizer_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.o `test -f 'google/protobuf/io/tokenizer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/tokenizer_unittest.cc - -google/protobuf/io/protobuf_test-tokenizer_unittest.obj: google/protobuf/io/tokenizer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-tokenizer_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.obj `if test -f 'google/protobuf/io/tokenizer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/tokenizer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/tokenizer_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-tokenizer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/tokenizer_unittest.cc' object='google/protobuf/io/protobuf_test-tokenizer_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-tokenizer_unittest.obj `if test -f 'google/protobuf/io/tokenizer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/tokenizer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/tokenizer_unittest.cc'; fi` - -google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o: google/protobuf/io/zero_copy_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o `test -f 'google/protobuf/io/zero_copy_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/zero_copy_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/zero_copy_stream_unittest.cc' object='google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.o `test -f 'google/protobuf/io/zero_copy_stream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/io/zero_copy_stream_unittest.cc - -google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj: google/protobuf/io/zero_copy_stream_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj -MD -MP -MF google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj `if test -f 'google/protobuf/io/zero_copy_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/zero_copy_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/zero_copy_stream_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Tpo google/protobuf/io/$(DEPDIR)/protobuf_test-zero_copy_stream_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/io/zero_copy_stream_unittest.cc' object='google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/io/protobuf_test-zero_copy_stream_unittest.obj `if test -f 'google/protobuf/io/zero_copy_stream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/io/zero_copy_stream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/io/zero_copy_stream_unittest.cc'; fi` - -google/protobuf/compiler/protobuf_test-annotation_test_util.o: google/protobuf/compiler/annotation_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-annotation_test_util.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.o `test -f 'google/protobuf/compiler/annotation_test_util.cc' || echo '$(srcdir)/'`google/protobuf/compiler/annotation_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/annotation_test_util.cc' object='google/protobuf/compiler/protobuf_test-annotation_test_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.o `test -f 'google/protobuf/compiler/annotation_test_util.cc' || echo '$(srcdir)/'`google/protobuf/compiler/annotation_test_util.cc - -google/protobuf/compiler/protobuf_test-annotation_test_util.obj: google/protobuf/compiler/annotation_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-annotation_test_util.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.obj `if test -f 'google/protobuf/compiler/annotation_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/annotation_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/annotation_test_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-annotation_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/annotation_test_util.cc' object='google/protobuf/compiler/protobuf_test-annotation_test_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-annotation_test_util.obj `if test -f 'google/protobuf/compiler/annotation_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/annotation_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/annotation_test_util.cc'; fi` - -google/protobuf/compiler/protobuf_test-importer_unittest.o: google/protobuf/compiler/importer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-importer_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-importer_unittest.o `test -f 'google/protobuf/compiler/importer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/importer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/importer_unittest.cc' object='google/protobuf/compiler/protobuf_test-importer_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-importer_unittest.o `test -f 'google/protobuf/compiler/importer_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/importer_unittest.cc - -google/protobuf/compiler/protobuf_test-importer_unittest.obj: google/protobuf/compiler/importer_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-importer_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-importer_unittest.obj `if test -f 'google/protobuf/compiler/importer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/importer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/importer_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-importer_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/importer_unittest.cc' object='google/protobuf/compiler/protobuf_test-importer_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-importer_unittest.obj `if test -f 'google/protobuf/compiler/importer_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/importer_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/importer_unittest.cc'; fi` - -google/protobuf/compiler/protobuf_test-mock_code_generator.o: google/protobuf/compiler/mock_code_generator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-mock_code_generator.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.o `test -f 'google/protobuf/compiler/mock_code_generator.cc' || echo '$(srcdir)/'`google/protobuf/compiler/mock_code_generator.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/protobuf_test-mock_code_generator.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.o `test -f 'google/protobuf/compiler/mock_code_generator.cc' || echo '$(srcdir)/'`google/protobuf/compiler/mock_code_generator.cc - -google/protobuf/compiler/protobuf_test-mock_code_generator.obj: google/protobuf/compiler/mock_code_generator.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-mock_code_generator.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.obj `if test -f 'google/protobuf/compiler/mock_code_generator.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/mock_code_generator.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/mock_code_generator.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-mock_code_generator.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/mock_code_generator.cc' object='google/protobuf/compiler/protobuf_test-mock_code_generator.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-mock_code_generator.obj `if test -f 'google/protobuf/compiler/mock_code_generator.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/mock_code_generator.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/mock_code_generator.cc'; fi` - -google/protobuf/compiler/protobuf_test-parser_unittest.o: google/protobuf/compiler/parser_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-parser_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-parser_unittest.o `test -f 'google/protobuf/compiler/parser_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/parser_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/parser_unittest.cc' object='google/protobuf/compiler/protobuf_test-parser_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-bytestream_unittest.o: google/protobuf/stubs/bytestream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-bytestream_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.o `test -f 'google/protobuf/stubs/bytestream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/bytestream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/bytestream_unittest.cc' object='google/protobuf/stubs/protobuf_test-bytestream_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-parser_unittest.o `test -f 'google/protobuf/compiler/parser_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/parser_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.o `test -f 'google/protobuf/stubs/bytestream_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/bytestream_unittest.cc -google/protobuf/compiler/protobuf_test-parser_unittest.obj: google/protobuf/compiler/parser_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-parser_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-parser_unittest.obj `if test -f 'google/protobuf/compiler/parser_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/parser_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/parser_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-parser_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/parser_unittest.cc' object='google/protobuf/compiler/protobuf_test-parser_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-bytestream_unittest.obj: google/protobuf/stubs/bytestream_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-bytestream_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.obj `if test -f 'google/protobuf/stubs/bytestream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/bytestream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/bytestream_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-bytestream_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/bytestream_unittest.cc' object='google/protobuf/stubs/protobuf_test-bytestream_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-parser_unittest.obj `if test -f 'google/protobuf/compiler/parser_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/parser_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/parser_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-bytestream_unittest.obj `if test -f 'google/protobuf/stubs/bytestream_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/bytestream_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/bytestream_unittest.cc'; fi` -google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o: google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-common_unittest.o: google/protobuf/stubs/common_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-common_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-common_unittest.o `test -f 'google/protobuf/stubs/common_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/common_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/common_unittest.cc' object='google/protobuf/stubs/protobuf_test-common_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-common_unittest.o `test -f 'google/protobuf/stubs/common_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/common_unittest.cc -google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj: google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-common_unittest.obj: google/protobuf/stubs/common_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-common_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-common_unittest.obj `if test -f 'google/protobuf/stubs/common_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/common_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/common_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-common_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/common_unittest.cc' object='google/protobuf/stubs/protobuf_test-common_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-common_unittest.obj `if test -f 'google/protobuf/stubs/common_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/common_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/common_unittest.cc'; fi` -google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o: google/protobuf/compiler/cpp/cpp_move_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_move_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-int128_unittest.o: google/protobuf/stubs/int128_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-int128_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-int128_unittest.o `test -f 'google/protobuf/stubs/int128_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/int128_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/int128_unittest.cc' object='google/protobuf/stubs/protobuf_test-int128_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_move_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-int128_unittest.o `test -f 'google/protobuf/stubs/int128_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/int128_unittest.cc -google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj: google/protobuf/compiler/cpp/cpp_move_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_move_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_move_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_move_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-int128_unittest.obj: google/protobuf/stubs/int128_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-int128_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-int128_unittest.obj `if test -f 'google/protobuf/stubs/int128_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/int128_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/int128_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-int128_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/int128_unittest.cc' object='google/protobuf/stubs/protobuf_test-int128_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_move_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_move_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_move_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-int128_unittest.obj `if test -f 'google/protobuf/stubs/int128_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/int128_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/int128_unittest.cc'; fi` -google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o: google/protobuf/compiler/cpp/cpp_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-status_test.o: google/protobuf/stubs/status_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-status_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo -c -o google/protobuf/stubs/protobuf_test-status_test.o `test -f 'google/protobuf/stubs/status_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/status_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/status_test.cc' object='google/protobuf/stubs/protobuf_test-status_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-status_test.o `test -f 'google/protobuf/stubs/status_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/status_test.cc -google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj: google/protobuf/compiler/cpp/cpp_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-status_test.obj: google/protobuf/stubs/status_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-status_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo -c -o google/protobuf/stubs/protobuf_test-status_test.obj `if test -f 'google/protobuf/stubs/status_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/status_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/status_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-status_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/status_test.cc' object='google/protobuf/stubs/protobuf_test-status_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-status_test.obj `if test -f 'google/protobuf/stubs/status_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/status_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/status_test.cc'; fi` -google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o: google/protobuf/compiler/cpp/cpp_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-statusor_test.o: google/protobuf/stubs/statusor_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-statusor_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo -c -o google/protobuf/stubs/protobuf_test-statusor_test.o `test -f 'google/protobuf/stubs/statusor_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/statusor_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/statusor_test.cc' object='google/protobuf/stubs/protobuf_test-statusor_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.o `test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-statusor_test.o `test -f 'google/protobuf/stubs/statusor_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/statusor_test.cc -google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj: google/protobuf/compiler/cpp/cpp_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-cpp_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/cpp_plugin_unittest.cc' object='google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-statusor_test.obj: google/protobuf/stubs/statusor_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-statusor_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo -c -o google/protobuf/stubs/protobuf_test-statusor_test.obj `if test -f 'google/protobuf/stubs/statusor_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/statusor_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/statusor_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-statusor_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/statusor_test.cc' object='google/protobuf/stubs/protobuf_test-statusor_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-cpp_plugin_unittest.obj `if test -f 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-statusor_test.obj `if test -f 'google/protobuf/stubs/statusor_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/statusor_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/statusor_test.cc'; fi` -google/protobuf/compiler/cpp/protobuf_test-metadata_test.o: google/protobuf/compiler/cpp/metadata_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-metadata_test.o -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.o `test -f 'google/protobuf/compiler/cpp/metadata_test.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/metadata_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/metadata_test.cc' object='google/protobuf/compiler/cpp/protobuf_test-metadata_test.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-stringpiece_unittest.o: google/protobuf/stubs/stringpiece_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringpiece_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.o `test -f 'google/protobuf/stubs/stringpiece_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringpiece_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringpiece_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringpiece_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.o `test -f 'google/protobuf/compiler/cpp/metadata_test.cc' || echo '$(srcdir)/'`google/protobuf/compiler/cpp/metadata_test.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.o `test -f 'google/protobuf/stubs/stringpiece_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringpiece_unittest.cc -google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj: google/protobuf/compiler/cpp/metadata_test.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj -MD -MP -MF google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj `if test -f 'google/protobuf/compiler/cpp/metadata_test.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/metadata_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/metadata_test.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Tpo google/protobuf/compiler/cpp/$(DEPDIR)/protobuf_test-metadata_test.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/cpp/metadata_test.cc' object='google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj: google/protobuf/stubs/stringpiece_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj `if test -f 'google/protobuf/stubs/stringpiece_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringpiece_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringpiece_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringpiece_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringpiece_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/cpp/protobuf_test-metadata_test.obj `if test -f 'google/protobuf/compiler/cpp/metadata_test.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/cpp/metadata_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/cpp/metadata_test.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringpiece_unittest.obj `if test -f 'google/protobuf/stubs/stringpiece_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringpiece_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringpiece_unittest.cc'; fi` -google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o: google/protobuf/compiler/java/java_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o `test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-stringprintf_unittest.o: google/protobuf/stubs/stringprintf_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringprintf_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.o `test -f 'google/protobuf/stubs/stringprintf_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringprintf_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringprintf_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringprintf_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.o `test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_plugin_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.o `test -f 'google/protobuf/stubs/stringprintf_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/stringprintf_unittest.cc -google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj: google/protobuf/compiler/java/java_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_plugin_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj: google/protobuf/stubs/stringprintf_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj `if test -f 'google/protobuf/stubs/stringprintf_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringprintf_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringprintf_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-stringprintf_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/stringprintf_unittest.cc' object='google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_plugin_unittest.obj `if test -f 'google/protobuf/compiler/java/java_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_plugin_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-stringprintf_unittest.obj `if test -f 'google/protobuf/stubs/stringprintf_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/stringprintf_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/stringprintf_unittest.cc'; fi` -google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o: google/protobuf/compiler/java/java_doc_comment_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_doc_comment_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o: google/protobuf/stubs/structurally_valid_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o `test -f 'google/protobuf/stubs/structurally_valid_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/structurally_valid_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/structurally_valid_unittest.cc' object='google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.o `test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/java/java_doc_comment_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.o `test -f 'google/protobuf/stubs/structurally_valid_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/structurally_valid_unittest.cc -google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj: google/protobuf/compiler/java/java_doc_comment_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj -MD -MP -MF google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_doc_comment_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Tpo google/protobuf/compiler/java/$(DEPDIR)/protobuf_test-java_doc_comment_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/java/java_doc_comment_unittest.cc' object='google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj: google/protobuf/stubs/structurally_valid_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj `if test -f 'google/protobuf/stubs/structurally_valid_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/structurally_valid_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/structurally_valid_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-structurally_valid_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/structurally_valid_unittest.cc' object='google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/java/protobuf_test-java_doc_comment_unittest.obj `if test -f 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/java/java_doc_comment_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/java/java_doc_comment_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-structurally_valid_unittest.obj `if test -f 'google/protobuf/stubs/structurally_valid_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/structurally_valid_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/structurally_valid_unittest.cc'; fi` -google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o: google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o -MD -MP -MF google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o `test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' object='google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-strutil_unittest.o: google/protobuf/stubs/strutil_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-strutil_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.o `test -f 'google/protobuf/stubs/strutil_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/strutil_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/strutil_unittest.cc' object='google/protobuf/stubs/protobuf_test-strutil_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.o `test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.o `test -f 'google/protobuf/stubs/strutil_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/strutil_unittest.cc -google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj: google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj -MD -MP -MF google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj `if test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Tpo google/protobuf/compiler/objectivec/$(DEPDIR)/protobuf_test-objectivec_helpers_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc' object='google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-strutil_unittest.obj: google/protobuf/stubs/strutil_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-strutil_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.obj `if test -f 'google/protobuf/stubs/strutil_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/strutil_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/strutil_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-strutil_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/strutil_unittest.cc' object='google/protobuf/stubs/protobuf_test-strutil_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/objectivec/protobuf_test-objectivec_helpers_unittest.obj `if test -f 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-strutil_unittest.obj `if test -f 'google/protobuf/stubs/strutil_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/strutil_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/strutil_unittest.cc'; fi` -google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o: google/protobuf/compiler/python/python_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o `test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/python_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/python_plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-template_util_unittest.o: google/protobuf/stubs/template_util_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-template_util_unittest.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.o `test -f 'google/protobuf/stubs/template_util_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/template_util_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/template_util_unittest.cc' object='google/protobuf/stubs/protobuf_test-template_util_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.o `test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/python/python_plugin_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.o `test -f 'google/protobuf/stubs/template_util_unittest.cc' || echo '$(srcdir)/'`google/protobuf/stubs/template_util_unittest.cc -google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj: google/protobuf/compiler/python/python_plugin_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj -MD -MP -MF google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/python_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/python/python_plugin_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Tpo google/protobuf/compiler/python/$(DEPDIR)/protobuf_test-python_plugin_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/python/python_plugin_unittest.cc' object='google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-template_util_unittest.obj: google/protobuf/stubs/template_util_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-template_util_unittest.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.obj `if test -f 'google/protobuf/stubs/template_util_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/template_util_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/template_util_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-template_util_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/template_util_unittest.cc' object='google/protobuf/stubs/protobuf_test-template_util_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/python/protobuf_test-python_plugin_unittest.obj `if test -f 'google/protobuf/compiler/python/python_plugin_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/python/python_plugin_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/python/python_plugin_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-template_util_unittest.obj `if test -f 'google/protobuf/stubs/template_util_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/template_util_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/template_util_unittest.cc'; fi` -google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o: google/protobuf/compiler/ruby/ruby_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o -MD -MP -MF google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o `test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/ruby/ruby_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/ruby/ruby_generator_unittest.cc' object='google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-time_test.o: google/protobuf/stubs/time_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-time_test.o -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo -c -o google/protobuf/stubs/protobuf_test-time_test.o `test -f 'google/protobuf/stubs/time_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/time_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/time_test.cc' object='google/protobuf/stubs/protobuf_test-time_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.o `test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/ruby/ruby_generator_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-time_test.o `test -f 'google/protobuf/stubs/time_test.cc' || echo '$(srcdir)/'`google/protobuf/stubs/time_test.cc -google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj: google/protobuf/compiler/ruby/ruby_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj -MD -MP -MF google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj `if test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Tpo google/protobuf/compiler/ruby/$(DEPDIR)/protobuf_test-ruby_generator_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/ruby/ruby_generator_unittest.cc' object='google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/stubs/protobuf_test-time_test.obj: google/protobuf/stubs/time_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/stubs/protobuf_test-time_test.obj -MD -MP -MF google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo -c -o google/protobuf/stubs/protobuf_test-time_test.obj `if test -f 'google/protobuf/stubs/time_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/time_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/time_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Tpo google/protobuf/stubs/$(DEPDIR)/protobuf_test-time_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/stubs/time_test.cc' object='google/protobuf/stubs/protobuf_test-time_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/ruby/protobuf_test-ruby_generator_unittest.obj `if test -f 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/ruby/ruby_generator_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/stubs/protobuf_test-time_test.obj `if test -f 'google/protobuf/stubs/time_test.cc'; then $(CYGPATH_W) 'google/protobuf/stubs/time_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/stubs/time_test.cc'; fi` -google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o: google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-text_format_unittest.o: google/protobuf/text_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-text_format_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo -c -o google/protobuf/protobuf_test-text_format_unittest.o `test -f 'google/protobuf/text_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/text_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/text_format_unittest.cc' object='google/protobuf/protobuf_test-text_format_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-text_format_unittest.o `test -f 'google/protobuf/text_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/text_format_unittest.cc -google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj: google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_bootstrap_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-text_format_unittest.obj: google/protobuf/text_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-text_format_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo -c -o google/protobuf/protobuf_test-text_format_unittest.obj `if test -f 'google/protobuf/text_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/text_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/text_format_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/text_format_unittest.cc' object='google/protobuf/protobuf_test-text_format_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_bootstrap_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-text_format_unittest.obj `if test -f 'google/protobuf/text_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/text_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/text_format_unittest.cc'; fi` -google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o: google/protobuf/compiler/csharp/csharp_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_generator_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-unknown_field_set_unittest.o: google/protobuf/unknown_field_set_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unknown_field_set_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.o `test -f 'google/protobuf/unknown_field_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/unknown_field_set_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unknown_field_set_unittest.cc' object='google/protobuf/protobuf_test-unknown_field_set_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.o `test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/csharp/csharp_generator_unittest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.o `test -f 'google/protobuf/unknown_field_set_unittest.cc' || echo '$(srcdir)/'`google/protobuf/unknown_field_set_unittest.cc -google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj: google/protobuf/compiler/csharp/csharp_generator_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj -MD -MP -MF google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Tpo google/protobuf/compiler/csharp/$(DEPDIR)/protobuf_test-csharp_generator_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/csharp/csharp_generator_unittest.cc' object='google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-unknown_field_set_unittest.obj: google/protobuf/unknown_field_set_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unknown_field_set_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.obj `if test -f 'google/protobuf/unknown_field_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/unknown_field_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unknown_field_set_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unknown_field_set_unittest.cc' object='google/protobuf/protobuf_test-unknown_field_set_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/csharp/protobuf_test-csharp_generator_unittest.obj `if test -f 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/csharp/csharp_generator_unittest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unknown_field_set_unittest.obj `if test -f 'google/protobuf/unknown_field_set_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/unknown_field_set_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unknown_field_set_unittest.cc'; fi` google/protobuf/util/protobuf_test-delimited_message_util_test.o: google/protobuf/util/delimited_message_util_test.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/util/protobuf_test-delimited_message_util_test.o -MD -MP -MF google/protobuf/util/$(DEPDIR)/protobuf_test-delimited_message_util_test.Tpo -c -o google/protobuf/util/protobuf_test-delimited_message_util_test.o `test -f 'google/protobuf/util/delimited_message_util_test.cc' || echo '$(srcdir)/'`google/protobuf/util/delimited_message_util_test.cc @@ -7170,75 +7293,33 @@ google/protobuf/util/protobuf_test-type_resolver_util_test.obj: google/protobuf/ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/util/protobuf_test-type_resolver_util_test.obj `if test -f 'google/protobuf/util/type_resolver_util_test.cc'; then $(CYGPATH_W) 'google/protobuf/util/type_resolver_util_test.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/util/type_resolver_util_test.cc'; fi` -google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o: google/protobuf/compiler/command_line_interface_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o `test -f 'google/protobuf/compiler/command_line_interface_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/command_line_interface_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/command_line_interface_unittest.cc' object='google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.o `test -f 'google/protobuf/compiler/command_line_interface_unittest.cc' || echo '$(srcdir)/'`google/protobuf/compiler/command_line_interface_unittest.cc - -google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj: google/protobuf/compiler/command_line_interface_unittest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj `if test -f 'google/protobuf/compiler/command_line_interface_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/command_line_interface_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/command_line_interface_unittest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Tpo google/protobuf/compiler/$(DEPDIR)/protobuf_test-command_line_interface_unittest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/compiler/command_line_interface_unittest.cc' object='google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/protobuf_test-command_line_interface_unittest.obj `if test -f 'google/protobuf/compiler/command_line_interface_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/command_line_interface_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/command_line_interface_unittest.cc'; fi` - -google/protobuf/protobuf_test-arena_test_util.o: google/protobuf/arena_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arena_test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_test-arena_test_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arena_test_util.o `test -f 'google/protobuf/arena_test_util.cc' || echo '$(srcdir)/'`google/protobuf/arena_test_util.cc - -google/protobuf/protobuf_test-arena_test_util.obj: google/protobuf/arena_test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-arena_test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo -c -o google/protobuf/protobuf_test-arena_test_util.obj `if test -f 'google/protobuf/arena_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/arena_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_test_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/arena_test_util.cc' object='google/protobuf/protobuf_test-arena_test_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-arena_test_util.obj `if test -f 'google/protobuf/arena_test_util.cc'; then $(CYGPATH_W) 'google/protobuf/arena_test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/arena_test_util.cc'; fi` - -google/protobuf/protobuf_test-test_util.o: google/protobuf/test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo -c -o google/protobuf/protobuf_test-test_util.o `test -f 'google/protobuf/test_util.cc' || echo '$(srcdir)/'`google/protobuf/test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_test-test_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util.o `test -f 'google/protobuf/test_util.cc' || echo '$(srcdir)/'`google/protobuf/test_util.cc - -google/protobuf/protobuf_test-test_util.obj: google/protobuf/test_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-test_util.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo -c -o google/protobuf/protobuf_test-test_util.obj `if test -f 'google/protobuf/test_util.cc'; then $(CYGPATH_W) 'google/protobuf/test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-test_util.Tpo google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/test_util.cc' object='google/protobuf/protobuf_test-test_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-test_util.obj `if test -f 'google/protobuf/test_util.cc'; then $(CYGPATH_W) 'google/protobuf/test_util.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/test_util.cc'; fi` - -google/protobuf/testing/protobuf_test-googletest.o: google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-googletest.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_test-googletest.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-well_known_types_unittest.o: google/protobuf/well_known_types_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-well_known_types_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo -c -o google/protobuf/protobuf_test-well_known_types_unittest.o `test -f 'google/protobuf/well_known_types_unittest.cc' || echo '$(srcdir)/'`google/protobuf/well_known_types_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/well_known_types_unittest.cc' object='google/protobuf/protobuf_test-well_known_types_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-googletest.o `test -f 'google/protobuf/testing/googletest.cc' || echo '$(srcdir)/'`google/protobuf/testing/googletest.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-well_known_types_unittest.o `test -f 'google/protobuf/well_known_types_unittest.cc' || echo '$(srcdir)/'`google/protobuf/well_known_types_unittest.cc -google/protobuf/testing/protobuf_test-googletest.obj: google/protobuf/testing/googletest.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-googletest.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo -c -o google/protobuf/testing/protobuf_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-googletest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/googletest.cc' object='google/protobuf/testing/protobuf_test-googletest.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-well_known_types_unittest.obj: google/protobuf/well_known_types_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-well_known_types_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo -c -o google/protobuf/protobuf_test-well_known_types_unittest.obj `if test -f 'google/protobuf/well_known_types_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/well_known_types_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/well_known_types_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/well_known_types_unittest.cc' object='google/protobuf/protobuf_test-well_known_types_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-googletest.obj `if test -f 'google/protobuf/testing/googletest.cc'; then $(CYGPATH_W) 'google/protobuf/testing/googletest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/googletest.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-well_known_types_unittest.obj `if test -f 'google/protobuf/well_known_types_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/well_known_types_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/well_known_types_unittest.cc'; fi` -google/protobuf/testing/protobuf_test-file.o: google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-file.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo -c -o google/protobuf/testing/protobuf_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_test-file.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-wire_format_unittest.o: google/protobuf/wire_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-wire_format_unittest.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo -c -o google/protobuf/protobuf_test-wire_format_unittest.o `test -f 'google/protobuf/wire_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/wire_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/wire_format_unittest.cc' object='google/protobuf/protobuf_test-wire_format_unittest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-wire_format_unittest.o `test -f 'google/protobuf/wire_format_unittest.cc' || echo '$(srcdir)/'`google/protobuf/wire_format_unittest.cc -google/protobuf/testing/protobuf_test-file.obj: google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/protobuf_test-file.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo -c -o google/protobuf/testing/protobuf_test-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Tpo google/protobuf/testing/$(DEPDIR)/protobuf_test-file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/protobuf_test-file.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-wire_format_unittest.obj: google/protobuf/wire_format_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-wire_format_unittest.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo -c -o google/protobuf/protobuf_test-wire_format_unittest.obj `if test -f 'google/protobuf/wire_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/wire_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/wire_format_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Tpo google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/wire_format_unittest.cc' object='google/protobuf/protobuf_test-wire_format_unittest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/protobuf_test-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-wire_format_unittest.obj `if test -f 'google/protobuf/wire_format_unittest.cc'; then $(CYGPATH_W) 'google/protobuf/wire_format_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/wire_format_unittest.cc'; fi` google/protobuf/protobuf_test-map_lite_unittest.pb.o: google/protobuf/map_lite_unittest.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/protobuf_test-map_lite_unittest.pb.o `test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/map_lite_unittest.pb.cc @@ -7254,34 +7335,6 @@ google/protobuf/protobuf_test-map_lite_unittest.pb.obj: google/protobuf/map_lite @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-map_lite_unittest.pb.obj `if test -f 'google/protobuf/map_lite_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_lite_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_lite_unittest.pb.cc'; fi` -google/protobuf/protobuf_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc - -google/protobuf/protobuf_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_no_arena_lite.pb.o: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena_lite.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena_lite.pb.o `test -f 'google/protobuf/unittest_no_arena_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_lite.pb.cc - -google/protobuf/protobuf_test-unittest_no_arena_lite.pb.obj: google/protobuf/unittest_no_arena_lite.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena_lite.pb.obj `if test -f 'google/protobuf/unittest_no_arena_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_lite.pb.cc'; fi` - google/protobuf/protobuf_test-unittest_import_lite.pb.o: google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_import_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_import_lite.pb.o `test -f 'google/protobuf/unittest_import_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_import_lite.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_import_lite.pb.Po @@ -7310,6 +7363,20 @@ google/protobuf/protobuf_test-unittest_import_public_lite.pb.obj: google/protobu @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_import_public_lite.pb.obj `if test -f 'google/protobuf/unittest_import_public_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_import_public_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_import_public_lite.pb.cc'; fi` +google/protobuf/protobuf_test-unittest_lite.pb.o: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_lite.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_lite.pb.o `test -f 'google/protobuf/unittest_lite.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_lite.pb.cc + +google/protobuf/protobuf_test-unittest_lite.pb.obj: google/protobuf/unittest_lite.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_lite.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_lite.pb.cc' object='google/protobuf/protobuf_test-unittest_lite.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_lite.pb.obj `if test -f 'google/protobuf/unittest_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_lite.pb.cc'; fi` + google/protobuf/protobuf_test-any_test.pb.o: google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-any_test.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Tpo -c -o google/protobuf/protobuf_test-any_test.pb.o `test -f 'google/protobuf/any_test.pb.cc' || echo '$(srcdir)/'`google/protobuf/any_test.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po @@ -7380,6 +7447,20 @@ google/protobuf/protobuf_test-map_unittest.pb.obj: google/protobuf/map_unittest. @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-map_unittest.pb.obj `if test -f 'google/protobuf/map_unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/map_unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/map_unittest.pb.cc'; fi` +google/protobuf/protobuf_test-unittest.pb.o: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc + +google/protobuf/protobuf_test-unittest.pb.obj: google/protobuf/unittest.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` + google/protobuf/protobuf_test-unittest_arena.pb.o: google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_arena.pb.o `test -f 'google/protobuf/unittest_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_arena.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Po @@ -7576,34 +7657,6 @@ google/protobuf/protobuf_test-unittest_mset_wire_format.pb.obj: google/protobuf/ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_mset_wire_format.pb.obj `if test -f 'google/protobuf/unittest_mset_wire_format.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_mset_wire_format.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_mset_wire_format.pb.cc'; fi` -google/protobuf/protobuf_test-unittest_no_arena_import.pb.o: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena_import.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena_import.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena_import.pb.o `test -f 'google/protobuf/unittest_no_arena_import.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena_import.pb.cc - -google/protobuf/protobuf_test-unittest_no_arena_import.pb.obj: google/protobuf/unittest_no_arena_import.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena_import.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena_import.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena_import.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena_import.pb.obj `if test -f 'google/protobuf/unittest_no_arena_import.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena_import.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena_import.pb.cc'; fi` - -google/protobuf/protobuf_test-unittest_no_arena.pb.o: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena.pb.o `test -f 'google/protobuf/unittest_no_arena.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_arena.pb.cc - -google/protobuf/protobuf_test-unittest_no_arena.pb.obj: google/protobuf/unittest_no_arena.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_arena.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_no_arena.pb.cc' object='google/protobuf/protobuf_test-unittest_no_arena.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_no_arena.pb.obj `if test -f 'google/protobuf/unittest_no_arena.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_no_arena.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_no_arena.pb.cc'; fi` - google/protobuf/protobuf_test-unittest_no_field_presence.pb.o: google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_no_field_presence.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_no_field_presence.pb.o `test -f 'google/protobuf/unittest_no_field_presence.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_no_field_presence.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Po @@ -7646,19 +7699,19 @@ google/protobuf/protobuf_test-unittest_optimize_for.pb.obj: google/protobuf/unit @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_optimize_for.pb.obj `if test -f 'google/protobuf/unittest_optimize_for.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_optimize_for.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_optimize_for.pb.cc'; fi` -google/protobuf/protobuf_test-unittest.pb.o: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_test-unittest.pb.o' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest.pb.o `test -f 'google/protobuf/unittest.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest.pb.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -google/protobuf/protobuf_test-unittest.pb.obj: google/protobuf/unittest.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo -c -o google/protobuf/protobuf_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest.pb.cc' object='google/protobuf/protobuf_test-unittest.pb.obj' libtool=no @AMDEPBACKSLASH@ +google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest.pb.obj `if test -f 'google/protobuf/unittest.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest.pb.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.o: google/protobuf/unittest_preserve_unknown_enum2.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum2.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum2.pb.cc @@ -7674,20 +7727,6 @@ google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.obj: google/pro @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum2.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum2.pb.cc'; fi` -google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.o `test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_preserve_unknown_enum.pb.cc - -google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj: google/protobuf/unittest_preserve_unknown_enum.pb.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_preserve_unknown_enum.pb.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_preserve_unknown_enum.pb.cc' object='google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_preserve_unknown_enum.pb.obj `if test -f 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_preserve_unknown_enum.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_preserve_unknown_enum.pb.cc'; fi` - google/protobuf/protobuf_test-unittest_proto3.pb.o: google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_proto3.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3.pb.o `test -f 'google/protobuf/unittest_proto3.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3.pb.Po @@ -7744,6 +7783,20 @@ google/protobuf/protobuf_test-unittest_proto3_lite.pb.obj: google/protobuf/unitt @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_proto3_lite.pb.obj `if test -f 'google/protobuf/unittest_proto3_lite.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_lite.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_lite.pb.cc'; fi` +google/protobuf/protobuf_test-unittest_proto3_optional.pb.o: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_proto3_optional.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_optional.pb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_proto3_optional.pb.o `test -f 'google/protobuf/unittest_proto3_optional.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_proto3_optional.pb.cc + +google/protobuf/protobuf_test-unittest_proto3_optional.pb.obj: google/protobuf/unittest_proto3_optional.pb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_proto3_optional.pb.obj -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/unittest_proto3_optional.pb.cc' object='google/protobuf/protobuf_test-unittest_proto3_optional.pb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/protobuf_test-unittest_proto3_optional.pb.obj `if test -f 'google/protobuf/unittest_proto3_optional.pb.cc'; then $(CYGPATH_W) 'google/protobuf/unittest_proto3_optional.pb.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/unittest_proto3_optional.pb.cc'; fi` + google/protobuf/protobuf_test-unittest_well_known_types.pb.o: google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(protobuf_test_CPPFLAGS) $(CPPFLAGS) $(protobuf_test_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/protobuf_test-unittest_well_known_types.pb.o -MD -MP -MF google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Tpo -c -o google/protobuf/protobuf_test-unittest_well_known_types.pb.o `test -f 'google/protobuf/unittest_well_known_types.pb.cc' || echo '$(srcdir)/'`google/protobuf/unittest_well_known_types.pb.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Tpo google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Po @@ -7968,20 +8021,6 @@ google/protobuf/compiler/test_plugin-mock_code_generator.obj: google/protobuf/co @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/test_plugin-mock_code_generator.obj `if test -f 'google/protobuf/compiler/mock_code_generator.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/mock_code_generator.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/mock_code_generator.cc'; fi` -google/protobuf/testing/test_plugin-file.o: google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/test_plugin-file.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo -c -o google/protobuf/testing/test_plugin-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/test_plugin-file.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/test_plugin-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc - -google/protobuf/testing/test_plugin-file.obj: google/protobuf/testing/file.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/test_plugin-file.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo -c -o google/protobuf/testing/test_plugin-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/test_plugin-file.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/test_plugin-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` - google/protobuf/compiler/test_plugin-test_plugin.o: google/protobuf/compiler/test_plugin.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/compiler/test_plugin-test_plugin.o -MD -MP -MF google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Tpo -c -o google/protobuf/compiler/test_plugin-test_plugin.o `test -f 'google/protobuf/compiler/test_plugin.cc' || echo '$(srcdir)/'`google/protobuf/compiler/test_plugin.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Tpo google/protobuf/compiler/$(DEPDIR)/test_plugin-test_plugin.Po @@ -7996,6 +8035,20 @@ google/protobuf/compiler/test_plugin-test_plugin.obj: google/protobuf/compiler/t @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/compiler/test_plugin-test_plugin.obj `if test -f 'google/protobuf/compiler/test_plugin.cc'; then $(CYGPATH_W) 'google/protobuf/compiler/test_plugin.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/compiler/test_plugin.cc'; fi` +google/protobuf/testing/test_plugin-file.o: google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/test_plugin-file.o -MD -MP -MF google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo -c -o google/protobuf/testing/test_plugin-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/test_plugin-file.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/test_plugin-file.o `test -f 'google/protobuf/testing/file.cc' || echo '$(srcdir)/'`google/protobuf/testing/file.cc + +google/protobuf/testing/test_plugin-file.obj: google/protobuf/testing/file.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT google/protobuf/testing/test_plugin-file.obj -MD -MP -MF google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo -c -o google/protobuf/testing/test_plugin-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) google/protobuf/testing/$(DEPDIR)/test_plugin-file.Tpo google/protobuf/testing/$(DEPDIR)/test_plugin-file.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='google/protobuf/testing/file.cc' object='google/protobuf/testing/test_plugin-file.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_plugin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o google/protobuf/testing/test_plugin-file.obj `if test -f 'google/protobuf/testing/file.cc'; then $(CYGPATH_W) 'google/protobuf/testing/file.cc'; else $(CYGPATH_W) '$(srcdir)/google/protobuf/testing/file.cc'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -8223,7 +8276,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -8320,7 +8373,6 @@ no-warning-test.log: no-warning-test$(EXEEXT) @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -8361,6 +8413,8 @@ check: check-am all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES +install-checkPROGRAMS: install-libLTLIBRARIES + installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(protodir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ @@ -8444,6 +8498,7 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/any_lite.Plo -rm -f google/protobuf/$(DEPDIR)/api.pb.Plo -rm -f google/protobuf/$(DEPDIR)/arena.Plo + -rm -f google/protobuf/$(DEPDIR)/arenastring.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor.pb.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor_database.Plo @@ -8454,11 +8509,16 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/extension_set_heavy.Plo -rm -f google/protobuf/$(DEPDIR)/field_mask.pb.Plo -rm -f google/protobuf/$(DEPDIR)/generated_enum_util.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_bases.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_reflection.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_table_driven.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_table_driven_lite.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_tctable_full.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_tctable_lite.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_util.Plo -rm -f google/protobuf/$(DEPDIR)/implicit_weak_message.Plo + -rm -f google/protobuf/$(DEPDIR)/inlined_string_field.Plo + -rm -f google/protobuf/$(DEPDIR)/map.Plo -rm -f google/protobuf/$(DEPDIR)/map_field.Plo -rm -f google/protobuf/$(DEPDIR)/message.Plo -rm -f google/protobuf/$(DEPDIR)/message_lite.Plo @@ -8484,9 +8544,6 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po @@ -8496,14 +8553,18 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/parse_context.Plo -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po @@ -8522,9 +8583,6 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po @@ -8534,6 +8592,7 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po @@ -8543,7 +8602,6 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Po @@ -8552,7 +8610,6 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po @@ -8564,7 +8621,9 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po @@ -8576,9 +8635,11 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Po @@ -8598,9 +8659,6 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po @@ -8610,12 +8668,14 @@ distclean: distclean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po -rm -f google/protobuf/$(DEPDIR)/reflection_ops.Plo -rm -f google/protobuf/$(DEPDIR)/repeated_field.Plo + -rm -f google/protobuf/$(DEPDIR)/repeated_ptr_field.Plo -rm -f google/protobuf/$(DEPDIR)/service.Plo -rm -f google/protobuf/$(DEPDIR)/source_context.pb.Plo -rm -f google/protobuf/$(DEPDIR)/struct.pb.Plo @@ -8653,6 +8713,7 @@ distclean: distclean-am -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message_field.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_padding_optimizer.Plo + -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_parse_function_generator.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_primitive_field.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_service.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_string_field.Plo @@ -8699,6 +8760,7 @@ distclean: distclean-am -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_generator.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_generator_factory.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_helpers.Plo + -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_kotlin_generator.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_map_field.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_map_field_lite.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_message.Plo @@ -8820,7 +8882,6 @@ distclean: distclean-am -rm -f google/protobuf/util/internal/$(DEPDIR)/protostream_objectsource.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/protostream_objectwriter.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/type_info.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/type_info_test_helper.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/utility.Plo -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po @@ -8907,6 +8968,7 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/any_lite.Plo -rm -f google/protobuf/$(DEPDIR)/api.pb.Plo -rm -f google/protobuf/$(DEPDIR)/arena.Plo + -rm -f google/protobuf/$(DEPDIR)/arenastring.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor.pb.Plo -rm -f google/protobuf/$(DEPDIR)/descriptor_database.Plo @@ -8917,11 +8979,16 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/extension_set_heavy.Plo -rm -f google/protobuf/$(DEPDIR)/field_mask.pb.Plo -rm -f google/protobuf/$(DEPDIR)/generated_enum_util.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_bases.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_reflection.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_table_driven.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_table_driven_lite.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_tctable_full.Plo + -rm -f google/protobuf/$(DEPDIR)/generated_message_tctable_lite.Plo -rm -f google/protobuf/$(DEPDIR)/generated_message_util.Plo -rm -f google/protobuf/$(DEPDIR)/implicit_weak_message.Plo + -rm -f google/protobuf/$(DEPDIR)/inlined_string_field.Plo + -rm -f google/protobuf/$(DEPDIR)/map.Plo -rm -f google/protobuf/$(DEPDIR)/map_field.Plo -rm -f google/protobuf/$(DEPDIR)/message.Plo -rm -f google/protobuf/$(DEPDIR)/message_lite.Plo @@ -8947,9 +9014,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_optimize_for.pb.Po @@ -8959,14 +9023,18 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/no_warning_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/parse_context.Plo -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-any_test.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-arena_test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_lite_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_proto2_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-map_unittest.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-reflection_tester.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-test_util_lite.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_custom_options.pb.Po @@ -8985,9 +9053,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_optimize_for.pb.Po @@ -8997,6 +9062,7 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lazy_descriptor_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-arena_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-lite_arena_unittest.Po @@ -9006,7 +9072,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_import_public_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_arena_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-arena_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-lite_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-map_lite_test_util.Po @@ -9015,7 +9080,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_import_public_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_lite.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_lite_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-any_test.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-any_test.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-arena_test_util.Po @@ -9027,7 +9091,9 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-dynamic_message_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-extension_set_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-generated_message_reflection_unittest.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-inlined_string_field_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_field_test.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_lite_test_util.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_lite_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_proto2_unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-map_test.Po @@ -9039,9 +9105,11 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_arena_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-proto3_lite_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-reflection_ops_unittest.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-reflection_tester.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_reflection_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-repeated_field_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-test_util.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-test_util_lite.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-text_format_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_arena.pb.Po @@ -9061,9 +9129,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_lite_imports_nonlite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_mset_wire_format.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_import.pb.Po - -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_field_presence.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_no_generic_services.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_optimize_for.pb.Po @@ -9073,12 +9138,14 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_arena_lite.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_lite.pb.Po + -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_proto3_optional.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unittest_well_known_types.pb.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-unknown_field_set_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-well_known_types_unittest.Po -rm -f google/protobuf/$(DEPDIR)/protobuf_test-wire_format_unittest.Po -rm -f google/protobuf/$(DEPDIR)/reflection_ops.Plo -rm -f google/protobuf/$(DEPDIR)/repeated_field.Plo + -rm -f google/protobuf/$(DEPDIR)/repeated_ptr_field.Plo -rm -f google/protobuf/$(DEPDIR)/service.Plo -rm -f google/protobuf/$(DEPDIR)/source_context.pb.Plo -rm -f google/protobuf/$(DEPDIR)/struct.pb.Plo @@ -9116,6 +9183,7 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_message_field.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_padding_optimizer.Plo + -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_parse_function_generator.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_primitive_field.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_service.Plo -rm -f google/protobuf/compiler/cpp/$(DEPDIR)/cpp_string_field.Plo @@ -9162,6 +9230,7 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_generator.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_generator_factory.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_helpers.Plo + -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_kotlin_generator.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_map_field.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_map_field_lite.Plo -rm -f google/protobuf/compiler/java/$(DEPDIR)/java_message.Plo @@ -9283,7 +9352,6 @@ maintainer-clean: maintainer-clean-am -rm -f google/protobuf/util/internal/$(DEPDIR)/protostream_objectsource.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/protostream_objectwriter.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/type_info.Plo - -rm -f google/protobuf/util/internal/$(DEPDIR)/type_info_test_helper.Plo -rm -f google/protobuf/util/internal/$(DEPDIR)/utility.Plo -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-anys.pb.Po -rm -f google/protobuf/util/internal/testdata/$(DEPDIR)/no_warning_test-books.pb.Po @@ -9375,7 +9443,7 @@ clean-local: # relative to srcdir, which may not be the same as the current directory when # building out-of-tree. @USE_EXTERNAL_PROTOC_FALSE@unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs) -@USE_EXTERNAL_PROTOC_FALSE@ oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) ) +@USE_EXTERNAL_PROTOC_FALSE@ oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) --experimental_allow_proto3_optional ) @USE_EXTERNAL_PROTOC_FALSE@ touch unittest_proto_middleman $(protoc_outputs): unittest_proto_middleman @@ -9390,7 +9458,8 @@ $(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman no_warning_test.cc: echo "// Generated from Makefile.am" > no_warning_test.cc for FILE in $(nobase_include_HEADERS); do \ - echo "#include <$${FILE}>" >> no_warning_test.cc; \ + case $$FILE in *.inc) continue;; esac; \ + echo "#include <$${FILE}>" >> no_warning_test.cc; \ done echo "int main(int, char**) { return 0; }" >> no_warning_test.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/README.md b/cdk/extra/protobuf/protobuf-3.19.6/src/README.md similarity index 85% rename from cdk/extra/protobuf/protobuf-3.11.4/src/README.md rename to cdk/extra/protobuf/protobuf-3.19.6/src/README.md index 007deb328..9db40fdde 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/README.md +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/README.md @@ -1,8 +1,6 @@ Protocol Buffers - Google's data interchange format =================================================== -[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcpp_distcheck%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-bazel.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fbazel%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp_distcheck%2Fcontinuous) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) - Copyright 2008 Google Inc. https://developers.google.com/protocol-buffers/ @@ -21,7 +19,7 @@ To build protobuf from source, the following tools are needed: On Ubuntu/Debian, you can install them with: - $ sudo apt-get install autoconf automake libtool curl make g++ unzip + sudo apt-get install autoconf automake libtool curl make g++ unzip On other platforms, please use the corresponding package managing tool to install them before proceeding. @@ -40,22 +38,21 @@ You can also get the source by "git clone" our git repository. Make sure you have also cloned the submodules and generated the configure script (skip this if you are using a release .tar.gz or .zip package): -```shell git clone https://github.com/protocolbuffers/protobuf.git cd protobuf git submodule update --init --recursive ./autogen.sh -``` + To build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) execute the following: -```shell + ./configure make make check sudo make install sudo ldconfig # refresh shared library cache. -``` + If "make check" fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk. @@ -123,15 +120,15 @@ of "protobuf" in these examples. For a Mac system, Unix tools are not available by default. You will first need to install Xcode from the Mac AppStore and then run the following command from a terminal: -```shell + sudo xcode-select --install -```shell + To install Unix tools, you can install "port" following the instructions at https://www.macports.org . This will reside in /opt/local/bin/port for most Mac installations. -```shell + sudo /opt/local/bin/port install autoconf automake libtool -``` + Then follow the Unix instructions above. **Note for cross-compiling** @@ -230,4 +227,4 @@ Usage The complete documentation for Protocol Buffers is available via the web at: - https://developers.google.com/protocol-buffers/ +https://developers.google.com/protocol-buffers/ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.cc similarity index 83% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.cc index a79214b75..73c002f60 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.cc @@ -41,24 +41,24 @@ namespace google { namespace protobuf { namespace internal { -void AnyMetadata::PackFrom(const Message& message) { - PackFrom(message, kTypeGoogleApisComPrefix); +bool AnyMetadata::PackFrom(Arena* arena, const Message& message) { + return PackFrom(arena, message, kTypeGoogleApisComPrefix); } -void AnyMetadata::PackFrom(const Message& message, - const std::string& type_url_prefix) { - type_url_->SetNoArena( +bool AnyMetadata::PackFrom(Arena* arena, const Message& message, + StringPiece type_url_prefix) { + type_url_->Set( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString(), - GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix)); - message.SerializeToString(value_->MutableNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())); + GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena); + return message.SerializeToString( + value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena)); } bool AnyMetadata::UnpackTo(Message* message) const { if (!InternalIs(message->GetDescriptor()->full_name())) { return false; } - return message->ParseFromString(value_->GetNoArena()); + return message->ParseFromString(value_->Get()); } bool GetAnyFieldDescriptors(const Message& message, @@ -70,12 +70,14 @@ bool GetAnyFieldDescriptors(const Message& message, } *type_url_field = descriptor->FindFieldByNumber(1); *value_field = descriptor->FindFieldByNumber(2); - return (*type_url_field != NULL && + return (*type_url_field != nullptr && (*type_url_field)->type() == FieldDescriptor::TYPE_STRING && - *value_field != NULL && + *value_field != nullptr && (*value_field)->type() == FieldDescriptor::TYPE_BYTES); } } // namespace internal } // namespace protobuf } // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.h similarity index 85% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.h index 59dd50cb2..e8336fa14 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.h @@ -60,16 +60,19 @@ class PROTOBUF_EXPORT AnyMetadata { typedef ArenaStringPtr ValueType; public: // AnyMetadata does not take ownership of "type_url" and "value". - AnyMetadata(UrlType* type_url, ValueType* value); + constexpr AnyMetadata(UrlType* type_url, ValueType* value) + : type_url_(type_url), value_(value) {} // Packs a message using the default type URL prefix: "type.googleapis.com". // The resulted type URL will be "type.googleapis.com/". + // Returns false if serializing the message failed. template - void PackFrom(const T& message) { - InternalPackFrom(message, kTypeGoogleApisComPrefix, T::FullMessageName()); + bool PackFrom(Arena* arena, const T& message) { + return InternalPackFrom(arena, message, kTypeGoogleApisComPrefix, + T::FullMessageName()); } - void PackFrom(const Message& message); + bool PackFrom(Arena* arena, const Message& message); // Packs a message using the given type URL prefix. The type URL will be // constructed by concatenating the message type's full name to the prefix @@ -77,12 +80,16 @@ class PROTOBUF_EXPORT AnyMetadata { // For example, both PackFrom(message, "type.googleapis.com") and // PackFrom(message, "type.googleapis.com/") yield the same result type // URL: "type.googleapis.com/". + // Returns false if serializing the message failed. template - void PackFrom(const T& message, StringPiece type_url_prefix) { - InternalPackFrom(message, type_url_prefix, T::FullMessageName()); + bool PackFrom(Arena* arena, const T& message, + StringPiece type_url_prefix) { + return InternalPackFrom(arena, message, type_url_prefix, + T::FullMessageName()); } - void PackFrom(const Message& message, const std::string& type_url_prefix); + bool PackFrom(Arena* arena, const Message& message, + StringPiece type_url_prefix); // Unpacks the payload into the given message. Returns false if the message's // type doesn't match the type specified in the type URL (i.e., the full @@ -104,7 +111,7 @@ class PROTOBUF_EXPORT AnyMetadata { } private: - void InternalPackFrom(const MessageLite& message, + bool InternalPackFrom(Arena* arena, const MessageLite& message, StringPiece type_url_prefix, StringPiece type_name); bool InternalUnpackTo(StringPiece type_name, @@ -124,14 +131,14 @@ class PROTOBUF_EXPORT AnyMetadata { // // NOTE: this function is available publicly as: // google::protobuf::Any() // static method on the generated message type. -bool ParseAnyTypeUrl(const std::string& type_url, std::string* full_type_name); +bool ParseAnyTypeUrl(StringPiece type_url, std::string* full_type_name); // Get the proto type name and prefix from Any::type_url value. For example, // passing "type.googleapis.com/rpc.QueryOrigin" will return // "type.googleapis.com/" in *url_prefix and "rpc.QueryOrigin" in // *full_type_name. Returns false if the type_url does not have a "/" in the // type url separating the full type name. -bool ParseAnyTypeUrl(const std::string& type_url, std::string* url_prefix, +bool ParseAnyTypeUrl(StringPiece type_url, std::string* url_prefix, std::string* full_type_name); // See if message is of type google.protobuf.Any, if so, return the descriptors diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.cc new file mode 100644 index 000000000..52c6ccca2 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.cc @@ -0,0 +1,352 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +PROTOBUF_NAMESPACE_OPEN +constexpr Any::Any( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , _any_metadata_(&type_url_, &value_){} +struct AnyDefaultTypeInternal { + constexpr AnyDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~AnyDefaultTypeInternal() {} + union { + Any _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AnyDefaultTypeInternal _Any_default_instance_; +PROTOBUF_NAMESPACE_CLOSE +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; + +const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, value_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Any)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::_Any_default_instance_), +}; + +const char descriptor_table_protodef_google_2fprotobuf_2fany_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\031google/protobuf/any.proto\022\017google.prot" + "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002" + " \001(\014Bv\n\023com.google.protobufB\010AnyProtoP\001Z" + ",google.golang.org/protobuf/types/known/" + "anypb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownT" + "ypesb\006proto3" + ; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fany_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto = { + false, false, 212, descriptor_table_protodef_google_2fprotobuf_2fany_2eproto, "google/protobuf/any.proto", + &descriptor_table_google_2fprotobuf_2fany_2eproto_once, nullptr, 0, 1, + schemas, file_default_instances, TableStruct_google_2fprotobuf_2fany_2eproto::offsets, + file_level_metadata_google_2fprotobuf_2fany_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto, file_level_service_descriptors_google_2fprotobuf_2fany_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fany_2eproto_getter() { + return &descriptor_table_google_2fprotobuf_2fany_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_google_2fprotobuf_2fany_2eproto(&descriptor_table_google_2fprotobuf_2fany_2eproto); +PROTOBUF_NAMESPACE_OPEN + +// =================================================================== + +bool Any::GetAnyFieldDescriptors( + const ::PROTOBUF_NAMESPACE_ID::Message& message, + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** type_url_field, + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field) { + return ::PROTOBUF_NAMESPACE_ID::internal::GetAnyFieldDescriptors( + message, type_url_field, value_field); +} +bool Any::ParseAnyTypeUrl( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url, + std::string* full_type_name) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseAnyTypeUrl(type_url, + full_type_name); +} + +class Any::_Internal { + public: +}; + +Any::Any(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + _any_metadata_(&type_url_, &value_) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.Any) +} +Any::Any(const Any& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _any_metadata_(&type_url_, &value_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_type_url().empty()) { + type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(), + GetArenaForAllocation()); + } + value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_value().empty()) { + value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) +} + +inline void Any::SharedCtor() { +type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +Any::~Any() { + // @@protoc_insertion_point(destructor:google.protobuf.Any) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void Any::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void Any::ArenaDtor(void* object) { + Any* _this = reinterpret_cast< Any* >(object); + (void)_this; +} +void Any::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Any::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void Any::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.Any) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + type_url_.ClearToEmpty(); + value_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string type_url = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_type_url(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bytes value = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_value(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* Any::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string type_url = 1; + if (!this->_internal_type_url().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_type_url().data(), static_cast(this->_internal_type_url().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "google.protobuf.Any.type_url"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_type_url(), target); + } + + // bytes value = 2; + if (!this->_internal_value().empty()) { + target = stream->WriteBytesMaybeAliased( + 2, this->_internal_value(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any) + return target; +} + +size_t Any::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string type_url = 1; + if (!this->_internal_type_url().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_type_url()); + } + + // bytes value = 2; + if (!this->_internal_value().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_value()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + Any::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Any::GetClassData() const { return &_class_data_; } + +void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void Any::MergeFrom(const Any& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_type_url().empty()) { + _internal_set_type_url(https://github.com/from._internal_type_url()); + } + if (!from._internal_value().empty()) { + _internal_set_value(from._internal_value()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void Any::CopyFrom(const Any& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Any) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Any::IsInitialized() const { + return true; +} + +void Any::InternalSwap(Any* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &type_url_, lhs_arena, + &other->type_url_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &value_, lhs_arena, + &other->value_, rhs_arena + ); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fany_2eproto_getter, &descriptor_table_google_2fprotobuf_2fany_2eproto_once, + file_level_metadata_google_2fprotobuf_2fany_2eproto[0]); +} + +// @@protoc_insertion_point(namespace_scope) +PROTOBUF_NAMESPACE_CLOSE +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Any >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Any >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.h similarity index 59% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.h index 0ff9341b0..630a99420 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.pb.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3011000 +#if PROTOBUF_VERSION < 3019000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3011004 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019006 < 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. @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include #include #include // IWYU pragma: export @@ -45,32 +44,33 @@ PROTOBUF_NAMESPACE_CLOSE struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto { static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const uint32_t offsets[]; }; -extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto; +PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto; PROTOBUF_NAMESPACE_OPEN class Any; -class AnyDefaultTypeInternal; +struct AnyDefaultTypeInternal; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN // =================================================================== -class PROTOBUF_EXPORT Any : +class PROTOBUF_EXPORT Any final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ { public: - Any(); - virtual ~Any(); + inline Any() : Any(nullptr) {} + ~Any() override; + explicit constexpr Any(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Any(const Any& from); Any(Any&& from) noexcept @@ -83,8 +83,13 @@ class PROTOBUF_EXPORT Any : return *this; } inline Any& operator=(Any&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -95,14 +100,14 @@ class PROTOBUF_EXPORT Any : return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const Any& default_instance() { + return *internal_default_instance(); } - static const Any& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Any* internal_default_instance() { return reinterpret_cast( &_Any_default_instance_); @@ -112,12 +117,12 @@ class PROTOBUF_EXPORT Any : // implements Any ----------------------------------------------- - void PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) { - _any_metadata_.PackFrom(message); + bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) { + return _any_metadata_.PackFrom(GetArena(), message); } - void PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message, - const std::string& type_url_prefix) { - _any_metadata_.PackFrom(message, type_url_prefix); + bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message, + ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { + return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix); } bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const { return _any_metadata_.UnpackTo(message); @@ -127,13 +132,13 @@ class PROTOBUF_EXPORT Any : const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** type_url_field, const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field); template ::value>::type> - void PackFrom(const T& message) { - _any_metadata_.PackFrom(message); + bool PackFrom(const T& message) { + return _any_metadata_.PackFrom(GetArena(), message); } template ::value>::type> - void PackFrom(const T& message, - const std::string& type_url_prefix) { - _any_metadata_.PackFrom(message, type_url_prefix);} + bool PackFrom(const T& message, + ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) { + return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);} template ::value>::type> bool UnpackTo(T* message) const { return _any_metadata_.UnpackTo(message); @@ -141,64 +146,74 @@ class PROTOBUF_EXPORT Any : template bool Is() const { return _any_metadata_.Is(); } - static bool ParseAnyTypeUrl(const string& type_url, + static bool ParseAnyTypeUrl(::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url, std::string* full_type_name); friend void swap(Any& a, Any& b) { a.Swap(&b); } inline void Swap(Any* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Any* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline Any* New() const final { - return CreateMaybeMessage(nullptr); - } - - Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const Any& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Any& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Any* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Any"; } + protected: + explicit Any(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fany_2eproto); - return ::descriptor_table_google_2fprotobuf_2fany_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -211,32 +226,28 @@ class PROTOBUF_EXPORT Any : // string type_url = 1; void clear_type_url(); const std::string& type_url() const; - void set_type_url(https://github.com/const%20std::string&%20value); - void set_type_url(/service/std::string&& value); - void set_type_url(https://github.com/const%20char*%20value); - void set_type_url(https://github.com/const%20char*%20value,%20size_t%20size); + template + void set_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args); std::string* mutable_type_url(); - std::string* release_type_url(); + PROTOBUF_NODISCARD std::string* release_type_url(); void set_allocated_type_url(/service/std::string* type_url); private: const std::string& _internal_type_url() const; - void _internal_set_type_url(https://github.com/const%20std::string&%20value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(https://github.com/const%20std::string&%20value); std::string* _internal_mutable_type_url(); public: // bytes value = 2; void clear_value(); const std::string& value() const; - void set_value(const std::string& value); - void set_value(std::string&& value); - void set_value(const char* value); - void set_value(const void* value, size_t size); + template + void set_value(ArgT0&& arg0, ArgT... args); std::string* mutable_value(); - std::string* release_value(); + PROTOBUF_NODISCARD std::string* release_value(); void set_allocated_value(std::string* value); private: const std::string& _internal_value() const; - void _internal_set_value(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); std::string* _internal_mutable_value(); public: @@ -244,7 +255,9 @@ class PROTOBUF_EXPORT Any : private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; @@ -264,53 +277,38 @@ class PROTOBUF_EXPORT Any : // string type_url = 1; inline void Any::clear_type_url() { - type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + type_url_.ClearToEmpty(); } inline const std::string& Any::type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url) return _internal_type_url(); } -inline void Any::set_type_url(https://github.com/const%20std::string&%20value) { - _internal_set_type_url(https://github.com/value); +template +inline PROTOBUF_ALWAYS_INLINE +void Any::set_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args) { + + type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) } inline std::string* Any::mutable_type_url() { + std::string* _s = _internal_mutable_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url) - return _internal_mutable_type_url(); + return _s; } inline const std::string& Any::_internal_type_url() const { - return type_url_.GetNoArena(); + return type_url_.Get(); } inline void Any::_internal_set_type_url(https://github.com/const%20std::string&%20value) { - type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Any::set_type_url(/service/std::string&& value) { - - type_url_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.type_url) -} -inline void Any::set_type_url(https://github.com/const%20char*%20value) { - GOOGLE_DCHECK(value != nullptr); - - type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url) -} -inline void Any::set_type_url(https://github.com/const%20char*%20value,%20size_t%20size) { - - type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url) + type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Any::_internal_mutable_type_url() { - return type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Any::release_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) - - return type_url_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Any::set_allocated_type_url(/service/std::string* type_url) { if (type_url != nullptr) { @@ -318,59 +316,50 @@ inline void Any::set_allocated_type_url(/service/std::string* type_url) { } else { } - type_url_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url); + type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url) } // bytes value = 2; inline void Any::clear_value() { - value_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + value_.ClearToEmpty(); } inline const std::string& Any::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Any.value) return _internal_value(); } -inline void Any::set_value(const std::string& value) { - _internal_set_value(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Any::set_value(ArgT0&& arg0, ArgT... args) { + + value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Any.value) } inline std::string* Any::mutable_value() { + std::string* _s = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value) - return _internal_mutable_value(); + return _s; } inline const std::string& Any::_internal_value() const { - return value_.GetNoArena(); + return value_.Get(); } inline void Any::_internal_set_value(const std::string& value) { - value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Any::set_value(std::string&& value) { - - value_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.value) -} -inline void Any::set_value(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value) -} -inline void Any::set_value(const void* value, size_t size) { - - value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value) + value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Any::_internal_mutable_value() { - return value_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Any::release_value() { // @@protoc_insertion_point(field_release:google.protobuf.Any.value) - - return value_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Any::set_allocated_value(std::string* value) { if (value != nullptr) { @@ -378,7 +367,13 @@ inline void Any::set_allocated_value(std::string* value) { } else { } - value_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); + value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.proto similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.proto index c9be85416..6ed8a23cf 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/any"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; option java_package = "com.google.protobuf"; option java_outer_classname = "AnyProto"; option java_multiple_files = true; @@ -77,10 +77,13 @@ option objc_class_prefix = "GPB"; // Example 4: Pack and unpack a message in Go // // foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } // ... // foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// if err := any.UnmarshalTo(foo); err != nil { // ... // } // diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_lite.cc similarity index 71% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_lite.cc index 783938133..a98559da1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_lite.cc @@ -53,16 +53,13 @@ const char kAnyFullTypeName[] = "google.protobuf.Any"; const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/"; const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/"; -AnyMetadata::AnyMetadata(UrlType* type_url, ValueType* value) - : type_url_(type_url), value_(value) {} - -void AnyMetadata::InternalPackFrom(const MessageLite& message, +bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message, StringPiece type_url_prefix, StringPiece type_name) { - type_url_->SetNoArena(&::google::protobuf::internal::GetEmptyString(), - GetTypeUrl(type_name, type_url_prefix)); - message.SerializeToString(value_->MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); + type_url_->Set(&::google::protobuf::internal::GetEmptyString(), + GetTypeUrl(type_name, type_url_prefix), arena); + return message.SerializeToString( + value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena)); } bool AnyMetadata::InternalUnpackTo(StringPiece type_name, @@ -70,50 +67,30 @@ bool AnyMetadata::InternalUnpackTo(StringPiece type_name, if (!InternalIs(type_name)) { return false; } - return message->ParseFromString(value_->GetNoArena()); -} - -namespace { - -// The type URL could be stored in either an ArenaStringPtr or a -// StringPieceField, so we provide these helpers to get a string_view from -// either type. We use a template function as a way to avoid depending on -// StringPieceField. - -template -StringPiece Get(const T* ptr) { - return ptr->Get(); -} - -template <> -// NOLINTNEXTLINE: clang-diagnostic-unused-function -StringPiece Get(const ArenaStringPtr* ptr) { - return ptr->GetNoArena(); + return message->ParseFromString(value_->Get()); } -} // namespace - bool AnyMetadata::InternalIs(StringPiece type_name) const { - StringPiece type_url = Get(type_url_); + StringPiece type_url = type_url_->Get(); return type_url.size() >= type_name.size() + 1 && type_url[type_url.size() - type_name.size() - 1] == '/' && HasSuffixString(type_url, type_name); } -bool ParseAnyTypeUrl(const std::string& type_url, std::string* url_prefix, +bool ParseAnyTypeUrl(StringPiece type_url, std::string* url_prefix, std::string* full_type_name) { - size_t pos = type_url.find_last_of("/"); + size_t pos = type_url.find_last_of('/'); if (pos == std::string::npos || pos + 1 == type_url.size()) { return false; } if (url_prefix) { - *url_prefix = type_url.substr(0, pos + 1); + *url_prefix = std::string(type_url.substr(0, pos + 1)); } - *full_type_name = type_url.substr(pos + 1); + *full_type_name = std::string(type_url.substr(pos + 1)); return true; } -bool ParseAnyTypeUrl(const std::string& type_url, std::string* full_type_name) { +bool ParseAnyTypeUrl(StringPiece type_url, std::string* full_type_name) { return ParseAnyTypeUrl(type_url, nullptr, full_type_name); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.cc similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.cc index 0d8893f7b..1d136aa55 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.cc @@ -33,15 +33,23 @@ #include +// Must be included last. +#include + namespace google { namespace protobuf { namespace { +TEST(AnyMetadataTest, ConstInit) { + PROTOBUF_CONSTINIT static internal::AnyMetadata metadata(nullptr, nullptr); + (void)metadata; +} + TEST(AnyTest, TestPackAndUnpack) { protobuf_unittest::TestAny submessage; submessage.set_int32_value(12345); protobuf_unittest::TestAny message; - message.mutable_any_value()->PackFrom(submessage); + ASSERT_TRUE(message.mutable_any_value()->PackFrom(submessage)); std::string data = message.SerializeAsString(); @@ -52,6 +60,13 @@ TEST(AnyTest, TestPackAndUnpack) { EXPECT_EQ(12345, submessage.int32_value()); } +TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) { + protobuf_unittest::TestAny submessage; + submessage.mutable_text()->resize(INT_MAX, 'a'); + protobuf_unittest::TestAny message; + EXPECT_FALSE(message.mutable_any_value()->PackFrom(submessage)); +} + TEST(AnyTest, TestUnpackWithTypeMismatch) { protobuf_unittest::TestAny payload; payload.set_int32_value(13); @@ -165,3 +180,5 @@ TEST(AnyTest, MoveAssignment) { } // namespace } // namespace protobuf } // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.proto similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.proto index 0c5b30ba3..256035b44 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/any_test.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/any_test.proto @@ -34,8 +34,11 @@ package protobuf_unittest; import "google/protobuf/any.proto"; +option java_outer_classname = "TestAnyProto"; + message TestAny { int32 int32_value = 1; google.protobuf.Any any_value = 2; repeated google.protobuf.Any repeated_any_value = 3; + string text = 4; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.cc similarity index 50% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.cc index 294c4ef43..72cc72e03 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.cc @@ -14,118 +14,111 @@ #include // @@protoc_insertion_point(includes) #include -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fapi_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Method_google_2fprotobuf_2fapi_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fapi_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Mixin_google_2fprotobuf_2fapi_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftype_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Option_google_2fprotobuf_2ftype_2eproto; -extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2fsource_5fcontext_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto; + +PROTOBUF_PRAGMA_INIT_SEG PROTOBUF_NAMESPACE_OPEN -class ApiDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Api_default_instance_; -class MethodDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Method_default_instance_; -class MixinDefaultTypeInternal { - public: - ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; -} _Mixin_default_instance_; +constexpr Api::Api( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : methods_() + , options_() + , mixins_() + , name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , source_context_(nullptr) + , syntax_(0) +{} +struct ApiDefaultTypeInternal { + constexpr ApiDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ApiDefaultTypeInternal() {} + union { + Api _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ApiDefaultTypeInternal _Api_default_instance_; +constexpr Method::Method( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : options_() + , name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , request_type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , response_type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , request_streaming_(false) + , response_streaming_(false) + , syntax_(0) +{} +struct MethodDefaultTypeInternal { + constexpr MethodDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MethodDefaultTypeInternal() {} + union { + Method _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MethodDefaultTypeInternal _Method_default_instance_; +constexpr Mixin::Mixin( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , root_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct MixinDefaultTypeInternal { + constexpr MixinDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MixinDefaultTypeInternal() {} + union { + Mixin _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MixinDefaultTypeInternal _Mixin_default_instance_; PROTOBUF_NAMESPACE_CLOSE -static void InitDefaultsscc_info_Api_google_2fprotobuf_2fapi_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Api_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Api(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Api::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_Api_google_2fprotobuf_2fapi_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 4, 0, InitDefaultsscc_info_Api_google_2fprotobuf_2fapi_2eproto}, { - &scc_info_Method_google_2fprotobuf_2fapi_2eproto.base, - &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base, - &scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base, - &scc_info_Mixin_google_2fprotobuf_2fapi_2eproto.base,}}; - -static void InitDefaultsscc_info_Method_google_2fprotobuf_2fapi_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Method_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Method(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Method::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Method_google_2fprotobuf_2fapi_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Method_google_2fprotobuf_2fapi_2eproto}, { - &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}}; - -static void InitDefaultsscc_info_Mixin_google_2fprotobuf_2fapi_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_; - new (ptr) PROTOBUF_NAMESPACE_ID::Mixin(); - ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); - } - PROTOBUF_NAMESPACE_ID::Mixin::InitAsDefaultInstance(); -} - -PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Mixin_google_2fprotobuf_2fapi_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Mixin_google_2fprotobuf_2fapi_2eproto}, {}}; - static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fapi_2eproto[3]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, methods_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, version_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, source_context_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, mixins_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, methods_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, version_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, source_context_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, mixins_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, request_type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, request_streaming_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, response_type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, response_streaming_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_streaming_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_streaming_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, root_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, root_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Api)}, - { 12, -1, sizeof(PROTOBUF_NAMESPACE_ID::Method)}, - { 24, -1, sizeof(PROTOBUF_NAMESPACE_ID::Mixin)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, + { 13, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, + { 26, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Api_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Method_default_instance_), - reinterpret_cast(&PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::_Api_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::_Method_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -144,45 +137,38 @@ const char descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto[] PROTOBUF_ "esponse_streaming\030\005 \001(\010\022(\n\007options\030\006 \003(\013" "2\027.google.protobuf.Option\022\'\n\006syntax\030\007 \001(" "\0162\027.google.protobuf.Syntax\"#\n\005Mixin\022\014\n\004n" - "ame\030\001 \001(\t\022\014\n\004root\030\002 \001(\tBu\n\023com.google.pr" - "otobufB\010ApiProtoP\001Z+google.golang.org/ge" - "nproto/protobuf/api;api\242\002\003GPB\252\002\036Google.P" - "rotobuf.WellKnownTypesb\006proto3" + "ame\030\001 \001(\t\022\014\n\004root\030\002 \001(\tBv\n\023com.google.pr" + "otobufB\010ApiProtoP\001Z,google.golang.org/pr" + "otobuf/types/known/apipb\242\002\003GPB\252\002\036Google." + "Protobuf.WellKnownTypesb\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fapi_2eproto_deps[2] = { &::descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, &::descriptor_table_google_2fprotobuf_2ftype_2eproto, }; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fapi_2eproto_sccs[3] = { - &scc_info_Api_google_2fprotobuf_2fapi_2eproto.base, - &scc_info_Method_google_2fprotobuf_2fapi_2eproto.base, - &scc_info_Mixin_google_2fprotobuf_2fapi_2eproto.base, -}; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fapi_2eproto_once; -static bool descriptor_table_google_2fprotobuf_2fapi_2eproto_initialized = false; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto = { - &descriptor_table_google_2fprotobuf_2fapi_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto, "google/protobuf/api.proto", 750, - &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, descriptor_table_google_2fprotobuf_2fapi_2eproto_sccs, descriptor_table_google_2fprotobuf_2fapi_2eproto_deps, 3, 2, + false, false, 751, descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto, "google/protobuf/api.proto", + &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, descriptor_table_google_2fprotobuf_2fapi_2eproto_deps, 2, 3, schemas, file_default_instances, TableStruct_google_2fprotobuf_2fapi_2eproto::offsets, - file_level_metadata_google_2fprotobuf_2fapi_2eproto, 3, file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto, file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto, + file_level_metadata_google_2fprotobuf_2fapi_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto, file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto, }; +PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fapi_2eproto_getter() { + return &descriptor_table_google_2fprotobuf_2fapi_2eproto; +} // Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_google_2fprotobuf_2fapi_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fapi_2eproto), true); +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_google_2fprotobuf_2fapi_2eproto(&descriptor_table_google_2fprotobuf_2fapi_2eproto); PROTOBUF_NAMESPACE_OPEN // =================================================================== -void Api::InitAsDefaultInstance() { - PROTOBUF_NAMESPACE_ID::_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< PROTOBUF_NAMESPACE_ID::SourceContext*>( - PROTOBUF_NAMESPACE_ID::SourceContext::internal_default_instance()); -} class Api::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); + static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); }; -const PROTOBUF_NAMESPACE_ID::SourceContext& +const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_Internal::source_context(const Api* msg) { return *msg->source_context_; } @@ -190,33 +176,47 @@ void Api::clear_options() { options_.Clear(); } void Api::clear_source_context() { - if (GetArenaNoVirtual() == nullptr && source_context_ != nullptr) { + if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) { delete source_context_; } source_context_ = nullptr; } -Api::Api() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { +Api::Api(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + methods_(arena), + options_(arena), + mixins_(arena) { SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Api) + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.Api) } Api::Api(const Api& from) : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), methods_(from.methods_), options_(from.options_), mixins_(from.mixins_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), + GetArenaForAllocation()); } version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_version().empty()) { - version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_); + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(), + GetArenaForAllocation()); } if (from._internal_has_source_context()) { - source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); + source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; } @@ -224,73 +224,83 @@ Api::Api(const Api& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) } -void Api::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Api_google_2fprotobuf_2fapi_2eproto.base); - name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - ::memset(&source_context_, 0, static_cast( - reinterpret_cast(&syntax_) - - reinterpret_cast(&source_context_)) + sizeof(syntax_)); +inline void Api::SharedCtor() { +name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&source_context_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&syntax_) - + reinterpret_cast(&source_context_)) + sizeof(syntax_)); } Api::~Api() { // @@protoc_insertion_point(destructor:google.protobuf.Api) + if (GetArenaForAllocation() != nullptr) return; SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } -void Api::SharedDtor() { +inline void Api::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete source_context_; } +void Api::ArenaDtor(void* object) { + Api* _this = reinterpret_cast< Api* >(object); + (void)_this; +} +void Api::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} void Api::SetCachedSize(int size) const { _cached_size_.Set(size); } -const Api& Api::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Api_google_2fprotobuf_2fapi_2eproto.base); - return *internal_default_instance(); -} - void Api::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Api) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; methods_.Clear(); options_.Clear(); mixins_.Clear(); - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - version_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - if (GetArenaNoVirtual() == nullptr && source_context_ != nullptr) { + name_.ClearToEmpty(); + version_.ClearToEmpty(); + if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) { delete source_context_; } source_context_ = nullptr; syntax_ = 0; - _internal_metadata_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + uint32_t tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Method methods = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -298,11 +308,12 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -310,27 +321,30 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string version = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { auto str = _internal_mutable_version(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.SourceContext source_context = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Mixin mixins = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -338,44 +352,49 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { - ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast(val)); - } else goto handle_unusual; + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Api::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_name().data(), static_cast(this->_internal_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -401,7 +420,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( } // string version = 4; - if (this->version().size() > 0) { + if (!this->_internal_version().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_version().data(), static_cast(this->_internal_version().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -411,7 +430,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( } // .google.protobuf.SourceContext source_context = 5; - if (this->has_source_context()) { + if (this->_internal_has_source_context()) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( @@ -427,7 +446,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( } // .google.protobuf.Syntax syntax = 7; - if (this->syntax() != 0) { + if (this->_internal_syntax() != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 7, this->_internal_syntax(), target); @@ -435,7 +454,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Api) return target; @@ -445,7 +464,7 @@ size_t Api::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -471,87 +490,70 @@ size_t Api::ByteSizeLong() const { } // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_name()); } // string version = 4; - if (this->version().size() > 0) { + if (!this->_internal_version().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_version()); } // .google.protobuf.SourceContext source_context = 5; - if (this->has_source_context()) { + if (this->_internal_has_source_context()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *source_context_); } // .google.protobuf.Syntax syntax = 7; - if (this->syntax() != 0) { + if (this->_internal_syntax() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } -void Api::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Api) - GOOGLE_DCHECK_NE(&from, this); - const Api* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Api) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Api) - MergeFrom(*source); - } +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + Api::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Api::GetClassData() const { return &_class_data_; } + +void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); } + void Api::MergeFrom(const Api& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api) GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; methods_.MergeFrom(from.methods_); options_.MergeFrom(from.options_); mixins_.MergeFrom(from.mixins_); - if (from.name().size() > 0) { - - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + if (!from._internal_name().empty()) { + _internal_set_name(from._internal_name()); } - if (from.version().size() > 0) { - - version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_); + if (!from._internal_version().empty()) { + _internal_set_version(from._internal_version()); } - if (from.has_source_context()) { - _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); + if (from._internal_has_source_context()) { + _internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } - if (from.syntax() != 0) { + if (from._internal_syntax() != 0) { _internal_set_syntax(from._internal_syntax()); } -} - -void Api::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Api) - if (&from == this) return; - Clear(); - MergeFrom(from); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void Api::CopyFrom(const Api& from) { @@ -567,27 +569,38 @@ bool Api::IsInitialized() const { void Api::InternalSwap(Api* other) { using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); methods_.InternalSwap(&other->methods_); options_.InternalSwap(&other->options_); mixins_.InternalSwap(&other->mixins_); - name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - version_.Swap(&other->version_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - swap(source_context_, other->source_context_); - swap(syntax_, other->syntax_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &name_, lhs_arena, + &other->name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &version_, lhs_arena, + &other->version_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Api, syntax_) + + sizeof(Api::syntax_) + - PROTOBUF_FIELD_OFFSET(Api, source_context_)>( + reinterpret_cast(&source_context_), + reinterpret_cast(&other->source_context_)); } ::PROTOBUF_NAMESPACE_ID::Metadata Api::GetMetadata() const { - return GetMetadataStatic(); + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, + file_level_metadata_google_2fprotobuf_2fapi_2eproto[0]); } - // =================================================================== -void Method::InitAsDefaultInstance() { -} class Method::_Internal { public: }; @@ -595,27 +608,43 @@ class Method::_Internal { void Method::clear_options() { options_.Clear(); } -Method::Method() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { +Method::Method(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + options_(arena) { SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Method) + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.Method) } Method::Method(const Method& from) : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr), options_(from.options_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), + GetArenaForAllocation()); } request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_request_type_url().empty()) { - request_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.request_type_url_); + request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(), + GetArenaForAllocation()); } response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_response_type_url().empty()) { - response_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); + response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(), + GetArenaForAllocation()); } ::memcpy(&request_streaming_, &from.request_streaming_, static_cast(reinterpret_cast(&syntax_) - @@ -623,103 +652,120 @@ Method::Method(const Method& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } -void Method::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Method_google_2fprotobuf_2fapi_2eproto.base); - name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - ::memset(&request_streaming_, 0, static_cast( - reinterpret_cast(&syntax_) - - reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); +inline void Method::SharedCtor() { +name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&request_streaming_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&syntax_) - + reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); } Method::~Method() { // @@protoc_insertion_point(destructor:google.protobuf.Method) + if (GetArenaForAllocation() != nullptr) return; SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } -void Method::SharedDtor() { +inline void Method::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); request_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); response_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } +void Method::ArenaDtor(void* object) { + Method* _this = reinterpret_cast< Method* >(object); + (void)_this; +} +void Method::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} void Method::SetCachedSize(int size) const { _cached_size_.Set(size); } -const Method& Method::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Method_google_2fprotobuf_2fapi_2eproto.base); - return *internal_default_instance(); -} - void Method::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Method) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; options_.Clear(); - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - request_type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - response_type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(); + request_type_url_.ClearToEmpty(); + response_type_url_.ClearToEmpty(); ::memset(&request_streaming_, 0, static_cast( reinterpret_cast(&syntax_) - reinterpret_cast(&request_streaming_)) + sizeof(syntax_)); - _internal_metadata_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + uint32_t tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string request_type_url = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { auto str = _internal_mutable_request_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool request_streaming = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { - request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string response_type_url = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { auto str = _internal_mutable_response_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool response_streaming = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { - response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -727,44 +773,49 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { - ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast(val)); - } else goto handle_unusual; + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Method::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_name().data(), static_cast(this->_internal_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -774,7 +825,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( } // string request_type_url = 2; - if (this->request_type_url().size() > 0) { + if (!this->_internal_request_type_url().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_request_type_url().data(), static_cast(this->_internal_request_type_url().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -784,13 +835,13 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( } // bool request_streaming = 3; - if (this->request_streaming() != 0) { + if (this->_internal_request_streaming() != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_request_streaming(), target); } // string response_type_url = 4; - if (this->response_type_url().size() > 0) { + if (!this->_internal_response_type_url().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_response_type_url().data(), static_cast(this->_internal_response_type_url().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -800,7 +851,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( } // bool response_streaming = 5; - if (this->response_streaming() != 0) { + if (this->_internal_response_streaming() != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_response_streaming(), target); } @@ -814,7 +865,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( } // .google.protobuf.Syntax syntax = 7; - if (this->syntax() != 0) { + if (this->_internal_syntax() != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 7, this->_internal_syntax(), target); @@ -822,7 +873,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Method) return target; @@ -832,7 +883,7 @@ size_t Method::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -844,102 +895,84 @@ size_t Method::ByteSizeLong() const { } // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_name()); } // string request_type_url = 2; - if (this->request_type_url().size() > 0) { + if (!this->_internal_request_type_url().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_request_type_url()); } // string response_type_url = 4; - if (this->response_type_url().size() > 0) { + if (!this->_internal_response_type_url().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_response_type_url()); } // bool request_streaming = 3; - if (this->request_streaming() != 0) { + if (this->_internal_request_streaming() != 0) { total_size += 1 + 1; } // bool response_streaming = 5; - if (this->response_streaming() != 0) { + if (this->_internal_response_streaming() != 0) { total_size += 1 + 1; } // .google.protobuf.Syntax syntax = 7; - if (this->syntax() != 0) { + if (this->_internal_syntax() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } -void Method::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Method) - GOOGLE_DCHECK_NE(&from, this); - const Method* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Method) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Method) - MergeFrom(*source); - } +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + Method::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Method::GetClassData() const { return &_class_data_; } + +void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); } + void Method::MergeFrom(const Method& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method) GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; options_.MergeFrom(from.options_); - if (from.name().size() > 0) { - - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + if (!from._internal_name().empty()) { + _internal_set_name(from._internal_name()); } - if (from.request_type_url().size() > 0) { - - request_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.request_type_url_); + if (!from._internal_request_type_url().empty()) { + _internal_set_request_type_url(https://github.com/from._internal_request_type_url()); } - if (from.response_type_url().size() > 0) { - - response_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); + if (!from._internal_response_type_url().empty()) { + _internal_set_response_type_url(https://github.com/from._internal_response_type_url()); } - if (from.request_streaming() != 0) { + if (from._internal_request_streaming() != 0) { _internal_set_request_streaming(from._internal_request_streaming()); } - if (from.response_streaming() != 0) { + if (from._internal_response_streaming() != 0) { _internal_set_response_streaming(from._internal_response_streaming()); } - if (from.syntax() != 0) { + if (from._internal_syntax() != 0) { _internal_set_syntax(from._internal_syntax()); } -} - -void Method::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Method) - if (&from == this) return; - Clear(); - MergeFrom(from); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void Method::CopyFrom(const Method& from) { @@ -955,141 +988,178 @@ bool Method::IsInitialized() const { void Method::InternalSwap(Method* other) { using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); options_.InternalSwap(&other->options_); - name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - request_type_url_.Swap(&other->request_type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - response_type_url_.Swap(&other->response_type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - swap(request_streaming_, other->request_streaming_); - swap(response_streaming_, other->response_streaming_); - swap(syntax_, other->syntax_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &name_, lhs_arena, + &other->name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &request_type_url_, lhs_arena, + &other->request_type_url_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &response_type_url_, lhs_arena, + &other->response_type_url_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Method, syntax_) + + sizeof(Method::syntax_) + - PROTOBUF_FIELD_OFFSET(Method, request_streaming_)>( + reinterpret_cast(&request_streaming_), + reinterpret_cast(&other->request_streaming_)); } ::PROTOBUF_NAMESPACE_ID::Metadata Method::GetMetadata() const { - return GetMetadataStatic(); + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, + file_level_metadata_google_2fprotobuf_2fapi_2eproto[1]); } - // =================================================================== -void Mixin::InitAsDefaultInstance() { -} class Mixin::_Internal { public: }; -Mixin::Mixin() - : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { +Mixin::Mixin(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); - // @@protoc_insertion_point(constructor:google.protobuf.Mixin) + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.Mixin) } Mixin::Mixin(const Mixin& from) - : ::PROTOBUF_NAMESPACE_ID::Message(), - _internal_metadata_(nullptr) { - _internal_metadata_.MergeFrom(from._internal_metadata_); + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), + GetArenaForAllocation()); } root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_root().empty()) { - root_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.root_); + root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(), + GetArenaForAllocation()); } // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin) } -void Mixin::SharedCtor() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Mixin_google_2fprotobuf_2fapi_2eproto.base); - name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +inline void Mixin::SharedCtor() { +name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } Mixin::~Mixin() { // @@protoc_insertion_point(destructor:google.protobuf.Mixin) + if (GetArenaForAllocation() != nullptr) return; SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } -void Mixin::SharedDtor() { +inline void Mixin::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); root_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } +void Mixin::ArenaDtor(void* object) { + Mixin* _this = reinterpret_cast< Mixin* >(object); + (void)_this; +} +void Mixin::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} void Mixin::SetCachedSize(int size) const { _cached_size_.Set(size); } -const Mixin& Mixin::default_instance() { - ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Mixin_google_2fprotobuf_2fapi_2eproto.base); - return *internal_default_instance(); -} - void Mixin::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - root_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); - _internal_metadata_.Clear(); + name_.ClearToEmpty(); + root_.ClearToEmpty(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + uint32_t tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - CHK_(ptr); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string root = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { auto str = _internal_mutable_root(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Mixin::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_name().data(), static_cast(this->_internal_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -1099,7 +1169,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize( } // string root = 2; - if (this->root().size() > 0) { + if (!this->_internal_root().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_root().data(), static_cast(this->_internal_root().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, @@ -1110,7 +1180,7 @@ ::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize( if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target, stream); + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Mixin) return target; @@ -1120,70 +1190,53 @@ size_t Mixin::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string name = 1; - if (this->name().size() > 0) { + if (!this->_internal_name().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_name()); } // string root = 2; - if (this->root().size() > 0) { + if (!this->_internal_root().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_root()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } -void Mixin::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Mixin) - GOOGLE_DCHECK_NE(&from, this); - const Mixin* source = - ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Mixin) - ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Mixin) - MergeFrom(*source); - } +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + Mixin::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Mixin::GetClassData() const { return &_class_data_; } + +void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); } + void Mixin::MergeFrom(const Mixin& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin) GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from.name().size() > 0) { - - name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_); + if (!from._internal_name().empty()) { + _internal_set_name(from._internal_name()); } - if (from.root().size() > 0) { - - root_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.root_); + if (!from._internal_root().empty()) { + _internal_set_root(from._internal_root()); } -} - -void Mixin::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Mixin) - if (&from == this) return; - Clear(); - MergeFrom(from); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void Mixin::CopyFrom(const Mixin& from) { @@ -1199,29 +1252,38 @@ bool Mixin::IsInitialized() const { void Mixin::InternalSwap(Mixin* other) { using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); - root_.Swap(&other->root_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - GetArenaNoVirtual()); + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &name_, lhs_arena, + &other->name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &root_, lhs_arena, + &other->root_, rhs_arena + ); } ::PROTOBUF_NAMESPACE_ID::Metadata Mixin::GetMetadata() const { - return GetMetadataStatic(); + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fapi_2eproto_getter, &descriptor_table_google_2fprotobuf_2fapi_2eproto_once, + file_level_metadata_google_2fprotobuf_2fapi_2eproto[2]); } - // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Api >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::Api >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Api >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Api >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Method >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::Method >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Method >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Method >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Mixin >(Arena* arena) { - return Arena::CreateInternal< PROTOBUF_NAMESPACE_ID::Mixin >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Mixin >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Mixin >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.h similarity index 52% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.h index ed49df1b1..93a251eb7 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.pb.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3011000 +#if PROTOBUF_VERSION < 3019000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3011004 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019006 < 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. @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include #include #include // IWYU pragma: export @@ -47,40 +46,41 @@ PROTOBUF_NAMESPACE_CLOSE struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto { static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[3] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const uint32_t offsets[]; }; -extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto; +PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto; PROTOBUF_NAMESPACE_OPEN class Api; -class ApiDefaultTypeInternal; +struct ApiDefaultTypeInternal; PROTOBUF_EXPORT extern ApiDefaultTypeInternal _Api_default_instance_; class Method; -class MethodDefaultTypeInternal; +struct MethodDefaultTypeInternal; PROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_; class Mixin; -class MixinDefaultTypeInternal; +struct MixinDefaultTypeInternal; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Api>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Method>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Mixin>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN // =================================================================== -class PROTOBUF_EXPORT Api : +class PROTOBUF_EXPORT Api final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ { public: - Api(); - virtual ~Api(); + inline Api() : Api(nullptr) {} + ~Api() override; + explicit constexpr Api(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Api(const Api& from); Api(Api&& from) noexcept @@ -93,8 +93,13 @@ class PROTOBUF_EXPORT Api : return *this; } inline Api& operator=(Api&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -105,14 +110,14 @@ class PROTOBUF_EXPORT Api : return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const Api& default_instance() { + return *internal_default_instance(); } - static const Api& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Api* internal_default_instance() { return reinterpret_cast( &_Api_default_instance_); @@ -125,57 +130,67 @@ class PROTOBUF_EXPORT Api : } inline void Swap(Api* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Api* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline Api* New() const final { - return CreateMaybeMessage(nullptr); - } - - Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const Api& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Api& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Api* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Api"; } + protected: + explicit Api(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fapi_2eproto); - return ::descriptor_table_google_2fprotobuf_2fapi_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -196,16 +211,16 @@ class PROTOBUF_EXPORT Api : int _internal_methods_size() const; public: void clear_methods(); - PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* + ::PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* mutable_methods(); private: - const PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); + const ::PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); public: - const PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* add_methods(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& + const ::PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* add_methods(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& methods() const; // repeated .google.protobuf.Option options = 3; @@ -214,16 +229,16 @@ class PROTOBUF_EXPORT Api : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // repeated .google.protobuf.Mixin mixins = 6; @@ -232,47 +247,43 @@ class PROTOBUF_EXPORT Api : int _internal_mixins_size() const; public: void clear_mixins(); - PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* + ::PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* mutable_mixins(); private: - const PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); public: - const PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& + const ::PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& mixins() const; // string name = 1; void clear_name(); const std::string& name() const; - void set_name(const std::string& value); - void set_name(std::string&& value); - void set_name(const char* value); - void set_name(const char* value, size_t size); + template + void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); - std::string* release_name(); + PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; - void _internal_set_name(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: // string version = 4; void clear_version(); const std::string& version() const; - void set_version(const std::string& value); - void set_version(std::string&& value); - void set_version(const char* value); - void set_version(const char* value, size_t size); + template + void set_version(ArgT0&& arg0, ArgT... args); std::string* mutable_version(); - std::string* release_version(); + PROTOBUF_NODISCARD std::string* release_version(); void set_allocated_version(std::string* version); private: const std::string& _internal_version() const; - void _internal_set_version(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value); std::string* _internal_mutable_version(); public: @@ -282,46 +293,52 @@ class PROTOBUF_EXPORT Api : bool _internal_has_source_context() const; public: void clear_source_context(); - const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); - PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); - void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); + void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); private: - const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); public: + void unsafe_arena_set_allocated_source_context( + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Api) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method > methods_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin > mixins_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; - PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT Method : +class PROTOBUF_EXPORT Method final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ { public: - Method(); - virtual ~Method(); + inline Method() : Method(nullptr) {} + ~Method() override; + explicit constexpr Method(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Method(const Method& from); Method(Method&& from) noexcept @@ -334,8 +351,13 @@ class PROTOBUF_EXPORT Method : return *this; } inline Method& operator=(Method&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -346,14 +368,14 @@ class PROTOBUF_EXPORT Method : return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const Method& default_instance() { + return *internal_default_instance(); } - static const Method& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Method* internal_default_instance() { return reinterpret_cast( &_Method_default_instance_); @@ -366,57 +388,67 @@ class PROTOBUF_EXPORT Method : } inline void Swap(Method* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Method* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline Method* New() const final { - return CreateMaybeMessage(nullptr); - } - - Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const Method& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Method& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Method* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Method"; } + protected: + explicit Method(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fapi_2eproto); - return ::descriptor_table_google_2fprotobuf_2fapi_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -437,63 +469,57 @@ class PROTOBUF_EXPORT Method : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; void clear_name(); const std::string& name() const; - void set_name(const std::string& value); - void set_name(std::string&& value); - void set_name(const char* value); - void set_name(const char* value, size_t size); + template + void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); - std::string* release_name(); + PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; - void _internal_set_name(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: // string request_type_url = 2; void clear_request_type_url(); const std::string& request_type_url() const; - void set_request_type_url(https://github.com/const%20std::string&%20value); - void set_request_type_url(/service/std::string&& value); - void set_request_type_url(https://github.com/const%20char*%20value); - void set_request_type_url(https://github.com/const%20char*%20value,%20size_t%20size); + template + void set_request_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args); std::string* mutable_request_type_url(); - std::string* release_request_type_url(); + PROTOBUF_NODISCARD std::string* release_request_type_url(); void set_allocated_request_type_url(/service/std::string* request_type_url); private: const std::string& _internal_request_type_url() const; - void _internal_set_request_type_url(https://github.com/const%20std::string&%20value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url(https://github.com/const%20std::string&%20value); std::string* _internal_mutable_request_type_url(); public: // string response_type_url = 4; void clear_response_type_url(); const std::string& response_type_url() const; - void set_response_type_url(https://github.com/const%20std::string&%20value); - void set_response_type_url(/service/std::string&& value); - void set_response_type_url(https://github.com/const%20char*%20value); - void set_response_type_url(https://github.com/const%20char*%20value,%20size_t%20size); + template + void set_response_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args); std::string* mutable_response_type_url(); - std::string* release_response_type_url(); + PROTOBUF_NODISCARD std::string* release_response_type_url(); void set_allocated_response_type_url(/service/std::string* response_type_url); private: const std::string& _internal_response_type_url() const; - void _internal_set_response_type_url(https://github.com/const%20std::string&%20value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url(https://github.com/const%20std::string&%20value); std::string* _internal_mutable_response_type_url(); public: @@ -517,19 +543,21 @@ class PROTOBUF_EXPORT Method : // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Method) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_type_url_; @@ -541,11 +569,12 @@ class PROTOBUF_EXPORT Method : }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT Mixin : +class PROTOBUF_EXPORT Mixin final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ { public: - Mixin(); - virtual ~Mixin(); + inline Mixin() : Mixin(nullptr) {} + ~Mixin() override; + explicit constexpr Mixin(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Mixin(const Mixin& from); Mixin(Mixin&& from) noexcept @@ -558,8 +587,13 @@ class PROTOBUF_EXPORT Mixin : return *this; } inline Mixin& operator=(Mixin&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -570,14 +604,14 @@ class PROTOBUF_EXPORT Mixin : return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const Mixin& default_instance() { + return *internal_default_instance(); } - static const Mixin& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Mixin* internal_default_instance() { return reinterpret_cast( &_Mixin_default_instance_); @@ -590,57 +624,67 @@ class PROTOBUF_EXPORT Mixin : } inline void Swap(Mixin* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Mixin* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline Mixin* New() const final { - return CreateMaybeMessage(nullptr); - } - - Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const Mixin& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Mixin& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Mixin* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Mixin"; } + protected: + explicit Mixin(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fapi_2eproto); - return ::descriptor_table_google_2fprotobuf_2fapi_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -653,32 +697,28 @@ class PROTOBUF_EXPORT Mixin : // string name = 1; void clear_name(); const std::string& name() const; - void set_name(const std::string& value); - void set_name(std::string&& value); - void set_name(const char* value); - void set_name(const char* value, size_t size); + template + void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); - std::string* release_name(); + PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; - void _internal_set_name(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: // string root = 2; void clear_root(); const std::string& root() const; - void set_root(const std::string& value); - void set_root(std::string&& value); - void set_root(const char* value); - void set_root(const char* value, size_t size); + template + void set_root(ArgT0&& arg0, ArgT... args); std::string* mutable_root(); - std::string* release_root(); + PROTOBUF_NODISCARD std::string* release_root(); void set_allocated_root(std::string* root); private: const std::string& _internal_root() const; - void _internal_set_root(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_root(const std::string& value); std::string* _internal_mutable_root(); public: @@ -686,7 +726,9 @@ class PROTOBUF_EXPORT Mixin : private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; @@ -705,53 +747,38 @@ class PROTOBUF_EXPORT Mixin : // string name = 1; inline void Api::clear_name() { - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(); } inline const std::string& Api::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.name) return _internal_name(); } -inline void Api::set_name(const std::string& value) { - _internal_set_name(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Api::set_name(ArgT0&& arg0, ArgT... args) { + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Api.name) } inline std::string* Api::mutable_name() { + std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name) - return _internal_mutable_name(); + return _s; } inline const std::string& Api::_internal_name() const { - return name_.GetNoArena(); + return name_.Get(); } inline void Api::_internal_set_name(const std::string& value) { - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Api::set_name(std::string&& value) { - - name_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.name) -} -inline void Api::set_name(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name) -} -inline void Api::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name) + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Api::_internal_mutable_name() { - return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Api::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Api.name) - - return name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Api::set_allocated_name(std::string* name) { if (name != nullptr) { @@ -759,7 +786,13 @@ inline void Api::set_allocated_name(std::string* name) { } else { } - name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) } @@ -773,30 +806,31 @@ inline int Api::methods_size() const { inline void Api::clear_methods() { methods_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) return methods_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* Api::mutable_methods() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) return &methods_; } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { return methods_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) return _internal_methods(index); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { return methods_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { + ::PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) - return _internal_add_methods(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& Api::methods() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) return methods_; @@ -809,30 +843,31 @@ inline int Api::_internal_options_size() const { inline int Api::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Api::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Api.options) - return _internal_add_options(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Api::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.options) return options_; @@ -840,53 +875,38 @@ Api::options() const { // string version = 4; inline void Api::clear_version() { - version_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + version_.ClearToEmpty(); } inline const std::string& Api::version() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.version) return _internal_version(); } -inline void Api::set_version(const std::string& value) { - _internal_set_version(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Api::set_version(ArgT0&& arg0, ArgT... args) { + + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Api.version) } inline std::string* Api::mutable_version() { + std::string* _s = _internal_mutable_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version) - return _internal_mutable_version(); + return _s; } inline const std::string& Api::_internal_version() const { - return version_.GetNoArena(); + return version_.Get(); } inline void Api::_internal_set_version(const std::string& value) { - version_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Api::set_version(std::string&& value) { - - version_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.version) -} -inline void Api::set_version(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - version_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version) -} -inline void Api::set_version(const char* value, size_t size) { - - version_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version) + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Api::_internal_mutable_version() { - return version_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Api::release_version() { // @@protoc_insertion_point(field_release:google.protobuf.Api.version) - - return version_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Api::set_allocated_version(std::string* version) { if (version != nullptr) { @@ -894,7 +914,13 @@ inline void Api::set_allocated_version(std::string* version) { } else { } - version_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version); + version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) } @@ -905,41 +931,73 @@ inline bool Api::_internal_has_source_context() const { inline bool Api::has_source_context() const { return _internal_has_source_context(); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { - const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - return p != nullptr ? *p : *reinterpret_cast( - &PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { + const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return _internal_source_context(); } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { +inline void Api::unsafe_arena_set_allocated_source_context( + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); + } + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) +} +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { + + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + source_context_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { if (source_context_ == nullptr) { - auto* p = CreateMaybeMessage(GetArenaNoVirtual()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); source_context_ = p; } return source_context_; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { + ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) - return _internal_mutable_source_context(); + return _msg; } -inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); +inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); } if (source_context) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr; + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper< + ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context)); if (message_arena != submessage_arena) { source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, source_context, submessage_arena); @@ -962,30 +1020,31 @@ inline int Api::mixins_size() const { inline void Api::clear_mixins() { mixins_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) return mixins_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* Api::mutable_mixins() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) return &mixins_; } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { return mixins_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) return _internal_mixins(index); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { return mixins_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { + ::PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) - return _internal_add_mixins(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& Api::mixins() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) return mixins_; @@ -995,18 +1054,18 @@ Api::mixins() const { inline void Api::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) return _internal_syntax(); } -inline void Api::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } @@ -1017,53 +1076,38 @@ inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { // string name = 1; inline void Method::clear_name() { - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(); } inline const std::string& Method::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.name) return _internal_name(); } -inline void Method::set_name(const std::string& value) { - _internal_set_name(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Method::set_name(ArgT0&& arg0, ArgT... args) { + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Method.name) } inline std::string* Method::mutable_name() { + std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name) - return _internal_mutable_name(); + return _s; } inline const std::string& Method::_internal_name() const { - return name_.GetNoArena(); + return name_.Get(); } inline void Method::_internal_set_name(const std::string& value) { - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Method::set_name(std::string&& value) { - - name_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.name) -} -inline void Method::set_name(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name) -} -inline void Method::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name) + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Method::_internal_mutable_name() { - return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Method::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Method.name) - - return name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Method::set_allocated_name(std::string* name) { if (name != nullptr) { @@ -1071,59 +1115,50 @@ inline void Method::set_allocated_name(std::string* name) { } else { } - name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name) } // string request_type_url = 2; inline void Method::clear_request_type_url() { - request_type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + request_type_url_.ClearToEmpty(); } inline const std::string& Method::request_type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url) return _internal_request_type_url(); } -inline void Method::set_request_type_url(https://github.com/const%20std::string&%20value) { - _internal_set_request_type_url(https://github.com/value); +template +inline PROTOBUF_ALWAYS_INLINE +void Method::set_request_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args) { + + request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) } inline std::string* Method::mutable_request_type_url() { + std::string* _s = _internal_mutable_request_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url) - return _internal_mutable_request_type_url(); + return _s; } inline const std::string& Method::_internal_request_type_url() const { - return request_type_url_.GetNoArena(); + return request_type_url_.Get(); } inline void Method::_internal_set_request_type_url(https://github.com/const%20std::string&%20value) { - request_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Method::set_request_type_url(/service/std::string&& value) { - - request_type_url_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.request_type_url) -} -inline void Method::set_request_type_url(https://github.com/const%20char*%20value) { - GOOGLE_DCHECK(value != nullptr); - - request_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url) -} -inline void Method::set_request_type_url(https://github.com/const%20char*%20value,%20size_t%20size) { - - request_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url) + request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Method::_internal_mutable_request_type_url() { - return request_type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Method::release_request_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) - - return request_type_url_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return request_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Method::set_allocated_request_type_url(/service/std::string* request_type_url) { if (request_type_url != nullptr) { @@ -1131,7 +1166,13 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url } else { } - request_type_url_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url); + request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (request_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) } @@ -1157,53 +1198,38 @@ inline void Method::set_request_streaming(bool value) { // string response_type_url = 4; inline void Method::clear_response_type_url() { - response_type_url_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + response_type_url_.ClearToEmpty(); } inline const std::string& Method::response_type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url) return _internal_response_type_url(); } -inline void Method::set_response_type_url(https://github.com/const%20std::string&%20value) { - _internal_set_response_type_url(https://github.com/value); +template +inline PROTOBUF_ALWAYS_INLINE +void Method::set_response_type_url(https://github.com/ArgT0&&%20arg0,%20ArgT...%20args) { + + response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) } inline std::string* Method::mutable_response_type_url() { + std::string* _s = _internal_mutable_response_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url) - return _internal_mutable_response_type_url(); + return _s; } inline const std::string& Method::_internal_response_type_url() const { - return response_type_url_.GetNoArena(); + return response_type_url_.Get(); } inline void Method::_internal_set_response_type_url(https://github.com/const%20std::string&%20value) { - response_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Method::set_response_type_url(/service/std::string&& value) { - - response_type_url_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.response_type_url) -} -inline void Method::set_response_type_url(https://github.com/const%20char*%20value) { - GOOGLE_DCHECK(value != nullptr); - - response_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url) -} -inline void Method::set_response_type_url(https://github.com/const%20char*%20value,%20size_t%20size) { - - response_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url) + response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Method::_internal_mutable_response_type_url() { - return response_type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Method::release_response_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) - - return response_type_url_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return response_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Method::set_allocated_response_type_url(/service/std::string* response_type_url) { if (response_type_url != nullptr) { @@ -1211,7 +1237,13 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u } else { } - response_type_url_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url); + response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (response_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) } @@ -1242,30 +1274,31 @@ inline int Method::_internal_options_size() const { inline int Method::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Method::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Method.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Method.options) - return _internal_add_options(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Method::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Method.options) return options_; @@ -1275,18 +1308,18 @@ Method::options() const { inline void Method::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) return _internal_syntax(); } -inline void Method::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } @@ -1297,53 +1330,38 @@ inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { // string name = 1; inline void Mixin::clear_name() { - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(); } inline const std::string& Mixin::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name) return _internal_name(); } -inline void Mixin::set_name(const std::string& value) { - _internal_set_name(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Mixin::set_name(ArgT0&& arg0, ArgT... args) { + + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name) } inline std::string* Mixin::mutable_name() { + std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name) - return _internal_mutable_name(); + return _s; } inline const std::string& Mixin::_internal_name() const { - return name_.GetNoArena(); + return name_.Get(); } inline void Mixin::_internal_set_name(const std::string& value) { - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Mixin::set_name(std::string&& value) { - - name_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.name) -} -inline void Mixin::set_name(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.name) -} -inline void Mixin::set_name(const char* value, size_t size) { - - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name) + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Mixin::_internal_mutable_name() { - return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Mixin::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) - - return name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Mixin::set_allocated_name(std::string* name) { if (name != nullptr) { @@ -1351,59 +1369,50 @@ inline void Mixin::set_allocated_name(std::string* name) { } else { } - name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name) } // string root = 2; inline void Mixin::clear_root() { - root_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + root_.ClearToEmpty(); } inline const std::string& Mixin::root() const { // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root) return _internal_root(); } -inline void Mixin::set_root(const std::string& value) { - _internal_set_root(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Mixin::set_root(ArgT0&& arg0, ArgT... args) { + + root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root) } inline std::string* Mixin::mutable_root() { + std::string* _s = _internal_mutable_root(); // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root) - return _internal_mutable_root(); + return _s; } inline const std::string& Mixin::_internal_root() const { - return root_.GetNoArena(); + return root_.Get(); } inline void Mixin::_internal_set_root(const std::string& value) { - root_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Mixin::set_root(std::string&& value) { - - root_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.root) -} -inline void Mixin::set_root(const char* value) { - GOOGLE_DCHECK(value != nullptr); - - root_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.root) -} -inline void Mixin::set_root(const char* value, size_t size) { - - root_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root) + root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Mixin::_internal_mutable_root() { - return root_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Mixin::release_root() { // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) - - return root_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return root_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } inline void Mixin::set_allocated_root(std::string* root) { if (root != nullptr) { @@ -1411,7 +1420,13 @@ inline void Mixin::set_allocated_root(std::string* root) { } else { } - root_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root); + root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (root_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root) } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.proto similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.proto index f37ee2fa4..3d598fc85 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/api.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/api.proto @@ -40,7 +40,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "ApiProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/api;api"; +option go_package = "google.golang.org/protobuf/types/known/apipb"; // Api is a light-weight descriptor for an API Interface. // @@ -52,7 +52,6 @@ option go_package = "google.golang.org/genproto/protobuf/api;api"; // this message itself. See https://cloud.google.com/apis/design/glossary for // detailed terminology. message Api { - // The fully qualified name of this interface, including package name // followed by the interface's simple name. string name = 1; @@ -99,7 +98,6 @@ message Api { // Method represents a method of an API interface. message Method { - // The simple name of this method. string name = 1; @@ -169,7 +167,7 @@ message Method { // The mixin construct implies that all methods in `AccessControl` are // also declared with same name and request/response types in // `Storage`. A documentation generator or annotation processor will -// see the effective `Storage.GetAcl` method after inherting +// see the effective `Storage.GetAcl` method after inheriting // documentation and annotations as follows: // // service Storage { diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.cc new file mode 100644 index 000000000..7624e0b2f --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.cc @@ -0,0 +1,511 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#ifdef ADDRESS_SANITIZER +#include +#endif // ADDRESS_SANITIZER + +#include + +namespace google { +namespace protobuf { +namespace internal { + +static SerialArena::Memory AllocateMemory(const AllocationPolicy* policy_ptr, + size_t last_size, size_t min_bytes) { + AllocationPolicy policy; // default policy + if (policy_ptr) policy = *policy_ptr; + size_t size; + if (last_size != 0) { + // Double the current block size, up to a limit. + auto max_size = policy.max_block_size; + size = std::min(2 * last_size, max_size); + } else { + size = policy.start_block_size; + } + // Verify that min_bytes + kBlockHeaderSize won't overflow. + GOOGLE_CHECK_LE(min_bytes, + std::numeric_limits::max() - SerialArena::kBlockHeaderSize); + size = std::max(size, SerialArena::kBlockHeaderSize + min_bytes); + + void* mem; + if (policy.block_alloc == nullptr) { + mem = ::operator new(size); + } else { + mem = policy.block_alloc(size); + } + return {mem, size}; +} + +class GetDeallocator { + public: + GetDeallocator(const AllocationPolicy* policy, size_t* space_allocated) + : dealloc_(policy ? policy->block_dealloc : nullptr), + space_allocated_(space_allocated) {} + + void operator()(SerialArena::Memory mem) const { +#ifdef ADDRESS_SANITIZER + // This memory was provided by the underlying allocator as unpoisoned, + // so return it in an unpoisoned state. + ASAN_UNPOISON_MEMORY_REGION(mem.ptr, mem.size); +#endif // ADDRESS_SANITIZER + if (dealloc_) { + dealloc_(mem.ptr, mem.size); + } else { +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + ::operator delete(mem.ptr, mem.size); +#else + ::operator delete(mem.ptr); +#endif + } + *space_allocated_ += mem.size; + } + + private: + void (*dealloc_)(void*, size_t); + size_t* space_allocated_; +}; + +SerialArena::SerialArena(Block* b, void* owner) : space_allocated_(b->size) { + owner_ = owner; + head_ = b; + ptr_ = b->Pointer(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize); + limit_ = b->Pointer(b->size & static_cast(-8)); +} + +SerialArena* SerialArena::New(Memory mem, void* owner) { + GOOGLE_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize, mem.size); + + auto b = new (mem.ptr) Block{nullptr, mem.size}; + return new (b->Pointer(kBlockHeaderSize)) SerialArena(b, owner); +} + +template +SerialArena::Memory SerialArena::Free(Deallocator deallocator) { + Block* b = head_; + Memory mem = {b, b->size}; + while (b->next) { + b = b->next; // We must first advance before deleting this block + deallocator(mem); + mem = {b, b->size}; + } + return mem; +} + +PROTOBUF_NOINLINE +std::pair +SerialArena::AllocateAlignedWithCleanupFallback( + size_t n, const AllocationPolicy* policy) { + AllocateNewBlock(n + kCleanupSize, policy); + return AllocateFromExistingWithCleanupFallback(n); +} + +PROTOBUF_NOINLINE +void* SerialArena::AllocateAlignedFallback(size_t n, + const AllocationPolicy* policy) { + AllocateNewBlock(n, policy); + return AllocateFromExisting(n); +} + +void SerialArena::AllocateNewBlock(size_t n, const AllocationPolicy* policy) { + // Sync limit to block + head_->start = reinterpret_cast(limit_); + + // Record how much used in this block. + space_used_ += ptr_ - head_->Pointer(kBlockHeaderSize); + + auto mem = AllocateMemory(policy, head_->size, n); + // We don't want to emit an expensive RMW instruction that requires + // exclusive access to a cacheline. Hence we write it in terms of a + // regular add. + auto relaxed = std::memory_order_relaxed; + space_allocated_.store(space_allocated_.load(relaxed) + mem.size, relaxed); + head_ = new (mem.ptr) Block{head_, mem.size}; + ptr_ = head_->Pointer(kBlockHeaderSize); + limit_ = head_->Pointer(head_->size); + +#ifdef ADDRESS_SANITIZER + ASAN_POISON_MEMORY_REGION(ptr_, limit_ - ptr_); +#endif // ADDRESS_SANITIZER +} + +uint64_t SerialArena::SpaceUsed() const { + uint64_t space_used = ptr_ - head_->Pointer(kBlockHeaderSize); + space_used += space_used_; + // Remove the overhead of the SerialArena itself. + space_used -= ThreadSafeArena::kSerialArenaSize; + return space_used; +} + +void SerialArena::CleanupList() { + Block* b = head_; + b->start = reinterpret_cast(limit_); + do { + auto* limit = reinterpret_cast( + b->Pointer(b->size & static_cast(-8))); + auto it = b->start; + auto num = limit - it; + if (num > 0) { + for (; it < limit; it++) { + it->cleanup(it->elem); + } + } + b = b->next; + } while (b); +} + + +ThreadSafeArena::CacheAlignedLifecycleIdGenerator + ThreadSafeArena::lifecycle_id_generator_; +#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) +ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() { + static internal::ThreadLocalStorage* thread_cache_ = + new internal::ThreadLocalStorage(); + return *thread_cache_->Get(); +} +#elif defined(PROTOBUF_USE_DLLS) +ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() { + static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_ = { + 0, static_cast(-1), nullptr}; + return thread_cache_; +} +#else +PROTOBUF_THREAD_LOCAL ThreadSafeArena::ThreadCache + ThreadSafeArena::thread_cache_ = {0, static_cast(-1), + nullptr}; +#endif + +void ThreadSafeArena::InitializeFrom(void* mem, size_t size) { + GOOGLE_DCHECK_EQ(reinterpret_cast(mem) & 7, 0u); + GOOGLE_DCHECK(!AllocPolicy()); // Reset should call InitializeWithPolicy instead. + Init(); + + // Ignore initial block if it is too small. + if (mem != nullptr && size >= kBlockHeaderSize + kSerialArenaSize) { + alloc_policy_.set_is_user_owned_initial_block(true); + SetInitialBlock(mem, size); + } +} + +void ThreadSafeArena::InitializeWithPolicy(void* mem, size_t size, + AllocationPolicy policy) { +#ifndef NDEBUG + const uint64_t old_alloc_policy = alloc_policy_.get_raw(); + // If there was a policy (e.g., in Reset()), make sure flags were preserved. +#define GOOGLE_DCHECK_POLICY_FLAGS_() \ + if (old_alloc_policy > 3) \ + GOOGLE_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3) +#else +#define GOOGLE_DCHECK_POLICY_FLAGS_() +#endif // NDEBUG + + if (policy.IsDefault()) { + // Legacy code doesn't use the API above, but provides the initial block + // through ArenaOptions. I suspect most do not touch the allocation + // policy parameters. + InitializeFrom(mem, size); + GOOGLE_DCHECK_POLICY_FLAGS_(); + return; + } + GOOGLE_DCHECK_EQ(reinterpret_cast(mem) & 7, 0u); + Init(); + + // Ignore initial block if it is too small. We include an optional + // AllocationPolicy in this check, so that this can be allocated on the + // first block. + constexpr size_t kAPSize = internal::AlignUpTo8(sizeof(AllocationPolicy)); + constexpr size_t kMinimumSize = kBlockHeaderSize + kSerialArenaSize + kAPSize; + + // The value for alloc_policy_ stores whether or not allocations should be + // recorded. + alloc_policy_.set_should_record_allocs( + policy.metrics_collector != nullptr && + policy.metrics_collector->RecordAllocs()); + // Make sure we have an initial block to store the AllocationPolicy. + if (mem != nullptr && size >= kMinimumSize) { + alloc_policy_.set_is_user_owned_initial_block(true); + } else { + auto tmp = AllocateMemory(&policy, 0, kMinimumSize); + mem = tmp.ptr; + size = tmp.size; + } + SetInitialBlock(mem, size); + + auto sa = threads_.load(std::memory_order_relaxed); + // We ensured enough space so this cannot fail. + void* p; + if (!sa || !sa->MaybeAllocateAligned(kAPSize, &p)) { + GOOGLE_LOG(FATAL) << "MaybeAllocateAligned cannot fail here."; + return; + } + new (p) AllocationPolicy{policy}; + // Low bits store flags, so they mustn't be overwritten. + GOOGLE_DCHECK_EQ(0, reinterpret_cast(p) & 3); + alloc_policy_.set_policy(reinterpret_cast(p)); + GOOGLE_DCHECK_POLICY_FLAGS_(); + +#undef GOOGLE_DCHECK_POLICY_FLAGS_ +} + +void ThreadSafeArena::Init() { +#ifndef NDEBUG + const bool was_message_owned = IsMessageOwned(); +#endif // NDEBUG + ThreadCache& tc = thread_cache(); + auto id = tc.next_lifecycle_id; + // We increment lifecycle_id's by multiples of two so we can use bit 0 as + // a tag. + constexpr uint64_t kDelta = 2; + constexpr uint64_t kInc = ThreadCache::kPerThreadIds * kDelta; + if (PROTOBUF_PREDICT_FALSE((id & (kInc - 1)) == 0)) { + constexpr auto relaxed = std::memory_order_relaxed; + // On platforms that don't support uint64_t atomics we can certainly not + // afford to increment by large intervals and expect uniqueness due to + // wrapping, hence we only add by 1. + id = lifecycle_id_generator_.id.fetch_add(1, relaxed) * kInc; + } + tc.next_lifecycle_id = id + kDelta; + // Message ownership is stored in tag_and_id_, and is set in the constructor. + // This flag bit must be preserved, even across calls to Reset(). + tag_and_id_ = id | (tag_and_id_ & kMessageOwnedArena); + hint_.store(nullptr, std::memory_order_relaxed); + threads_.store(nullptr, std::memory_order_relaxed); +#ifndef NDEBUG + GOOGLE_CHECK_EQ(was_message_owned, IsMessageOwned()); +#endif // NDEBUG +} + +void ThreadSafeArena::SetInitialBlock(void* mem, size_t size) { + SerialArena* serial = SerialArena::New({mem, size}, &thread_cache()); + serial->set_next(NULL); + threads_.store(serial, std::memory_order_relaxed); + CacheSerialArena(serial); +} + +ThreadSafeArena::~ThreadSafeArena() { + // Have to do this in a first pass, because some of the destructors might + // refer to memory in other blocks. + CleanupList(); + + size_t space_allocated = 0; + auto mem = Free(&space_allocated); + + // Policy is about to get deleted. + auto* p = alloc_policy_.get(); + ArenaMetricsCollector* collector = p ? p->metrics_collector : nullptr; + + if (alloc_policy_.is_user_owned_initial_block()) { + space_allocated += mem.size; + } else { + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); + } + + if (collector) collector->OnDestroy(space_allocated); +} + +SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) { + SerialArena::Memory mem = {nullptr, 0}; + auto deallocator = GetDeallocator(alloc_policy_.get(), space_allocated); + PerSerialArena([deallocator, &mem](SerialArena* a) { + if (mem.ptr) deallocator(mem); + mem = a->Free(deallocator); + }); + return mem; +} + +uint64_t ThreadSafeArena::Reset() { + // Have to do this in a first pass, because some of the destructors might + // refer to memory in other blocks. + CleanupList(); + + // Discard all blocks except the special block (if present). + size_t space_allocated = 0; + auto mem = Free(&space_allocated); + + AllocationPolicy* policy = alloc_policy_.get(); + if (policy) { + auto saved_policy = *policy; + if (alloc_policy_.is_user_owned_initial_block()) { + space_allocated += mem.size; + } else { + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); + mem.ptr = nullptr; + mem.size = 0; + } + ArenaMetricsCollector* collector = saved_policy.metrics_collector; + if (collector) collector->OnReset(space_allocated); + InitializeWithPolicy(mem.ptr, mem.size, saved_policy); + } else { + GOOGLE_DCHECK(!alloc_policy_.should_record_allocs()); + // Nullptr policy + if (alloc_policy_.is_user_owned_initial_block()) { + space_allocated += mem.size; + InitializeFrom(mem.ptr, mem.size); + } else { + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); + Init(); + } + } + + return space_allocated; +} + +std::pair +ThreadSafeArena::AllocateAlignedWithCleanup(size_t n, + const std::type_info* type) { + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFast(&arena))) { + return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); + } else { + return AllocateAlignedWithCleanupFallback(n, type); + } +} + +void ThreadSafeArena::AddCleanup(void* elem, void (*cleanup)(void*)) { + SerialArena* arena; + if (PROTOBUF_PREDICT_FALSE(!GetSerialArenaFast(&arena))) { + arena = GetSerialArenaFallback(&thread_cache()); + } + arena->AddCleanup(elem, cleanup, AllocPolicy()); +} + +PROTOBUF_NOINLINE +void* ThreadSafeArena::AllocateAlignedFallback(size_t n, + const std::type_info* type) { + if (alloc_policy_.should_record_allocs()) { + alloc_policy_.RecordAlloc(type, n); + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + return arena->AllocateAligned(n, alloc_policy_.get()); + } + } + return GetSerialArenaFallback(&thread_cache()) + ->AllocateAligned(n, alloc_policy_.get()); +} + +PROTOBUF_NOINLINE +std::pair +ThreadSafeArena::AllocateAlignedWithCleanupFallback( + size_t n, const std::type_info* type) { + if (alloc_policy_.should_record_allocs()) { + alloc_policy_.RecordAlloc(type, n); + SerialArena* arena; + if (GetSerialArenaFast(&arena)) { + return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); + } + } + return GetSerialArenaFallback(&thread_cache()) + ->AllocateAlignedWithCleanup(n, alloc_policy_.get()); +} + +uint64_t ThreadSafeArena::SpaceAllocated() const { + SerialArena* serial = threads_.load(std::memory_order_acquire); + uint64_t res = 0; + for (; serial; serial = serial->next()) { + res += serial->SpaceAllocated(); + } + return res; +} + +uint64_t ThreadSafeArena::SpaceUsed() const { + SerialArena* serial = threads_.load(std::memory_order_acquire); + uint64_t space_used = 0; + for (; serial; serial = serial->next()) { + space_used += serial->SpaceUsed(); + } + return space_used - (alloc_policy_.get() ? sizeof(AllocationPolicy) : 0); +} + +void ThreadSafeArena::CleanupList() { + PerSerialArena([](SerialArena* a) { a->CleanupList(); }); +} + +PROTOBUF_NOINLINE +SerialArena* ThreadSafeArena::GetSerialArenaFallback(void* me) { + // Look for this SerialArena in our linked list. + SerialArena* serial = threads_.load(std::memory_order_acquire); + for (; serial; serial = serial->next()) { + if (serial->owner() == me) { + break; + } + } + + if (!serial) { + // This thread doesn't have any SerialArena, which also means it doesn't + // have any blocks yet. So we'll allocate its first block now. + serial = SerialArena::New( + AllocateMemory(alloc_policy_.get(), 0, kSerialArenaSize), me); + + SerialArena* head = threads_.load(std::memory_order_relaxed); + do { + serial->set_next(head); + } while (!threads_.compare_exchange_weak( + head, serial, std::memory_order_release, std::memory_order_relaxed)); + } + + CacheSerialArena(serial); + return serial; +} + +} // namespace internal + +PROTOBUF_FUNC_ALIGN(32) +void* Arena::AllocateAlignedNoHook(size_t n) { + return impl_.AllocateAligned(n, nullptr); +} + +PROTOBUF_FUNC_ALIGN(32) +void* Arena::AllocateAlignedWithHook(size_t n, const std::type_info* type) { + return impl_.AllocateAligned(n, type); +} + +PROTOBUF_FUNC_ALIGN(32) +std::pair +Arena::AllocateAlignedWithCleanup(size_t n, const std::type_info* type) { + return impl_.AllocateAlignedWithCleanup(n, type); +} + +} // namespace protobuf +} // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.h similarity index 63% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.h index d73b53c79..6dd6467f5 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena.h @@ -65,13 +65,6 @@ namespace google { namespace protobuf { struct ArenaOptions; // defined below - -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { - class Arena; // defined below class Message; // defined in message.h class MessageLite; @@ -84,33 +77,46 @@ void EnableArenaMetrics(ArenaOptions* options); } // namespace arena_metrics +namespace TestUtil { +class ReflectionTester; // defined in test_util.h +} // namespace TestUtil + namespace internal { struct ArenaStringPtr; // defined in arenastring.h +class InlinedStringField; // defined in inlined_string_field.h class LazyField; // defined in lazy_field.h class EpsCopyInputStream; // defined in parse_context.h template class GenericTypeHandler; // defined in repeated_field.h +inline PROTOBUF_ALWAYS_INLINE +void* AlignTo(void* ptr, size_t align) { + return reinterpret_cast( + (reinterpret_cast(ptr) + align - 1) & (~align + 1)); +} + // Templated cleanup methods. template void arena_destruct_object(void* object) { reinterpret_cast(object)->~T(); } + +template +struct ObjectDestructor { + constexpr static void (*destructor)(void*) = &arena_destruct_object; +}; + +template +struct ObjectDestructor { + constexpr static void (*destructor)(void*) = nullptr; +}; + template void arena_delete_object(void* object) { delete reinterpret_cast(object); } -inline void arena_free(void* object, size_t size) { -#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) - ::operator delete(object, size); -#else - (void)size; - ::operator delete(object); -#endif -} - } // namespace internal // ArenaOptions provides optional additional parameters to arena construction @@ -147,46 +153,36 @@ struct ArenaOptions { void (*block_dealloc)(void*, size_t); ArenaOptions() - : start_block_size(kDefaultStartBlockSize), - max_block_size(kDefaultMaxBlockSize), + : start_block_size(internal::AllocationPolicy::kDefaultStartBlockSize), + max_block_size(internal::AllocationPolicy::kDefaultMaxBlockSize), initial_block(NULL), initial_block_size(0), - block_alloc(&::operator new), - block_dealloc(&internal::arena_free), - on_arena_init(NULL), - on_arena_reset(NULL), - on_arena_destruction(NULL), - on_arena_allocation(NULL) {} + block_alloc(nullptr), + block_dealloc(nullptr), + make_metrics_collector(nullptr) {} private: - // Hooks for adding external functionality such as user-specific metrics - // collection, specific debugging abilities, etc. - // Init hook (if set) will always be called at Arena init time. Init hook may - // return a pointer to a cookie to be stored in the arena. Reset and - // destruction hooks will then be called with the same cookie pointer. This - // allows us to save an external object per arena instance and use it on the - // other hooks (Note: If init hook returns NULL, the other hooks will NOT be - // called on this arena instance). - // on_arena_reset and on_arena_destruction also receive the space used in the - // arena just before the reset. - void* (*on_arena_init)(Arena* arena); - void (*on_arena_reset)(Arena* arena, void* cookie, uint64 space_used); - void (*on_arena_destruction)(Arena* arena, void* cookie, uint64 space_used); - - // type_info is promised to be static - its lifetime extends to - // match program's lifetime (It is given by typeid operator). - // Note: typeid(void) will be passed as allocated_type every time we - // intentionally want to avoid monitoring an allocation. (i.e. internal - // allocations for managing the arena) - void (*on_arena_allocation)(const std::type_info* allocated_type, - uint64 alloc_size, void* cookie); - - // Constants define default starting block size and max block size for - // arena allocator behavior -- see descriptions above. - static const size_t kDefaultStartBlockSize = 256; - static const size_t kDefaultMaxBlockSize = 8192; + // If make_metrics_collector is not nullptr, it will be called at Arena init + // time. It may return a pointer to a collector instance that will be notified + // of interesting events related to the arena. + internal::ArenaMetricsCollector* (*make_metrics_collector)(); + + internal::ArenaMetricsCollector* MetricsCollector() const { + return make_metrics_collector ? (*make_metrics_collector)() : nullptr; + } + + internal::AllocationPolicy AllocationPolicy() const { + internal::AllocationPolicy res; + res.start_block_size = start_block_size; + res.max_block_size = max_block_size; + res.block_alloc = block_alloc; + res.block_dealloc = block_dealloc; + res.metrics_collector = MetricsCollector(); + return res; + } friend void arena_metrics::EnableArenaMetrics(ArenaOptions*); + friend class Arena; friend class ArenaOptionsTestFriend; }; @@ -219,14 +215,15 @@ struct ArenaOptions { // any special requirements on the type T, and will invoke the object's // destructor when the arena is destroyed. // -// The arena message allocation protocol, required by CreateMessage, is as -// follows: +// The arena message allocation protocol, required by +// CreateMessage(Arena* arena, Args&&... args), is as follows: // -// - The type T must have (at least) two constructors: a constructor with no -// arguments, called when a T is allocated on the heap; and a constructor with -// a Arena* argument, called when a T is allocated on an arena. If the -// second constructor is called with a NULL arena pointer, it must be -// equivalent to invoking the first (no-argument) constructor. +// - The type T must have (at least) two constructors: a constructor callable +// with `args` (without `arena`), called when a T is allocated on the heap; +// and a constructor callable with `Arena* arena, Args&&... args`, called when +// a T is allocated on an arena. If the second constructor is called with a +// NULL arena pointer, it must be equivalent to invoking the first +// (`args`-only) constructor. // // - The type T must have a particular type trait: a nested type // |InternalArenaConstructable_|. This is usually a typedef to |void|. If no @@ -239,22 +236,28 @@ struct ArenaOptions { // present on the type, then its destructor is always called when the // containing arena is destroyed. // -// - One- and two-user-argument forms of CreateMessage() also exist that -// forward these constructor arguments to T's constructor: for example, -// CreateMessage(Arena*, arg1, arg2) forwards to a constructor T(Arena*, -// arg1, arg2). -// // This protocol is implemented by all arena-enabled proto2 message classes as // well as protobuf container types like RepeatedPtrField and Map. The protocol // is internal to protobuf and is not guaranteed to be stable. Non-proto types // should not rely on this protocol. -class PROTOBUF_EXPORT alignas(8) Arena final { +class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { public: - // Arena constructor taking custom options. See ArenaOptions below for + // Default constructor with sensible default options, tuned for average + // use-cases. + inline Arena() : impl_() {} + + // Construct an arena with default options, except for the supplied + // initial block. It is more efficient to use this constructor + // instead of passing ArenaOptions if the only configuration needed + // by the caller is supplying an initial block. + inline Arena(char* initial_block, size_t initial_block_size) + : impl_(initial_block, initial_block_size) {} + + // Arena constructor taking custom options. See ArenaOptions above for // descriptions of the options available. - explicit Arena(const ArenaOptions& options) : impl_(options) { - Init(options); - } + explicit Arena(const ArenaOptions& options) + : impl_(options.initial_block, options.initial_block_size, + options.AllocationPolicy()) {} // Block overhead. Use this as a guide for how much to over-allocate the // initial block if you want an allocation of size N to fit inside it. @@ -262,30 +265,14 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // WARNING: if you allocate multiple objects, it is difficult to guarantee // that a series of allocations will fit in the initial block, especially if // Arena changes its alignment guarantees in the future! - static const size_t kBlockOverhead = internal::ArenaImpl::kBlockHeaderSize + - internal::ArenaImpl::kSerialArenaSize; + static const size_t kBlockOverhead = + internal::ThreadSafeArena::kBlockHeaderSize + + internal::ThreadSafeArena::kSerialArenaSize; - // Default constructor with sensible default options, tuned for average - // use-cases. - Arena() : impl_(ArenaOptions()) { Init(ArenaOptions()); } - - ~Arena() { - if (hooks_cookie_) { - CallDestructorHooks(); - } - } + inline ~Arena() {} - void Init(const ArenaOptions& options) { - on_arena_allocation_ = options.on_arena_allocation; - on_arena_reset_ = options.on_arena_reset; - on_arena_destruction_ = options.on_arena_destruction; - // Call the initialization hook - if (options.on_arena_init != NULL) { - hooks_cookie_ = options.on_arena_init(this); - } else { - hooks_cookie_ = NULL; - } - } + // TODO(protobuf-team): Fix callers to use constructor and delete this method. + void Init(const ArenaOptions&) {} // API to create proto2 message objects on the arena. If the arena passed in // is NULL, then a heap allocated object is returned. Type T must be a message @@ -305,7 +292,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal() // because protobuf generated classes specialize CreateMaybeMessage() and we // need to use that specialization for code size reasons. - return Arena::CreateMaybeMessage(arena, std::forward(args)...); + return Arena::CreateMaybeMessage(arena, static_cast(args)...); } // API to create any objects on the arena. Note that only the object will @@ -324,9 +311,9 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // if the object were allocated on the heap (except that the underlying memory // is obtained from the arena). template - PROTOBUF_ALWAYS_INLINE static T* Create(Arena* arena, Args&&... args) { - return CreateNoMessage(arena, is_arena_constructable(), - std::forward(args)...); + PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { + return CreateInternal(arena, std::is_convertible(), + static_cast(args)...); } // Create an array of object type T on the arena *without* invoking the @@ -336,9 +323,9 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // (when compiled as C++11) that T is trivially default-constructible and // trivially destructible. template - PROTOBUF_ALWAYS_INLINE static T* CreateArray(Arena* arena, + PROTOBUF_NDEBUG_INLINE static T* CreateArray(Arena* arena, size_t num_elements) { - static_assert(std::is_pod::value, + static_assert(std::is_trivial::value, "CreateArray requires a trivially constructible type"); static_assert(std::is_trivially_destructible::value, "CreateArray requires a trivially destructible type"); @@ -351,34 +338,31 @@ class PROTOBUF_EXPORT alignas(8) Arena final { } } + // The following are routines are for monitoring. They will approximate the + // total sum allocated and used memory, but the exact value is an + // implementation deal. For instance allocated space depends on growth + // policies. Do not use these in unit tests. // Returns the total space allocated by the arena, which is the sum of the - // sizes of the underlying blocks. This method is relatively fast; a counter - // is kept as blocks are allocated. - uint64 SpaceAllocated() const { return impl_.SpaceAllocated(); } + // sizes of the underlying blocks. + uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); } // Returns the total space used by the arena. Similar to SpaceAllocated but // does not include free space and block overhead. The total space returned // may not include space used by other threads executing concurrently with // the call to this method. - uint64 SpaceUsed() const { return impl_.SpaceUsed(); } + uint64_t SpaceUsed() const { return impl_.SpaceUsed(); } // Frees all storage allocated by this arena after calling destructors // registered with OwnDestructor() and freeing objects registered with Own(). // Any objects allocated on this arena are unusable after this call. It also // returns the total space used by the arena which is the sums of the sizes // of the allocated blocks. This method is not thread-safe. - PROTOBUF_NOINLINE uint64 Reset() { - // Call the reset hook - if (on_arena_reset_ != NULL) { - on_arena_reset_(this, hooks_cookie_, impl_.SpaceAllocated()); - } - return impl_.Reset(); - } + uint64_t Reset() { return impl_.Reset(); } // Adds |object| to a list of heap-allocated objects to be freed with |delete| // when the arena is destroyed or reset. template - PROTOBUF_NOINLINE void Own(T* object) { - OwnInternal(object, std::is_convertible()); + PROTOBUF_ALWAYS_INLINE void Own(T* object) { + OwnInternal(object, std::is_convertible()); } // Adds |object| to a list of objects whose destructors will be manually @@ -387,7 +371,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // normally only used for objects that are placement-newed into // arena-allocated memory. template - PROTOBUF_NOINLINE void OwnDestructor(T* object) { + PROTOBUF_ALWAYS_INLINE void OwnDestructor(T* object) { if (object != NULL) { impl_.AddCleanup(object, &internal::arena_destruct_object); } @@ -397,8 +381,8 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // will be manually called when the arena is destroyed or reset. This differs // from OwnDestructor() in that any member function may be specified, not only // the class destructor. - PROTOBUF_NOINLINE void OwnCustomDestructor(void* object, - void (*destruct)(void*)) { + PROTOBUF_ALWAYS_INLINE void OwnCustomDestructor(void* object, + void (*destruct)(void*)) { impl_.AddCleanup(object, destruct); } @@ -413,6 +397,59 @@ class PROTOBUF_EXPORT alignas(8) Arena final { template class InternalHelper { + public: + // Provides access to protected GetOwningArena to generated messages. + static Arena* GetOwningArena(const T* p) { return p->GetOwningArena(); } + + // Provides access to protected GetArenaForAllocation to generated messages. + static Arena* GetArenaForAllocation(const T* p) { + return GetArenaForAllocationInternal( + p, std::is_convertible()); + } + + // Creates message-owned arena. + static Arena* CreateMessageOwnedArena() { + return new Arena(internal::MessageOwned{}); + } + + // Checks whether the given arena is message-owned. + static bool IsMessageOwnedArena(Arena* arena) { + return arena->IsMessageOwned(); + } + + private: + static Arena* GetArenaForAllocationInternal( + const T* p, std::true_type /*is_derived_from*/) { + return p->GetArenaForAllocation(); + } + + static Arena* GetArenaForAllocationInternal( + const T* p, std::false_type /*is_derived_from*/) { + return GetArenaForAllocationForNonMessage( + p, typename is_arena_constructable::type()); + } + + static Arena* GetArenaForAllocationForNonMessage( + const T* p, std::true_type /*is_arena_constructible*/) { + return p->GetArena(); + } + + static Arena* GetArenaForAllocationForNonMessage( + const T* p, std::false_type /*is_arena_constructible*/) { + return GetArenaForAllocationForNonMessageNonArenaConstructible( + p, typename has_get_arena::type()); + } + + static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible( + const T* p, std::true_type /*has_get_arena*/) { + return p->GetArena(); + } + + static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible( + const T* /* p */, std::false_type /*has_get_arena*/) { + return nullptr; + } + template static char DestructorSkippable(const typename U::DestructorSkippable_*); template @@ -450,12 +487,17 @@ class PROTOBUF_EXPORT alignas(8) Arena final { template static T* Construct(void* ptr, Args&&... args) { - return new (ptr) T(std::forward(args)...); + return new (ptr) T(static_cast(args)...); + } + + static inline PROTOBUF_ALWAYS_INLINE T* New() { + return new T(nullptr); } - static Arena* GetArena(const T* p) { return p->GetArenaNoVirtual(); } + static Arena* GetArena(const T* p) { return p->GetArena(); } friend class Arena; + friend class TestUtil::ReflectionTester; }; // Helper typetraits that indicates support for arenas in a type T at compile @@ -477,19 +519,29 @@ class PROTOBUF_EXPORT alignas(8) Arena final { }; private: + internal::ThreadSafeArena impl_; + template struct has_get_arena : InternalHelper::has_get_arena {}; + // Constructor solely used by message-owned arena. + inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {} + + // Checks whether this arena is message-owned. + PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const { + return impl_.IsMessageOwned(); + } + template - PROTOBUF_ALWAYS_INLINE static T* CreateMessageInternal(Arena* arena, + PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena, Args&&... args) { static_assert( InternalHelper::is_arena_constructable::value, "CreateMessage can only construct types that are ArenaConstructable"); if (arena == NULL) { - return new T(nullptr, std::forward(args)...); + return new T(nullptr, static_cast(args)...); } else { - return arena->DoCreateMessage(std::forward(args)...); + return arena->DoCreateMessage(static_cast(args)...); } } @@ -497,49 +549,40 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // slightly different. When the arena pointer is nullptr, it calls T() // instead of T(nullptr). template - PROTOBUF_ALWAYS_INLINE static T* CreateMessageInternal(Arena* arena) { + PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) { static_assert( InternalHelper::is_arena_constructable::value, "CreateMessage can only construct types that are ArenaConstructable"); if (arena == NULL) { - return new T(); + // Generated arena constructor T(Arena*) is protected. Call via + // InternalHelper. + return InternalHelper::New(); } else { return arena->DoCreateMessage(); } } - template - PROTOBUF_ALWAYS_INLINE static T* CreateInternal(Arena* arena, - Args&&... args) { - if (arena == NULL) { - return new T(std::forward(args)...); - } else { - return arena->DoCreate(std::is_trivially_destructible::value, - std::forward(args)...); - } - } - - void CallDestructorHooks(); - void OnArenaAllocation(const std::type_info* allocated_type, size_t n) const; - inline void AllocHook(const std::type_info* allocated_type, size_t n) const { - if (PROTOBUF_PREDICT_FALSE(hooks_cookie_ != NULL)) { - OnArenaAllocation(allocated_type, n); - } - } - - // Allocate and also optionally call on_arena_allocation callback with the - // allocated type info when the hooks are in place in ArenaOptions and - // the cookie is not null. - template - PROTOBUF_ALWAYS_INLINE void* AllocateInternal(bool skip_explicit_ownership) { - const size_t n = internal::AlignUpTo8(sizeof(T)); - AllocHook(RTTI_TYPE_ID(T), n); + // Allocate and also optionally call collector with the allocated type info + // when allocation recording is enabled. + PROTOBUF_NDEBUG_INLINE void* AllocateInternal(size_t size, size_t align, + void (*destructor)(void*), + const std::type_info* type) { // Monitor allocation if needed. - if (skip_explicit_ownership) { - return AllocateAlignedNoHook(n); + if (destructor == nullptr) { + return AllocateAlignedWithHook(size, align, type); } else { - return impl_.AllocateAlignedAndAddCleanup( - n, &internal::arena_destruct_object); + if (align <= 8) { + auto res = AllocateAlignedWithCleanup(internal::AlignUpTo8(size), type); + res.second->elem = res.first; + res.second->cleanup = destructor; + return res.first; + } else { + auto res = AllocateAlignedWithCleanup(size + align - 8, type); + auto ptr = internal::AlignTo(res.first, align); + res.second->elem = ptr; + res.second->cleanup = destructor; + return ptr; + } } } @@ -559,7 +602,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { PROTOBUF_ALWAYS_INLINE static T* DoCreateMaybeMessage(Arena* arena, std::false_type, Args&&... args) { - return CreateInternal(arena, std::forward(args)...); + return Create(arena, std::forward(args)...); } template @@ -569,71 +612,54 @@ class PROTOBUF_EXPORT alignas(8) Arena final { std::forward(args)...); } - template - PROTOBUF_ALWAYS_INLINE static T* CreateNoMessage(Arena* arena, std::true_type, - Args&&... args) { - // User is constructing with Create() despite the fact that T supports arena - // construction. In this case we have to delegate to CreateInternal(), and - // we can't use any CreateMaybeMessage() specialization that may be defined. - return CreateInternal(arena, std::forward(args)...); - } - - template - PROTOBUF_ALWAYS_INLINE static T* CreateNoMessage(Arena* arena, - std::false_type, - Args&&... args) { - // User is constructing with Create() and the type does not support arena - // construction. In this case we can delegate to CreateMaybeMessage() and - // use any specialization that may be available for that. - return CreateMaybeMessage(arena, std::forward(args)...); - } - // Just allocate the required size for the given type assuming the // type has a trivial constructor. template - PROTOBUF_ALWAYS_INLINE T* CreateInternalRawArray(size_t num_elements) { + PROTOBUF_NDEBUG_INLINE T* CreateInternalRawArray(size_t num_elements) { GOOGLE_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) << "Requested size is too large to fit into size_t."; - const size_t n = internal::AlignUpTo8(sizeof(T) * num_elements); - // Monitor allocation if needed. - AllocHook(RTTI_TYPE_ID(T), n); - return static_cast(AllocateAlignedNoHook(n)); + // We count on compiler to realize that if sizeof(T) is a multiple of + // 8 AlignUpTo can be elided. + const size_t n = sizeof(T) * num_elements; + return static_cast( + AllocateAlignedWithHook(n, alignof(T), RTTI_TYPE_ID(T))); } template - PROTOBUF_ALWAYS_INLINE T* DoCreate(bool skip_explicit_ownership, - Args&&... args) { - return new (AllocateInternal(skip_explicit_ownership)) - T(std::forward(args)...); - } - template - PROTOBUF_ALWAYS_INLINE T* DoCreateMessage(Args&&... args) { + PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) { return InternalHelper::Construct( - AllocateInternal(InternalHelper::is_destructor_skippable::value), + AllocateInternal(sizeof(T), alignof(T), + internal::ObjectDestructor< + InternalHelper::is_destructor_skippable::value, + T>::destructor, + RTTI_TYPE_ID(T)), this, std::forward(args)...); } // CreateInArenaStorage is used to implement map field. Without it, // Map need to call generated message's protected arena constructor, // which needs to declare Map as friend of generated message. - template - static void CreateInArenaStorage(T* ptr, Arena* arena) { + template + static void CreateInArenaStorage(T* ptr, Arena* arena, Args&&... args) { CreateInArenaStorageInternal(ptr, arena, - typename is_arena_constructable::type()); - RegisterDestructorInternal( - ptr, arena, - typename InternalHelper::is_destructor_skippable::type()); + typename is_arena_constructable::type(), + std::forward(args)...); + if (arena != nullptr) { + RegisterDestructorInternal( + ptr, arena, + typename InternalHelper::is_destructor_skippable::type()); + } } - template + template static void CreateInArenaStorageInternal(T* ptr, Arena* arena, - std::true_type) { - InternalHelper::Construct(ptr, arena); + std::true_type, Args&&... args) { + InternalHelper::Construct(ptr, arena, std::forward(args)...); } - template + template static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */, - std::false_type) { - new (ptr) T(); + std::false_type, Args&&... args) { + new (ptr) T(std::forward(args)...); } template @@ -645,6 +671,39 @@ class PROTOBUF_EXPORT alignas(8) Arena final { arena->OwnDestructor(ptr); } + // These implement Create(). The second parameter has type 'true_type' if T is + // a subtype of Message and 'false_type' otherwise. + template + PROTOBUF_ALWAYS_INLINE static T* CreateInternal(Arena* arena, std::true_type, + Args&&... args) { + if (arena == nullptr) { + return new T(std::forward(args)...); + } else { + auto destructor = + internal::ObjectDestructor::value, + T>::destructor; + T* result = + new (arena->AllocateInternal(sizeof(T), alignof(T), destructor, + RTTI_TYPE_ID(T))) + T(std::forward(args)...); + return result; + } + } + template + PROTOBUF_ALWAYS_INLINE static T* CreateInternal(Arena* arena, std::false_type, + Args&&... args) { + if (arena == nullptr) { + return new T(std::forward(args)...); + } else { + auto destructor = + internal::ObjectDestructor::value, + T>::destructor; + return new (arena->AllocateInternal(sizeof(T), alignof(T), destructor, + RTTI_TYPE_ID(T))) + T(std::forward(args)...); + } + } + // These implement Own(), which registers an object for deletion (destructor // call and operator delete()). The second parameter has type 'true_type' if T // is a subtype of Message and 'false_type' otherwise. Collapsing @@ -653,7 +712,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { template PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::true_type) { if (object != NULL) { - impl_.AddCleanup(object, &internal::arena_delete_object); + impl_.AddCleanup(object, &internal::arena_delete_object); } } template @@ -665,7 +724,7 @@ class PROTOBUF_EXPORT alignas(8) Arena final { // Implementation for GetArena(). Only message objects with // InternalArenaConstructable_ tags can be associated with an arena, and such - // objects must implement a GetArenaNoVirtual() method. + // objects must implement a GetArena() method. template ::value, int>::type = 0> PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) { @@ -687,28 +746,63 @@ class PROTOBUF_EXPORT alignas(8) Arena final { return nullptr; } - // For friends of arena. - void* AllocateAligned(size_t n) { - AllocHook(NULL, n); - return AllocateAlignedNoHook(internal::AlignUpTo8(n)); + template + PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArena(const T* value) { + return GetOwningArenaInternal( + value, std::is_convertible()); } - void* AllocateAlignedNoHook(size_t n); + // Implementation for GetOwningArena(). All and only message objects have + // GetOwningArena() method. + template + PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal( + const T* value, std::true_type) { + return InternalHelper::GetOwningArena(value); + } + template + PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal( + const T* /* value */, std::false_type) { + return nullptr; + } - internal::ArenaImpl impl_; + // For friends of arena. + void* AllocateAligned(size_t n, size_t align = 8) { + if (align <= 8) { + return AllocateAlignedNoHook(internal::AlignUpTo8(n)); + } else { + // We are wasting space by over allocating align - 8 bytes. Compared + // to a dedicated function that takes current alignment in consideration. + // Such a scheme would only waste (align - 8)/2 bytes on average, but + // requires a dedicated function in the outline arena allocation + // functions. Possibly re-evaluate tradeoffs later. + return internal::AlignTo(AllocateAlignedNoHook(n + align - 8), align); + } + } - void (*on_arena_allocation_)(const std::type_info* allocated_type, - uint64 alloc_size, void* cookie); - void (*on_arena_reset_)(Arena* arena, void* cookie, uint64 space_used); - void (*on_arena_destruction_)(Arena* arena, void* cookie, uint64 space_used); + void* AllocateAlignedWithHook(size_t n, size_t align, + const std::type_info* type) { + if (align <= 8) { + return AllocateAlignedWithHook(internal::AlignUpTo8(n), type); + } else { + // We are wasting space by over allocating align - 8 bytes. Compared + // to a dedicated function that takes current alignment in consideration. + // Such a schemee would only waste (align - 8)/2 bytes on average, but + // requires a dedicated function in the outline arena allocation + // functions. Possibly re-evaluate tradeoffs later. + return internal::AlignTo(AllocateAlignedWithHook(n + align - 8, type), + align); + } + } - // The arena may save a cookie it receives from the external on_init hook - // and then use it when calling the on_reset and on_destruction hooks. - void* hooks_cookie_; + void* AllocateAlignedNoHook(size_t n); + void* AllocateAlignedWithHook(size_t n, const std::type_info* type); + std::pair + AllocateAlignedWithCleanup(size_t n, const std::type_info* type); template friend class internal::GenericTypeHandler; friend struct internal::ArenaStringPtr; // For AllocateAligned. + friend class internal::InlinedStringField; // For AllocateAligned. friend class internal::LazyField; // For CreateMaybeMessage. friend class internal::EpsCopyInputStream; // For parser performance friend class MessageLite; diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_impl.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_impl.h new file mode 100644 index 000000000..2ffac319b --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_impl.h @@ -0,0 +1,562 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file defines an Arena allocator for better allocation performance. + +#ifndef GOOGLE_PROTOBUF_ARENA_IMPL_H__ +#define GOOGLE_PROTOBUF_ARENA_IMPL_H__ + +#include +#include +#include + +#include +#include + +#ifdef ADDRESS_SANITIZER +#include +#endif // ADDRESS_SANITIZER + +#include + + +namespace google { +namespace protobuf { +namespace internal { + +inline constexpr size_t AlignUpTo8(size_t n) { + // Align n to next multiple of 8 (from Hacker's Delight, Chapter 3.) + return (n + 7) & static_cast(-8); +} + +using LifecycleIdAtomic = uint64_t; + +// MetricsCollector collects stats for a particular arena. +class PROTOBUF_EXPORT ArenaMetricsCollector { + public: + ArenaMetricsCollector(bool record_allocs) : record_allocs_(record_allocs) {} + + // Invoked when the arena is about to be destroyed. This method will + // typically finalize any metric collection and delete the collector. + // space_allocated is the space used by the arena. + virtual void OnDestroy(uint64_t space_allocated) = 0; + + // OnReset() is called when the associated arena is reset. + // space_allocated is the space used by the arena just before the reset. + virtual void OnReset(uint64_t space_allocated) = 0; + + // OnAlloc is called when an allocation happens. + // type_info is promised to be static - its lifetime extends to + // match program's lifetime (It is given by typeid operator). + // Note: typeid(void) will be passed as allocated_type every time we + // intentionally want to avoid monitoring an allocation. (i.e. internal + // allocations for managing the arena) + virtual void OnAlloc(const std::type_info* allocated_type, + uint64_t alloc_size) = 0; + + // Does OnAlloc() need to be called? If false, metric collection overhead + // will be reduced since we will not do extra work per allocation. + bool RecordAllocs() { return record_allocs_; } + + protected: + // This class is destructed by the call to OnDestroy(). + ~ArenaMetricsCollector() = default; + const bool record_allocs_; +}; + +struct AllocationPolicy { + static constexpr size_t kDefaultStartBlockSize = 256; + static constexpr size_t kDefaultMaxBlockSize = 8192; + + size_t start_block_size = kDefaultStartBlockSize; + size_t max_block_size = kDefaultMaxBlockSize; + void* (*block_alloc)(size_t) = nullptr; + void (*block_dealloc)(void*, size_t) = nullptr; + ArenaMetricsCollector* metrics_collector = nullptr; + + bool IsDefault() const { + return start_block_size == kDefaultMaxBlockSize && + max_block_size == kDefaultMaxBlockSize && block_alloc == nullptr && + block_dealloc == nullptr && metrics_collector == nullptr; + } +}; + +// Tagged pointer to an AllocationPolicy. +class TaggedAllocationPolicyPtr { + public: + constexpr TaggedAllocationPolicyPtr() : policy_(0) {} + + explicit TaggedAllocationPolicyPtr(AllocationPolicy* policy) + : policy_(reinterpret_cast(policy)) {} + + void set_policy(AllocationPolicy* policy) { + auto bits = policy_ & kTagsMask; + policy_ = reinterpret_cast(policy) | bits; + } + + AllocationPolicy* get() { + return reinterpret_cast(policy_ & kPtrMask); + } + const AllocationPolicy* get() const { + return reinterpret_cast(policy_ & kPtrMask); + } + + AllocationPolicy& operator*() { return *get(); } + const AllocationPolicy& operator*() const { return *get(); } + + AllocationPolicy* operator->() { return get(); } + const AllocationPolicy* operator->() const { return get(); } + + bool is_user_owned_initial_block() const { + return static_cast(get_mask()); + } + void set_is_user_owned_initial_block(bool v) { + set_mask(v); + } + + bool should_record_allocs() const { + return static_cast(get_mask()); + } + void set_should_record_allocs(bool v) { set_mask(v); } + + uintptr_t get_raw() const { return policy_; } + + inline void RecordAlloc(const std::type_info* allocated_type, + size_t n) const { + get()->metrics_collector->OnAlloc(allocated_type, n); + } + + private: + enum : uintptr_t { + kUserOwnedInitialBlock = 1, + kRecordAllocs = 2, + }; + + static constexpr uintptr_t kTagsMask = 7; + static constexpr uintptr_t kPtrMask = ~kTagsMask; + + template + uintptr_t get_mask() const { + return policy_ & kMask; + } + template + void set_mask(bool v) { + if (v) { + policy_ |= kMask; + } else { + policy_ &= ~kMask; + } + } + uintptr_t policy_; +}; + +// A simple arena allocator. Calls to allocate functions must be properly +// serialized by the caller, hence this class cannot be used as a general +// purpose allocator in a multi-threaded program. It serves as a building block +// for ThreadSafeArena, which provides a thread-safe arena allocator. +// +// This class manages +// 1) Arena bump allocation + owning memory blocks. +// 2) Maintaining a cleanup list. +// It delagetes the actual memory allocation back to ThreadSafeArena, which +// contains the information on block growth policy and backing memory allocation +// used. +class PROTOBUF_EXPORT SerialArena { + public: + struct Memory { + void* ptr; + size_t size; + }; + + // Node contains the ptr of the object to be cleaned up and the associated + // cleanup function ptr. + struct CleanupNode { + void* elem; // Pointer to the object to be cleaned up. + void (*cleanup)(void*); // Function pointer to the destructor or deleter. + }; + + void CleanupList(); + uint64_t SpaceAllocated() const { + return space_allocated_.load(std::memory_order_relaxed); + } + uint64_t SpaceUsed() const; + + bool HasSpace(size_t n) { return n <= static_cast(limit_ - ptr_); } + + void* AllocateAligned(size_t n, const AllocationPolicy* policy) { + GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_DCHECK_GE(limit_, ptr_); + if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) { + return AllocateAlignedFallback(n, policy); + } + return AllocateFromExisting(n); + } + + private: + void* AllocateFromExisting(size_t n) { + void* ret = ptr_; + ptr_ += n; +#ifdef ADDRESS_SANITIZER + ASAN_UNPOISON_MEMORY_REGION(ret, n); +#endif // ADDRESS_SANITIZER + return ret; + } + + public: + // Allocate space if the current region provides enough space. + bool MaybeAllocateAligned(size_t n, void** out) { + GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_DCHECK_GE(limit_, ptr_); + if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; + *out = AllocateFromExisting(n); + return true; + } + + std::pair AllocateAlignedWithCleanup( + size_t n, const AllocationPolicy* policy) { + GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) { + return AllocateAlignedWithCleanupFallback(n, policy); + } + return AllocateFromExistingWithCleanupFallback(n); + } + + private: + std::pair AllocateFromExistingWithCleanupFallback( + size_t n) { + void* ret = ptr_; + ptr_ += n; + limit_ -= kCleanupSize; +#ifdef ADDRESS_SANITIZER + ASAN_UNPOISON_MEMORY_REGION(ret, n); + ASAN_UNPOISON_MEMORY_REGION(limit_, kCleanupSize); +#endif // ADDRESS_SANITIZER + return CreatePair(ret, reinterpret_cast(limit_)); + } + + public: + void AddCleanup(void* elem, void (*cleanup)(void*), + const AllocationPolicy* policy) { + auto res = AllocateAlignedWithCleanup(0, policy); + res.second->elem = elem; + res.second->cleanup = cleanup; + } + + void* owner() const { return owner_; } + SerialArena* next() const { return next_; } + void set_next(SerialArena* next) { next_ = next; } + + private: + friend class ThreadSafeArena; + friend class ArenaBenchmark; + + // Creates a new SerialArena inside mem using the remaining memory as for + // future allocations. + static SerialArena* New(SerialArena::Memory mem, void* owner); + // Free SerialArena returning the memory passed in to New + template + Memory Free(Deallocator deallocator); + + // Blocks are variable length malloc-ed objects. The following structure + // describes the common header for all blocks. + struct Block { + Block(Block* next, size_t size) : next(next), size(size), start(nullptr) {} + + char* Pointer(size_t n) { + GOOGLE_DCHECK(n <= size); + return reinterpret_cast(this) + n; + } + + Block* const next; + const size_t size; + CleanupNode* start; + // data follows + }; + + void* owner_; // &ThreadCache of this thread; + Block* head_; // Head of linked list of blocks. + SerialArena* next_; // Next SerialArena in this linked list. + size_t space_used_ = 0; // Necessary for metrics. + std::atomic space_allocated_; + + // Next pointer to allocate from. Always 8-byte aligned. Points inside + // head_ (and head_->pos will always be non-canonical). We keep these + // here to reduce indirection. + char* ptr_; + char* limit_; + + // Constructor is private as only New() should be used. + inline SerialArena(Block* b, void* owner); + void* AllocateAlignedFallback(size_t n, const AllocationPolicy* policy); + std::pair AllocateAlignedWithCleanupFallback( + size_t n, const AllocationPolicy* policy); + void AllocateNewBlock(size_t n, const AllocationPolicy* policy); + + std::pair CreatePair(void* ptr, CleanupNode* node) { + return {ptr, node}; + } + + public: + static constexpr size_t kBlockHeaderSize = AlignUpTo8(sizeof(Block)); + static constexpr size_t kCleanupSize = AlignUpTo8(sizeof(CleanupNode)); +}; + +// Tag type used to invoke the constructor of message-owned arena. +// Only message-owned arenas use this constructor for creation. +// Such constructors are internal implementation details of the library. +struct MessageOwned { + explicit MessageOwned() = default; +}; + +// This class provides the core Arena memory allocation library. Different +// implementations only need to implement the public interface below. +// Arena is not a template type as that would only be useful if all protos +// in turn would be templates, which will/cannot happen. However separating +// the memory allocation part from the cruft of the API users expect we can +// use #ifdef the select the best implementation based on hardware / OS. +class PROTOBUF_EXPORT ThreadSafeArena { + public: + ThreadSafeArena() { Init(); } + + // Constructor solely used by message-owned arena. + ThreadSafeArena(internal::MessageOwned) : tag_and_id_(kMessageOwnedArena) { + Init(); + } + + ThreadSafeArena(char* mem, size_t size) { InitializeFrom(mem, size); } + + explicit ThreadSafeArena(void* mem, size_t size, + const AllocationPolicy& policy) { + InitializeWithPolicy(mem, size, policy); + } + + // Destructor deletes all owned heap allocated objects, and destructs objects + // that have non-trivial destructors, except for proto2 message objects whose + // destructors can be skipped. Also, frees all blocks except the initial block + // if it was passed in. + ~ThreadSafeArena(); + + uint64_t Reset(); + + uint64_t SpaceAllocated() const; + uint64_t SpaceUsed() const; + + void* AllocateAligned(size_t n, const std::type_info* type) { + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFast(&arena))) { + return arena->AllocateAligned(n, AllocPolicy()); + } else { + return AllocateAlignedFallback(n, type); + } + } + + // This function allocates n bytes if the common happy case is true and + // returns true. Otherwise does nothing and returns false. This strange + // semantics is necessary to allow callers to program functions that only + // have fallback function calls in tail position. This substantially improves + // code for the happy path. + PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) { + SerialArena* a; + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFromThreadCache(&a))) { + return a->MaybeAllocateAligned(n, out); + } + return false; + } + + std::pair AllocateAlignedWithCleanup( + size_t n, const std::type_info* type); + + // Add object pointer and cleanup function pointer to the list. + void AddCleanup(void* elem, void (*cleanup)(void*)); + + // Checks whether this arena is message-owned. + PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const { + return tag_and_id_ & kMessageOwnedArena; + } + + private: + // Unique for each arena. Changes on Reset(). + uint64_t tag_and_id_ = 0; + // The LSB of tag_and_id_ indicates if the arena is message-owned. + enum : uint64_t { kMessageOwnedArena = 1 }; + + TaggedAllocationPolicyPtr alloc_policy_; // Tagged pointer to AllocPolicy. + + // Pointer to a linked list of SerialArena. + std::atomic threads_; + std::atomic hint_; // Fast thread-local block access + + const AllocationPolicy* AllocPolicy() const { return alloc_policy_.get(); } + void InitializeFrom(void* mem, size_t size); + void InitializeWithPolicy(void* mem, size_t size, AllocationPolicy policy); + void* AllocateAlignedFallback(size_t n, const std::type_info* type); + std::pair + AllocateAlignedWithCleanupFallback(size_t n, const std::type_info* type); + + void Init(); + void SetInitialBlock(void* mem, size_t size); + + // Delete or Destruct all objects owned by the arena. + void CleanupList(); + + inline uint64_t LifeCycleId() const { + return tag_and_id_ & ~kMessageOwnedArena; + } + + inline void CacheSerialArena(SerialArena* serial) { + thread_cache().last_serial_arena = serial; + thread_cache().last_lifecycle_id_seen = tag_and_id_; + // TODO(haberman): evaluate whether we would gain efficiency by getting rid + // of hint_. It's the only write we do to ThreadSafeArena in the allocation + // path, which will dirty the cache line. + + hint_.store(serial, std::memory_order_release); + } + + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) { + if (GetSerialArenaFromThreadCache(arena)) return true; + + // Check whether we own the last accessed SerialArena on this arena. This + // fast path optimizes the case where a single thread uses multiple arenas. + ThreadCache* tc = &thread_cache(); + SerialArena* serial = hint_.load(std::memory_order_acquire); + if (PROTOBUF_PREDICT_TRUE(serial != NULL && serial->owner() == tc)) { + *arena = serial; + return true; + } + return false; + } + + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( + SerialArena** arena) { + // If this thread already owns a block in this arena then try to use that. + // This fast path optimizes the case where multiple threads allocate from + // the same arena. + ThreadCache* tc = &thread_cache(); + if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { + *arena = tc->last_serial_arena; + return true; + } + return false; + } + SerialArena* GetSerialArenaFallback(void* me); + + template + void PerSerialArena(Functor fn) { + // By omitting an Acquire barrier we ensure that any user code that doesn't + // properly synchronize Reset() or the destructor will throw a TSAN warning. + SerialArena* serial = threads_.load(std::memory_order_relaxed); + + for (; serial; serial = serial->next()) fn(serial); + } + + // Releases all memory except the first block which it returns. The first + // block might be owned by the user and thus need some extra checks before + // deleting. + SerialArena::Memory Free(size_t* space_allocated); + +#ifdef _MSC_VER +#pragma warning(disable : 4324) +#endif + struct alignas(64) ThreadCache { +#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) + // If we are using the ThreadLocalStorage class to store the ThreadCache, + // then the ThreadCache's default constructor has to be responsible for + // initializing it. + ThreadCache() + : next_lifecycle_id(0), + last_lifecycle_id_seen(-1), + last_serial_arena(NULL) {} +#endif + + // Number of per-thread lifecycle IDs to reserve. Must be power of two. + // To reduce contention on a global atomic, each thread reserves a batch of + // IDs. The following number is calculated based on a stress test with + // ~6500 threads all frequently allocating a new arena. + static constexpr size_t kPerThreadIds = 256; + // Next lifecycle ID available to this thread. We need to reserve a new + // batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. + uint64_t next_lifecycle_id; + // The ThreadCache is considered valid as long as this matches the + // lifecycle_id of the arena being used. + uint64_t last_lifecycle_id_seen; + SerialArena* last_serial_arena; + }; + + // Lifecycle_id can be highly contended variable in a situation of lots of + // arena creation. Make sure that other global variables are not sharing the + // cacheline. +#ifdef _MSC_VER +#pragma warning(disable : 4324) +#endif + struct alignas(64) CacheAlignedLifecycleIdGenerator { + std::atomic id; + }; + static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_; +#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) + // iOS does not support __thread keyword so we use a custom thread local + // storage class we implemented. + static ThreadCache& thread_cache(); +#elif defined(PROTOBUF_USE_DLLS) + // Thread local variables cannot be exposed through DLL interface but we can + // wrap them in static functions. + static ThreadCache& thread_cache(); +#else + static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_; + static ThreadCache& thread_cache() { return thread_cache_; } +#endif + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ThreadSafeArena); + // All protos have pointers back to the arena hence Arena must have + // pointer stability. + ThreadSafeArena(ThreadSafeArena&&) = delete; + ThreadSafeArena& operator=(ThreadSafeArena&&) = delete; + + public: + // kBlockHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 + // to protect the invariant that pos is always at a multiple of 8. + static constexpr size_t kBlockHeaderSize = SerialArena::kBlockHeaderSize; + static constexpr size_t kSerialArenaSize = + (sizeof(SerialArena) + 7) & static_cast(-8); + static_assert(kBlockHeaderSize % 8 == 0, + "kBlockHeaderSize must be a multiple of 8."); + static_assert(kSerialArenaSize % 8 == 0, + "kSerialArenaSize must be a multiple of 8."); +}; + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include + +#endif // GOOGLE_PROTOBUF_ARENA_IMPL_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_test_util.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_test_util.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_test_util.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_test_util.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_test_util.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_test_util.h similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_test_util.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_test_util.h index 84df34989..33f5cf419 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_test_util.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_test_util.h @@ -84,7 +84,7 @@ class NoHeapChecker { private: class NewDeleteCapture { public: - // TOOD(xiaofeng): Implement this for opensource protobuf. + // TODO(xiaofeng): Implement this for opensource protobuf. void Hook() {} void Unhook() {} int alloc_count() { return 0; } @@ -92,6 +92,33 @@ class NoHeapChecker { } capture_alloc; }; +// Owns the internal T only if it's not owned by an arena. +// T needs to be arena constructible and destructor skippable. +template +class ArenaHolder { + public: + explicit ArenaHolder(Arena* arena) + : field_(Arena::CreateMessage(arena)), + owned_by_arena_(arena != nullptr) { + GOOGLE_DCHECK(google::protobuf::Arena::is_arena_constructable::value); + GOOGLE_DCHECK(google::protobuf::Arena::is_destructor_skippable::value); + } + + ~ArenaHolder() { + if (!owned_by_arena_) { + delete field_; + } + } + + T* get() { return field_; } + T* operator->() { return field_; } + T& operator*() { return *field_; } + + private: + T* field_; + bool owned_by_arena_; +}; + } // namespace internal } // namespace protobuf } // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_unittest.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_unittest.cc index 7e5b11563..76d9126ac 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/arena_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arena_unittest.cc @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -58,12 +58,14 @@ #include +// Must be included last +#include + using proto2_arena_unittest::ArenaMessage; using protobuf_unittest::TestAllExtensions; using protobuf_unittest::TestAllTypes; using protobuf_unittest::TestEmptyMessage; using protobuf_unittest::TestOneof2; -using protobuf_unittest_no_arena::TestNoArenaMessage; namespace google { namespace protobuf { @@ -156,26 +158,24 @@ class MustBeConstructedWithOneThroughEight { TEST(ArenaTest, ArenaConstructable) { EXPECT_TRUE(Arena::is_arena_constructable::type::value); EXPECT_TRUE(Arena::is_arena_constructable::type::value); - EXPECT_FALSE(Arena::is_arena_constructable::type::value); EXPECT_FALSE(Arena::is_arena_constructable::type::value); } TEST(ArenaTest, DestructorSkippable) { EXPECT_TRUE(Arena::is_destructor_skippable::type::value); EXPECT_TRUE(Arena::is_destructor_skippable::type::value); - EXPECT_FALSE(Arena::is_destructor_skippable::type::value); EXPECT_FALSE(Arena::is_destructor_skippable::type::value); } TEST(ArenaTest, BasicCreate) { Arena arena; - EXPECT_TRUE(Arena::Create(&arena) != NULL); - EXPECT_TRUE(Arena::Create(&arena) != NULL); + EXPECT_TRUE(Arena::Create(&arena) != NULL); + EXPECT_TRUE(Arena::Create(&arena) != NULL); EXPECT_TRUE(Arena::Create(&arena) != NULL); EXPECT_TRUE(Arena::Create(&arena) != NULL); EXPECT_TRUE(Arena::Create(&arena) != NULL); - arena.Own(new int32); - arena.Own(new int64); + arena.Own(new int32_t); + arena.Own(new int64_t); arena.Own(new float); arena.Own(new double); arena.Own(new std::string); @@ -273,28 +273,36 @@ TEST(ArenaTest, CreateWithMoveArguments) { } TEST(ArenaTest, InitialBlockTooSmall) { - // Construct a small (64 byte) initial block of memory to be used by the - // arena allocator; then, allocate an object which will not fit in the - // initial block. - std::vector arena_block(96); - ArenaOptions options; - options.initial_block = &arena_block[0]; - options.initial_block_size = arena_block.size(); - Arena arena(options); + // Construct a small blocks of memory to be used by the arena allocator; then, + // allocate an object which will not fit in the initial block. + for (int size = 0; size <= Arena::kBlockOverhead + 32; size++) { + std::vector arena_block(size); + ArenaOptions options; + options.initial_block = arena_block.data(); + options.initial_block_size = arena_block.size(); + + // Try sometimes with non-default block sizes so that we exercise paths + // with and without ArenaImpl::Options. + if ((size % 2) != 0) { + options.start_block_size += 8; + } + + Arena arena(options); - char* p = Arena::CreateArray(&arena, 96); - uintptr_t allocation = reinterpret_cast(p); + char* p = Arena::CreateArray(&arena, 96); + uintptr_t allocation = reinterpret_cast(p); - // Ensure that the arena allocator did not return memory pointing into the - // initial block of memory. - uintptr_t arena_start = reinterpret_cast(&arena_block[0]); - uintptr_t arena_end = arena_start + arena_block.size(); - EXPECT_FALSE(allocation >= arena_start && allocation < arena_end); + // Ensure that the arena allocator did not return memory pointing into the + // initial block of memory. + uintptr_t arena_start = reinterpret_cast(arena_block.data()); + uintptr_t arena_end = arena_start + arena_block.size(); + EXPECT_FALSE(allocation >= arena_start && allocation < arena_end); - // Write to the memory we allocated; this should (but is not guaranteed to) - // trigger a check for heap corruption if the object was allocated from the - // initially-provided block. - memset(p, '\0', 96); + // Write to the memory we allocated; this should (but is not guaranteed to) + // trigger a check for heap corruption if the object was allocated from the + // initially-provided block. + memset(p, '\0', 96); + } } TEST(ArenaTest, Parsing) { @@ -462,13 +470,6 @@ TEST(ArenaTest, SetAllocatedMessage) { nested->set_bb(118); arena_message->set_allocated_optional_nested_message(nested); EXPECT_EQ(118, arena_message->optional_nested_message().bb()); - - TestNoArenaMessage no_arena_message; - EXPECT_FALSE(no_arena_message.has_arena_message()); - no_arena_message.set_allocated_arena_message(NULL); - EXPECT_FALSE(no_arena_message.has_arena_message()); - no_arena_message.set_allocated_arena_message(new ArenaMessage); - EXPECT_TRUE(no_arena_message.has_arena_message()); } TEST(ArenaTest, ReleaseMessage) { @@ -621,7 +622,11 @@ TEST(ArenaTest, SetAllocatedAcrossArenas) { TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - arena1_message->set_allocated_optional_nested_message(arena2_submessage); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH(arena1_message->set_allocated_optional_nested_message( + arena2_submessage), + "submessage_arena"); +#endif EXPECT_NE(arena2_submessage, arena1_message->mutable_optional_nested_message()); } @@ -630,11 +635,43 @@ TEST(ArenaTest, SetAllocatedAcrossArenas) { Arena::CreateMessage(&arena1); arena1_submessage->set_bb(42); TestAllTypes* heap_message = new TestAllTypes; - heap_message->set_allocated_optional_nested_message(arena1_submessage); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + heap_message->set_allocated_optional_nested_message(arena1_submessage), + "submessage_arena"); +#endif EXPECT_NE(arena1_submessage, heap_message->mutable_optional_nested_message()); delete heap_message; } +TEST(ArenaTest, UnsafeArenaSetAllocatedAcrossArenas) { + Arena arena1; + TestAllTypes* arena1_message = Arena::CreateMessage(&arena1); + { + Arena arena2; + TestAllTypes::NestedMessage* arena2_submessage = + Arena::CreateMessage(&arena2); + arena2_submessage->set_bb(42); + arena1_message->unsafe_arena_set_allocated_optional_nested_message( + arena2_submessage); + EXPECT_EQ(arena2_submessage, + arena1_message->mutable_optional_nested_message()); + EXPECT_EQ(arena2_submessage, + arena1_message->unsafe_arena_release_optional_nested_message()); + } + + TestAllTypes::NestedMessage* arena1_submessage = + Arena::CreateMessage(&arena1); + arena1_submessage->set_bb(42); + TestAllTypes* heap_message = new TestAllTypes; + heap_message->unsafe_arena_set_allocated_optional_nested_message( + arena1_submessage); + EXPECT_EQ(arena1_submessage, heap_message->mutable_optional_nested_message()); + EXPECT_EQ(arena1_submessage, + heap_message->unsafe_arena_release_optional_nested_message()); + delete heap_message; +} + TEST(ArenaTest, SetAllocatedAcrossArenasWithReflection) { // Same as above, with reflection. Arena arena1; @@ -654,7 +691,11 @@ TEST(ArenaTest, SetAllocatedAcrossArenasWithReflection) { TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - r->SetAllocatedMessage(arena1_message, arena2_submessage, msg_field); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + r->SetAllocatedMessage(arena1_message, arena2_submessage, msg_field), + "GetOwningArena"); +#endif EXPECT_NE(arena2_submessage, arena1_message->mutable_optional_nested_message()); } @@ -663,25 +704,54 @@ TEST(ArenaTest, SetAllocatedAcrossArenasWithReflection) { Arena::CreateMessage(&arena1); arena1_submessage->set_bb(42); TestAllTypes* heap_message = new TestAllTypes; - r->SetAllocatedMessage(heap_message, arena1_submessage, msg_field); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + r->SetAllocatedMessage(heap_message, arena1_submessage, msg_field), + "GetOwningArena"); +#endif EXPECT_NE(arena1_submessage, heap_message->mutable_optional_nested_message()); delete heap_message; } +TEST(ArenaTest, UnsafeArenaSetAllocatedAcrossArenasWithReflection) { + // Same as above, with reflection. + Arena arena1; + TestAllTypes* arena1_message = Arena::CreateMessage(&arena1); + const Reflection* r = arena1_message->GetReflection(); + const Descriptor* d = arena1_message->GetDescriptor(); + const FieldDescriptor* msg_field = + d->FindFieldByName("optional_nested_message"); + { + Arena arena2; + TestAllTypes::NestedMessage* arena2_submessage = + Arena::CreateMessage(&arena2); + arena2_submessage->set_bb(42); + r->UnsafeArenaSetAllocatedMessage(arena1_message, arena2_submessage, + msg_field); + EXPECT_EQ(arena2_submessage, + arena1_message->mutable_optional_nested_message()); + EXPECT_EQ(arena2_submessage, + arena1_message->unsafe_arena_release_optional_nested_message()); + } + + TestAllTypes::NestedMessage* arena1_submessage = + Arena::CreateMessage(&arena1); + arena1_submessage->set_bb(42); + TestAllTypes* heap_message = new TestAllTypes; + r->UnsafeArenaSetAllocatedMessage(heap_message, arena1_submessage, msg_field); + EXPECT_EQ(arena1_submessage, heap_message->mutable_optional_nested_message()); + EXPECT_EQ(arena1_submessage, + heap_message->unsafe_arena_release_optional_nested_message()); + delete heap_message; +} + TEST(ArenaTest, AddAllocatedWithReflection) { Arena arena1; ArenaMessage* arena1_message = Arena::CreateMessage(&arena1); const Reflection* r = arena1_message->GetReflection(); const Descriptor* d = arena1_message->GetDescriptor(); - const FieldDescriptor* fd = - d->FindFieldByName("repeated_import_no_arena_message"); - // Message with cc_enable_arenas = false; - r->AddMessage(arena1_message, fd); - r->AddMessage(arena1_message, fd); - r->AddMessage(arena1_message, fd); - EXPECT_EQ(3, r->FieldSize(*arena1_message, fd)); // Message with cc_enable_arenas = true; - fd = d->FindFieldByName("repeated_nested_message"); + const FieldDescriptor* fd = d->FindFieldByName("repeated_nested_message"); r->AddMessage(arena1_message, fd); r->AddMessage(arena1_message, fd); r->AddMessage(arena1_message, fd); @@ -689,6 +759,7 @@ TEST(ArenaTest, AddAllocatedWithReflection) { } TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) { +#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES { RepeatedPtrField repeated_field; EXPECT_TRUE(repeated_field.empty()); @@ -699,6 +770,7 @@ TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) { EXPECT_TRUE(repeated_field.empty()); EXPECT_EQ(0, repeated_field.size()); } +#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES { RepeatedPtrField repeated_field; EXPECT_TRUE(repeated_field.empty()); @@ -733,29 +805,35 @@ TEST(ArenaTest, AddAllocatedToRepeatedField) { TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - arena1_message->mutable_repeated_nested_message()->AddAllocated( - arena2_submessage); - // Should copy object. - EXPECT_NE(arena2_submessage, &arena1_message->repeated_nested_message(i)); - EXPECT_EQ(42, arena1_message->repeated_nested_message(i).bb()); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + arena1_message->mutable_repeated_nested_message()->AddAllocated( + arena2_submessage), + "value_arena"); +#endif + // Should not receive object. + EXPECT_TRUE(arena1_message->repeated_nested_message().empty()); } // Arena->heap case. - TestAllTypes* heap_message = new TestAllTypes(); + TestAllTypes* heap_message = new TestAllTypes; for (int i = 0; i < 10; i++) { Arena arena2; TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - heap_message->mutable_repeated_nested_message()->AddAllocated( - arena2_submessage); - // Should copy object. - EXPECT_NE(arena2_submessage, &heap_message->repeated_nested_message(i)); - EXPECT_EQ(42, heap_message->repeated_nested_message(i).bb()); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + heap_message->mutable_repeated_nested_message()->AddAllocated( + arena2_submessage), + "value_arena"); +#endif + // Should not receive object. + EXPECT_TRUE(heap_message->repeated_nested_message().empty()); } delete heap_message; - // Heap-arena case for strings (which are not arena-allocated). + // Heap->arena case for strings (which are not arena-allocated). arena1_message->Clear(); for (int i = 0; i < 10; i++) { std::string* s = new std::string("Test"); @@ -766,6 +844,65 @@ TEST(ArenaTest, AddAllocatedToRepeatedField) { } } +TEST(ArenaTest, UnsafeArenaAddAllocatedToRepeatedField) { + // Heap->arena case. + Arena arena1; + TestAllTypes* arena1_message = Arena::CreateMessage(&arena1); + { + auto* heap_submessage = new TestAllTypes::NestedMessage; + arena1_message->mutable_repeated_nested_message()->UnsafeArenaAddAllocated( + heap_submessage); + // Should not copy object. + EXPECT_EQ(heap_submessage, &arena1_message->repeated_nested_message(0)); + EXPECT_EQ(heap_submessage, arena1_message->mutable_repeated_nested_message() + ->UnsafeArenaReleaseLast()); + delete heap_submessage; + } + + // Arena1->Arena2 case. + arena1_message->Clear(); + { + Arena arena2; + TestAllTypes::NestedMessage* arena2_submessage = + Arena::CreateMessage(&arena2); + arena2_submessage->set_bb(42); + arena1_message->mutable_repeated_nested_message()->UnsafeArenaAddAllocated( + arena2_submessage); + // Should own object. + EXPECT_EQ(arena2_submessage, &arena1_message->repeated_nested_message(0)); + EXPECT_EQ(arena2_submessage, + arena1_message->mutable_repeated_nested_message() + ->UnsafeArenaReleaseLast()); + } + + // Arena->heap case. + TestAllTypes* heap_message = new TestAllTypes; + { + Arena arena2; + TestAllTypes::NestedMessage* arena2_submessage = + Arena::CreateMessage(&arena2); + arena2_submessage->set_bb(42); + heap_message->mutable_repeated_nested_message()->UnsafeArenaAddAllocated( + arena2_submessage); + // Should own object. + EXPECT_EQ(arena2_submessage, &heap_message->repeated_nested_message(0)); + EXPECT_EQ(arena2_submessage, heap_message->mutable_repeated_nested_message() + ->UnsafeArenaReleaseLast()); + } + delete heap_message; + + // Heap->arena case for strings (which are not arena-allocated). + arena1_message->Clear(); + { + std::string* s = new std::string("Test"); + arena1_message->mutable_repeated_string()->UnsafeArenaAddAllocated(s); + // Should not copy. + EXPECT_EQ(s, &arena1_message->repeated_string(0)); + EXPECT_EQ("Test", arena1_message->repeated_string(0)); + delete arena1_message->mutable_repeated_string()->UnsafeArenaReleaseLast(); + } +} + TEST(ArenaTest, AddAllocatedToRepeatedFieldViaReflection) { // Heap->arena case. Arena arena1; @@ -790,10 +927,13 @@ TEST(ArenaTest, AddAllocatedToRepeatedFieldViaReflection) { TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - r->AddAllocatedMessage(arena1_message, fd, arena2_submessage); - // Should copy object. - EXPECT_NE(arena2_submessage, &arena1_message->repeated_nested_message(i)); - EXPECT_EQ(42, arena1_message->repeated_nested_message(i).bb()); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + r->AddAllocatedMessage(arena1_message, fd, arena2_submessage), + "value_arena"); +#endif + // Should not receive object. + EXPECT_TRUE(arena1_message->repeated_nested_message().empty()); } // Arena->heap case. @@ -803,10 +943,13 @@ TEST(ArenaTest, AddAllocatedToRepeatedFieldViaReflection) { TestAllTypes::NestedMessage* arena2_submessage = Arena::CreateMessage(&arena2); arena2_submessage->set_bb(42); - r->AddAllocatedMessage(heap_message, fd, arena2_submessage); - // Should copy object. - EXPECT_NE(arena2_submessage, &heap_message->repeated_nested_message(i)); - EXPECT_EQ(42, heap_message->repeated_nested_message(i).bb()); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH( + r->AddAllocatedMessage(heap_message, fd, arena2_submessage), + "value_arena"); +#endif + // Should not receive object. + EXPECT_TRUE(heap_message->repeated_nested_message().empty()); } delete heap_message; } @@ -873,23 +1016,6 @@ TEST(ArenaTest, ReleaseLastRepeatedField) { } } -TEST(ArenaTest, UnsafeArenaReleaseAdd) { - // Use unsafe_arena_release() and unsafe_arena_set_allocated() to transfer an - // arena-allocated string from one message to another. - const char kContent[] = "Test content"; - - Arena arena; - TestAllTypes* message1 = Arena::CreateMessage(&arena); - TestAllTypes* message2 = Arena::CreateMessage(&arena); - std::string* arena_string = Arena::Create(&arena); - *arena_string = kContent; - - message1->unsafe_arena_set_allocated_optional_string(arena_string); - message2->unsafe_arena_set_allocated_optional_string( - message1->unsafe_arena_release_optional_string()); - EXPECT_EQ(kContent, message2->optional_string()); -} - TEST(ArenaTest, UnsafeArenaAddAllocated) { Arena arena; TestAllTypes* message = Arena::CreateMessage(&arena); @@ -900,43 +1026,20 @@ TEST(ArenaTest, UnsafeArenaAddAllocated) { } } -TEST(ArenaTest, UnsafeArenaRelease) { - Arena arena; - TestAllTypes* message = Arena::CreateMessage(&arena); - - std::string* s = new std::string("test string"); - message->unsafe_arena_set_allocated_optional_string(s); - EXPECT_TRUE(message->has_optional_string()); - EXPECT_EQ("test string", message->optional_string()); - s = message->unsafe_arena_release_optional_string(); - EXPECT_FALSE(message->has_optional_string()); - delete s; - - s = new std::string("test string"); - message->unsafe_arena_set_allocated_oneof_string(s); - EXPECT_TRUE(message->has_oneof_string()); - EXPECT_EQ("test string", message->oneof_string()); - s = message->unsafe_arena_release_oneof_string(); - EXPECT_FALSE(message->has_oneof_string()); - delete s; -} - TEST(ArenaTest, OneofMerge) { Arena arena; TestAllTypes* message0 = Arena::CreateMessage(&arena); TestAllTypes* message1 = Arena::CreateMessage(&arena); - message0->unsafe_arena_set_allocated_oneof_string(new std::string("x")); + message0->set_oneof_string("x"); ASSERT_TRUE(message0->has_oneof_string()); - message1->unsafe_arena_set_allocated_oneof_string(new std::string("y")); + message1->set_oneof_string("y"); ASSERT_TRUE(message1->has_oneof_string()); EXPECT_EQ("x", message0->oneof_string()); EXPECT_EQ("y", message1->oneof_string()); message0->MergeFrom(*message1); EXPECT_EQ("y", message0->oneof_string()); EXPECT_EQ("y", message1->oneof_string()); - delete message0->unsafe_arena_release_oneof_string(); - delete message1->unsafe_arena_release_oneof_string(); } TEST(ArenaTest, ArenaOneofReflection) { @@ -1043,17 +1146,14 @@ TEST(ArenaTest, ExtensionsOnArena) { TEST(ArenaTest, RepeatedFieldOnArena) { // Preallocate an initial arena block to avoid mallocs during hooked region. std::vector arena_block(1024 * 1024); - ArenaOptions options; - options.initial_block = &arena_block[0]; - options.initial_block_size = arena_block.size(); - Arena arena(options); + Arena arena(arena_block.data(), arena_block.size()); { internal::NoHeapChecker no_heap; // Fill some repeated fields on the arena to test for leaks. Also verify no // memory allocations. - RepeatedField repeated_int32(&arena); + RepeatedField repeated_int32(&arena); RepeatedPtrField repeated_message(&arena); for (int i = 0; i < 100; i++) { repeated_int32.Add(42); @@ -1221,7 +1321,6 @@ TEST(ArenaTest, MessageLiteOnArena) { } #endif // PROTOBUF_RTTI - // RepeatedField should support non-POD types, and invoke constructors and // destructors appropriately, because it's used this way by lots of other code // (even if this was not its original intent). @@ -1242,13 +1341,10 @@ TEST(ArenaTest, RepeatedFieldWithNonPODType) { } // Align n to next multiple of 8 -uint64 Align8(uint64 n) { return (n + 7) & -8; } +uint64_t Align8(uint64_t n) { return (n + 7) & -8; } TEST(ArenaTest, SpaceAllocated_and_Used) { - ArenaOptions options; - options.start_block_size = 256; - options.max_block_size = 8192; - Arena arena_1(options); + Arena arena_1; EXPECT_EQ(0, arena_1.SpaceAllocated()); EXPECT_EQ(0, arena_1.SpaceUsed()); EXPECT_EQ(0, arena_1.Reset()); @@ -1260,6 +1356,9 @@ TEST(ArenaTest, SpaceAllocated_and_Used) { // Test with initial block. std::vector arena_block(1024); + ArenaOptions options; + options.start_block_size = 256; + options.max_block_size = 8192; options.initial_block = &arena_block[0]; options.initial_block_size = arena_block.size(); Arena arena_2(options); @@ -1270,19 +1369,25 @@ TEST(ArenaTest, SpaceAllocated_and_Used) { EXPECT_EQ(1024, arena_2.SpaceAllocated()); EXPECT_EQ(Align8(55), arena_2.SpaceUsed()); EXPECT_EQ(1024, arena_2.Reset()); +} + +TEST(ArenaTest, BlockSizeDoubling) { + Arena arena; + EXPECT_EQ(0, arena.SpaceUsed()); + EXPECT_EQ(0, arena.SpaceAllocated()); + + // Allocate something to get initial block size. + Arena::CreateArray(&arena, 1); + auto first_block_size = arena.SpaceAllocated(); + + // Keep allocating until space used increases. + while (arena.SpaceAllocated() == first_block_size) { + Arena::CreateArray(&arena, 1); + } + ASSERT_GT(arena.SpaceAllocated(), first_block_size); + auto second_block_size = (arena.SpaceAllocated() - first_block_size); - // Reset options to test doubling policy explicitly. - options.initial_block = NULL; - options.initial_block_size = 0; - Arena arena_3(options); - EXPECT_EQ(0, arena_3.SpaceUsed()); - Arena::CreateArray(&arena_3, 160); - EXPECT_EQ(256, arena_3.SpaceAllocated()); - EXPECT_EQ(Align8(160), arena_3.SpaceUsed()); - Arena::CreateArray(&arena_3, 70); - EXPECT_EQ(256 + 512, arena_3.SpaceAllocated()); - EXPECT_EQ(Align8(160) + Align8(70), arena_3.SpaceUsed()); - EXPECT_EQ(256 + 512, arena_3.Reset()); + EXPECT_EQ(second_block_size, 2*first_block_size); } TEST(ArenaTest, Alignment) { @@ -1299,11 +1404,11 @@ TEST(ArenaTest, BlockSizeSmallerThanAllocation) { opt.start_block_size = opt.max_block_size = i; Arena arena(opt); - *Arena::Create(&arena) = 42; + *Arena::Create(&arena) = 42; EXPECT_GE(arena.SpaceAllocated(), 8); EXPECT_EQ(8, arena.SpaceUsed()); - *Arena::Create(&arena) = 42; + *Arena::Create(&arena) = 42; EXPECT_GE(arena.SpaceAllocated(), 16); EXPECT_EQ(16, arena.SpaceUsed()); } @@ -1331,11 +1436,6 @@ TEST(ArenaTest, GetArenaShouldReturnNullForNonArenaAllocatedMessages) { } TEST(ArenaTest, GetArenaShouldReturnNullForNonArenaCompatibleTypes) { - TestNoArenaMessage message; - const TestNoArenaMessage* const_pointer_to_message = &message; - EXPECT_EQ(nullptr, Arena::GetArena(&message)); - EXPECT_EQ(nullptr, Arena::GetArena(const_pointer_to_message)); - // Test that GetArena returns nullptr for types that have a GetArena method // that doesn't return Arena*. struct { @@ -1365,96 +1465,93 @@ TEST(ArenaTest, AddCleanup) { } } -TEST(ArenaTest, UnsafeSetAllocatedOnArena) { - Arena arena; - TestAllTypes* message = Arena::CreateMessage(&arena); - EXPECT_FALSE(message->has_optional_string()); - - std::string owned_string = "test with long enough content to heap-allocate"; - message->unsafe_arena_set_allocated_optional_string(&owned_string); - EXPECT_TRUE(message->has_optional_string()); - - message->unsafe_arena_set_allocated_optional_string(NULL); - EXPECT_FALSE(message->has_optional_string()); +namespace { +uint32_t hooks_num_init = 0; +uint32_t hooks_num_allocations = 0; +uint32_t hooks_num_reset = 0; +uint32_t hooks_num_destruct = 0; + +void ClearHookCounts() { + hooks_num_init = 0; + hooks_num_allocations = 0; + hooks_num_reset = 0; + hooks_num_destruct = 0; } +} // namespace -// A helper utility class to only contain static hook functions, some -// counters to be used to verify the counters have been called and a cookie -// value to be verified. -class ArenaHooksTestUtil { +// A helper utility class that handles arena callbacks. +class ArenaOptionsTestFriend final : public internal::ArenaMetricsCollector { public: - static void* on_init(Arena* arena) { - ++num_init; - int* cookie = new int(kCookieValue); - return static_cast(cookie); + static internal::ArenaMetricsCollector* NewWithAllocs() { + return new ArenaOptionsTestFriend(true); } - static void on_allocation(const std::type_info* /*unused*/, uint64 alloc_size, - void* cookie) { - ++num_allocations; - int cookie_value = *static_cast(cookie); - EXPECT_EQ(kCookieValue, cookie_value); + static internal::ArenaMetricsCollector* NewWithoutAllocs() { + return new ArenaOptionsTestFriend(false); } - static void on_reset(Arena* arena, void* cookie, uint64 space_used) { - ++num_reset; - int cookie_value = *static_cast(cookie); - EXPECT_EQ(kCookieValue, cookie_value); + static void Enable(ArenaOptions* options) { + ClearHookCounts(); + options->make_metrics_collector = &ArenaOptionsTestFriend::NewWithAllocs; } - static void on_destruction(Arena* arena, void* cookie, uint64 space_used) { - ++num_destruct; - int cookie_value = *static_cast(cookie); - EXPECT_EQ(kCookieValue, cookie_value); - delete static_cast(cookie); + static void EnableWithoutAllocs(ArenaOptions* options) { + ClearHookCounts(); + options->make_metrics_collector = &ArenaOptionsTestFriend::NewWithoutAllocs; } - static const int kCookieValue = 999; - static uint32 num_init; - static uint32 num_allocations; - static uint32 num_reset; - static uint32 num_destruct; -}; -uint32 ArenaHooksTestUtil::num_init = 0; -uint32 ArenaHooksTestUtil::num_allocations = 0; -uint32 ArenaHooksTestUtil::num_reset = 0; -uint32 ArenaHooksTestUtil::num_destruct = 0; -const int ArenaHooksTestUtil::kCookieValue; - -class ArenaOptionsTestFriend { - public: - static void Set(ArenaOptions* options) { - options->on_arena_init = ArenaHooksTestUtil::on_init; - options->on_arena_allocation = ArenaHooksTestUtil::on_allocation; - options->on_arena_reset = ArenaHooksTestUtil::on_reset; - options->on_arena_destruction = ArenaHooksTestUtil::on_destruction; + explicit ArenaOptionsTestFriend(bool record_allocs) + : ArenaMetricsCollector(record_allocs) { + ++hooks_num_init; + } + void OnDestroy(uint64_t space_allocated) override { + ++hooks_num_destruct; + delete this; + } + void OnReset(uint64_t space_allocated) override { ++hooks_num_reset; } + void OnAlloc(const std::type_info* allocated_type, + uint64_t alloc_size) override { + ++hooks_num_allocations; } }; -// Test the hooks are correctly called and that the cookie is passed. +// Test the hooks are correctly called. TEST(ArenaTest, ArenaHooksSanity) { ArenaOptions options; - ArenaOptionsTestFriend::Set(&options); + ArenaOptionsTestFriend::Enable(&options); // Scope for defining the arena { Arena arena(options); - EXPECT_EQ(1, ArenaHooksTestUtil::num_init); - EXPECT_EQ(0, ArenaHooksTestUtil::num_allocations); - Arena::Create(&arena); - if (std::is_trivially_destructible::value) { - EXPECT_EQ(1, ArenaHooksTestUtil::num_allocations); + EXPECT_EQ(1, hooks_num_init); + EXPECT_EQ(0, hooks_num_allocations); + Arena::Create(&arena); + if (std::is_trivially_destructible::value) { + EXPECT_EQ(1, hooks_num_allocations); } else { - EXPECT_EQ(2, ArenaHooksTestUtil::num_allocations); + EXPECT_EQ(2, hooks_num_allocations); } arena.Reset(); arena.Reset(); - EXPECT_EQ(2, ArenaHooksTestUtil::num_reset); + EXPECT_EQ(2, hooks_num_reset); } - EXPECT_EQ(3, ArenaHooksTestUtil::num_reset); - EXPECT_EQ(1, ArenaHooksTestUtil::num_destruct); + EXPECT_EQ(2, hooks_num_reset); + EXPECT_EQ(1, hooks_num_destruct); +} + +// Test that allocation hooks are not called when we don't need them. +TEST(ArenaTest, ArenaHooksWhenAllocationsNotNeeded) { + ArenaOptions options; + ArenaOptionsTestFriend::EnableWithoutAllocs(&options); + + Arena arena(options); + EXPECT_EQ(0, hooks_num_allocations); + Arena::Create(&arena); + EXPECT_EQ(0, hooks_num_allocations); } } // namespace protobuf } // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.cc new file mode 100644 index 000000000..169f52729 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.cc @@ -0,0 +1,286 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// clang-format off +#include +// clang-format on + +namespace google { +namespace protobuf { +namespace internal { + +const std::string& LazyString::Init() const { + static WrappedMutex mu{GOOGLE_PROTOBUF_LINKER_INITIALIZED}; + mu.Lock(); + const std::string* res = inited_.load(std::memory_order_acquire); + if (res == nullptr) { + auto init_value = init_value_; + res = ::new (static_cast(string_buf_)) + std::string(init_value.ptr, init_value.size); + inited_.store(res, std::memory_order_release); + } + mu.Unlock(); + return *res; +} + + +std::string* ArenaStringPtr::SetAndReturnNewString() { + std::string* new_string = new std::string(); + tagged_ptr_.Set(new_string); + return new_string; +} + +void ArenaStringPtr::DestroyNoArenaSlowPath() { delete UnsafeMutablePointer(); } + +void ArenaStringPtr::Set(const std::string* default_value, + ConstStringParam value, ::google::protobuf::Arena* arena) { + if (IsDefault(default_value)) { + tagged_ptr_.Set(Arena::Create(arena, value)); + } else { + UnsafeMutablePointer()->assign(value.data(), value.length()); + } +} + +void ArenaStringPtr::Set(const std::string* default_value, std::string&& value, + ::google::protobuf::Arena* arena) { + if (IsDefault(default_value)) { + if (arena == nullptr) { + tagged_ptr_.Set(new std::string(std::move(value))); + } else { + tagged_ptr_.Set(Arena::Create(arena, std::move(value))); + } + } else if (IsDonatedString()) { + std::string* current = tagged_ptr_.Get(); + auto* s = new (current) std::string(std::move(value)); + arena->OwnDestructor(s); + tagged_ptr_.Set(s); + } else /* !IsDonatedString() */ { + *UnsafeMutablePointer() = std::move(value); + } +} + +void ArenaStringPtr::Set(EmptyDefault, ConstStringParam value, + ::google::protobuf::Arena* arena) { + Set(&GetEmptyStringAlreadyInited(), value, arena); +} + +void ArenaStringPtr::Set(EmptyDefault, std::string&& value, + ::google::protobuf::Arena* arena) { + Set(&GetEmptyStringAlreadyInited(), std::move(value), arena); +} + +void ArenaStringPtr::Set(NonEmptyDefault, ConstStringParam value, + ::google::protobuf::Arena* arena) { + Set(nullptr, value, arena); +} + +void ArenaStringPtr::Set(NonEmptyDefault, std::string&& value, + ::google::protobuf::Arena* arena) { + Set(nullptr, std::move(value), arena); +} + +std::string* ArenaStringPtr::Mutable(EmptyDefault, ::google::protobuf::Arena* arena) { + if (!IsDonatedString() && !IsDefault(&GetEmptyStringAlreadyInited())) { + return UnsafeMutablePointer(); + } else { + return MutableSlow(arena); + } +} + +std::string* ArenaStringPtr::Mutable(const LazyString& default_value, + ::google::protobuf::Arena* arena) { + if (!IsDonatedString() && !IsDefault(nullptr)) { + return UnsafeMutablePointer(); + } else { + return MutableSlow(arena, default_value); + } +} + +std::string* ArenaStringPtr::MutableNoCopy(const std::string* default_value, + ::google::protobuf::Arena* arena) { + if (!IsDonatedString() && !IsDefault(default_value)) { + return UnsafeMutablePointer(); + } else { + GOOGLE_DCHECK(IsDefault(default_value)); + // Allocate empty. The contents are not relevant. + std::string* new_string = Arena::Create(arena); + tagged_ptr_.Set(new_string); + return new_string; + } +} + +template +std::string* ArenaStringPtr::MutableSlow(::google::protobuf::Arena* arena, + const Lazy&... lazy_default) { + const std::string* const default_value = + sizeof...(Lazy) == 0 ? &GetEmptyStringAlreadyInited() : nullptr; + GOOGLE_DCHECK(IsDefault(default_value)); + std::string* new_string = + Arena::Create(arena, lazy_default.get()...); + tagged_ptr_.Set(new_string); + return new_string; +} + +std::string* ArenaStringPtr::Release(const std::string* default_value, + ::google::protobuf::Arena* arena) { + if (IsDefault(default_value)) { + return nullptr; + } else { + return ReleaseNonDefault(default_value, arena); + } +} + +std::string* ArenaStringPtr::ReleaseNonDefault(const std::string* default_value, + ::google::protobuf::Arena* arena) { + GOOGLE_DCHECK(!IsDefault(default_value)); + + if (!IsDonatedString()) { + std::string* released; + if (arena != nullptr) { + released = new std::string; + released->swap(*UnsafeMutablePointer()); + } else { + released = UnsafeMutablePointer(); + } + tagged_ptr_.Set(const_cast(default_value)); + return released; + } else /* IsDonatedString() */ { + GOOGLE_DCHECK(arena != nullptr); + std::string* released = new std::string(Get()); + tagged_ptr_.Set(const_cast(default_value)); + return released; + } +} + +void ArenaStringPtr::SetAllocated(const std::string* default_value, + std::string* value, ::google::protobuf::Arena* arena) { + // Release what we have first. + if (arena == nullptr && !IsDefault(default_value)) { + delete UnsafeMutablePointer(); + } + if (value == nullptr) { + tagged_ptr_.Set(const_cast(default_value)); + } else { +#ifdef NDEBUG + tagged_ptr_.Set(value); + if (arena != nullptr) { + arena->Own(value); + } +#else + // On debug builds, copy the string so the address differs. delete will + // fail if value was a stack-allocated temporary/etc., which would have + // failed when arena ran its cleanup list. + std::string* new_value = Arena::Create(arena, *value); + delete value; + tagged_ptr_.Set(new_value); +#endif + } +} + +void ArenaStringPtr::Destroy(const std::string* default_value, + ::google::protobuf::Arena* arena) { + if (arena == nullptr) { + GOOGLE_DCHECK(!IsDonatedString()); + if (!IsDefault(default_value)) { + delete UnsafeMutablePointer(); + } + } +} + +void ArenaStringPtr::Destroy(EmptyDefault, ::google::protobuf::Arena* arena) { + Destroy(&GetEmptyStringAlreadyInited(), arena); +} + +void ArenaStringPtr::Destroy(NonEmptyDefault, ::google::protobuf::Arena* arena) { + Destroy(nullptr, arena); +} + +void ArenaStringPtr::ClearToEmpty() { + if (IsDefault(&GetEmptyStringAlreadyInited())) { + // Already set to default -- do nothing. + } else { + // Unconditionally mask away the tag. + // + // UpdateDonatedString uses assign when capacity is larger than the new + // value, which is trivially true in the donated string case. + // const_cast(PtrValue())->clear(); + tagged_ptr_.Get()->clear(); + } +} + +void ArenaStringPtr::ClearToDefault(const LazyString& default_value, + ::google::protobuf::Arena* arena) { + (void)arena; + if (IsDefault(nullptr)) { + // Already set to default -- do nothing. + } else if (!IsDonatedString()) { + UnsafeMutablePointer()->assign(default_value.get()); + } +} + +inline void SetStrWithHeapBuffer(std::string* str, ArenaStringPtr* s) { + TaggedPtr res; + res.Set(str); + s->UnsafeSetTaggedPointer(res); +} + +const char* EpsCopyInputStream::ReadArenaString(const char* ptr, + ArenaStringPtr* s, + Arena* arena) { + GOOGLE_DCHECK(arena != nullptr); + + int size = ReadSize(&ptr); + if (!ptr) return nullptr; + + auto* str = Arena::Create(arena); + ptr = ReadString(ptr, size, str); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + + SetStrWithHeapBuffer(str, s); + + return ptr; +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.h new file mode 100644 index 000000000..38c36378c --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring.h @@ -0,0 +1,420 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_ARENASTRING_H__ +#define GOOGLE_PROTOBUF_ARENASTRING_H__ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#ifdef SWIG +#error "You cannot SWIG proto headers" +#endif + + +namespace google { +namespace protobuf { +namespace internal { + +template +class ExplicitlyConstructed; + +class SwapFieldHelper; + +// Lazy string instance to support string fields with non-empty default. +// These are initialized on the first call to .get(). +class PROTOBUF_EXPORT LazyString { + public: + // We explicitly make LazyString an aggregate so that MSVC can do constant + // initialization on it without marking it `constexpr`. + // We do not want to use `constexpr` because it makes it harder to have extern + // storage for it and causes library bloat. + struct InitValue { + const char* ptr; + size_t size; + }; + // We keep a union of the initialization value and the std::string to save on + // space. We don't need the string array after Init() is done. + union { + mutable InitValue init_value_; + alignas(std::string) mutable char string_buf_[sizeof(std::string)]; + }; + mutable std::atomic inited_; + + const std::string& get() const { + // This check generates less code than a call-once invocation. + auto* res = inited_.load(std::memory_order_acquire); + if (PROTOBUF_PREDICT_FALSE(res == nullptr)) return Init(); + return *res; + } + + private: + // Initialize the string in `string_buf_`, update `inited_` and return it. + // We return it here to avoid having to read it again in the inlined code. + const std::string& Init() const; +}; + +template +class TaggedPtr { + public: + TaggedPtr() = default; + explicit constexpr TaggedPtr(const ExplicitlyConstructed* ptr) + : ptr_(const_cast*>(ptr)) {} + + void SetTagged(T* p) { + Set(p); + ptr_ = reinterpret_cast(as_int() | 1); + } + void Set(T* p) { ptr_ = p; } + T* Get() const { return reinterpret_cast(as_int() & -2); } + bool IsTagged() const { return as_int() & 1; } + + // Returned value is only safe to dereference if IsTagged() == false. + // It is safe to compare. + T* UnsafeGet() const { return static_cast(ptr_); } + + bool IsNull() { return ptr_ == nullptr; } + + private: + uintptr_t as_int() const { return reinterpret_cast(ptr_); } + void* ptr_; +}; + +static_assert(std::is_trivial>::value, + "TaggedPtr must be trivial"); + +// This class encapsulates a pointer to a std::string with or without a donated +// buffer, tagged by bottom bit. It is a high-level wrapper that almost directly +// corresponds to the interface required by string fields in generated +// code. It replaces the old std::string* pointer in such cases. +// +// The object has different but similar code paths for when the default value is +// the empty string and when it is a non-empty string. +// The empty string is handled different throughout the library and there is a +// single global instance of it we can share. +// +// For fields with an empty string default value, there are three distinct +// states: +// +// - Pointer set to 'String' tag (LSB is 0), equal to +// &GetEmptyStringAlreadyInited(): field is set to its default value. Points +// to a true std::string*, but we do not own that std::string* (it's a +// globally shared instance). +// +// - Pointer set to 'String' tag (LSB is 0), but not equal to the global empty +// string: field points to a true std::string* instance that we own. This +// instance is either on the heap or on the arena (i.e. registered on +// free()/destructor-call list) as appropriate. +// +// - Pointer set to 'DonatedString' tag (LSB is 1): points to a std::string +// instance with a buffer on the arena (arena is never nullptr in this case). +// +// For fields with a non-empty string default value, there are three distinct +// states: +// +// - Pointer set to 'String' tag (LSB is 0), equal to `nullptr`: +// Field is in "default" mode and does not point to any actual instance. +// Methods that might need to create an instance of the object will pass a +// `const LazyString&` for it. +// +// - Pointer set to 'String' tag (LSB is 0), but not equal to `nullptr`: +// field points to a true std::string* instance that we own. This instance is +// either on the heap or on the arena (i.e. registered on +// free()/destructor-call list) as appropriate. +// +// - Pointer set to 'DonatedString' tag (LSB is 1): points to a std::string +// instance with a buffer on the arena (arena is never nullptr in this case). +// +// Generated code and reflection code both ensure that ptr_ is never null for +// fields with an empty default. +// Because ArenaStringPtr is used in oneof unions, its constructor is a NOP and +// so the field is always manually initialized via method calls. +// +// Side-note: why pass information about the default on every API call? Because +// we don't want to hold it in a member variable, or else this would go into +// every proto message instance. This would be a huge waste of space, since the +// default instance pointer is typically a global (static class field). We want +// the generated code to be as efficient as possible, and if we take +// the default value information as a parameter that's in practice taken from a +// static class field, and compare ptr_ to the default value, we end up with a +// single "cmp %reg, GLOBAL" in the resulting machine code. (Note that this also +// requires the String tag to be 0 so we can avoid the mask before comparing.) +struct PROTOBUF_EXPORT ArenaStringPtr { + ArenaStringPtr() = default; + explicit constexpr ArenaStringPtr( + const ExplicitlyConstructed* default_value) + : tagged_ptr_(default_value) {} + + // Some methods below are overloaded on a `default_value` and on tags. + // The tagged overloads help reduce code size in the callers in generated + // code, while the `default_value` overloads are useful from reflection. + // By-value empty struct arguments are elided in the ABI. + struct EmptyDefault {}; + struct NonEmptyDefault {}; + + void Set(const std::string* default_value, ConstStringParam value, + ::google::protobuf::Arena* arena); + void Set(const std::string* default_value, std::string&& value, + ::google::protobuf::Arena* arena); + void Set(EmptyDefault, ConstStringParam value, ::google::protobuf::Arena* arena); + void Set(EmptyDefault, std::string&& value, ::google::protobuf::Arena* arena); + void Set(NonEmptyDefault, ConstStringParam value, ::google::protobuf::Arena* arena); + void Set(NonEmptyDefault, std::string&& value, ::google::protobuf::Arena* arena); + template + void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena) { + Set(p1, ConstStringParam(str), arena); + } + template + void Set(FirstParam p1, const char* str, size_t size, + ::google::protobuf::Arena* arena) { + ConstStringParam sp{str, size}; // for string_view and `const string &` + Set(p1, sp, arena); + } + template + void Set(FirstParam p1, + std::reference_wrapper const_string_ref, + ::google::protobuf::Arena* arena) { + Set(p1, const_string_ref.get(), arena); + } + + template + void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena) { + Set(p1, static_cast(p2), arena); + } + template + void SetBytes(FirstParam p1, const void* str, size_t size, + ::google::protobuf::Arena* arena) { + // must work whether ConstStringParam is string_view or `const string &` + ConstStringParam sp{static_cast(str), size}; + Set(p1, sp, arena); + } + + // Basic accessors. + PROTOBUF_NDEBUG_INLINE const std::string& Get() const { + // Unconditionally mask away the tag. + return *tagged_ptr_.Get(); + } + PROTOBUF_NDEBUG_INLINE const std::string* GetPointer() const { + // Unconditionally mask away the tag. + return tagged_ptr_.Get(); + } + + // For fields with an empty default value. + std::string* Mutable(EmptyDefault, ::google::protobuf::Arena* arena); + // For fields with a non-empty default value. + std::string* Mutable(const LazyString& default_value, ::google::protobuf::Arena* arena); + + // Release returns a std::string* instance that is heap-allocated and is not + // Own()'d by any arena. If the field is not set, this returns nullptr. The + // caller retains ownership. Clears this field back to nullptr state. Used to + // implement release_() methods on generated classes. + PROTOBUF_NODISCARD std::string* Release(const std::string* default_value, + ::google::protobuf::Arena* arena); + PROTOBUF_NODISCARD std::string* ReleaseNonDefault( + const std::string* default_value, ::google::protobuf::Arena* arena); + + // Takes a std::string that is heap-allocated, and takes ownership. The + // std::string's destructor is registered with the arena. Used to implement + // set_allocated_ in generated classes. + void SetAllocated(const std::string* default_value, std::string* value, + ::google::protobuf::Arena* arena); + + // Swaps internal pointers. Arena-safety semantics: this is guarded by the + // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is + // 'unsafe' if called directly. + inline PROTOBUF_NDEBUG_INLINE static void InternalSwap( + const std::string* default_value, ArenaStringPtr* rhs, Arena* rhs_arena, + ArenaStringPtr* lhs, Arena* lhs_arena); + + // Frees storage (if not on an arena). + void Destroy(const std::string* default_value, ::google::protobuf::Arena* arena); + void Destroy(EmptyDefault, ::google::protobuf::Arena* arena); + void Destroy(NonEmptyDefault, ::google::protobuf::Arena* arena); + + // Clears content, but keeps allocated std::string, to avoid the overhead of + // heap operations. After this returns, the content (as seen by the user) will + // always be the empty std::string. Assumes that |default_value| is an empty + // std::string. + void ClearToEmpty(); + + // Clears content, assuming that the current value is not the empty + // string default. + void ClearNonDefaultToEmpty(); + + // Clears content, but keeps allocated std::string if arena != nullptr, to + // avoid the overhead of heap operations. After this returns, the content + // (as seen by the user) will always be equal to |default_value|. + void ClearToDefault(const LazyString& default_value, ::google::protobuf::Arena* arena); + + // Called from generated code / reflection runtime only. Resets value to point + // to a default string pointer, with the semantics that this + // ArenaStringPtr does not own the pointed-to memory. Disregards initial value + // of ptr_ (so this is the *ONLY* safe method to call after construction or + // when reinitializing after becoming the active field in a oneof union). + inline void UnsafeSetDefault(const std::string* default_value); + + // Returns a mutable pointer, but doesn't initialize the string to the + // default value. + std::string* MutableNoArenaNoDefault(const std::string* default_value); + + // Get a mutable pointer with unspecified contents. + // Similar to `MutableNoArenaNoDefault`, but also handles the arena case. + // If the value was donated, the contents are discarded. + std::string* MutableNoCopy(const std::string* default_value, + ::google::protobuf::Arena* arena); + + // Destroy the string. Assumes `arena == nullptr`. + void DestroyNoArena(const std::string* default_value); + + // Internal setter used only at parse time to directly set a donated string + // value. + void UnsafeSetTaggedPointer(TaggedPtr value) { + tagged_ptr_ = value; + } + // Generated code only! An optimization, in certain cases the generated + // code is certain we can obtain a std::string with no default checks and + // tag tests. + std::string* UnsafeMutablePointer() PROTOBUF_RETURNS_NONNULL; + + inline bool IsDefault(const std::string* default_value) const { + // Relies on the fact that kPtrTagString == 0, so if IsString(), ptr_ is the + // actual std::string pointer (and if !IsString(), ptr_ will never be equal + // to any aligned |default_value| pointer). The key is that we want to avoid + // masking in the fastpath const-pointer Get() case for non-arena code. + return tagged_ptr_.UnsafeGet() == default_value; + } + + private: + TaggedPtr tagged_ptr_; + + bool IsDonatedString() const { return false; } + + // Swaps tagged pointer without debug hardening. This is to allow python + // protobuf to maintain pointer stability even in DEBUG builds. + inline PROTOBUF_NDEBUG_INLINE static void UnsafeShallowSwap( + ArenaStringPtr* rhs, ArenaStringPtr* lhs) { + std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); + } + + friend class ::google::protobuf::internal::SwapFieldHelper; + + // Slow paths. + + // MutableSlow requires that !IsString() || IsDefault + // Variadic to support 0 args for EmptyDefault and 1 arg for LazyString. + template + std::string* MutableSlow(::google::protobuf::Arena* arena, const Lazy&... lazy_default); + + // Sets value to a newly allocated string and returns it + std::string* SetAndReturnNewString(); + + // Destroys the non-default string value out-of-line + void DestroyNoArenaSlowPath(); + +}; + +inline void ArenaStringPtr::UnsafeSetDefault(const std::string* value) { + tagged_ptr_.Set(const_cast(value)); +} + +// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs. +inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // + const std::string* default_value, // + ArenaStringPtr* rhs, Arena* rhs_arena, // + ArenaStringPtr* lhs, Arena* lhs_arena) { + // Silence unused variable warnings in release buildls. + (void)default_value; + (void)rhs_arena; + (void)lhs_arena; + std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + auto force_realloc = [default_value](ArenaStringPtr* p, Arena* arena) { + if (p->IsDefault(default_value)) return; + std::string* old_value = p->tagged_ptr_.Get(); + std::string* new_value = + p->IsDonatedString() + ? Arena::Create(arena, *old_value) + : Arena::Create(arena, std::move(*old_value)); + if (arena == nullptr) delete old_value; + p->tagged_ptr_.Set(new_value); + }; + // Because, at this point, tagged_ptr_ has been swapped, arena should also be + // swapped. + force_realloc(lhs, rhs_arena); + force_realloc(rhs, lhs_arena); +#endif // PROTOBUF_FORCE_COPY_IN_SWAP +} + +inline void ArenaStringPtr::ClearNonDefaultToEmpty() { + // Unconditionally mask away the tag. + tagged_ptr_.Get()->clear(); +} + +inline std::string* ArenaStringPtr::MutableNoArenaNoDefault( + const std::string* default_value) { + // VERY IMPORTANT for performance and code size: this will reduce to a member + // variable load, a pointer check (against |default_value|, in practice a + // static global) and a branch to the slowpath (which calls operator new and + // the ctor). DO NOT add any tagged-pointer operations here. + if (IsDefault(default_value)) { + return SetAndReturnNewString(); + } else { + return UnsafeMutablePointer(); + } +} + +inline void ArenaStringPtr::DestroyNoArena(const std::string* default_value) { + if (!IsDefault(default_value)) { + DestroyNoArenaSlowPath(); + } +} + +inline std::string* ArenaStringPtr::UnsafeMutablePointer() { + GOOGLE_DCHECK(!tagged_ptr_.IsTagged()); + GOOGLE_DCHECK(tagged_ptr_.UnsafeGet() != nullptr); + return tagged_ptr_.UnsafeGet(); +} + + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include + +#endif // GOOGLE_PROTOBUF_ARENASTRING_H__ diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring_unittest.cc new file mode 100644 index 000000000..db988afb5 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/arenastring_unittest.cc @@ -0,0 +1,157 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +// Must be included last. +#include + +namespace google { +namespace protobuf { + +using internal::ArenaStringPtr; + +using EmptyDefault = ArenaStringPtr::EmptyDefault; + +const internal::LazyString nonempty_default{{{"default", 7}}, {nullptr}}; +const std::string* empty_default = &internal::GetEmptyString(); + +class SingleArena : public testing::TestWithParam { + public: + std::unique_ptr GetArena() { + if (this->GetParam()) return nullptr; + return std::unique_ptr(new Arena()); + } +}; + +INSTANTIATE_TEST_SUITE_P(ArenaString, SingleArena, testing::Bool()); + +TEST_P(SingleArena, GetSet) { + auto arena = GetArena(); + ArenaStringPtr field; + field.UnsafeSetDefault(empty_default); + EXPECT_EQ("", field.Get()); + field.Set(empty_default, "Test short", arena.get()); + EXPECT_EQ("Test short", field.Get()); + field.Set(empty_default, "Test long long long long value", arena.get()); + EXPECT_EQ("Test long long long long value", field.Get()); + field.Set(empty_default, "", arena.get()); + field.Destroy(empty_default, arena.get()); +} + +TEST_P(SingleArena, MutableAccessor) { + auto arena = GetArena(); + ArenaStringPtr field; + const std::string* empty_default = &internal::GetEmptyString(); + field.UnsafeSetDefault(empty_default); + + std::string* mut = field.Mutable(EmptyDefault{}, arena.get()); + EXPECT_EQ(mut, field.Mutable(EmptyDefault{}, arena.get())); + EXPECT_EQ(mut, &field.Get()); + EXPECT_NE(empty_default, mut); + EXPECT_EQ("", *mut); + *mut = "Test long long long long value"; // ensure string allocates storage + EXPECT_EQ("Test long long long long value", field.Get()); + field.Destroy(empty_default, arena.get()); +} + +TEST_P(SingleArena, NullDefault) { + auto arena = GetArena(); + + ArenaStringPtr field; + field.UnsafeSetDefault(nullptr); + std::string* mut = field.Mutable(nonempty_default, arena.get()); + EXPECT_EQ(mut, field.Mutable(nonempty_default, arena.get())); + EXPECT_EQ(mut, &field.Get()); + EXPECT_NE(nullptr, mut); + EXPECT_EQ("default", *mut); + *mut = "Test long long long long value"; // ensure string allocates storage + EXPECT_EQ("Test long long long long value", field.Get()); + field.Destroy(nullptr, arena.get()); +} + +class DualArena : public testing::TestWithParam> { + public: + std::unique_ptr GetLhsArena() { + if (std::get<0>(this->GetParam())) return nullptr; + return std::unique_ptr(new Arena()); + } + std::unique_ptr GetRhsArena() { + if (std::get<1>(this->GetParam())) return nullptr; + return std::unique_ptr(new Arena()); + } +}; + +INSTANTIATE_TEST_SUITE_P(ArenaString, DualArena, + testing::Combine(testing::Bool(), testing::Bool())); + +TEST_P(DualArena, Swap) { + auto lhs_arena = GetLhsArena(); + ArenaStringPtr lhs; + lhs.UnsafeSetDefault(empty_default); + ArenaStringPtr rhs; + rhs.UnsafeSetDefault(empty_default); + + { + auto rhs_arena = GetRhsArena(); + lhs.Set(empty_default, "lhs value that has some heft", lhs_arena.get()); + rhs.Set(empty_default, "rhs value that has some heft", rhs_arena.get()); + ArenaStringPtr::InternalSwap(empty_default, // + &lhs, lhs_arena.get(), // + &rhs, rhs_arena.get()); + EXPECT_EQ("rhs value that has some heft", lhs.Get()); + EXPECT_EQ("lhs value that has some heft", rhs.Get()); + lhs.Destroy(empty_default, rhs_arena.get()); + } + EXPECT_EQ("lhs value that has some heft", rhs.Get()); + rhs.Destroy(empty_default, lhs_arena.get()); +} + + +} // namespace protobuf +} // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.cc index d33f29fb9..3c47aa42d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.cc @@ -30,16 +30,17 @@ #include +#include #include + +#include +#include #include #include #include #include #include #include - -#include -#include #include #include @@ -141,8 +142,8 @@ bool AtLeastOneAnnotationMatchesSubstring( e = annotations.end(); i != e; ++i) { const GeneratedCodeInfo::Annotation* annotation = *i; - uint32 begin = annotation->begin(); - uint32 end = annotation->end(); + uint32_t begin = annotation->begin(); + uint32_t end = annotation->end(); if (end < begin || end > file_content.size()) { return false; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.h index 7c1319182..551f2244c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/annotation_test_util.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/annotation_test_util.h @@ -60,7 +60,7 @@ struct ExpectedOutput { // directory. void AddFile(const std::string& filename, const std::string& data); -// Runs proto compiler. Captures proto file structrue in FileDescriptorProto. +// Runs proto compiler. Captures proto file structure in FileDescriptorProto. // Files will be generated in TestTempDir() folder. Callers of this // function must read generated files themselves. // @@ -78,7 +78,7 @@ bool RunProtoCompiler(const std::string& filename, bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info); // Finds all of the Annotations for a given source file and path. -// See Location.path in http://google3/net/proto2/proto/descriptor.proto for +// See Location.path in https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for // explanation of what path vector is. void FindAnnotationsOnPath( const GeneratedCodeInfo& info, const std::string& source_file, @@ -88,7 +88,7 @@ void FindAnnotationsOnPath( // Finds the Annotation for a given source file and path (or returns null if it // couldn't). If there are several annotations for given path, returns the first // one. See Location.path in -// http://google3/net/proto2/proto/descriptor.proto for explanation of what path +// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for explanation of what path // vector is. const GeneratedCodeInfo::Annotation* FindAnnotationOnPath( const GeneratedCodeInfo& info, const std::string& source_file, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.cc similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.cc index 428ec4698..4544f3e71 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.cc @@ -50,7 +50,7 @@ bool CodeGenerator::GenerateAll(const std::vector& files, const std::string& parameter, GeneratorContext* generator_context, std::string* error) const { - // Default implemenation is just to call the per file method, and prefix any + // Default implementation is just to call the per file method, and prefix any // error string with the file to provide context. bool succeeded = true; for (int i = 0; i < files.size(); i++) { @@ -85,6 +85,12 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert( return NULL; // make compiler happy } +io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo( + const std::string& filename, const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& /*info*/) { + return OpenForInsert(filename, insertion_point); +} + void GeneratorContext::ListParsedFiles( std::vector* output) { GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; @@ -117,6 +123,15 @@ void ParseGeneratorParameter( } } +// Strips ".proto" or ".protodevel" from the end of a filename. +std::string StripProto(const std::string& filename) { + if (HasSuffixString(filename, ".protodevel")) { + return StripSuffixString(filename, ".protodevel"); + } else { + return StripSuffixString(filename, ".proto"); + } +} + } // namespace compiler } // namespace protobuf } // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.h similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.h index 528dc7642..2cbda270b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/code_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/code_generator.h @@ -52,6 +52,7 @@ namespace io { class ZeroCopyOutputStream; } class FileDescriptor; +class GeneratedCodeInfo; namespace compiler { class AccessInfoMap; @@ -102,6 +103,17 @@ class PROTOC_EXPORT CodeGenerator { GeneratorContext* generator_context, std::string* error) const; + // This must be kept in sync with plugin.proto. See that file for + // documentation on each value. + enum Feature { + FEATURE_PROTO3_OPTIONAL = 1, + }; + + // Implement this to indicate what features this code generator supports. + // + // This must be a bitwise OR of values from the Feature enum above (or zero). + virtual uint64_t GetSupportedFeatures() const { return 0; } + // This is no longer used, but this class is part of the opensource protobuf // library, so it has to remain to keep vtables the same for the current // version of the library. When protobufs does a api breaking change, the @@ -146,6 +158,15 @@ class PROTOC_EXPORT GeneratorContext { virtual io::ZeroCopyOutputStream* OpenForInsert( const std::string& filename, const std::string& insertion_point); + // Similar to OpenForInsert, but if `info` is non-empty, will open (or create) + // filename.pb.meta and insert info at the appropriate place with the + // necessary shifts. The default implementation ignores `info`. + // + // WARNING: This feature will be REMOVED in the near future. + virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( + const std::string& filename, const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& info); + // Returns a vector of FileDescriptors for all the files being compiled // in this run. Useful for languages, such as Go, that treat files // differently when compiled as a set rather than individually. @@ -173,6 +194,9 @@ typedef GeneratorContext OutputDirectory; PROTOC_EXPORT void ParseGeneratorParameter( const std::string&, std::vector >*); +// Strips ".proto" or ".protodevel" from the end of a filename. +PROTOC_EXPORT std::string StripProto(const std::string& filename); + } // namespace compiler } // namespace protobuf } // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.cc similarity index 76% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.cc index 2de565963..bfc6b0552 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.cc @@ -34,6 +34,8 @@ #include +#include + #include #include @@ -58,8 +60,10 @@ #include -#ifdef __APPLE__ +#if defined(__APPLE__) #include +#elif defined(__FreeBSD__) +#include #endif #include @@ -202,6 +206,13 @@ bool GetProtocAbsolutePath(std::string* path) { realpath(dirtybuffer, buffer); len = strlen(buffer); } +#elif defined(__FreeBSD__) + char buffer[PATH_MAX]; + size_t len = PATH_MAX; + int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; + if (sysctl(mib, 4, &buffer, &len, NULL, 0) != 0) { + len = 0; + } #else char buffer[PATH_MAX]; int len = readlink("/proc/self/exe", buffer, PATH_MAX); @@ -225,7 +236,7 @@ bool IsInstalledProtoPath(const std::string& path) { // Add the paths where google/protobuf/descriptor.proto and other well-known // type protos are installed. void AddDefaultProtoPaths( - std::vector >* paths) { + std::vector>* paths) { // TODO(xiaofeng): The code currently only checks relative paths of where // the protoc binary is installed. We probably should make it handle more // cases than that. @@ -279,45 +290,51 @@ class CommandLineInterface::ErrorPrinter public DescriptorPool::ErrorCollector { public: ErrorPrinter(ErrorFormat format, DiskSourceTree* tree = NULL) - : format_(format), tree_(tree), found_errors_(false) {} + : format_(format), + tree_(tree), + found_errors_(false), + found_warnings_(false) {} ~ErrorPrinter() {} // implements MultiFileErrorCollector ------------------------------ void AddError(const std::string& filename, int line, int column, - const std::string& message) { + const std::string& message) override { found_errors_ = true; AddErrorOrWarning(filename, line, column, message, "error", std::cerr); } void AddWarning(const std::string& filename, int line, int column, - const std::string& message) { + const std::string& message) override { + found_warnings_ = true; AddErrorOrWarning(filename, line, column, message, "warning", std::clog); } // implements io::ErrorCollector ----------------------------------- - void AddError(int line, int column, const std::string& message) { + void AddError(int line, int column, const std::string& message) override { AddError("input", line, column, message); } - void AddWarning(int line, int column, const std::string& message) { + void AddWarning(int line, int column, const std::string& message) override { AddErrorOrWarning("input", line, column, message, "warning", std::clog); } // implements DescriptorPool::ErrorCollector------------------------- void AddError(const std::string& filename, const std::string& element_name, const Message* descriptor, ErrorLocation location, - const std::string& message) { + const std::string& message) override { AddErrorOrWarning(filename, -1, -1, message, "error", std::cerr); } void AddWarning(const std::string& filename, const std::string& element_name, const Message* descriptor, ErrorLocation location, - const std::string& message) { + const std::string& message) override { AddErrorOrWarning(filename, -1, -1, message, "warning", std::clog); } bool FoundErrors() const { return found_errors_; } + bool FoundWarnings() const { return found_warnings_; } + private: void AddErrorOrWarning(const std::string& filename, int line, int column, const std::string& message, const std::string& type, @@ -356,6 +373,7 @@ class CommandLineInterface::ErrorPrinter const ErrorFormat format_; DiskSourceTree* tree_; bool found_errors_; + bool found_warnings_; }; // ------------------------------------------------------------------- @@ -382,18 +400,22 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { void GetOutputFilenames(std::vector* output_filenames); // implements GeneratorContext -------------------------------------- - io::ZeroCopyOutputStream* Open(const std::string& filename); - io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename); - io::ZeroCopyOutputStream* OpenForInsert(const std::string& filename, - const std::string& insertion_point); - void ListParsedFiles(std::vector* output) { + io::ZeroCopyOutputStream* Open(const std::string& filename) override; + io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename) override; + io::ZeroCopyOutputStream* OpenForInsert( + const std::string& filename, const std::string& insertion_point) override; + io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( + const std::string& filename, const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& info) override; + void ListParsedFiles(std::vector* output) override { *output = parsed_files_; } private: friend class MemoryOutputStream; - // map instead of unordered_map so that files are written in order (good when + // The files_ field maps from path keys to file content values. It's a map + // instead of an unordered_map so that files are written in order (good when // writing zips). std::map files_; const std::vector& parsed_files_; @@ -408,6 +430,10 @@ class CommandLineInterface::MemoryOutputStream MemoryOutputStream(GeneratorContextImpl* directory, const std::string& filename, const std::string& insertion_point); + MemoryOutputStream(GeneratorContextImpl* directory, + const std::string& filename, + const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& info); virtual ~MemoryOutputStream(); // implements ZeroCopyOutputStream --------------------------------- @@ -418,12 +444,23 @@ class CommandLineInterface::MemoryOutputStream int64_t ByteCount() const override { return inner_->ByteCount(); } private: - // Checks to see if "filename_.meta" exists in directory_; if so, fixes the + // Checks to see if "filename_.pb.meta" exists in directory_; if so, fixes the // offsets in that GeneratedCodeInfo record to reflect bytes inserted in // filename_ at original offset insertion_offset with length insertion_length. - // We assume that insertions will not occur within any given annotated span - // of text. - void UpdateMetadata(size_t insertion_offset, size_t insertion_length); + // Also adds in the data from info_to_insert_ with updated offsets governed by + // insertion_offset and indent_length. We assume that insertions will not + // occur within any given annotated span of text. insertion_content must end + // with an endline. + void UpdateMetadata(const std::string& insertion_content, + size_t insertion_offset, size_t insertion_length, + size_t indent_length); + + // Inserts info_to_insert_ into target_info, assuming that the relevant + // insertion was made at insertion_offset in file_content with the given + // indent_length. insertion_content must end with an endline. + void InsertShiftedInfo(const std::string& insertion_content, + size_t insertion_offset, size_t indent_length, + google::protobuf::GeneratedCodeInfo& target_info); // Where to insert the string when it's done. GeneratorContextImpl* directory_; @@ -438,6 +475,9 @@ class CommandLineInterface::MemoryOutputStream // StringOutputStream writing to data_. std::unique_ptr inner_; + + // The GeneratedCodeInfo to insert at the insertion point. + google::protobuf::GeneratedCodeInfo info_to_insert_; }; // ------------------------------------------------------------------- @@ -551,10 +591,12 @@ bool CommandLineInterface::GeneratorContextImpl::WriteAllToZip( if (stream.GetErrno() != 0) { std::cerr << filename << ": " << strerror(stream.GetErrno()) << std::endl; + return false; } if (!stream.Close()) { std::cerr << filename << ": " << strerror(stream.GetErrno()) << std::endl; + return false; } return true; @@ -594,6 +636,13 @@ CommandLineInterface::GeneratorContextImpl::OpenForInsert( return new MemoryOutputStream(this, filename, insertion_point); } +io::ZeroCopyOutputStream* +CommandLineInterface::GeneratorContextImpl::OpenForInsertWithGeneratedCodeInfo( + const std::string& filename, const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& info) { + return new MemoryOutputStream(this, filename, insertion_point, info); +} + // ------------------------------------------------------------------- CommandLineInterface::MemoryOutputStream::MemoryOutputStream( @@ -612,40 +661,114 @@ CommandLineInterface::MemoryOutputStream::MemoryOutputStream( insertion_point_(insertion_point), inner_(new io::StringOutputStream(&data_)) {} +CommandLineInterface::MemoryOutputStream::MemoryOutputStream( + GeneratorContextImpl* directory, const std::string& filename, + const std::string& insertion_point, const google::protobuf::GeneratedCodeInfo& info) + : directory_(directory), + filename_(filename), + insertion_point_(insertion_point), + inner_(new io::StringOutputStream(&data_)), + info_to_insert_(info) {} + +void CommandLineInterface::MemoryOutputStream::InsertShiftedInfo( + const std::string& insertion_content, size_t insertion_offset, + size_t indent_length, google::protobuf::GeneratedCodeInfo& target_info) { + // Keep track of how much extra data was added for indents before the + // current annotation being inserted. `pos` and `source_annotation.begin()` + // are offsets in `insertion_content`. `insertion_offset` is updated so that + // it can be added to an annotation's `begin` field to reflect that + // annotation's updated location after `insertion_content` was inserted into + // the target file. + size_t pos = 0; + insertion_offset += indent_length; + for (const auto& source_annotation : info_to_insert_.annotation()) { + GeneratedCodeInfo::Annotation* annotation = target_info.add_annotation(); + int inner_indent = 0; + // insertion_content is guaranteed to end in an endline. This last endline + // has no effect on indentation. + for (; pos < source_annotation.end() && pos < insertion_content.size() - 1; + ++pos) { + if (insertion_content[pos] == '\n') { + if (pos >= source_annotation.begin()) { + // The beginning of the annotation is at insertion_offset, but the end + // can still move further in the target file. + inner_indent += indent_length; + } else { + insertion_offset += indent_length; + } + } + } + *annotation = source_annotation; + annotation->set_begin(annotation->begin() + insertion_offset); + insertion_offset += inner_indent; + annotation->set_end(annotation->end() + insertion_offset); + } +} + void CommandLineInterface::MemoryOutputStream::UpdateMetadata( - size_t insertion_offset, size_t insertion_length) { - auto it = directory_->files_.find(filename_ + ".meta"); - if (it == directory_->files_.end()) { + const std::string& insertion_content, size_t insertion_offset, + size_t insertion_length, size_t indent_length) { + auto it = directory_->files_.find(filename_ + ".pb.meta"); + if (it == directory_->files_.end() && info_to_insert_.annotation().empty()) { // No metadata was recorded for this file. return; } - std::string& encoded_data = it->second; GeneratedCodeInfo metadata; bool is_text_format = false; - if (!metadata.ParseFromString(encoded_data)) { - if (!TextFormat::ParseFromString(encoded_data, &metadata)) { - // The metadata is invalid. - std::cerr << filename_ - << ".meta: Could not parse metadata as wire or text format." - << std::endl; - return; - } - // Generators that use the public plugin interface emit text-format - // metadata (because in the public plugin protocol, file content must be - // UTF8-encoded strings). - is_text_format = true; - } - for (int i = 0; i < metadata.annotation_size(); ++i) { - GeneratedCodeInfo::Annotation* annotation = metadata.mutable_annotation(i); - if (annotation->begin() >= insertion_offset) { - annotation->set_begin(annotation->begin() + insertion_length); - annotation->set_end(annotation->end() + insertion_length); + std::string* encoded_data = nullptr; + if (it != directory_->files_.end()) { + encoded_data = &it->second; + // Try to decode a GeneratedCodeInfo proto from the .pb.meta file. It may be + // in wire or text format. Keep the same format when the data is written out + // later. + if (!metadata.ParseFromString(*encoded_data)) { + if (!TextFormat::ParseFromString(*encoded_data, &metadata)) { + // The metadata is invalid. + std::cerr + << filename_ + << ".pb.meta: Could not parse metadata as wire or text format." + << std::endl; + return; + } + // Generators that use the public plugin interface emit text-format + // metadata (because in the public plugin protocol, file content must be + // UTF8-encoded strings). + is_text_format = true; } + } else { + // Create a new file to store the new metadata in info_to_insert_. + encoded_data = + &directory_->files_.insert({filename_ + ".pb.meta", ""}).first->second; + } + GeneratedCodeInfo new_metadata; + bool crossed_offset = false; + size_t to_add = 0; + for (const auto& source_annotation : metadata.annotation()) { + // The first time an annotation at or after the insertion point is found, + // insert the new metadata from info_to_insert_. Shift all annotations + // after the new metadata by the length of the text that was inserted + // (including any additional indent length). + if (source_annotation.begin() >= insertion_offset && !crossed_offset) { + crossed_offset = true; + InsertShiftedInfo(insertion_content, insertion_offset, indent_length, + new_metadata); + to_add += insertion_length; + } + GeneratedCodeInfo::Annotation* annotation = new_metadata.add_annotation(); + *annotation = source_annotation; + annotation->set_begin(annotation->begin() + to_add); + annotation->set_end(annotation->end() + to_add); + } + // If there were never any annotations at or after the insertion point, + // make sure to still insert the new metadata from info_to_insert_. + if (!crossed_offset) { + InsertShiftedInfo(insertion_content, insertion_offset, indent_length, + new_metadata); } if (is_text_format) { - TextFormat::PrintToString(metadata, &encoded_data); + TextFormat::PrintToString(new_metadata, encoded_data); } else { - metadata.SerializeToString(&encoded_data); + new_metadata.SerializeToString(encoded_data); } } @@ -728,7 +851,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { if (indent_.empty()) { // No indent. This makes things easier. target->insert(pos, data_); - UpdateMetadata(pos, data_.size()); + UpdateMetadata(data_, pos, data_.size(), 0); } else { // Calculate how much space we need. int indent_size = 0; @@ -738,7 +861,6 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { // Make a hole for it. target->insert(pos, data_.size() + indent_size, '\0'); - UpdateMetadata(pos, data_.size() + indent_size); // Now copy in the data. std::string::size_type data_pos = 0; @@ -757,6 +879,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { target_ptr += line_length; data_pos += line_length; } + UpdateMetadata(data_, pos, data_.size() + indent_size, indent_.size()); GOOGLE_CHECK_EQ(target_ptr, ::google::protobuf::string_as_array(target) + pos + data_.size() + indent_size); @@ -773,16 +896,9 @@ const char* const CommandLineInterface::kPathSeparator = ":"; #endif CommandLineInterface::CommandLineInterface() - : mode_(MODE_COMPILE), - print_mode_(PRINT_NONE), - error_format_(ERROR_FORMAT_GCC), - direct_dependencies_explicitly_set_(false), - direct_dependencies_violation_msg_( - kDefaultDirectDependenciesViolationMsg), - imports_in_descriptor_set_(false), - source_info_in_descriptor_set_(false), - disallow_services_(false) { -} + : direct_dependencies_violation_msg_( + kDefaultDirectDependenciesViolationMsg) {} + CommandLineInterface::~CommandLineInterface() {} void CommandLineInterface::RegisterGenerator(const std::string& flag_name, @@ -811,6 +927,39 @@ void CommandLineInterface::AllowPlugins(const std::string& exe_name_prefix) { plugin_prefix_ = exe_name_prefix; } +namespace { + +bool ContainsProto3Optional(const Descriptor* desc) { + for (int i = 0; i < desc->field_count(); i++) { + if (desc->field(i)->has_optional_keyword()) { + return true; + } + } + for (int i = 0; i < desc->nested_type_count(); i++) { + if (ContainsProto3Optional(desc->nested_type(i))) { + return true; + } + } + return false; +} + +bool ContainsProto3Optional(const FileDescriptor* file) { + if (file->syntax() == FileDescriptor::SYNTAX_PROTO3) { + for (int i = 0; i < file->message_type_count(); i++) { + if (ContainsProto3Optional(file->message_type(i))) { + return true; + } + } + } + return false; +} + +} // namespace + +namespace { +std::unique_ptr +PopulateSingleSimpleDescriptorDatabase(const std::string& descriptor_set_name); +} int CommandLineInterface::Run(int argc, const char* const argv[]) { Clear(); @@ -827,16 +976,38 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { std::unique_ptr disk_source_tree; std::unique_ptr error_collector; std::unique_ptr descriptor_pool; - std::unique_ptr descriptor_set_in_database; + + // The SimpleDescriptorDatabases here are the constituents of the + // MergedDescriptorDatabase descriptor_set_in_database, so this vector is for + // managing their lifetimes. Its scope should match descriptor_set_in_database + std::vector> + databases_per_descriptor_set; + std::unique_ptr descriptor_set_in_database; + std::unique_ptr source_tree_database; // Any --descriptor_set_in FileDescriptorSet objects will be used as a // fallback to input_files on command line, so create that db first. if (!descriptor_set_in_names_.empty()) { - descriptor_set_in_database.reset(new SimpleDescriptorDatabase()); - if (!PopulateSimpleDescriptorDatabase(descriptor_set_in_database.get())) { - return 1; + for (const std::string& name : descriptor_set_in_names_) { + std::unique_ptr database_for_descriptor_set = + PopulateSingleSimpleDescriptorDatabase(name); + if (!database_for_descriptor_set) { + return EXIT_FAILURE; + } + databases_per_descriptor_set.push_back( + std::move(database_for_descriptor_set)); + } + + std::vector raw_databases_per_descriptor_set; + raw_databases_per_descriptor_set.reserve( + databases_per_descriptor_set.size()); + for (const std::unique_ptr& db : + databases_per_descriptor_set) { + raw_databases_per_descriptor_set.push_back(db.get()); } + descriptor_set_in_database.reset( + new MergedDescriptorDatabase(raw_databases_per_descriptor_set)); } if (proto_path_.empty()) { @@ -886,7 +1057,8 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { for (int i = 0; i < output_directives_.size(); i++) { std::string output_location = output_directives_[i].output_location; if (!HasSuffixString(output_location, ".zip") && - !HasSuffixString(output_location, ".jar")) { + !HasSuffixString(output_location, ".jar") && + !HasSuffixString(output_location, ".srcjar")) { AddTrailingSlash(&output_location); } @@ -956,7 +1128,8 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { } } - if (error_collector->FoundErrors()) { + if (error_collector->FoundErrors() || + (fatal_warnings_ && error_collector->FoundWarnings())) { return 1; } @@ -999,48 +1172,51 @@ bool CommandLineInterface::InitializeDiskSourceTree( return true; } -bool CommandLineInterface::PopulateSimpleDescriptorDatabase( - SimpleDescriptorDatabase* database) { - for (int i = 0; i < descriptor_set_in_names_.size(); i++) { - int fd; - do { - fd = open(descriptor_set_in_names_[i].c_str(), O_RDONLY | O_BINARY); - } while (fd < 0 && errno == EINTR); - if (fd < 0) { - std::cerr << descriptor_set_in_names_[i] << ": " << strerror(ENOENT) - << std::endl; - return false; - } +namespace { +std::unique_ptr +PopulateSingleSimpleDescriptorDatabase(const std::string& descriptor_set_name) { + int fd; + do { + fd = open(descriptor_set_name.c_str(), O_RDONLY | O_BINARY); + } while (fd < 0 && errno == EINTR); + if (fd < 0) { + std::cerr << descriptor_set_name << ": " << strerror(ENOENT) << std::endl; + return nullptr; + } - FileDescriptorSet file_descriptor_set; - bool parsed = file_descriptor_set.ParseFromFileDescriptor(fd); - if (close(fd) != 0) { - std::cerr << descriptor_set_in_names_[i] << ": close: " << strerror(errno) - << std::endl; - return false; - } + FileDescriptorSet file_descriptor_set; + bool parsed = file_descriptor_set.ParseFromFileDescriptor(fd); + if (close(fd) != 0) { + std::cerr << descriptor_set_name << ": close: " << strerror(errno) + << std::endl; + return nullptr; + } - if (!parsed) { - std::cerr << descriptor_set_in_names_[i] << ": Unable to parse." - << std::endl; - return false; - } + if (!parsed) { + std::cerr << descriptor_set_name << ": Unable to parse." << std::endl; + return nullptr; + } - for (int j = 0; j < file_descriptor_set.file_size(); j++) { - FileDescriptorProto previously_added_file_descriptor_proto; - if (database->FindFileByName(file_descriptor_set.file(j).name(), - &previously_added_file_descriptor_proto)) { - // already present - skip - continue; - } - if (!database->Add(file_descriptor_set.file(j))) { - return false; - } + std::unique_ptr database{ + new SimpleDescriptorDatabase()}; + + for (int j = 0; j < file_descriptor_set.file_size(); j++) { + FileDescriptorProto previously_added_file_descriptor_proto; + if (database->FindFileByName(file_descriptor_set.file(j).name(), + &previously_added_file_descriptor_proto)) { + // already present - skip + continue; + } + if (!database->Add(file_descriptor_set.file(j))) { + return nullptr; } } - return true; + return database; } +} // namespace + + bool CommandLineInterface::VerifyInputFilesInDescriptors( DescriptorDatabase* database) { for (const auto& input_file : input_files_) { @@ -1059,6 +1235,7 @@ bool CommandLineInterface::VerifyInputFilesInDescriptors( << std::endl; return false; } + } return true; } @@ -1067,10 +1244,26 @@ bool CommandLineInterface::ParseInputFiles( DescriptorPool* descriptor_pool, DiskSourceTree* source_tree, std::vector* parsed_files) { - // Track unused imports in all source files - for (const auto& input_file : input_files_) { - descriptor_pool->AddUnusedImportTrackFile(input_file); + if (!proto_path_.empty()) { + // Track unused imports in all source files that were loaded from the + // filesystem. We do not track unused imports for files loaded from + // descriptor sets as they may be programmatically generated in which case + // exerting this level of rigor is less desirable. We're also making the + // assumption that the initial parse of the proto from the filesystem + // was rigorous in checking unused imports and that the descriptor set + // being parsed was produced then and that it was subsequent mutations + // of that descriptor set that left unused imports. + // + // Note that relying on proto_path exclusively is limited in that we may + // be loading descriptors from both the filesystem and descriptor sets + // depending on the invocation. At least for invocations that are + // exclusively reading from descriptor sets, we can eliminate this failure + // condition. + for (const auto& input_file : input_files_) { + descriptor_pool->AddUnusedImportTrackFile(input_file); + } } + bool result = true; // Parse each file. for (const auto& input_file : input_files_) { @@ -1093,6 +1286,7 @@ bool CommandLineInterface::ParseInputFiles( break; } + // Enforce --direct_dependencies if (direct_dependencies_explicitly_set_) { bool indirect_imports = false; @@ -1138,6 +1332,7 @@ void CommandLineInterface::Clear() { source_info_in_descriptor_set_ = false; disallow_services_ = false; direct_dependencies_explicitly_set_ = false; + deterministic_output_ = false; } bool CommandLineInterface::MakeProtoProtoPathRelative( @@ -1177,13 +1372,17 @@ bool CommandLineInterface::MakeProtoProtoPathRelative( "comes first." << std::endl; return false; - case DiskSourceTree::CANNOT_OPEN: + case DiskSourceTree::CANNOT_OPEN: { if (in_fallback_database) { return true; } + std::string error_str = source_tree->GetLastErrorMessage().empty() + ? strerror(errno) + : source_tree->GetLastErrorMessage(); std::cerr << "Could not map to virtual file: " << *proto << ": " - << strerror(errno) << std::endl; + << error_str << std::endl; return false; + } case DiskSourceTree::NO_MAPPING: { // Try to interpret the path as a virtual path. std::string disk_file; @@ -1326,13 +1525,36 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( proto_path_.push_back(std::pair("", ".")); } - // Check some error cases. - bool decoding_raw = (mode_ == MODE_DECODE) && codec_type_.empty(); - if (decoding_raw && !input_files_.empty()) { - std::cerr << "When using --decode_raw, no input files should be given." + // Check error cases that span multiple flag values. + bool missing_proto_definitions = false; + switch (mode_) { + case MODE_COMPILE: + missing_proto_definitions = input_files_.empty(); + break; + case MODE_DECODE: + // Handle --decode_raw separately, since it requires that no proto + // definitions are specified. + if (codec_type_.empty()) { + if (!input_files_.empty() || !descriptor_set_in_names_.empty()) { + std::cerr + << "When using --decode_raw, no input files should be given." << std::endl; - return PARSE_ARGUMENT_FAIL; - } else if (!decoding_raw && input_files_.empty()) { + return PARSE_ARGUMENT_FAIL; + } + missing_proto_definitions = false; + break; // only for --decode_raw + } + // --decode (not raw) is handled the same way as the rest of the modes. + PROTOBUF_FALLTHROUGH_INTENDED; + case MODE_ENCODE: + case MODE_PRINT: + missing_proto_definitions = + input_files_.empty() && descriptor_set_in_names_.empty(); + break; + default: + GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_; + } + if (missing_proto_definitions) { std::cerr << "Missing input file." << std::endl; return PARSE_ARGUMENT_FAIL; } @@ -1346,6 +1568,11 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( << std::endl; return PARSE_ARGUMENT_FAIL; } + if (mode_ != MODE_ENCODE && deterministic_output_) { + std::cerr << "Can only use --deterministic_output with --encode." + << std::endl; + return PARSE_ARGUMENT_FAIL; + } if (!dependency_out_name_.empty() && input_files_.size() > 1) { std::cerr << "Can only process one input file when using --dependency_out=FILE." @@ -1413,7 +1640,9 @@ bool CommandLineInterface::ParseArgument(const char* arg, std::string* name, if (*name == "-h" || *name == "--help" || *name == "--disallow_services" || *name == "--include_imports" || *name == "--include_source_info" || *name == "--version" || *name == "--decode_raw" || - *name == "--print_free_field_numbers") { + *name == "--print_free_field_numbers" || + *name == "--experimental_allow_proto3_optional" || + *name == "--deterministic_output" || *name == "--fatal_warnings") { // HACK: These are the only flags that don't take a value. // They probably should not be hard-coded like this but for now it's // not worth doing better. @@ -1614,12 +1843,15 @@ CommandLineInterface::InterpretArgument(const std::string& name, std::cout << version_info_ << std::endl; } std::cout << "libprotoc " << internal::VersionString(PROTOBUF_VERSION) - << std::endl; + << PROTOBUF_VERSION_SUFFIX << std::endl; return PARSE_ARGUMENT_DONE_AND_EXIT; // Exit without running compiler. } else if (name == "--disallow_services") { disallow_services_ = true; + + } else if (name == "--experimental_allow_proto3_optional") { + // Flag is no longer observed, but we allow it for backward compat. } else if (name == "--encode" || name == "--decode" || name == "--decode_raw") { if (mode_ != MODE_COMPILE) { @@ -1650,6 +1882,9 @@ CommandLineInterface::InterpretArgument(const std::string& name, codec_type_ = value; + } else if (name == "--deterministic_output") { + deterministic_output_ = true; + } else if (name == "--error_format") { if (value == "gcc") { error_format_ = ERROR_FORMAT_GCC; @@ -1660,6 +1895,12 @@ CommandLineInterface::InterpretArgument(const std::string& name, return PARSE_ARGUMENT_FAIL; } + } else if (name == "--fatal_warnings") { + if (fatal_warnings_) { + std::cerr << name << " may only be passed once." << std::endl; + return PARSE_ARGUMENT_FAIL; + } + fatal_warnings_ = true; } else if (name == "--plugin") { if (plugin_prefix_.empty()) { std::cerr << "This compiler does not support plugins." << std::endl; @@ -1764,124 +2005,80 @@ CommandLineInterface::InterpretArgument(const std::string& name, void CommandLineInterface::PrintHelpText() { // Sorry for indentation here; line wrapping would be uglier. - std::cout - << - "Usage: " << executable_name_ - << " [OPTION] PROTO_FILES\n" - "Parse PROTO_FILES and generate output based on the options given:\n" - " -IPATH, --proto_path=PATH Specify the directory in which to " - "search for\n" - " imports. May be specified multiple " - "times;\n" - " directories will be searched in order. " - " If not\n" - " given, the current working directory " - "is used.\n" - " If not found in any of the these " - "directories,\n" - " the --descriptor_set_in descriptors " - "will be\n" - " checked for required proto file.\n" - " --version Show version info and exit.\n" - " -h, --help Show this text and exit.\n" - " --encode=MESSAGE_TYPE Read a text-format message of the " - "given type\n" - " from standard input and write it in " - "binary\n" - " to standard output. The message type " - "must\n" - " be defined in PROTO_FILES or their " - "imports.\n" - " --decode=MESSAGE_TYPE Read a binary message of the given " - "type from\n" - " standard input and write it in text " - "format\n" - " to standard output. The message type " - "must\n" - " be defined in PROTO_FILES or their " - "imports.\n" - " --decode_raw Read an arbitrary protocol message " - "from\n" - " standard input and write the raw " - "tag/value\n" - " pairs in text format to standard " - "output. No\n" - " PROTO_FILES should be given when using " - "this\n" - " flag.\n" - " --descriptor_set_in=FILES Specifies a delimited list of FILES\n" - " each containing a FileDescriptorSet " - "(a\n" - " protocol buffer defined in " - "descriptor.proto).\n" - " The FileDescriptor for each of the " - "PROTO_FILES\n" - " provided will be loaded from these\n" - " FileDescriptorSets. If a " - "FileDescriptor\n" - " appears multiple times, the first " - "occurrence\n" - " will be used.\n" - " -oFILE, Writes a FileDescriptorSet (a protocol " - "buffer,\n" - " --descriptor_set_out=FILE defined in descriptor.proto) " - "containing all of\n" - " the input files to FILE.\n" - " --include_imports When using --descriptor_set_out, also " - "include\n" - " all dependencies of the input files in " - "the\n" - " set, so that the set is " - "self-contained.\n" - " --include_source_info When using --descriptor_set_out, do " - "not strip\n" - " SourceCodeInfo from the " - "FileDescriptorProto.\n" - " This results in vastly larger " - "descriptors that\n" - " include information about the " - "original\n" - " location of each decl in the source " - "file as\n" - " well as surrounding comments.\n" - " --dependency_out=FILE Write a dependency output file in the " - "format\n" - " expected by make. This writes the " - "transitive\n" - " set of input file paths to FILE\n" - " --error_format=FORMAT Set the format in which to print " - "errors.\n" - " FORMAT may be 'gcc' (the default) or " - "'msvs'\n" - " (Microsoft Visual Studio format).\n" - " --print_free_field_numbers Print the free field numbers of the " - "messages\n" - " defined in the given proto files. " - "Groups share\n" - " the same field number space with the " - "parent \n" - " message. Extension ranges are counted " - "as \n" - " occupied fields numbers.\n" - << std::endl; + std::cout << "Usage: " << executable_name_ << " [OPTION] PROTO_FILES"; + std::cout << R"( +Parse PROTO_FILES and generate output based on the options given: + -IPATH, --proto_path=PATH Specify the directory in which to search for + imports. May be specified multiple times; + directories will be searched in order. If not + given, the current working directory is used. + If not found in any of the these directories, + the --descriptor_set_in descriptors will be + checked for required proto file. + --version Show version info and exit. + -h, --help Show this text and exit. + --encode=MESSAGE_TYPE Read a text-format message of the given type + from standard input and write it in binary + to standard output. The message type must + be defined in PROTO_FILES or their imports. + --deterministic_output When using --encode, ensure map fields are + deterministically ordered. Note that this order + is not canonical, and changes across builds or + releases of protoc. + --decode=MESSAGE_TYPE Read a binary message of the given type from + standard input and write it in text format + to standard output. The message type must + be defined in PROTO_FILES or their imports. + --decode_raw Read an arbitrary protocol message from + standard input and write the raw tag/value + pairs in text format to standard output. No + PROTO_FILES should be given when using this + flag. + --descriptor_set_in=FILES Specifies a delimited list of FILES + each containing a FileDescriptorSet (a + protocol buffer defined in descriptor.proto). + The FileDescriptor for each of the PROTO_FILES + provided will be loaded from these + FileDescriptorSets. If a FileDescriptor + appears multiple times, the first occurrence + will be used. + -oFILE, Writes a FileDescriptorSet (a protocol buffer, + --descriptor_set_out=FILE defined in descriptor.proto) containing all of + the input files to FILE. + --include_imports When using --descriptor_set_out, also include + all dependencies of the input files in the + set, so that the set is self-contained. + --include_source_info When using --descriptor_set_out, do not strip + SourceCodeInfo from the FileDescriptorProto. + This results in vastly larger descriptors that + include information about the original + location of each decl in the source file as + well as surrounding comments. + --dependency_out=FILE Write a dependency output file in the format + expected by make. This writes the transitive + set of input file paths to FILE + --error_format=FORMAT Set the format in which to print errors. + FORMAT may be 'gcc' (the default) or 'msvs' + (Microsoft Visual Studio format). + --fatal_warnings Make warnings be fatal (similar to -Werr in + gcc). This flag will make protoc return + with a non-zero exit code if any warnings + are generated. + --print_free_field_numbers Print the free field numbers of the messages + defined in the given proto files. Groups share + the same field number space with the parent + message. Extension ranges are counted as + occupied fields numbers.)"; if (!plugin_prefix_.empty()) { - std::cout - << " --plugin=EXECUTABLE Specifies a plugin executable to " - "use.\n" - " Normally, protoc searches the PATH " - "for\n" - " plugins, but you may specify " - "additional\n" - " executables not in the path using " - "this flag.\n" - " Additionally, EXECUTABLE may be of " - "the form\n" - " NAME=PATH, in which case the given " - "plugin name\n" - " is mapped to the given executable " - "even if\n" - " the executable's own name differs." - << std::endl; + std::cout << R"( + --plugin=EXECUTABLE Specifies a plugin executable to use. + Normally, protoc searches the PATH for + plugins, but you may specify additional + executables not in the path using this flag. + Additionally, EXECUTABLE may be of the form + NAME=PATH, in which case the given plugin name + is mapped to the given executable even if + the executable's own name differs.)"; } for (GeneratorMap::iterator iter = generators_by_flag_name_.begin(); @@ -1889,35 +2086,48 @@ void CommandLineInterface::PrintHelpText() { // FIXME(kenton): If the text is long enough it will wrap, which is ugly, // but fixing this nicely (e.g. splitting on spaces) is probably more // trouble than it's worth. - std::cout << " " << iter->first << "=OUT_DIR " + std::cout << std::endl + << " " << iter->first << "=OUT_DIR " << std::string(19 - iter->first.size(), ' ') // Spaces for alignment. - << iter->second.help_text << std::endl; - } - std::cout << " @ Read options and filenames from " - "file. If a\n" - " relative file path is specified, " - "the file\n" - " will be searched in the working " - "directory.\n" - " The --proto_path option will not " - "affect how\n" - " this argument file is searched. " - "Content of\n" - " the file will be expanded in the " - "position of\n" - " @ as in the argument " - "list. Note\n" - " that shell expansion is not " - "applied to the\n" - " content of the file (i.e., you " - "cannot use\n" - " quotes, wildcards, escapes, " - "commands, etc.).\n" - " Each line corresponds to a " - "single argument,\n" - " even if it contains spaces." - << std::endl; + << iter->second.help_text; + } + std::cout << R"( + @ Read options and filenames from file. If a + relative file path is specified, the file + will be searched in the working directory. + The --proto_path option will not affect how + this argument file is searched. Content of + the file will be expanded in the position of + @ as in the argument list. Note + that shell expansion is not applied to the + content of the file (i.e., you cannot use + quotes, wildcards, escapes, commands, etc.). + Each line corresponds to a single argument, + even if it contains spaces.)"; + std::cout << std::endl; +} + +bool CommandLineInterface::EnforceProto3OptionalSupport( + const std::string& codegen_name, uint64_t supported_features, + const std::vector& parsed_files) const { + bool supports_proto3_optional = + supported_features & CodeGenerator::FEATURE_PROTO3_OPTIONAL; + if (!supports_proto3_optional) { + for (const auto fd : parsed_files) { + if (ContainsProto3Optional(fd)) { + std::cerr << fd->name() + << ": is a proto3 file that contains optional fields, but " + "code generator " + << codegen_name + << " hasn't been updated to support optional fields in " + "proto3. Please ask the owner of this code generator to " + "support proto3 optional."; + return false; + } + } + } + return true; } bool CommandLineInterface::GenerateOutput( @@ -1954,6 +2164,12 @@ bool CommandLineInterface::GenerateOutput( } parameters.append(generator_parameters_[output_directive.name]); } + if (!EnforceProto3OptionalSupport( + output_directive.name, + output_directive.generator->GetSupportedFeatures(), parsed_files)) { + return false; + } + if (!output_directive.generator->GenerateAll(parsed_files, parameters, generator_context, &error)) { // Generator returned an error. @@ -2091,8 +2307,10 @@ bool CommandLineInterface::GeneratePluginOutput( // We reset current_output to NULL first so that the old file is closed // before the new one is opened. current_output.reset(); - current_output.reset(generator_context->OpenForInsert( - filename, output_file.insertion_point())); + current_output.reset( + generator_context->OpenForInsertWithGeneratedCodeInfo( + filename, output_file.insertion_point(), + output_file.generated_code_info())); } else if (!output_file.name().empty()) { // Starting a new file. Open it. // We reset current_output to NULL first so that the old file is closed @@ -2118,6 +2336,9 @@ bool CommandLineInterface::GeneratePluginOutput( // Generator returned an error. *error = response.error(); return false; + } else if (!EnforceProto3OptionalSupport( + plugin_name, response.supported_features(), parsed_files)) { + return false; } return true; @@ -2171,7 +2392,9 @@ bool CommandLineInterface::EncodeOrDecode(const DescriptorPool* pool) { if (mode_ == MODE_ENCODE) { // Output is binary. - if (!message->SerializePartialToZeroCopyStream(&out)) { + io::CodedOutputStream coded_out(&out); + coded_out.SetSerializationDeterministic(deterministic_output_); + if (!message->SerializePartialToCodedStream(&coded_out)) { std::cerr << "output: I/O error." << std::endl; return false; } @@ -2200,8 +2423,8 @@ bool CommandLineInterface::WriteDescriptorSet( to_output.insert(parsed_files.begin(), parsed_files.end()); for (int i = 0; i < parsed_files.size(); i++) { const FileDescriptor* file = parsed_files[i]; - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dependency = file->dependency(i); + for (int j = 0; j < file->dependency_count(); j++) { + const FileDescriptor* dependency = file->dependency(j); // if the dependency isn't in parsed files, mark it as already seen if (to_output.find(dependency) == to_output.end()) { already_seen.insert(dependency); @@ -2228,12 +2451,20 @@ bool CommandLineInterface::WriteDescriptorSet( } io::FileOutputStream out(fd); - if (!file_set.SerializeToZeroCopyStream(&out)) { - std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno()) - << std::endl; - out.Close(); - return false; + + { + io::CodedOutputStream coded_out(&out); + // Determinism is useful here because build outputs are sometimes checked + // into version control. + coded_out.SetSerializationDeterministic(true); + if (!file_set.SerializeToCodedStream(&coded_out)) { + std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno()) + << std::endl; + out.Close(); + return false; + } } + if (!out.Close()) { std::cerr << descriptor_set_out_name_ << ": " << strerror(out.GetErrno()) << std::endl; @@ -2280,7 +2511,7 @@ namespace { // Nested Messages: // Note that it only stores the nested message type, iff the nested type is // either a direct child of the given descriptor, or the nested type is a -// decendent of the given descriptor and all the nodes between the +// descendant of the given descriptor and all the nodes between the // nested type and the given descriptor are group types. e.g. // // message Foo { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.h index 9449fa397..27178b1be 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface.h @@ -38,6 +38,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ #define GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__ +#include #include #include #include @@ -97,14 +98,14 @@ class DiskSourceTree; // importer.h // protoc --cpp_out=outdir --foo_out=outdir --proto_path=src src/foo.proto // // The .proto file to compile can be specified on the command line using either -// its physical file path, or a virtual path relative to a diretory specified +// its physical file path, or a virtual path relative to a directory specified // in --proto_path. For example, for src/foo.proto, the following two protoc // invocations work the same way: // 1. protoc --proto_path=src src/foo.proto (physical file path) // 2. protoc --proto_path=src foo.proto (virtual path relative to src) // // If a file path can be interpreted both as a physical file path and as a -// relative virtual path, the physical file path takes precendence. +// relative virtual path, the physical file path takes precedence. // // For a full description of the command-line syntax, invoke it with --help. class PROTOC_EXPORT CommandLineInterface { @@ -194,7 +195,7 @@ class PROTOC_EXPORT CommandLineInterface { // DEPRECATED. Calling this method has no effect. Protocol compiler now // always try to find the .proto file relative to the current directory // first and if the file is not found, it will then treat the input path - // as a virutal path. + // as a virtual path. void SetInputsAreProtoPathRelative(bool /* enable */) {} // Provides some text which will be printed when the --version flag is @@ -226,6 +227,12 @@ class PROTOC_EXPORT CommandLineInterface { bool MakeInputsBeProtoPathRelative(DiskSourceTree* source_tree, DescriptorDatabase* fallback_database); + // Fails if these files use proto3 optional and the code generator doesn't + // support it. This is a permanent check. + bool EnforceProto3OptionalSupport( + const std::string& codegen_name, uint64_t supported_features, + const std::vector& parsed_files) const; + // Return status for ParseArguments() and InterpretArgument(). enum ParseArgumentStatus { @@ -269,9 +276,6 @@ class PROTOC_EXPORT CommandLineInterface { // Verify that all the input files exist in the given database. bool VerifyInputFilesInDescriptors(DescriptorDatabase* fallback_database); - // Loads descriptor_set_in into the provided database - bool PopulateSimpleDescriptorDatabase(SimpleDescriptorDatabase* database); - // Parses input_files_ into parsed_files bool ParseInputFiles(DescriptorPool* descriptor_pool, DiskSourceTree* source_tree, @@ -373,21 +377,24 @@ class PROTOC_EXPORT CommandLineInterface { MODE_PRINT, // Print mode: print info of the given .proto files and exit. }; - Mode mode_; + Mode mode_ = MODE_COMPILE; enum PrintMode { PRINT_NONE, // Not in MODE_PRINT PRINT_FREE_FIELDS, // --print_free_fields }; - PrintMode print_mode_; + PrintMode print_mode_ = PRINT_NONE; enum ErrorFormat { ERROR_FORMAT_GCC, // GCC error output format (default). ERROR_FORMAT_MSVS // Visual Studio output (--error_format=msvs). }; - ErrorFormat error_format_; + ErrorFormat error_format_ = ERROR_FORMAT_GCC; + + // True if we should treat warnings as errors that fail the compilation. + bool fatal_warnings_ = false; std::vector > proto_path_; // Search path for proto files. @@ -396,7 +403,7 @@ class PROTOC_EXPORT CommandLineInterface { // Names of proto files which are allowed to be imported. Used by build // systems to enforce depend-on-what-you-import. std::set direct_dependencies_; - bool direct_dependencies_explicitly_set_; + bool direct_dependencies_explicitly_set_ = false; // If there's a violation of depend-on-what-you-import, this string will be // presented to the user. "%s" will be replaced with the violating import. @@ -435,10 +442,13 @@ class PROTOC_EXPORT CommandLineInterface { // True if --include_source_info was given, meaning that we should not strip // SourceCodeInfo from the DescriptorSet. - bool source_info_in_descriptor_set_; + bool source_info_in_descriptor_set_ = false; // Was the --disallow_services flag used? - bool disallow_services_; + bool disallow_services_ = false; + + // When using --encode, this will be passed to SetSerializationDeterministic. + bool deterministic_output_ = false; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CommandLineInterface); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface_unittest.cc similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface_unittest.cc index e4fd54e01..9cc8cf98c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -36,16 +36,20 @@ #include #include +#include + #ifndef _MSC_VER #include #endif #include +#include #include #include #include #include #include +#include #include #include #include @@ -59,10 +63,10 @@ #include #include #include +#include #include #include -#include namespace google { namespace protobuf { @@ -122,7 +126,7 @@ class CommandLineInterfaceTest : public testing::Test { void SwitchToTempDirectory() { File::ChangeWorkingDirectory(temp_directory_); } -#else // !PROTOBUF_OPENSOURCE +#else // !PROTOBUF_OPENSOURCE // TODO(teboring): Figure out how to change and get working directory in // google3. #endif // !PROTOBUF_OPENSOURCE @@ -155,6 +159,11 @@ class CommandLineInterfaceTest : public testing::Test { void ExpectCapturedStdoutSubstringWithZeroReturnCode( const std::string& expected_substring); + // Checks that Run() returned zero and the stderr contains the given + // substring. + void ExpectCapturedStderrSubstringWithZeroReturnCode( + const std::string& expected_substring); + #if defined(_WIN32) && !defined(__CYGWIN__) // Returns true if ExpectErrorSubstring(expected_substring) would pass, but // does not fail otherwise. @@ -205,6 +214,17 @@ class CommandLineInterfaceTest : public testing::Test { void ExpectFileContent(const std::string& filename, const std::string& content); + // The default code generators support all features. Use this to create a + // code generator that omits the given feature(s). + void CreateGeneratorWithMissingFeatures(const std::string& name, + const std::string& description, + uint64_t features) { + MockCodeGenerator* generator = new MockCodeGenerator(name); + generator->SuppressFeatures(features); + mock_generators_to_delete_.push_back(generator); + cli_.RegisterGenerator(name, generator, description); + } + private: // The object we are testing. CommandLineInterface cli_; @@ -413,8 +433,8 @@ void CommandLineInterfaceTest::ExpectErrorSubstring( void CommandLineInterfaceTest::ExpectWarningSubstring( const std::string& expected_substring) { - EXPECT_EQ(0, return_code_); EXPECT_PRED_FORMAT2(testing::IsSubstring, expected_substring, error_text_); + EXPECT_EQ(0, return_code_); } #if defined(_WIN32) && !defined(__CYGWIN__) @@ -502,6 +522,12 @@ void CommandLineInterfaceTest::ExpectCapturedStdoutSubstringWithZeroReturnCode( captured_stdout_); } +void CommandLineInterfaceTest::ExpectCapturedStderrSubstringWithZeroReturnCode( + const std::string& expected_substring) { + EXPECT_EQ(0, return_code_); + EXPECT_PRED_FORMAT2(testing::IsSubstring, expected_substring, error_text_); +} + void CommandLineInterfaceTest::ExpectFileContent(const std::string& filename, const std::string& content) { std::string path = temp_directory_ + "/" + filename; @@ -669,6 +695,9 @@ TEST_F(CommandLineInterfaceTest, MultipleInputs_UnusedImport_DescriptorSetIn) { FileDescriptorProto::descriptor()->file(); descriptor_file->CopyTo(file_descriptor_set.add_file()); + FileDescriptorProto& any_proto = *file_descriptor_set.add_file(); + google::protobuf::Any::descriptor()->file()->CopyTo(&any_proto); + const FileDescriptor* custom_file = protobuf_unittest::AggregateMessage::descriptor()->file(); FileDescriptorProto* file_descriptor_proto = file_descriptor_set.add_file(); @@ -913,6 +942,58 @@ TEST_F(CommandLineInterfaceTest, ExpectErrorSubstring("bar.proto: \"Baz\" is not defined."); } +TEST_F(CommandLineInterfaceTest, + InputsOnlyFromDescriptorSetIn_UnusedImportIsNotReported) { + FileDescriptorSet file_descriptor_set; + + FileDescriptorProto* file_descriptor_proto = file_descriptor_set.add_file(); + file_descriptor_proto->set_name("unused.proto"); + file_descriptor_proto->add_message_type()->set_name("Unused"); + + file_descriptor_proto = file_descriptor_set.add_file(); + file_descriptor_proto->set_name("bar.proto"); + file_descriptor_proto->add_dependency("unused.proto"); + file_descriptor_proto->add_message_type()->set_name("Bar"); + + WriteDescriptorSet("unused_and_bar.bin", &file_descriptor_set); + + Run("protocol_compiler --test_out=$tmpdir --plug_out=$tmpdir " + "--descriptor_set_in=$tmpdir/unused_and_bar.bin unused.proto bar.proto"); + ExpectNoErrors(); +} + +TEST_F(CommandLineInterfaceTest, + InputsFromDescriptorSetInAndFileSystem_UnusedImportIsReported) { + FileDescriptorSet file_descriptor_set; + + FileDescriptorProto* file_descriptor_proto = file_descriptor_set.add_file(); + file_descriptor_proto->set_name("unused.proto"); + file_descriptor_proto->add_message_type()->set_name("Unused"); + + file_descriptor_proto = file_descriptor_set.add_file(); + file_descriptor_proto->set_name("bar.proto"); + file_descriptor_proto->add_dependency("unused.proto"); + file_descriptor_proto->add_message_type()->set_name("Bar"); + + WriteDescriptorSet("unused_and_bar.bin", &file_descriptor_set); + + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "import \"bar.proto\";\n" + "message Foo {\n" + " optional Bar bar = 1;\n" + "}\n"); + + Run("protocol_compiler --test_out=$tmpdir --plug_out=$tmpdir " + "--descriptor_set_in=$tmpdir/unused_and_bar.bin " + "--proto_path=$tmpdir unused.proto bar.proto foo.proto"); + // Reporting unused imports here is unfair, since it's unactionable. Notice + // the lack of a line number. + // TODO(b/144853061): If the file with unused import is from the descriptor + // set and not from the file system, suppress the warning. + ExpectWarningSubstring("bar.proto: warning: Import unused.proto is unused."); +} + TEST_F(CommandLineInterfaceTest, OnlyReportsUnusedImportsForFilesBeingGenerated) { CreateTempFile("unused.proto", @@ -975,7 +1056,6 @@ TEST_F(CommandLineInterfaceTest, ReportsTransitiveMisingImports_LeafLast) { ExpectWarningSubstring( "bar.proto:2:1: warning: Import unused.proto is unused."); } - TEST_F(CommandLineInterfaceTest, CreateDirectory) { // Test that when we output to a sub-directory, it is created. @@ -1074,7 +1154,7 @@ TEST_F(CommandLineInterfaceTest, UnrecognizedExtraParameters) { } TEST_F(CommandLineInterfaceTest, ExtraPluginParametersForOutParameters) { - // This doesn't rely on the plugin having been registred and instead that + // This doesn't rely on the plugin having been registered and instead that // the existence of --[name]_out is enough to make the --[name]_opt valid. // However, running out of process plugins found via the search path (i.e. - // not pre registered with --plugin) isn't support in this test suite, so we @@ -1130,8 +1210,8 @@ TEST_F(CommandLineInterfaceTest, InsertWithAnnotationFixup) { Run("protocol_compiler " "--test_out=TestParameter:$tmpdir " "--plug_out=TestPluginParameter:$tmpdir " - "--test_out=insert=test_generator,test_plugin:$tmpdir " - "--plug_out=insert=test_generator,test_plugin:$tmpdir " + "--test_out=insert_endlines=test_generator,test_plugin:$tmpdir " + "--plug_out=insert_endlines=test_generator,test_plugin:$tmpdir " "--proto_path=$tmpdir foo.proto"); ExpectNoErrors(); @@ -1325,6 +1405,7 @@ TEST_F(CommandLineInterfaceTest, AllowServicesHasService) { ExpectGenerated("test_generator", "", "foo.proto", "Foo"); } + TEST_F(CommandLineInterfaceTest, DirectDependencies_Missing_EmptyList) { CreateTempFile("foo.proto", "syntax = \"proto2\";\n" @@ -2235,7 +2316,7 @@ TEST_F(CommandLineInterfaceTest, MsvsFormatErrors) { } TEST_F(CommandLineInterfaceTest, InvalidErrorFormat) { - // Test --error_format=msvs + // Test invalid --error_format CreateTempFile("foo.proto", "syntax = \"proto2\";\n" @@ -2247,6 +2328,24 @@ TEST_F(CommandLineInterfaceTest, InvalidErrorFormat) { ExpectErrorText("Unknown error format: invalid\n"); } +TEST_F(CommandLineInterfaceTest, Warnings) { + // Test --fatal_warnings. + + CreateTempFile("foo.proto", + "syntax = \"proto2\";\n" + "import \"bar.proto\";\n"); + CreateTempFile("bar.proto", "syntax = \"proto2\";\n"); + + Run("protocol_compiler --test_out=$tmpdir " + "--proto_path=$tmpdir foo.proto"); + ExpectCapturedStderrSubstringWithZeroReturnCode( + "foo.proto:2:1: warning: Import bar.proto is unused."); + + Run("protocol_compiler --test_out=$tmpdir --fatal_warnings " + "--proto_path=$tmpdir foo.proto"); + ExpectErrorSubstring("foo.proto:2:1: warning: Import bar.proto is unused."); +} + // ------------------------------------------------------------------- // Flag parsing tests @@ -2310,6 +2409,37 @@ TEST_F(CommandLineInterfaceTest, MissingValueAtEndError) { ExpectErrorText("Missing value for flag: --test_out\n"); } +TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedNoCodegenSupport) { + CreateTempFile("google/foo.proto", + "syntax = \"proto3\";\n" + "message Foo {\n" + " optional int32 i = 1;\n" + "}\n"); + + CreateGeneratorWithMissingFeatures("--no_proto3_optional_out", + "Doesn't support proto3 optional", + CodeGenerator::FEATURE_PROTO3_OPTIONAL); + + Run("protocol_compiler --experimental_allow_proto3_optional " + "--proto_path=$tmpdir google/foo.proto --no_proto3_optional_out=$tmpdir"); + + ExpectErrorSubstring( + "code generator --no_proto3_optional_out hasn't been updated to support " + "optional fields in proto3"); +} + +TEST_F(CommandLineInterfaceTest, Proto3OptionalAllowWithFlag) { + CreateTempFile("google/foo.proto", + "syntax = \"proto3\";\n" + "message Foo {\n" + " optional int32 i = 1;\n" + "}\n"); + + Run("protocol_compiler --experimental_allow_proto3_optional " + "--proto_path=$tmpdir google/foo.proto --test_out=$tmpdir"); + ExpectNoErrors(); +} + TEST_F(CommandLineInterfaceTest, PrintFreeFieldNumbers) { CreateTempFile("foo.proto", "syntax = \"proto2\";\n" @@ -2428,20 +2558,25 @@ class EncodeDecodeTest : public testing::TestWithParam { enum Type { TEXT, BINARY }; enum ReturnCode { SUCCESS, ERROR }; - bool Run(const std::string& command) { + bool Run(const std::string& command, bool specify_proto_files = true) { std::vector args; args.push_back("protoc"); - SplitStringUsing(command, " ", &args); - switch (GetParam()) { - case PROTO_PATH: - args.push_back("--proto_path=" + TestUtil::TestSourceDir()); - break; - case DESCRIPTOR_SET_IN: - args.push_back(StrCat("--descriptor_set_in=", - unittest_proto_descriptor_set_filename_)); - break; - default: - ADD_FAILURE() << "unexpected EncodeDecodeTestMode: " << GetParam(); + for (StringPiece split_piece : + Split(command, " ", true)) { + args.push_back(std::string(split_piece)); + } + if (specify_proto_files) { + switch (GetParam()) { + case PROTO_PATH: + args.push_back("--proto_path=" + TestUtil::TestSourceDir()); + break; + case DESCRIPTOR_SET_IN: + args.push_back(StrCat("--descriptor_set_in=", + unittest_proto_descriptor_set_filename_)); + break; + default: + ADD_FAILURE() << "unexpected EncodeDecodeTestMode: " << GetParam(); + } } std::unique_ptr argv(new const char*[args.size()]); @@ -2523,9 +2658,12 @@ TEST_P(EncodeDecodeTest, Encode) { RedirectStdinFromFile(TestUtil::GetTestDataPath( "net/proto2/internal/" "testdata/text_format_unittest_data_oneof_implemented.txt")); - EXPECT_TRUE( - Run(TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto") + - " --encode=protobuf_unittest.TestAllTypes")); + std::string args; + if (GetParam() != DESCRIPTOR_SET_IN) { + args.append( + TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto")); + } + EXPECT_TRUE(Run(args + " --encode=protobuf_unittest.TestAllTypes")); ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( "net/proto2/internal/testdata/golden_message_oneof_implemented")); ExpectStderrMatchesText(""); @@ -2561,7 +2699,7 @@ TEST_P(EncodeDecodeTest, DecodeRaw) { message.SerializeToString(&data); RedirectStdinFromText(data); - EXPECT_TRUE(Run("--decode_raw")); + EXPECT_TRUE(Run("--decode_raw", /*specify_proto_files=*/false)); ExpectStdoutMatchesText( "1: 123\n" "14: \"foo\"\n"); @@ -2585,6 +2723,32 @@ TEST_P(EncodeDecodeTest, ProtoParseError) { "net/proto2/internal/no_such_file.proto: No such file or directory\n"); } +TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { + RedirectStdinFromFile(TestUtil::GetTestDataPath( + "net/proto2/internal/" + "testdata/text_format_unittest_data_oneof_implemented.txt")); + std::string args; + if (GetParam() != DESCRIPTOR_SET_IN) { + args.append( + TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto")); + } + EXPECT_TRUE(Run( + args + " --encode=protobuf_unittest.TestAllTypes --deterministic_output")); + ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( + "net/proto2/internal/testdata/golden_message_oneof_implemented")); + ExpectStderrMatchesText(""); +} + +TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { + RedirectStdinFromFile(TestUtil::GetTestDataPath( + "net/proto2/internal/testdata/golden_message_oneof_implemented")); + EXPECT_FALSE( + Run(TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto") + + " --decode=protobuf_unittest.TestAllTypes --deterministic_output")); + ExpectStderrMatchesText( + "Can only use --deterministic_output with --encode.\n"); +} + INSTANTIATE_TEST_SUITE_P(FileDescriptorSetSource, EncodeDecodeTest, testing::Values(PROTO_PATH, DESCRIPTOR_SET_IN)); } // anonymous namespace diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index dbef85592..60619f107 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -76,8 +76,8 @@ class MockErrorCollector : public MultiFileErrorCollector { // implements ErrorCollector --------------------------------------- void AddError(const std::string& filename, int line, int column, const std::string& message) { - strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, - column, message); + strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, column, + message); } }; @@ -137,14 +137,10 @@ TEST(BootstrapTest, GeneratedFilesMatch) { // of the data to compare to. std::map vpath_map; std::map rpath_map; - rpath_map - ["third_party/protobuf_legacy_opensource/src/google/protobuf/" - "test_messages_proto2"] = - "net/proto2/z_generated_example/test_messages_proto2"; - rpath_map - ["third_party/protobuf_legacy_opensource/src/google/protobuf/" - "test_messages_proto3"] = - "net/proto2/z_generated_example/test_messages_proto3"; + rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto2"] = + "net/proto2/z_generated_example/test_messages_proto2"; + rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto3"] = + "net/proto2/z_generated_example/test_messages_proto3"; rpath_map["net/proto2/internal/proto2_weak"] = "net/proto2/z_generated_example/proto2_weak"; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum.cc index c0a03ad40..6ae5cf425 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum.cc @@ -32,10 +32,14 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include +#include #include -#include #include +#include #include #include @@ -49,13 +53,13 @@ namespace { // is kint32max, GOOGLE_ARRAYSIZE will overflow. In such cases we should omit the // generation of the GOOGLE_ARRAYSIZE constant. bool ShouldGenerateArraySize(const EnumDescriptor* descriptor) { - int32 max_value = descriptor->value(0)->number(); + int32_t max_value = descriptor->value(0)->number(); for (int i = 0; i < descriptor->value_count(); i++) { if (descriptor->value(i)->number() > max_value) { max_value = descriptor->value(i)->number(); } } - return max_value != kint32max; + return max_value != std::numeric_limits::max(); } // Returns the number of unique numeric enum values. This is less than @@ -180,14 +184,17 @@ void EnumGenerator::GenerateDefinition(io::Printer* printer) { if (HasDescriptorMethods(descriptor_->file(), options_)) { format( "inline bool $classname$_Parse(\n" - " const std::string& name, $classname$* value) {\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, $classname$* " + "value) " + "{\n" " return ::$proto_ns$::internal::ParseNamedEnum<$classname$>(\n" " $classname$_descriptor(), name, value);\n" "}\n"); } else { format( "bool $classname$_Parse(\n" - " const std::string& name, $classname$* value);\n"); + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, $classname$* " + "value);\n"); } } @@ -253,7 +260,8 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* printer) const { " return $classname$_Name(enum_t_value);\n" "}\n"); format( - "static inline bool $nested_name$_Parse(const std::string& name,\n" + "static inline bool " + "$nested_name$_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,\n" " $resolved_name$* value) {\n" " return $classname$_Parse(name, value);\n" "}\n"); @@ -383,7 +391,9 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { CountUniqueValues(descriptor_)); format( "bool $classname$_Parse(\n" - " const std::string& name, $classname$* value) {\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, $classname$* " + "value) " + "{\n" " int int_value;\n" " bool success = ::$proto_ns$::internal::LookUpEnumValue(\n" " $classname$_entries, $1$, name, &int_value);\n" @@ -399,10 +409,10 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { std::string parent = ClassName(descriptor_->containing_type(), false); // Before C++17, we must define the static constants which were // declared in the header, to give the linker a place to put them. - // But pre-2015 MSVC++ insists that we not. + // But MSVC++ pre-2015 and post-2017 (version 15.5+) insists that we not. format( "#if (__cplusplus < 201703) && " - "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n"); + "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n"); for (int i = 0; i < descriptor_->value_count(); i++) { format("constexpr $classname$ $1$::$2$;\n", parent, @@ -418,7 +428,7 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { format( "#endif // (__cplusplus < 201703) && " - "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n"); + "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n"); } } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.cc similarity index 78% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 7602e9fed..70311dde4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -93,7 +93,7 @@ void EnumFieldGenerator::GenerateInlineAccessorDefinitions( " return static_cast< $type$ >($name$_);\n" "}\n" "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" "}\n" @@ -106,8 +106,8 @@ void EnumFieldGenerator::GenerateInlineAccessorDefinitions( " $name$_ = value;\n" "}\n" "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" " _internal_set_$name$(value);\n" + "$annotate_set$" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -156,6 +156,12 @@ void EnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { "));\n"); } +void EnumFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_($default$)\n"); +} + // =================================================================== EnumOneofFieldGenerator::EnumOneofFieldGenerator( @@ -177,7 +183,7 @@ void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions( " return static_cast< $type$ >($default$);\n" "}\n" "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" "}\n" @@ -193,9 +199,9 @@ void EnumOneofFieldGenerator::GenerateInlineAccessorDefinitions( " $field_member$ = value;\n" "}\n" "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" " _internal_set_$name$(value);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -262,17 +268,17 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( " return static_cast< $type$ >($name$_.Get(index));\n" "}\n" "inline $type$ $classname$::$name$(int index) const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$(index);\n" "}\n" - "inline void $classname$::set_$name$(int index, $type$ value) {\n" - "$annotate_accessor$"); + "inline void $classname$::set_$name$(int index, $type$ value) {\n"); if (!HasPreservingUnknownEnumSemantics(descriptor_)) { format(" assert($type$_IsValid(value));\n"); } format( " $name$_.Set(index, value);\n" + "$annotate_set$" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" "inline void $classname$::_internal_add_$name$($type$ value) {\n"); @@ -283,13 +289,13 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( " $name$_.Add(value);\n" "}\n" "inline void $classname$::add_$name$($type$ value) {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_add:$full_name$)\n" " _internal_add_$name$(value);\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" "inline const ::$proto_ns$::RepeatedField&\n" "$classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_list$" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return $name$_;\n" "}\n" @@ -299,7 +305,7 @@ void RepeatedEnumFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline ::$proto_ns$::RepeatedField*\n" "$classname$::mutable_$name$() {\n" - "$annotate_accessor$" + "$annotate_mutable_list$" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return _internal_mutable_$name$();\n" "}\n"); @@ -328,106 +334,6 @@ void RepeatedEnumFieldGenerator::GenerateConstructorCode( // Not needed for repeated fields. } -void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - // Don't use ReadRepeatedPrimitive here so that the enum can be validated. - format( - "int value = 0;\n" - "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n" - " input, &value)));\n"); - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format("add_$name$(static_cast< $type$ >(value));\n"); - } else { - format( - "if ($type$_IsValid(value)) {\n" - " add_$name$(static_cast< $type$ >(value));\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "} else {\n" - " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<$uint64$>(value));\n"); - } else { - format( - "} else {\n" - " unknown_fields_stream.WriteVarint32(tag);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast<$uint32$>(value));\n"); - } - format("}\n"); - } -} - -void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (!descriptor_->is_packed()) { - // This path is rarely executed, so we use a non-inlined implementation. - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format( - "DO_((::$proto_ns$::internal::" - "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " nullptr,\n" - " nullptr,\n" - " this->_internal_mutable_$name$())));\n"); - } else if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "DO_((::$proto_ns$::internal::WireFormat::" - "ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " $type$_IsValid,\n" - " mutable_unknown_fields(),\n" - " this->_internal_mutable_$name$())));\n"); - } else { - format( - "DO_((::$proto_ns$::internal::" - "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " $type$_IsValid,\n" - " &unknown_fields_stream,\n" - " this->_internal_mutable_$name$())));\n"); - } - } else { - format( - "$uint32$ length;\n" - "DO_(input->ReadVarint32(&length));\n" - "::$proto_ns$::io::CodedInputStream::Limit limit = " - "input->PushLimit(static_cast(length));\n" - "while (input->BytesUntilLimit() > 0) {\n" - " int value = 0;\n" - " DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n" - " input, &value)));\n"); - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" add_$name$(static_cast< $type$ >(value));\n"); - } else { - format( - " if ($type$_IsValid(value)) {\n" - " _internal_add_$name$(static_cast< $type$ >(value));\n" - " } else {\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<$uint64$>(value));\n"); - } else { - format( - " unknown_fields_stream.WriteVarint32(tag);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast<$uint32$>(value));\n"); - } - format(" }\n"); - } - format( - "}\n" - "input->PopLimit(limit);\n"); - } -} - void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); @@ -484,6 +390,16 @@ void RepeatedEnumFieldGenerator::GenerateByteSize(io::Printer* printer) const { format("}\n"); } +void RepeatedEnumFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_()"); + if (descriptor_->is_packed() && + HasGeneratedMethods(descriptor_->file(), options_)) { + format("\n, _$name$_cached_byte_size_(0)"); + } +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.h similarity index 67% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.h index 3b97608ea..e65ec0f5c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_enum_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_enum_field.h @@ -50,16 +50,18 @@ class EnumFieldGenerator : public FieldGenerator { ~EnumFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); @@ -72,10 +74,10 @@ class EnumOneofFieldGenerator : public EnumFieldGenerator { ~EnumOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumOneofFieldGenerator); @@ -88,18 +90,18 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { ~RepeatedEnumFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const {} - void GenerateMergeFromCodedStream(io::Printer* printer) const; - void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override {} + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.cc similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.cc index 8a661ea7c..8604da5f2 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.cc @@ -44,21 +44,10 @@ namespace protobuf { namespace compiler { namespace cpp { -namespace { - -// Returns the fully-qualified class name of the message that this field -// extends. This function is used in the Google-internal code to handle some -// legacy cases. -std::string ExtendeeClassName(const FieldDescriptor* descriptor) { - const Descriptor* extendee = descriptor->containing_type(); - return ClassName(extendee, true); -} - -} // anonymous namespace - ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options) - : descriptor_(descriptor), options_(options) { + const Options& options, + MessageSCCAnalyzer* scc_analyzer) + : descriptor_(descriptor), options_(options), scc_analyzer_(scc_analyzer) { // Construct type_traits_. if (descriptor_->is_repeated()) { type_traits_ = "Repeated"; @@ -87,20 +76,20 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, break; } SetCommonVars(options, &variables_); - variables_["extendee"] = ExtendeeClassName(descriptor_); + variables_["extendee"] = + QualifiedClassName(descriptor_->containing_type(), options_); variables_["type_traits"] = type_traits_; std::string name = descriptor_->name(); variables_["name"] = ResolveKeyword(name); variables_["constant_name"] = FieldConstantName(descriptor_); variables_["field_type"] = StrCat(static_cast(descriptor_->type())); - variables_["packed"] = descriptor_->options().packed() ? "true" : "false"; + variables_["packed"] = descriptor_->is_packed() ? "true" : "false"; std::string scope = IsScoped() ? ClassName(descriptor_->extension_scope(), false) + "::" : ""; variables_["scope"] = scope; - std::string scoped_name = scope + ResolveKeyword(name); - variables_["scoped_name"] = scoped_name; + variables_["scoped_name"] = ExtensionName(descriptor_); variables_["number"] = StrCat(descriptor_->number()); } @@ -157,6 +146,11 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { StringReplace(variables_["scoped_name"], "::", "_", true) + "_default"; format("const std::string $1$($2$);\n", default_str, DefaultValue(options_, descriptor_)); + } else if (descriptor_->message_type()) { + // We have to initialize the default instance for extensions at registration + // time. + default_str = + FieldMessageTypeName(descriptor_, options_) + "::default_instance()"; } else { default_str = DefaultValue(options_, descriptor_); } @@ -164,16 +158,29 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { // Likewise, class members need to declare the field constant variable. if (IsScoped()) { format( - "#if !defined(_MSC_VER) || _MSC_VER >= 1900\n" + "#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)\n" "const int $scope$$constant_name$;\n" "#endif\n"); } format( + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY " "::$proto_ns$::internal::ExtensionIdentifier< $extendee$,\n" " ::$proto_ns$::internal::$type_traits$, $field_type$, $packed$ >\n" " $scoped_name$($constant_name$, $1$);\n", default_str); + + // Register extension verify function if needed. + if (descriptor_->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + ShouldVerify(descriptor_->message_type(), options_, scc_analyzer_) && + ShouldVerify(descriptor_->containing_type(), options_, scc_analyzer_)) { + format( + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY " + "::$proto_ns$::internal::RegisterExtensionVerify< $extendee$,\n" + " $1$, $number$> $2$_$name$_register;\n", + ClassName(descriptor_->message_type(), true), + IsScoped() ? ClassName(descriptor_->extension_scope(), false) : ""); + } } } // namespace cpp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.h index 72413f6b2..bcc80186d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_extension.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_extension.h @@ -55,6 +55,8 @@ namespace protobuf { namespace compiler { namespace cpp { +class MessageSCCAnalyzer; + // Generates code for an extension, which may be within the scope of some // message or may be at file scope. This is much simpler than FieldGenerator // since extensions are just simple identifiers with interesting types. @@ -62,7 +64,8 @@ class ExtensionGenerator { public: // See generator.cc for the meaning of dllexport_decl. explicit ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options); + const Options& options, + MessageSCCAnalyzer* scc_analyzer); ~ExtensionGenerator(); // Header stuff. @@ -77,6 +80,7 @@ class ExtensionGenerator { const FieldDescriptor* descriptor_; std::string type_traits_; Options options_; + MessageSCCAnalyzer* scc_analyzer_; std::map variables_; diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.cc new file mode 100644 index 000000000..a95dd33e9 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.cc @@ -0,0 +1,391 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +using internal::WireFormat; + +namespace { + +void MaySetAnnotationVariable(const Options& options, + StringPiece annotation_name, + StringPiece substitute_template_prefix, + StringPiece prepared_template, + int field_index, StringPiece access_type, + std::map* variables) { + if (options.field_listener_options.forbidden_field_listener_events.count( + std::string(annotation_name))) + return; + (*variables)[StrCat("annotate_", annotation_name)] = strings::Substitute( + StrCat(substitute_template_prefix, prepared_template, ");\n"), + field_index, access_type); +} + +std::string GenerateTemplateForOneofString(const FieldDescriptor* descriptor, + StringPiece proto_ns, + StringPiece field_member) { + std::string field_name = google::protobuf::compiler::cpp::FieldName(descriptor); + std::string field_pointer = + descriptor->options().ctype() == google::protobuf::FieldOptions::STRING + ? "$0.GetPointer()" + : "$0"; + + if (descriptor->default_value_string().empty()) { + return strings::Substitute(StrCat("_internal_has_", field_name, "() ? ", + field_pointer, ": nullptr"), + field_member); + } + + if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING_PIECE) { + return strings::Substitute(StrCat("_internal_has_", field_name, "() ? ", + field_pointer, ": nullptr"), + field_member); + } + + std::string default_value_pointer = + descriptor->options().ctype() == google::protobuf::FieldOptions::STRING + ? "&$1.get()" + : "&$1"; + return strings::Substitute( + StrCat("_internal_has_", field_name, "() ? ", field_pointer, " : ", + default_value_pointer), + field_member, MakeDefaultName(descriptor)); +} + +std::string GenerateTemplateForSingleString(const FieldDescriptor* descriptor, + StringPiece field_member) { + if (descriptor->default_value_string().empty()) { + return StrCat("&", field_member); + } + + if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING) { + return strings::Substitute( + "$0.IsDefault(nullptr) ? &$1.get() : $0.GetPointer()", field_member, + MakeDefaultName(descriptor)); + } + + return StrCat("&", field_member); +} + +} // namespace + +void AddAccessorAnnotations(const FieldDescriptor* descriptor, + const Options& options, + std::map* variables) { + // Can be expanded to include more specific calls, for example, for arena or + // clear calls. + static constexpr const char* kAccessorsAnnotations[] = { + "annotate_add", "annotate_get", "annotate_has", + "annotate_list", "annotate_mutable", "annotate_mutable_list", + "annotate_release", "annotate_set", "annotate_size", + "annotate_clear", "annotate_add_mutable", + }; + for (size_t i = 0; i < GOOGLE_ARRAYSIZE(kAccessorsAnnotations); ++i) { + (*variables)[kAccessorsAnnotations[i]] = ""; + } + if (options.annotate_accessor) { + for (size_t i = 0; i < GOOGLE_ARRAYSIZE(kAccessorsAnnotations); ++i) { + (*variables)[kAccessorsAnnotations[i]] = StrCat( + " ", FieldName(descriptor), "_AccessedNoStrip = true;\n"); + } + } + if (!options.field_listener_options.inject_field_listener_events) { + return; + } + if (descriptor->file()->options().optimize_for() == + google::protobuf::FileOptions::LITE_RUNTIME) { + return; + } + std::string field_member = (*variables)["field_member"]; + const google::protobuf::OneofDescriptor* oneof_member = + descriptor->real_containing_oneof(); + if (oneof_member) { + field_member = StrCat(oneof_member->name(), "_.", field_member); + } + const std::string proto_ns = (*variables)["proto_ns"]; + const std::string substitute_template_prefix = " _tracker_.$1<$0>(this, "; + std::string prepared_template; + + // Flat template is needed if the prepared one is introspecting the values + // inside the returned values, for example, for repeated fields and maps. + std::string prepared_flat_template; + std::string prepared_add_template; + // TODO(b/190614678): Support fields with type Message or Map. + if (descriptor->is_repeated() && !descriptor->is_map()) { + if (descriptor->type() != FieldDescriptor::TYPE_MESSAGE && + descriptor->type() != FieldDescriptor::TYPE_GROUP) { + prepared_template = strings::Substitute("&$0.Get(index)", field_member); + prepared_add_template = + strings::Substitute("&$0.Get($0.size() - 1)", field_member); + } else { + prepared_template = "nullptr"; + prepared_add_template = "nullptr"; + } + } else if (descriptor->is_map()) { + prepared_template = "nullptr"; + } else if (descriptor->type() == FieldDescriptor::TYPE_MESSAGE && + !descriptor->options().lazy()) { + prepared_template = "nullptr"; + } else if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { + if (oneof_member) { + prepared_template = GenerateTemplateForOneofString( + descriptor, (*variables)["proto_ns"], field_member); + } else { + prepared_template = + GenerateTemplateForSingleString(descriptor, field_member); + } + } else { + prepared_template = StrCat("&", field_member); + } + if (descriptor->is_repeated() && !descriptor->is_map() && + descriptor->type() != FieldDescriptor::TYPE_MESSAGE && + descriptor->type() != FieldDescriptor::TYPE_GROUP) { + prepared_flat_template = StrCat("&", field_member); + } else { + prepared_flat_template = prepared_template; + } + + MaySetAnnotationVariable(options, "get", substitute_template_prefix, + prepared_template, descriptor->index(), "OnGet", + variables); + MaySetAnnotationVariable(options, "set", substitute_template_prefix, + prepared_template, descriptor->index(), "OnSet", + variables); + MaySetAnnotationVariable(options, "has", substitute_template_prefix, + prepared_template, descriptor->index(), "OnHas", + variables); + MaySetAnnotationVariable(options, "mutable", substitute_template_prefix, + prepared_template, descriptor->index(), "OnMutable", + variables); + MaySetAnnotationVariable(options, "release", substitute_template_prefix, + prepared_template, descriptor->index(), "OnRelease", + variables); + MaySetAnnotationVariable(options, "clear", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnClear", variables); + MaySetAnnotationVariable(options, "size", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnSize", variables); + MaySetAnnotationVariable(options, "list", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnList", variables); + MaySetAnnotationVariable(options, "mutable_list", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnMutableList", variables); + MaySetAnnotationVariable(options, "add", substitute_template_prefix, + prepared_add_template, descriptor->index(), "OnAdd", + variables); + MaySetAnnotationVariable(options, "add_mutable", substitute_template_prefix, + prepared_add_template, descriptor->index(), + "OnAddMutable", variables); +} + +void SetCommonFieldVariables(const FieldDescriptor* descriptor, + std::map* variables, + const Options& options) { + SetCommonVars(options, variables); + (*variables)["ns"] = Namespace(descriptor, options); + (*variables)["name"] = FieldName(descriptor); + (*variables)["index"] = StrCat(descriptor->index()); + (*variables)["number"] = StrCat(descriptor->number()); + (*variables)["classname"] = ClassName(FieldScope(descriptor), false); + (*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type()); + (*variables)["field_member"] = FieldName(descriptor) + "_"; + + (*variables)["tag_size"] = StrCat( + WireFormat::TagSize(descriptor->number(), descriptor->type())); + (*variables)["deprecated_attr"] = DeprecatedAttribute(options, descriptor); + + (*variables)["set_hasbit"] = ""; + (*variables)["clear_hasbit"] = ""; + if (HasHasbit(descriptor)) { + (*variables)["set_hasbit_io"] = + "_Internal::set_has_" + FieldName(descriptor) + "(&_has_bits_);"; + } else { + (*variables)["set_hasbit_io"] = ""; + } + + AddAccessorAnnotations(descriptor, options, variables); + + // These variables are placeholders to pick out the beginning and ends of + // identifiers for annotations (when doing so with existing variables would + // be ambiguous or impossible). They should never be set to anything but the + // empty string. + (*variables)["{"] = ""; + (*variables)["}"] = ""; +} + +void FieldGenerator::SetHasBitIndex(int32_t has_bit_index) { + if (!HasHasbit(descriptor_)) { + GOOGLE_CHECK_EQ(has_bit_index, -1); + return; + } + variables_["set_hasbit"] = StrCat( + "_has_bits_[", has_bit_index / 32, "] |= 0x", + strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); + variables_["clear_hasbit"] = StrCat( + "_has_bits_[", has_bit_index / 32, "] &= ~0x", + strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); +} + +void FieldGenerator::SetInlinedStringIndex(int32_t inlined_string_index) { + if (!IsStringInlined(descriptor_, options_)) { + GOOGLE_CHECK_EQ(inlined_string_index, -1); + return; + } + variables_["inlined_string_donated"] = StrCat( + "(_inlined_string_donated_[", inlined_string_index / 32, "] & 0x", + strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), + "u) != 0;"); + variables_["donating_states_word"] = + StrCat("_inlined_string_donated_[", inlined_string_index / 32, "]"); + variables_["mask_for_undonate"] = StrCat( + "~0x", strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), + "u"); +} + +void SetCommonOneofFieldVariables( + const FieldDescriptor* descriptor, + std::map* variables) { + const std::string prefix = descriptor->containing_oneof()->name() + "_."; + (*variables)["oneof_name"] = descriptor->containing_oneof()->name(); + (*variables)["field_member"] = + StrCat(prefix, (*variables)["name"], "_"); +} + +FieldGenerator::~FieldGenerator() {} + +FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, + const Options& options, + MessageSCCAnalyzer* scc_analyzer) + : descriptor_(descriptor), field_generators_(descriptor->field_count()) { + // Construct all the FieldGenerators. + for (int i = 0; i < descriptor->field_count(); i++) { + field_generators_[i].reset( + MakeGenerator(descriptor->field(i), options, scc_analyzer)); + } +} + +FieldGenerator* FieldGeneratorMap::MakeGoogleInternalGenerator( + const FieldDescriptor* field, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + + return nullptr; +} + +FieldGenerator* FieldGeneratorMap::MakeGenerator( + const FieldDescriptor* field, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + FieldGenerator* generator = + MakeGoogleInternalGenerator(field, options, scc_analyzer); + if (generator) { + return generator; + } + + if (field->is_repeated()) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_MESSAGE: + if (field->is_map()) { + return new MapFieldGenerator(field, options, scc_analyzer); + } else { + return new RepeatedMessageFieldGenerator(field, options, + scc_analyzer); + } + case FieldDescriptor::CPPTYPE_STRING: + return new RepeatedStringFieldGenerator(field, options); + case FieldDescriptor::CPPTYPE_ENUM: + return new RepeatedEnumFieldGenerator(field, options); + default: + return new RepeatedPrimitiveFieldGenerator(field, options); + } + } else if (field->real_containing_oneof()) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_MESSAGE: + return new MessageOneofFieldGenerator(field, options, scc_analyzer); + case FieldDescriptor::CPPTYPE_STRING: + return new StringOneofFieldGenerator(field, options); + case FieldDescriptor::CPPTYPE_ENUM: + return new EnumOneofFieldGenerator(field, options); + default: + return new PrimitiveOneofFieldGenerator(field, options); + } + } else { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_MESSAGE: + return new MessageFieldGenerator(field, options, scc_analyzer); + case FieldDescriptor::CPPTYPE_STRING: + return new StringFieldGenerator(field, options); + case FieldDescriptor::CPPTYPE_ENUM: + return new EnumFieldGenerator(field, options); + default: + return new PrimitiveFieldGenerator(field, options); + } + } +} + +FieldGeneratorMap::~FieldGeneratorMap() {} + +const FieldGenerator& FieldGeneratorMap::get( + const FieldDescriptor* field) const { + GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); + return *field_generators_[field->index()]; +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.h index aef9aaf30..e0eb679b4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_field.h @@ -35,6 +35,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ +#include #include #include #include @@ -164,9 +165,11 @@ class FieldGenerator { return false; } - // Generate code that allocates the fields's default instance. - virtual void GenerateDefaultInstanceAllocator( - io::Printer* /*printer*/) const {} + // Generate initialization code for private members declared by + // GeneratePrivateMembers(), specifically for the constexpr constructor. + // These go into the constructor's initializer list and must follow that + // syntax (eg `field_(args)`). Does not include `:` or `,` separators. + virtual void GenerateConstinitInitializer(io::Printer* printer) const {} // Generate lines to serialize this field directly to the array "target", // which are placed within the message's SerializeWithCachedSizesToArray() @@ -178,12 +181,14 @@ class FieldGenerator { // are placed in the message's ByteSize() method. virtual void GenerateByteSize(io::Printer* printer) const = 0; - // Any tags about field layout decisions (such as inlining) to embed in the - // offset. - virtual uint32 CalculateFieldTag() const { return 0; } + // Generates lines to call IsInitialized() for eligible message fields. Non + // message fields won't need to override this function. + virtual void GenerateIsInitialized(io::Printer* printer) const {} + virtual bool IsInlined() const { return false; } - void SetHasBitIndex(int32 has_bit_index); + void SetHasBitIndex(int32_t has_bit_index); + void SetInlinedStringIndex(int32_t inlined_string_index); protected: const FieldDescriptor* descriptor_; @@ -209,6 +214,12 @@ class FieldGeneratorMap { } } + void SetInlinedStringIndices(const std::vector& inlined_string_indices) { + for (int i = 0; i < descriptor_->field_count(); ++i) { + field_generators_[i]->SetInlinedStringIndex(inlined_string_indices[i]); + } + } + private: const Descriptor* descriptor_; std::vector> field_generators_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.cc similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.cc index 45fd30871..c7816b546 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -34,9 +34,11 @@ #include +#include #include #include #include +#include #include #include @@ -51,6 +53,7 @@ #include #include +// Must be last. #include namespace google { @@ -72,11 +75,6 @@ std::string GetSortKey(const FileDescriptor& val) { return val.name(); } -template <> -std::string GetSortKey(const SCC& val) { - return val.GetRepresentative()->full_name(); -} - template bool CompareSortKeys(const T* a, const T* b) { return GetSortKey(*a) < GetSortKey(*b); @@ -132,18 +130,11 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) } for (int i = 0; i < file->extension_count(); i++) { extension_generators_.emplace_back( - new ExtensionGenerator(file->extension(i), options)); + new ExtensionGenerator(file->extension(i), options, &scc_analyzer_)); } for (int i = 0; i < file->weak_dependency_count(); ++i) { weak_deps_.insert(file->weak_dependency(i)); } - for (int i = 0; i < message_generators_.size(); i++) { - if (IsSCCRepresentative(message_generators_[i]->descriptor_)) { - sccs_.push_back(GetSCC(message_generators_[i]->descriptor_)); - } - } - - std::sort(sccs_.begin(), sccs_.end(), CompareSortKeys); } FileGenerator::~FileGenerator() = default; @@ -163,8 +154,8 @@ void FileGenerator::GenerateMacroUndefs(io::Printer* printer) { for (int i = 0; i < fields.size(); i++) { const std::string& name = fields[i]->name(); static const char* kMacroNames[] = {"major", "minor"}; - for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) { - if (name == kMacroNames[i]) { + for (int j = 0; j < GOOGLE_ARRAYSIZE(kMacroNames); ++j) { + if (name == kMacroNames[j]) { names_to_undef.push_back(name); break; } @@ -411,10 +402,10 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* printer) { IncludeFile("net/proto2/public/reflection_ops.h", printer); IncludeFile("net/proto2/public/wire_format.h", printer); } - if (IsProto2MessageSetFile(file_, options_)) { - format( - // Implementation of proto1 MessageSet API methods. - "#include \"net/proto2/internal/message_set_util.h\"\n"); + + if (HasGeneratedMethods(file_, options_) && + options_.tctable_mode != Options::kTCTableNever) { + IncludeFile("net/proto2/public/generated_message_tctable_impl.h", printer); } if (options_.proto_h) { @@ -430,27 +421,64 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* printer) { format("#include \"$1$.proto.h\"\n", basename); } } + if (HasCordFields(file_, options_)) { + format( + "#include \"third_party/absl/strings/internal/string_constant.h\"\n"); + } format("// @@protoc_insertion_point(includes)\n"); IncludeFile("net/proto2/public/port_def.inc", printer); + + // For MSVC builds, we use #pragma init_seg to move the initialization of our + // libraries to happen before the user code. + // This worksaround the fact that MSVC does not do constant initializers when + // required by the standard. + format("\nPROTOBUF_PRAGMA_INIT_SEG\n"); } void FileGenerator::GenerateSourceDefaultInstance(int idx, io::Printer* printer) { Formatter format(printer, variables_); MessageGenerator* generator = message_generators_[idx].get(); + generator->GenerateConstexprConstructor(printer); + // Use a union to disable the destructor of the _instance member. + // We can constant initialize, but the object will still have a non-trivial + // destructor that we need to elide. format( - "class $1$ {\n" - " public:\n" - " ::$proto_ns$::internal::ExplicitlyConstructed<$2$> _instance;\n", + "struct $1$ {\n" + " constexpr $1$()\n" + " : _instance(::$proto_ns$::internal::ConstantInitialized{}) {}\n" + " ~$1$() {}\n" + " union {\n" + " $2$ _instance;\n" + " };\n" + "};\n", DefaultInstanceType(generator->descriptor_, options_), generator->classname_); - format.Indent(); - generator->GenerateExtraDefaultFields(printer); - format.Outdent(); - format("} $1$;\n", DefaultInstanceName(generator->descriptor_, options_)); + // NO_DESTROY is not necessary for correctness. The empty destructor is + // enough. However, the empty destructor fails to be elided in some + // configurations (like non-opt or with certain sanitizers). NO_DESTROY is + // there just to improve performance and binary size in these builds. + format("PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT $1$ $2$;\n", + DefaultInstanceType(generator->descriptor_, options_), + DefaultInstanceName(generator->descriptor_, options_)); + + for (int i = 0; i < generator->descriptor_->field_count(); i++) { + const FieldDescriptor* field = generator->descriptor_->field(i); + if (IsStringInlined(field, options_)) { + // Force the initialization of the inlined string in the default instance. + format( + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY std::true_type " + "$1$::_init_inline_$2$_ = " + "($3$._instance.$2$_.Init(), std::true_type{});\n", + ClassName(generator->descriptor_), FieldName(field), + DefaultInstanceName(generator->descriptor_, options_)); + } + } + if (options_.lite_implicit_weak_fields) { - format("$1$DefaultTypeInternal* $2$ = &$3$;\n", generator->classname_, + format("$1$* $2$ = &$3$;\n", + DefaultInstanceType(generator->descriptor_, options_), DefaultInstancePtr(generator->descriptor_, options_), DefaultInstanceName(generator->descriptor_, options_)); } @@ -460,8 +488,6 @@ void FileGenerator::GenerateSourceDefaultInstance(int idx, // another .pb.cc file. struct FileGenerator::CrossFileReferences { // Populated if we are referencing from messages or files. - std::unordered_set strong_sccs; - std::unordered_set weak_sccs; std::unordered_set weak_default_instances; // Only if we are referencing from files. @@ -473,16 +499,10 @@ void FileGenerator::GetCrossFileReferencesForField(const FieldDescriptor* field, CrossFileReferences* refs) { const Descriptor* msg = field->message_type(); if (msg == nullptr) return; - const SCC* scc = GetSCC(msg); if (IsImplicitWeakField(field, options_, &scc_analyzer_) || IsWeak(field, options_)) { - refs->weak_sccs.insert(scc); refs->weak_default_instances.insert(msg); - } else { - refs->strong_sccs.insert(scc); - // We don't need to declare default instances, because it is declared in the - // .proto.h file we imported. } } @@ -509,35 +529,6 @@ void FileGenerator::GenerateInternalForwardDeclarations( const CrossFileReferences& refs, io::Printer* printer) { Formatter format(printer, variables_); - for (auto scc : Sorted(refs.strong_sccs)) { - format("extern $1$ ::$proto_ns$::internal::SCCInfo<$2$> $3$;\n", - FileDllExport(scc->GetFile(), options_), scc->children.size(), - SccInfoSymbol(scc, options_)); - } - - for (auto scc : Sorted(refs.weak_sccs)) { - // We do things a little bit differently for proto1-style weak fields versus - // lite implicit weak fields, even though they are trying to accomplish - // similar things. We need to support implicit weak fields on iOS, and the - // Apple linker only supports weak definitions, not weak declarations. For - // that reason we need a pointer type which we can weakly define to be null. - // However, code size considerations prevent us from using the same approach - // for proto1-style weak fields. - if (options_.lite_implicit_weak_fields) { - format("extern ::$proto_ns$::internal::SCCInfo<$1$> $2$;\n", - scc->children.size(), SccInfoSymbol(scc, options_)); - format( - "__attribute__((weak)) ::$proto_ns$::internal::SCCInfo<$1$>*\n" - " $2$ = nullptr;\n", - scc->children.size(), SccInfoPtrSymbol(scc, options_)); - } else { - format( - "extern __attribute__((weak)) ::$proto_ns$::internal::SCCInfo<$1$> " - "$2$;\n", - scc->children.size(), SccInfoSymbol(scc, options_)); - } - } - { NamespaceOpener ns(format); for (auto instance : Sorted(refs.weak_default_instances)) { @@ -568,24 +559,13 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { Formatter format(printer, variables_); GenerateSourceIncludes(printer); - // Generate weak declarations. We do this for the whole strongly-connected - // component (SCC), because we have a single InitDefaults* function for the - // SCC. CrossFileReferences refs; - for (const Descriptor* message : - scc_analyzer_.GetSCC(message_generators_[idx]->descriptor_) - ->descriptors) { - ForEachField(message, [this, &refs](const FieldDescriptor* field) { - GetCrossFileReferencesForField(field, &refs); - }); - } + ForEachField(message_generators_[idx]->descriptor_, + [this, &refs](const FieldDescriptor* field) { + GetCrossFileReferencesForField(field, &refs); + }); GenerateInternalForwardDeclarations(refs, printer); - if (IsSCCRepresentative(message_generators_[idx]->descriptor_)) { - GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), refs, - printer); - } - { // package namespace NamespaceOpener ns(Namespace(file_, options_), format); @@ -611,6 +591,13 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { "// @@protoc_insertion_point(global_scope)\n"); } +void FileGenerator::GenerateSourceForExtension(int idx, io::Printer* printer) { + Formatter format(printer, variables_); + GenerateSourceIncludes(printer); + NamespaceOpener ns(Namespace(file_, options_), format); + extension_generators_[idx]->GenerateDefinition(printer); +} + void FileGenerator::GenerateGlobalSource(io::Printer* printer) { Formatter format(printer, variables_); GenerateSourceIncludes(printer); @@ -631,21 +618,6 @@ void FileGenerator::GenerateGlobalSource(io::Printer* printer) { for (int i = 0; i < enum_generators_.size(); i++) { enum_generators_[i]->GenerateMethods(i, printer); } - - // Define extensions. - for (int i = 0; i < extension_generators_.size(); i++) { - extension_generators_[i]->GenerateDefinition(printer); - } - - if (HasGenericServices(file_, options_)) { - // Generate services. - for (int i = 0; i < service_generators_.size(); i++) { - if (i == 0) format("\n"); - format(kThickSeparator); - format("\n"); - service_generators_[i]->GenerateImplementation(printer); - } - } } void FileGenerator::GenerateSource(io::Printer* printer) { @@ -667,11 +639,6 @@ void FileGenerator::GenerateSource(io::Printer* printer) { { GenerateTables(printer); - // Now generate the InitDefaults for each SCC. - for (auto scc : sccs_) { - GenerateInitForSCC(scc, refs, printer); - } - if (HasDescriptorMethods(file_, options_)) { // Define the code to initialize reflection. This code uses a global // constructor to register reflection data with the runtime pre-main. @@ -737,10 +704,6 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) { if (!message_generators_.empty()) { format("static ::$proto_ns$::Metadata $file_level_metadata$[$1$];\n", message_generators_.size()); - } else { - format( - "static " - "constexpr ::$proto_ns$::Metadata* $file_level_metadata$ = nullptr;\n"); } if (!enum_generators_.empty()) { format( @@ -871,45 +834,57 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) { refs.strong_reflection_files.size() + refs.weak_reflection_files.size(); // Build array of DescriptorTable deps. - format( - "static const ::$proto_ns$::internal::DescriptorTable*const " - "$desc_table$_deps[$1$] = {\n", - std::max(num_deps, 1)); - - for (auto dep : Sorted(refs.strong_reflection_files)) { - format(" &::$1$,\n", DescriptorTableName(dep, options_)); - } - for (auto dep : Sorted(refs.weak_reflection_files)) { - format(" &::$1$,\n", DescriptorTableName(dep, options_)); - } - - format("};\n"); + if (num_deps > 0) { + format( + "static const ::$proto_ns$::internal::DescriptorTable*const " + "$desc_table$_deps[$1$] = {\n", + num_deps); - // Build array of SCCs from this file. - format( - "static ::$proto_ns$::internal::SCCInfoBase*const " - "$desc_table$_sccs[$1$] = {\n", - std::max(sccs_.size(), 1)); + for (auto dep : Sorted(refs.strong_reflection_files)) { + format(" &::$1$,\n", DescriptorTableName(dep, options_)); + } + for (auto dep : Sorted(refs.weak_reflection_files)) { + format(" &::$1$,\n", DescriptorTableName(dep, options_)); + } - for (auto scc : sccs_) { - format(" &$1$.base,\n", SccInfoSymbol(scc, options_)); + format("};\n"); } - format("};\n"); - // The DescriptorTable itself. + // Should be "bool eager = NeedsEagerDescriptorAssignment(file_, options_);" + // however this might cause a tsan failure in superroot b/148382879, + // so disable for now. + bool eager = false; format( "static ::$proto_ns$::internal::once_flag $desc_table$_once;\n" - "static bool $desc_table$_initialized = false;\n" "const ::$proto_ns$::internal::DescriptorTable $desc_table$ = {\n" - " &$desc_table$_initialized, $1$, \"$filename$\", $2$,\n" - " &$desc_table$_once, $desc_table$_sccs, $desc_table$_deps, $3$, $4$,\n" + " false, $1$, $2$, $3$, \"$filename$\", \n" + " &$desc_table$_once, $4$, $5$, $6$,\n" " schemas, file_default_instances, $tablename$::offsets,\n" - " $file_level_metadata$, $5$, $file_level_enum_descriptors$, " + " $7$, $file_level_enum_descriptors$, " "$file_level_service_descriptors$,\n" - "};\n\n", - protodef_name, file_data.size(), sccs_.size(), num_deps, - message_generators_.size()); + "};\n" + // This function exists to be marked as weak. + // It can significantly speed up compilation by breaking up LLVM's SCC in + // the .pb.cc translation units. Large translation units see a reduction + // of more than 35% of walltime for optimized builds. + // Without the weak attribute all the messages in the file, including all + // the vtables and everything they use become part of the same SCC through + // a cycle like: + // GetMetadata -> descriptor table -> default instances -> + // vtables -> GetMetadata + // By adding a weak function here we break the connection from the + // individual vtables back into the descriptor table. + "PROTOBUF_ATTRIBUTE_WEAK const ::$proto_ns$::internal::DescriptorTable* " + "$desc_table$_getter() {\n" + " return &$desc_table$;\n" + "}\n" + "\n", + eager ? "true" : "false", file_data.size(), protodef_name, + num_deps == 0 ? "nullptr" : variables_["desc_table"] + "_deps", num_deps, + message_generators_.size(), + message_generators_.empty() ? "nullptr" + : variables_["file_level_metadata"]); // For descriptor.proto we want to avoid doing any dynamic initialization, // because in some situations that would otherwise pull in a lot of @@ -918,106 +893,13 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) { if (file_->name() != "net/proto2/proto/descriptor.proto") { format( "// Force running AddDescriptors() at dynamic initialization time.\n" - "static bool $1$ = (" - " ::$proto_ns$::internal::AddDescriptors(&$desc_table$), true);\n", + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY " + "static ::$proto_ns$::internal::AddDescriptorsRunner " + "$1$(&$desc_table$);\n", UniqueName("dynamic_init_dummy", file_, options_)); } } -void FileGenerator::GenerateInitForSCC(const SCC* scc, - const CrossFileReferences& refs, - io::Printer* printer) { - Formatter format(printer, variables_); - // We use static and not anonymous namespace because symbol names are - // substantially shorter. - format("static void InitDefaults$1$() {\n", SccInfoSymbol(scc, options_)); - - if (options_.opensource_runtime) { - format(" GOOGLE_PROTOBUF_VERIFY_VERSION;\n\n"); - } - - format.Indent(); - - // First construct all the necessary default instances. - for (int i = 0; i < message_generators_.size(); i++) { - if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) { - continue; - } - // TODO(gerbens) This requires this function to be friend. Remove - // the need for this. - message_generators_[i]->GenerateFieldDefaultInstances(printer); - format( - "{\n" - " void* ptr = &$1$;\n" - " new (ptr) $2$();\n", - QualifiedDefaultInstanceName(message_generators_[i]->descriptor_, - options_), - QualifiedClassName(message_generators_[i]->descriptor_, options_)); - if (options_.opensource_runtime && - !IsMapEntryMessage(message_generators_[i]->descriptor_)) { - format( - " " - "::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);" - "\n"); - } - format("}\n"); - } - - // TODO(gerbens) make default instances be the same as normal instances. - // Default instances differ from normal instances because they have cross - // linked message fields. - for (int i = 0; i < message_generators_.size(); i++) { - if (scc_analyzer_.GetSCC(message_generators_[i]->descriptor_) != scc) { - continue; - } - format("$1$::InitAsDefaultInstance();\n", - QualifiedClassName(message_generators_[i]->descriptor_, options_)); - } - format.Outdent(); - format("}\n\n"); - - // If we are using lite implicit weak fields then we need to distinguish - // between regular SCC dependencies and ones that we need to reference weakly - // through an extra pointer indirection. - std::vector regular_sccs; - std::vector implicit_weak_sccs; - for (const SCC* child : scc->children) { - if (options_.lite_implicit_weak_fields && - refs.weak_sccs.find(child) != refs.weak_sccs.end()) { - implicit_weak_sccs.push_back(child); - } else { - regular_sccs.push_back(child); - } - } - - format( - "$dllexport_decl $::$proto_ns$::internal::SCCInfo<$1$> $2$ =\n" - " " - "{{ATOMIC_VAR_INIT(::$proto_ns$::internal::SCCInfoBase::kUninitialized), " - "$3$, $4$, InitDefaults$2$}, {", - scc->children.size(), // 1 - SccInfoSymbol(scc, options_), regular_sccs.size(), - implicit_weak_sccs.size()); - for (const SCC* child : regular_sccs) { - format("\n &$1$.base,", SccInfoSymbol(child, options_)); - } - for (const SCC* child : implicit_weak_sccs) { - format( - "\n reinterpret_cast<::$proto_ns$::internal::SCCInfoBase**>(" - "\n &$1$),", - SccInfoPtrSymbol(child, options_)); - } - format("}};\n\n"); - - if (options_.lite_implicit_weak_fields) { - format( - "$dllexport_decl $::$proto_ns$::internal::SCCInfo<$1$>*\n" - " $2$ = &$3$;\n\n", - scc->children.size(), SccInfoPtrSymbol(scc, options_), - SccInfoSymbol(scc, options_)); - } -} - void FileGenerator::GenerateTables(io::Printer* printer) { Formatter format(printer, variables_); if (options_.table_driven_parsing) { @@ -1047,7 +929,7 @@ void FileGenerator::GenerateTables(io::Printer* printer) { "};\n" "\n" "PROTOBUF_CONSTEXPR_VAR " - "::$proto_ns$::internal::AuxillaryParseTableField\n" + "::$proto_ns$::internal::AuxiliaryParseTableField\n" " const $tablename$::aux[] " "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n"); format.Indent(); @@ -1061,7 +943,7 @@ void FileGenerator::GenerateTables(io::Printer* printer) { } if (count == 0) { - format("::$proto_ns$::internal::AuxillaryParseTableField(),\n"); + format("::$proto_ns$::internal::AuxiliaryParseTableField(),\n"); } format.Outdent(); @@ -1147,7 +1029,7 @@ class FileGenerator::ForwardDeclarations { const Descriptor* class_desc = p.second; format( "class ${1$$2$$}$;\n" - "class $3$;\n" + "struct $3$;\n" "$dllexport_decl $extern $3$ $4$;\n", class_desc, classname, DefaultInstanceType(class_desc, options), DefaultInstanceName(class_desc, options)); @@ -1185,7 +1067,7 @@ void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) { FlattenMessagesInFile(file_, &classes); // All messages need forward decls. if (options_.proto_h) { // proto.h needs extra forward declarations. - // All classes / enums refered to as field members + // All classes / enums referred to as field members std::vector fields; ListAllFields(file_, &fields); for (int i = 0; i < fields.size(); i++) { @@ -1213,7 +1095,6 @@ void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) { decls[Namespace(d, options_)].AddEnum(d); } - { NamespaceOpener ns(format); for (const auto& pair : decls) { @@ -1263,10 +1144,13 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { GOOGLE_CHECK(!options_.opensource_runtime); IncludeFile("net/proto2/public/weak_field_map.h", printer); } - if (HasLazyFields(file_, options_)) { + if (HasLazyFields(file_, options_, &scc_analyzer_)) { GOOGLE_CHECK(!options_.opensource_runtime); IncludeFile("net/proto2/public/lazy_field.h", printer); } + if (ShouldVerify(file_, options_, &scc_analyzer_)) { + IncludeFile("net/proto2/public/wire_format_verify.h", printer); + } if (options_.opensource_runtime) { // Verify the protobuf library header version is compatible with the protoc @@ -1294,15 +1178,23 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { IncludeFile("net/proto2/io/public/coded_stream.h", printer); IncludeFile("net/proto2/public/arena.h", printer); IncludeFile("net/proto2/public/arenastring.h", printer); + if ((options_.force_inline_string || options_.profile_driven_inline_string) && + !options_.opensource_runtime) { + IncludeFile("net/proto2/public/inlined_string_field.h", printer); + } + if (HasSimpleBaseClasses(file_, options_)) { + IncludeFile("net/proto2/public/generated_message_bases.h", printer); + } IncludeFile("net/proto2/public/generated_message_table_driven.h", printer); + if (HasGeneratedMethods(file_, options_) && + options_.tctable_mode != Options::kTCTableNever) { + IncludeFile("net/proto2/public/generated_message_tctable_decl.h", printer); + } IncludeFile("net/proto2/public/generated_message_util.h", printer); - IncludeFile("net/proto2/public/inlined_string_field.h", printer); + IncludeFile("net/proto2/public/metadata_lite.h", printer); if (HasDescriptorMethods(file_, options_)) { - IncludeFile("net/proto2/public/metadata.h", printer); IncludeFile("net/proto2/public/generated_message_reflection.h", printer); - } else { - IncludeFile("net/proto2/public/metadata_lite.h", printer); } if (!message_generators_.empty()) { @@ -1409,7 +1301,7 @@ void FileGenerator::GenerateGlobalStateFunctionDeclarations( // for table driven code. " static const ::$proto_ns$::internal::ParseTableField entries[]\n" " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n" - " static const ::$proto_ns$::internal::AuxillaryParseTableField aux[]\n" + " static const ::$proto_ns$::internal::AuxiliaryParseTableField aux[]\n" " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n" " static const ::$proto_ns$::internal::ParseTable schema[$1$]\n" " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n" @@ -1421,7 +1313,7 @@ void FileGenerator::GenerateGlobalStateFunctionDeclarations( std::max(size_t(1), message_generators_.size())); if (HasDescriptorMethods(file_, options_)) { format( - "extern $dllexport_decl $const ::$proto_ns$::internal::DescriptorTable " + "$dllexport_decl $extern const ::$proto_ns$::internal::DescriptorTable " "$desc_table$;\n"); } } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.h index e81af42aa..e8816020d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_file.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_file.h @@ -82,9 +82,20 @@ class FileGenerator { void GeneratePBHeader(io::Printer* printer, const std::string& info_path); void GenerateSource(io::Printer* printer); + // The following member functions are used when the lite_implicit_weak_fields + // option is set. In this mode the code is organized a bit differently to + // promote better linker stripping of unused code. In particular, we generate + // one .cc file per message, one .cc file per extension, and a main pb.cc file + // containing everything else. + int NumMessages() const { return message_generators_.size(); } - // Similar to GenerateSource but generates only one message + int NumExtensions() const { return extension_generators_.size(); } + // Generates the source file for one message. void GenerateSourceForMessage(int idx, io::Printer* printer); + // Generates the source file for one extension. + void GenerateSourceForExtension(int idx, io::Printer* printer); + // Generates a source file containing everything except messages and + // extensions. void GenerateGlobalSource(io::Printer* printer); private: @@ -148,7 +159,7 @@ class FileGenerator { // Generates extension identifiers. void GenerateExtensionIdentifiers(io::Printer* printer); - // Generates inline function defintions. + // Generates inline function definitions. void GenerateInlineFunctionDefinitions(io::Printer* printer); void GenerateProto2NamespaceEnumSpecializations(io::Printer* printer); @@ -162,14 +173,6 @@ class FileGenerator { // generally a breaking change so we prefer the #undef approach. void GenerateMacroUndefs(io::Printer* printer); - bool IsSCCRepresentative(const Descriptor* d) { - return GetSCCRepresentative(d) == d; - } - const Descriptor* GetSCCRepresentative(const Descriptor* d) { - return GetSCC(d)->GetRepresentative(); - } - const SCC* GetSCC(const Descriptor* d) { return scc_analyzer_.GetSCC(d); } - bool IsDepWeak(const FileDescriptor* dep) const { if (weak_deps_.count(dep) != 0) { GOOGLE_CHECK(!options_.opensource_runtime); @@ -179,7 +182,6 @@ class FileGenerator { } std::set weak_deps_; - std::vector sccs_; const FileDescriptor* file_; const Options options_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.cc similarity index 73% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.cc index 0d80ea279..085157102 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -53,6 +54,12 @@ namespace cpp { CppGenerator::CppGenerator() {} CppGenerator::~CppGenerator() {} +namespace { +std::string NumberedCcFileName(const std::string& basename, int number) { + return StrCat(basename, ".out/", number, ".cc"); +} +} // namespace + bool CppGenerator::Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* generator_context, @@ -93,6 +100,8 @@ bool CppGenerator::Generate(const FileDescriptor* file, file_options.annotation_guard_name = options[i].second; } else if (options[i].first == "speed") { file_options.enforce_mode = EnforceOptimizeMode::kSpeed; + } else if (options[i].first == "code_size") { + file_options.enforce_mode = EnforceOptimizeMode::kCodeSize; } else if (options[i].first == "lite") { file_options.enforce_mode = EnforceOptimizeMode::kLiteRuntime; } else if (options[i].first == "lite_implicit_weak_fields") { @@ -102,10 +111,42 @@ bool CppGenerator::Generate(const FileDescriptor* file, file_options.num_cc_files = strto32(options[i].second.c_str(), NULL, 10); } + } else if (options[i].first == "annotate_accessor") { + file_options.annotate_accessor = true; + } else if (options[i].first == "inject_field_listener_events") { + file_options.field_listener_options.inject_field_listener_events = true; + } else if (options[i].first == "forbidden_field_listener_events") { + std::size_t pos = 0; + do { + std::size_t next_pos = options[i].second.find_first_of("+", pos); + if (next_pos == std::string::npos) { + next_pos = options[i].second.size(); + } + if (next_pos > pos) + file_options.field_listener_options.forbidden_field_listener_events + .insert(options[i].second.substr(pos, next_pos - pos)); + pos = next_pos + 1; + } while (pos < options[i].second.size()); + } else if (options[i].first == "eagerly_verified_lazy") { + file_options.eagerly_verified_lazy = true; + } else if (options[i].first == "force_eagerly_verified_lazy") { + file_options.force_eagerly_verified_lazy = true; } else if (options[i].first == "table_driven_parsing") { file_options.table_driven_parsing = true; } else if (options[i].first == "table_driven_serialization") { file_options.table_driven_serialization = true; + } else if (options[i].first == "experimental_tail_call_table_mode") { + if (options[i].second == "never") { + file_options.tctable_mode = Options::kTCTableNever; + } else if (options[i].second == "guarded") { + file_options.tctable_mode = Options::kTCTableGuarded; + } else if (options[i].second == "always") { + file_options.tctable_mode = Options::kTCTableAlways; + } else { + *error = "Unknown value for experimental_tail_call_table_mode: " + + options[i].second; + return false; + } } else { *error = "Unknown generator option: " + options[i].first; return false; @@ -182,24 +223,37 @@ bool CppGenerator::Generate(const FileDescriptor* file, file_generator.GenerateGlobalSource(&printer); } - int num_cc_files = file_generator.NumMessages(); + int num_cc_files = + file_generator.NumMessages() + file_generator.NumExtensions(); // If we're using implicit weak fields then we allow the user to // optionally specify how many files to generate, not counting the global // pb.cc file. If we have more files than messages, then some files will // be generated as empty placeholders. if (file_options.num_cc_files > 0) { - GOOGLE_CHECK_LE(file_generator.NumMessages(), file_options.num_cc_files) - << "There must be at least as many numbered .cc files as messages."; + GOOGLE_CHECK_LE(num_cc_files, file_options.num_cc_files) + << "There must be at least as many numbered .cc files as messages " + "and extensions."; num_cc_files = file_options.num_cc_files; } - for (int i = 0; i < num_cc_files; i++) { - std::unique_ptr output( - generator_context->Open(StrCat(basename, ".out/", i, ".cc"))); + int cc_file_number = 0; + for (int i = 0; i < file_generator.NumMessages(); i++) { + std::unique_ptr output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number++))); io::Printer printer(output.get(), '$'); - if (i < file_generator.NumMessages()) { - file_generator.GenerateSourceForMessage(i, &printer); - } + file_generator.GenerateSourceForMessage(i, &printer); + } + for (int i = 0; i < file_generator.NumExtensions(); i++) { + std::unique_ptr output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number++))); + io::Printer printer(output.get(), '$'); + file_generator.GenerateSourceForExtension(i, &printer); + } + // Create empty placeholder files if necessary to match the expected number + // of files. + for (; cc_file_number < num_cc_files; ++cc_file_number) { + std::unique_ptr output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number))); } } else { std::unique_ptr output( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.h index c5ff28a70..97e848dc4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_generator.h @@ -81,7 +81,14 @@ class PROTOC_EXPORT CppGenerator : public CodeGenerator { // implements CodeGenerator ---------------------------------------- bool Generate(const FileDescriptor* file, const std::string& parameter, - GeneratorContext* generator_context, std::string* error) const; + GeneratorContext* generator_context, + std::string* error) const override; + + uint64_t GetSupportedFeatures() const override { + // We don't fully support this yet, but this is needed to unblock the tests, + // and we will have full support before the experimental flag is removed. + return FEATURE_PROTO3_OPTIONAL; + } private: bool opensource_runtime_ = true; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.cc similarity index 63% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 062ad6b33..9fe47bff5 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -34,6 +34,7 @@ #include +#include #include #include #include @@ -43,16 +44,21 @@ #include #include +#include +#include +#include #include #include #include #include +#include #include #include #include #include #include +// Must be last. #include namespace google { @@ -164,49 +170,28 @@ static std::unordered_set* MakeKeywordsMap() { static std::unordered_set& kKeywords = *MakeKeywordsMap(); -// Encode [0..63] as 'A'-'Z', 'a'-'z', '0'-'9', '_' -char Base63Char(int value) { - GOOGLE_CHECK_GE(value, 0); - if (value < 26) return 'A' + value; - value -= 26; - if (value < 26) return 'a' + value; - value -= 26; - if (value < 10) return '0' + value; - GOOGLE_CHECK_EQ(value, 10); - return '_'; -} - -// Given a c identifier has 63 legal characters we can't implement base64 -// encoding. So we return the k least significant "digits" in base 63. -template -std::string Base63(I n, int k) { - std::string res; - while (k-- > 0) { - res += Base63Char(static_cast(n % 63)); - n /= 63; - } - return res; -} - std::string IntTypeName(const Options& options, const std::string& type) { - if (options.opensource_runtime) { - return "::PROTOBUF_NAMESPACE_ID::" + type; - } else { - return "::" + type; - } + return type + "_t"; } void SetIntVar(const Options& options, const std::string& type, std::map* variables) { (*variables)[type] = IntTypeName(options, type); } - -bool HasInternalAccessors(const FieldOptions::CType ctype) { - return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD; +bool IsEagerlyVerifiedLazyImpl(const FieldDescriptor* field, + const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + return false; } } // namespace +bool IsLazy(const FieldDescriptor* field, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + return IsLazilyVerifiedLazy(field, options) || + IsEagerlyVerifiedLazyImpl(field, options, scc_analyzer); +} + void SetCommonVars(const Options& options, std::map* variables) { (*variables)["proto_ns"] = ProtobufNamespace(options); @@ -244,6 +229,31 @@ void SetCommonVars(const Options& options, (*variables)["string"] = "std::string"; } +void SetUnknownFieldsVariable(const Descriptor* descriptor, + const Options& options, + std::map* variables) { + std::string proto_ns = ProtobufNamespace(options); + std::string unknown_fields_type; + if (UseUnknownFieldSet(descriptor->file(), options)) { + unknown_fields_type = "::" + proto_ns + "::UnknownFieldSet"; + (*variables)["unknown_fields"] = + "_internal_metadata_.unknown_fields<" + unknown_fields_type + ">(" + + unknown_fields_type + "::default_instance)"; + } else { + unknown_fields_type = + PrimitiveTypeName(options, FieldDescriptor::CPPTYPE_STRING); + (*variables)["unknown_fields"] = "_internal_metadata_.unknown_fields<" + + unknown_fields_type + ">(::" + proto_ns + + "::internal::GetEmptyString)"; + } + (*variables)["unknown_fields_type"] = unknown_fields_type; + (*variables)["have_unknown_fields"] = + "_internal_metadata_.have_unknown_fields()"; + (*variables)["mutable_unknown_fields"] = + "_internal_metadata_.mutable_unknown_fields<" + unknown_fields_type + + ">()"; +} + std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter) { std::string result; @@ -334,6 +344,22 @@ std::string QualifiedClassName(const EnumDescriptor* d) { return QualifiedClassName(d, Options()); } +std::string ExtensionName(const FieldDescriptor* d) { + if (const Descriptor* scope = d->extension_scope()) + return StrCat(ClassName(scope), "::", ResolveKeyword(d->name())); + return ResolveKeyword(d->name()); +} + +std::string QualifiedExtensionName(const FieldDescriptor* d, + const Options& options) { + GOOGLE_DCHECK(d->is_extension()); + return QualifiedFileLevelSymbol(d->file(), ExtensionName(d), options); +} + +std::string QualifiedExtensionName(const FieldDescriptor* d) { + return QualifiedExtensionName(d, Options()); +} + std::string Namespace(const std::string& package) { if (package.empty()) return ""; return "::" + DotsToColons(package); @@ -347,7 +373,7 @@ std::string Namespace(const FileDescriptor* d, const Options& options) { ret = StringReplace(ret, "::google::" "protobuf", - "PROTOBUF_NAMESPACE_ID", false); + "::PROTOBUF_NAMESPACE_ID", false); } return ret; } @@ -401,9 +427,14 @@ std::string FileDllExport(const FileDescriptor* file, const Options& options) { std::string SuperClassName(const Descriptor* descriptor, const Options& options) { - return "::" + ProtobufNamespace(options) + - (HasDescriptorMethods(descriptor->file(), options) ? "::Message" - : "::MessageLite"); + if (!HasDescriptorMethods(descriptor->file(), options)) { + return "::" + ProtobufNamespace(options) + "::MessageLite"; + } + auto simple_base = SimpleBaseClass(descriptor, options); + if (simple_base.empty()) { + return "::" + ProtobufNamespace(options) + "::Message"; + } + return "::" + ProtobufNamespace(options) + "::internal::" + simple_base; } std::string ResolveKeyword(const std::string& name) { @@ -422,6 +453,19 @@ std::string FieldName(const FieldDescriptor* field) { return result; } +std::string OneofCaseConstantName(const FieldDescriptor* field) { + GOOGLE_DCHECK(field->containing_oneof()); + std::string field_name = UnderscoresToCamelCase(field->name(), true); + return "k" + field_name; +} + +std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) { + GOOGLE_DCHECK(field->containing_oneof()); + const std::string qualification = + QualifiedClassName(field->containing_type()); + return StrCat(qualification, "::", OneofCaseConstantName(field)); +} + std::string EnumValueName(const EnumValueDescriptor* enum_value) { std::string result = enum_value->name(); if (kKeywords.count(result) > 0) { @@ -478,23 +522,23 @@ std::string FieldMessageTypeName(const FieldDescriptor* field, } std::string StripProto(const std::string& filename) { - if (HasSuffixString(filename, ".protodevel")) { - return StripSuffixString(filename, ".protodevel"); - } else { - return StripSuffixString(filename, ".proto"); - } + /* + * TODO(github/georgthegreat) remove this proxy method + * once Google's internal codebase will become ready + */ + return compiler::StripProto(filename); } const char* PrimitiveTypeName(FieldDescriptor::CppType type) { switch (type) { case FieldDescriptor::CPPTYPE_INT32: - return "::google::protobuf::int32"; + return "int32_t"; case FieldDescriptor::CPPTYPE_INT64: - return "::google::protobuf::int64"; + return "int64_t"; case FieldDescriptor::CPPTYPE_UINT32: - return "::google::protobuf::uint32"; + return "uint32_t"; case FieldDescriptor::CPPTYPE_UINT64: - return "::google::protobuf::uint64"; + return "uint64_t"; case FieldDescriptor::CPPTYPE_DOUBLE: return "double"; case FieldDescriptor::CPPTYPE_FLOAT: @@ -597,7 +641,7 @@ const char* DeclaredTypeMethodName(FieldDescriptor::Type type) { } std::string Int32ToString(int number) { - if (number == kint32min) { + if (number == std::numeric_limits::min()) { // This needs to be special-cased, see explanation here: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52661 return StrCat(number + 1, " - 1"); @@ -606,28 +650,21 @@ std::string Int32ToString(int number) { } } -std::string Int64ToString(const std::string& macro_prefix, int64 number) { - if (number == kint64min) { +static std::string Int64ToString(int64_t number) { + if (number == std::numeric_limits::min()) { // This needs to be special-cased, see explanation here: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52661 - return StrCat(macro_prefix, "_LONGLONG(", number + 1, ") - 1"); + return StrCat("int64_t{", number + 1, "} - 1"); } - return StrCat(macro_prefix, "_LONGLONG(", number, ")"); + return StrCat("int64_t{", number, "}"); } -std::string UInt64ToString(const std::string& macro_prefix, uint64 number) { - return StrCat(macro_prefix, "_ULONGLONG(", number, ")"); +static std::string UInt64ToString(uint64_t number) { + return StrCat("uint64_t{", number, "u}"); } std::string DefaultValue(const FieldDescriptor* field) { - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT64: - return Int64ToString("GG", field->default_value_int64()); - case FieldDescriptor::CPPTYPE_UINT64: - return UInt64ToString("GG", field->default_value_uint64()); - default: - return DefaultValue(Options(), field); - } + return DefaultValue(Options(), field); } std::string DefaultValue(const Options& options, const FieldDescriptor* field) { @@ -637,9 +674,9 @@ std::string DefaultValue(const Options& options, const FieldDescriptor* field) { case FieldDescriptor::CPPTYPE_UINT32: return StrCat(field->default_value_uint32()) + "u"; case FieldDescriptor::CPPTYPE_INT64: - return Int64ToString("PROTOBUF", field->default_value_int64()); + return Int64ToString(field->default_value_int64()); case FieldDescriptor::CPPTYPE_UINT64: - return UInt64ToString("PROTOBUF", field->default_value_uint64()); + return UInt64ToString(field->default_value_uint64()); case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field->default_value_double(); if (value == std::numeric_limits::infinity()) { @@ -703,7 +740,8 @@ std::string FilenameIdentifier(const std::string& filename) { } else { // Not alphanumeric. To avoid any possibility of name conflicts we // use the hex code for the character. - StrAppend(&result, "_", strings::Hex(static_cast(filename[i]))); + StrAppend(&result, "_", + strings::Hex(static_cast(filename[i]))); } } return result; @@ -751,37 +789,25 @@ std::string SafeFunctionName(const Descriptor* descriptor, bool IsStringInlined(const FieldDescriptor* descriptor, const Options& options) { - if (options.opensource_runtime) return false; - - // TODO(ckennelly): Handle inlining for any.proto. - if (IsAnyMessage(descriptor->containing_type(), options)) return false; - if (descriptor->containing_type()->options().map_entry()) return false; - - // Limit to proto2, as we rely on has bits to distinguish field presence for - // release_$name$. On proto3, we cannot use the address of the string - // instance when the field has been inlined. - if (!HasFieldPresence(descriptor->file())) return false; - - if (options.access_info_map) { - if (descriptor->is_required()) return true; - } + (void)descriptor; + (void)options; return false; } -static bool HasLazyFields(const Descriptor* descriptor, - const Options& options) { +static bool HasLazyFields(const Descriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { for (int field_idx = 0; field_idx < descriptor->field_count(); field_idx++) { - if (IsLazy(descriptor->field(field_idx), options)) { + if (IsLazy(descriptor->field(field_idx), options, scc_analyzer)) { return true; } } for (int idx = 0; idx < descriptor->extension_count(); idx++) { - if (IsLazy(descriptor->extension(idx), options)) { + if (IsLazy(descriptor->extension(idx), options, scc_analyzer)) { return true; } } for (int idx = 0; idx < descriptor->nested_type_count(); idx++) { - if (HasLazyFields(descriptor->nested_type(idx), options)) { + if (HasLazyFields(descriptor->nested_type(idx), options, scc_analyzer)) { return true; } } @@ -789,15 +815,16 @@ static bool HasLazyFields(const Descriptor* descriptor, } // Does the given FileDescriptor use lazy fields? -bool HasLazyFields(const FileDescriptor* file, const Options& options) { +bool HasLazyFields(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { for (int i = 0; i < file->message_type_count(); i++) { const Descriptor* descriptor(file->message_type(i)); - if (HasLazyFields(descriptor, options)) { + if (HasLazyFields(descriptor, options, scc_analyzer)) { return true; } } for (int field_idx = 0; field_idx < file->extension_count(); field_idx++) { - if (IsLazy(file->extension(field_idx), options)) { + if (IsLazy(file->extension(field_idx), options, scc_analyzer)) { return true; } } @@ -924,6 +951,22 @@ bool HasEnumDefinitions(const FileDescriptor* file) { return false; } +bool ShouldVerify(const Descriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + (void)descriptor; + (void)options; + (void)scc_analyzer; + return false; +} + +bool ShouldVerify(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + (void)file; + (void)options; + (void)scc_analyzer; + return false; +} + bool IsStringOrMessage(const FieldDescriptor* field) { switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: @@ -998,13 +1041,13 @@ Utf8CheckMode GetUtf8CheckMode(const FieldDescriptor* field, const Options& options) { if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 && FieldEnforceUtf8(field, options)) { - return STRICT; + return Utf8CheckMode::kStrict; } else if (GetOptimizeFor(field->file(), options) != FileOptions::LITE_RUNTIME && FileUtf8Verification(field->file(), options)) { - return VERIFY; + return Utf8CheckMode::kVerify; } else { - return NONE; + return Utf8CheckMode::kNone; } } @@ -1015,7 +1058,7 @@ static void GenerateUtf8CheckCode(const FieldDescriptor* field, const char* verify_function, const Formatter& format) { switch (GetUtf8CheckMode(field, options)) { - case STRICT: { + case Utf8CheckMode::kStrict: { if (for_parse) { format("DO_("); } @@ -1035,7 +1078,7 @@ static void GenerateUtf8CheckCode(const FieldDescriptor* field, format.Outdent(); break; } - case VERIFY: { + case Utf8CheckMode::kVerify: { format("::$proto_ns$::internal::WireFormat::$1$(\n", verify_function); format.Indent(); format(parameters); @@ -1048,7 +1091,7 @@ static void GenerateUtf8CheckCode(const FieldDescriptor* field, format.Outdent(); break; } - case NONE: + case Utf8CheckMode::kNone: break; } } @@ -1070,21 +1113,12 @@ void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field, "VerifyUTF8CordNamedField", format); } -namespace { - -void Flatten(const Descriptor* descriptor, - std::vector* flatten) { - for (int i = 0; i < descriptor->nested_type_count(); i++) - Flatten(descriptor->nested_type(i), flatten); - flatten->push_back(descriptor); -} - -} // namespace - void FlattenMessagesInFile(const FileDescriptor* file, std::vector* result) { for (int i = 0; i < file->message_type_count(); i++) { - Flatten(file->message_type(i), result); + ForEachMessage(file->message_type(i), [&](const Descriptor* descriptor) { + result->push_back(descriptor); + }); } } @@ -1113,7 +1147,7 @@ bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, return UsingImplicitWeakFields(field->file(), options) && field->type() == FieldDescriptor::TYPE_MESSAGE && !field->is_required() && !field->is_map() && !field->is_extension() && - field->containing_oneof() == nullptr && + !field->real_containing_oneof() && !IsWellKnownMessage(field->message_type()->file()) && field->message_type()->file()->name() != "net/proto2/proto/descriptor.proto" && @@ -1125,26 +1159,26 @@ bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { if (analysis_cache_.count(scc)) return analysis_cache_[scc]; - MessageAnalysis result{}; + MessageAnalysis result; + if (UsingImplicitWeakFields(scc->GetFile(), options_)) { + result.contains_weak = true; + } for (int i = 0; i < scc->descriptors.size(); i++) { const Descriptor* descriptor = scc->descriptors[i]; if (descriptor->extension_range_count() > 0) { result.contains_extension = true; - // Extensions are found by looking up default_instance and extension - // number in a map. So you'd maybe expect here - // result.constructor_requires_initialization = true; - // However the extension registration mechanism already makes sure - // the default will be initialized. } - for (int i = 0; i < descriptor->field_count(); i++) { - const FieldDescriptor* field = descriptor->field(i); + for (int j = 0; j < descriptor->field_count(); j++) { + const FieldDescriptor* field = descriptor->field(j); if (field->is_required()) { result.contains_required = true; } + if (field->options().weak()) { + result.contains_weak = true; + } switch (field->type()) { case FieldDescriptor::TYPE_STRING: case FieldDescriptor::TYPE_BYTES: { - result.constructor_requires_initialization = true; if (field->options().ctype() == FieldOptions::CORD) { result.contains_cord = true; } @@ -1152,7 +1186,6 @@ MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { } case FieldDescriptor::TYPE_GROUP: case FieldDescriptor::TYPE_MESSAGE: { - result.constructor_requires_initialization = true; const SCC* child = analyzer_.GetSCC(field->message_type()); if (child != scc) { MessageAnalysis analysis = GetSCCAnalysis(child); @@ -1161,6 +1194,7 @@ MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { if (!ShouldIgnoreRequiredFieldCheck(field, options_)) { result.contains_required |= analysis.contains_required; } + result.contains_weak |= analysis.contains_weak; } else { // This field points back into the same SCC hence the messages // in the SCC are recursive. Note if SCC contains more than two @@ -1328,503 +1362,133 @@ bool MaybeBootstrap(const Options& options, GeneratorContext* generator_context, } } -class ParseLoopGenerator { - public: - ParseLoopGenerator(int num_hasbits, const Options& options, - MessageSCCAnalyzer* scc_analyzer, io::Printer* printer) - : scc_analyzer_(scc_analyzer), - options_(options), - format_(printer), - num_hasbits_(num_hasbits) {} - - void GenerateParserLoop(const Descriptor* descriptor) { - format_.Set("classname", ClassName(descriptor)); - format_.Set("p_ns", "::" + ProtobufNamespace(options_)); - format_.Set("pi_ns", - StrCat("::", ProtobufNamespace(options_), "::internal")); - format_.Set("GOOGLE_PROTOBUF", MacroPrefix(options_)); - std::map vars; - SetCommonVars(options_, &vars); - format_.AddMap(vars); - - std::vector ordered_fields; - for (auto field : FieldRange(descriptor)) { - ordered_fields.push_back(field); - } - std::sort(ordered_fields.begin(), ordered_fields.end(), - [](const FieldDescriptor* a, const FieldDescriptor* b) { - return a->number() < b->number(); - }); - - format_( - "const char* $classname$::_InternalParse(const char* ptr, " - "$pi_ns$::ParseContext* ctx) {\n" - "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure\n"); - format_.Indent(); - int hasbits_size = 0; - if (HasFieldPresence(descriptor->file())) { - hasbits_size = (num_hasbits_ + 31) / 32; +static bool HasExtensionFromFile(const Message& msg, const FileDescriptor* file, + const Options& options, + bool* has_opt_codesize_extension) { + std::vector fields; + auto reflection = msg.GetReflection(); + reflection->ListFields(msg, &fields); + for (auto field : fields) { + const auto* field_msg = field->message_type(); + if (field_msg == nullptr) { + // It so happens that enums Is_Valid are still generated so enums work. + // Only messages have potential problems. + continue; } - // For now only optimize small hasbits. - if (hasbits_size != 1) hasbits_size = 0; - if (hasbits_size) { - format_("_Internal::HasBits has_bits{};\n"); - format_.Set("has_bits", "has_bits"); - } else { - format_.Set("has_bits", "_has_bits_"); - } - - if (descriptor->file()->options().cc_enable_arenas()) { - format_("$p_ns$::Arena* arena = GetArenaNoVirtual(); (void)arena;\n"); - } - GenerateParseLoop(descriptor, ordered_fields); - format_.Outdent(); - format_("success:\n"); - if (hasbits_size) format_(" _has_bits_.Or(has_bits);\n"); - format_( - " return ptr;\n" - "failure:\n" - " ptr = nullptr;\n" - " goto success;\n" - "#undef CHK_\n" - "}\n"); - } - - private: - MessageSCCAnalyzer* scc_analyzer_; - const Options& options_; - Formatter format_; - int num_hasbits_; - - using WireFormat = internal::WireFormat; - using WireFormatLite = internal::WireFormatLite; - - void GenerateArenaString(const FieldDescriptor* field) { - if (HasFieldPresence(field->file())) { - format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); - } - std::string default_string = - field->default_value_string().empty() - ? "::" + ProtobufNamespace(options_) + - "::internal::GetEmptyStringAlreadyInited()" - : QualifiedClassName(field->containing_type(), options_) + - "::" + MakeDefaultName(field) + ".get()"; - format_( - "if (arena != nullptr) {\n" - " ptr = ctx->ReadArenaString(ptr, &$1$_, arena);\n" - "} else {\n" - " ptr = " - "$pi_ns$::InlineGreedyStringParser($1$_.MutableNoArenaNoDefault(&$2$" - "), ptr, ctx);" - "\n}\n" - "const std::string* str = &$1$_.Get(); (void)str;\n", - FieldName(field), default_string); - } - - void GenerateStrings(const FieldDescriptor* field, bool check_utf8) { - FieldOptions::CType ctype = FieldOptions::STRING; - if (!options_.opensource_runtime) { - // Open source doesn't support other ctypes; - ctype = field->options().ctype(); - } - if (field->file()->options().cc_enable_arenas() && !field->is_repeated() && - !options_.opensource_runtime && - GetOptimizeFor(field->file(), options_) != FileOptions::LITE_RUNTIME && - // For now only use arena string for strings with empty defaults. - field->default_value_string().empty() && - !IsStringInlined(field, options_) && - field->containing_oneof() == nullptr && ctype == FieldOptions::STRING) { - GenerateArenaString(field); - } else { - std::string name; - switch (ctype) { - case FieldOptions::STRING: - name = "GreedyStringParser"; - break; - case FieldOptions::CORD: - name = "CordParser"; - break; - case FieldOptions::STRING_PIECE: - name = "StringPieceParser"; - break; + // If this option has an extension set AND that extension is defined in the + // same file we have bootstrap problem. + if (field->is_extension()) { + const auto* msg_extension_file = field->message_type()->file(); + if (msg_extension_file == file) return true; + if (has_opt_codesize_extension && + GetOptimizeFor(msg_extension_file, options) == + FileOptions::CODE_SIZE) { + *has_opt_codesize_extension = true; } - format_( - "auto str = $1$$2$_$3$();\n" - "ptr = $pi_ns$::Inline$4$(str, ptr, ctx);\n", - HasInternalAccessors(ctype) ? "_internal_" : "", - field->is_repeated() && !field->is_packable() ? "add" : "mutable", - FieldName(field), name); - } - if (!check_utf8) return; // return if this is a bytes field - auto level = GetUtf8CheckMode(field, options_); - switch (level) { - case NONE: - return; - case VERIFY: - format_("#ifndef NDEBUG\n"); - break; - case STRICT: - format_("CHK_("); - break; } - std::string field_name; - field_name = "nullptr"; - if (HasDescriptorMethods(field->file(), options_)) { - field_name = StrCat("\"", field->full_name(), "\""); - } - format_("$pi_ns$::VerifyUTF8(str, $1$)", field_name); - switch (level) { - case NONE: - return; - case VERIFY: - format_( - ";\n" - "#endif // !NDEBUG\n"); - break; - case STRICT: - format_(");\n"); - break; - } - } - - void GenerateLengthDelim(const FieldDescriptor* field) { - if (field->is_packable()) { - std::string enum_validator; - if (field->type() == FieldDescriptor::TYPE_ENUM && - !HasPreservingUnknownEnumSemantics(field)) { - enum_validator = - StrCat(", ", QualifiedClassName(field->enum_type(), options_), - "_IsValid, &_internal_metadata_, ", field->number()); + // Recurse in this field to see if there is a problem in there + if (field->is_repeated()) { + for (int i = 0; i < reflection->FieldSize(msg, field); i++) { + if (HasExtensionFromFile(reflection->GetRepeatedMessage(msg, field, i), + file, options, has_opt_codesize_extension)) { + return true; + } } - format_( - "ptr = $pi_ns$::Packed$1$Parser(_internal_mutable_$2$(), ptr, " - "ctx$3$);\n", - DeclaredTypeMethodName(field->type()), FieldName(field), - enum_validator); } else { - auto field_type = field->type(); - switch (field_type) { - case FieldDescriptor::TYPE_STRING: - GenerateStrings(field, true /* utf8 */); - break; - case FieldDescriptor::TYPE_BYTES: - GenerateStrings(field, false /* utf8 */); - break; - case FieldDescriptor::TYPE_MESSAGE: { - if (field->is_map()) { - const FieldDescriptor* val = - field->message_type()->FindFieldByName("value"); - GOOGLE_CHECK(val); - if (HasFieldPresence(field->file()) && - val->type() == FieldDescriptor::TYPE_ENUM) { - format_( - "auto object = ::$proto_ns$::internal::InitEnumParseWrapper(" - "&$1$_, $2$_IsValid, $3$, &_internal_metadata_);\n" - "ptr = ctx->ParseMessage(&object, ptr);\n", - FieldName(field), QualifiedClassName(val->enum_type()), - field->number()); - } else { - format_("ptr = ctx->ParseMessage(&$1$_, ptr);\n", - FieldName(field)); - } - } else if (IsLazy(field, options_)) { - if (field->containing_oneof() != nullptr) { - format_( - "if (!_internal_has_$1$()) {\n" - " clear_$2$();\n" - " $2$_.$1$_ = ::$proto_ns$::Arena::CreateMessage<\n" - " $pi_ns$::LazyField>(" - "GetArenaNoVirtual());\n" - " set_has_$1$();\n" - "}\n" - "ptr = ctx->ParseMessage($2$_.$1$_, ptr);\n", - FieldName(field), field->containing_oneof()->name()); - } else if (HasFieldPresence(field->file())) { - format_( - "_Internal::set_has_$1$(&$has_bits$);\n" - "ptr = ctx->ParseMessage(&$1$_, ptr);\n", - FieldName(field)); - } else { - format_("ptr = ctx->ParseMessage(&$1$_, ptr);\n", - FieldName(field)); - } - } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) { - if (!field->is_repeated()) { - format_( - "ptr = ctx->ParseMessage(_Internal::mutable_$1$(this), " - "ptr);\n", - FieldName(field)); - } else { - format_( - "ptr = ctx->ParseMessage($1$_.AddWeak(reinterpret_cast($2$::_$3$_default_instance_ptr_)" - "), ptr);\n", - FieldName(field), Namespace(field->message_type(), options_), - ClassName(field->message_type())); - } - } else if (IsWeak(field, options_)) { - format_( - "ptr = ctx->ParseMessage(_weak_field_map_.MutableMessage($1$," - " _$classname$_default_instance_.$2$_), ptr);\n", - field->number(), FieldName(field)); - } else { - format_("ptr = ctx->ParseMessage(_internal_$1$_$2$(), ptr);\n", - field->is_repeated() ? "add" : "mutable", FieldName(field)); - } - break; - } - default: - GOOGLE_LOG(FATAL) << "Illegal combination for length delimited wiretype " - << " filed type is " << field->type(); + if (HasExtensionFromFile(reflection->GetMessage(msg, field), file, + options, has_opt_codesize_extension)) { + return true; } } } + return false; +} - // Convert a 1 or 2 byte varint into the equivalent value upon a direct load. - static uint32 SmallVarintValue(uint32 x) { - GOOGLE_DCHECK(x < 128 * 128); - if (x >= 128) x += (x & 0xFF80) + 128; - return x; - } - - static bool ShouldRepeat(const FieldDescriptor* descriptor, - internal::WireFormatLite::WireType wiretype) { - constexpr int kMaxTwoByteFieldNumber = 16 * 128; - return descriptor->number() < kMaxTwoByteFieldNumber && - descriptor->is_repeated() && - (!descriptor->is_packable() || - wiretype != internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - } - - void GenerateFieldBody(internal::WireFormatLite::WireType wiretype, - const FieldDescriptor* field) { - uint32 tag = WireFormatLite::MakeTag(field->number(), wiretype); - switch (wiretype) { - case WireFormatLite::WIRETYPE_VARINT: { - std::string type = PrimitiveTypeName(options_, field->cpp_type()); - std::string prefix = field->is_repeated() ? "add" : "set"; - if (field->type() == FieldDescriptor::TYPE_ENUM) { - format_( - "$uint64$ val = $pi_ns$::ReadVarint(&ptr);\n" - "CHK_(ptr);\n"); - if (!HasPreservingUnknownEnumSemantics(field)) { - format_("if (PROTOBUF_PREDICT_TRUE($1$_IsValid(val))) {\n", - QualifiedClassName(field->enum_type(), options_)); - format_.Indent(); - } - format_("_internal_$1$_$2$(static_cast<$3$>(val));\n", prefix, - FieldName(field), - QualifiedClassName(field->enum_type(), options_)); - if (!HasPreservingUnknownEnumSemantics(field)) { - format_.Outdent(); - format_( - "} else {\n" - " $pi_ns$::WriteVarint($1$, val, mutable_unknown_fields());\n" - "}\n", - field->number()); - } - } else { - int size = field->type() == FieldDescriptor::TYPE_SINT32 ? 32 : 64; - std::string zigzag; - if ((field->type() == FieldDescriptor::TYPE_SINT32 || - field->type() == FieldDescriptor::TYPE_SINT64)) { - zigzag = StrCat("ZigZag", size); - } - if (field->is_repeated() || field->containing_oneof()) { - std::string prefix = field->is_repeated() ? "add" : "set"; - format_( - "_internal_$1$_$2$($pi_ns$::ReadVarint$3$(&ptr));\n" - "CHK_(ptr);\n", - prefix, FieldName(field), zigzag); - } else { - if (HasFieldPresence(field->file())) { - format_("_Internal::set_has_$1$(&$has_bits$);\n", - FieldName(field)); - } - format_( - "$1$_ = $pi_ns$::ReadVarint$2$(&ptr);\n" - "CHK_(ptr);\n", - FieldName(field), zigzag); - } - } - break; - } - case WireFormatLite::WIRETYPE_FIXED32: - case WireFormatLite::WIRETYPE_FIXED64: { - std::string type = PrimitiveTypeName(options_, field->cpp_type()); - if (field->is_repeated() || field->containing_oneof()) { - std::string prefix = field->is_repeated() ? "add" : "set"; - format_( - "_internal_$1$_$2$($pi_ns$::UnalignedLoad<$3$>(ptr));\n" - "ptr += sizeof($3$);\n", - prefix, FieldName(field), type); - } else { - if (HasFieldPresence(field->file())) { - format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); - } - format_( - "$1$_ = $pi_ns$::UnalignedLoad<$2$>(ptr);\n" - "ptr += sizeof($2$);\n", - FieldName(field), type); - } - break; - } - case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - GenerateLengthDelim(field); - format_("CHK_(ptr);\n"); - break; - } - case WireFormatLite::WIRETYPE_START_GROUP: { - format_( - "ptr = ctx->ParseGroup(_internal_$1$_$2$(), ptr, $3$);\n" - "CHK_(ptr);\n", - field->is_repeated() ? "add" : "mutable", FieldName(field), tag); - break; - } - case WireFormatLite::WIRETYPE_END_GROUP: { - GOOGLE_LOG(FATAL) << "Can't have end group field\n"; - break; - } - } // switch (wire_type) - } - - // Returns the tag for this field and in case of repeated packable fields, - // sets a fallback tag in fallback_tag_ptr. - static uint32 ExpectedTag(const FieldDescriptor* field, - uint32* fallback_tag_ptr) { - uint32 expected_tag; - if (field->is_packable()) { - auto expected_wiretype = WireFormat::WireTypeForFieldType(field->type()); - expected_tag = - WireFormatLite::MakeTag(field->number(), expected_wiretype); - GOOGLE_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - auto fallback_wiretype = WireFormatLite::WIRETYPE_LENGTH_DELIMITED; - uint32 fallback_tag = - WireFormatLite::MakeTag(field->number(), fallback_wiretype); - - if (field->is_packed()) std::swap(expected_tag, fallback_tag); - *fallback_tag_ptr = fallback_tag; - } else { - auto expected_wiretype = WireFormat::WireTypeForField(field); - expected_tag = - WireFormatLite::MakeTag(field->number(), expected_wiretype); - } - return expected_tag; - } - - void GenerateParseLoop( - const Descriptor* descriptor, - const std::vector& ordered_fields) { - format_( - "while (!ctx->Done(&ptr)) {\n" - " $uint32$ tag;\n" - " ptr = $pi_ns$::ReadTag(ptr, &tag);\n" - " CHK_(ptr);\n"); - if (!ordered_fields.empty()) format_(" switch (tag >> 3) {\n"); - - format_.Indent(); - format_.Indent(); - - for (const auto* field : ordered_fields) { - PrintFieldComment(format_, field); - format_("case $1$:\n", field->number()); - format_.Indent(); - uint32 fallback_tag = 0; - uint32 expected_tag = ExpectedTag(field, &fallback_tag); - format_( - "if (PROTOBUF_PREDICT_TRUE(static_cast<$uint8$>(tag) == $1$)) {\n", - expected_tag & 0xFF); - format_.Indent(); - auto wiretype = WireFormatLite::GetTagWireType(expected_tag); - uint32 tag = WireFormatLite::MakeTag(field->number(), wiretype); - int tag_size = io::CodedOutputStream::VarintSize32(tag); - bool is_repeat = ShouldRepeat(field, wiretype); - if (is_repeat) { - format_( - "ptr -= $1$;\n" - "do {\n" - " ptr += $1$;\n", - tag_size); - format_.Indent(); - } - GenerateFieldBody(wiretype, field); - if (is_repeat) { - format_.Outdent(); - format_( - " if (!ctx->DataAvailable(ptr)) break;\n" - "} while ($pi_ns$::ExpectTag<$1$>(ptr));\n", - tag); +static bool HasBootstrapProblem(const FileDescriptor* file, + const Options& options, + bool* has_opt_codesize_extension) { + static auto& cache = *new std::unordered_map; + auto it = cache.find(file); + if (it != cache.end()) return it->second; + // In order to build the data structures for the reflective parse, it needs + // to parse the serialized descriptor describing all the messages defined in + // this file. Obviously this presents a bootstrap problem for descriptor + // messages. + if (file->name() == "net/proto2/proto/descriptor.proto" || + file->name() == "google/protobuf/descriptor.proto") { + return true; + } + // Unfortunately we're not done yet. The descriptor option messages allow + // for extensions. So we need to be able to parse these extensions in order + // to parse the file descriptor for a file that has custom options. This is a + // problem when these custom options extensions are defined in the same file. + FileDescriptorProto linkedin_fd_proto; + const DescriptorPool* pool = file->pool(); + const Descriptor* fd_proto_descriptor = + pool->FindMessageTypeByName(linkedin_fd_proto.GetTypeName()); + // Not all pools have descriptor.proto in them. In these cases there for sure + // are no custom options. + if (fd_proto_descriptor == nullptr) return false; + + // It's easier to inspect file as a proto, because we can use reflection on + // the proto to iterate over all content. + file->CopyTo(&linkedin_fd_proto); + + // linkedin_fd_proto is a generated proto linked in the proto compiler. As + // such it doesn't know the extensions that are potentially present in the + // descriptor pool constructed from the protos that are being compiled. These + // custom options are therefore in the unknown fields. + // By building the corresponding FileDescriptorProto in the pool constructed + // by the protos that are being compiled, ie. file's pool, the unknown fields + // are converted to extensions. + DynamicMessageFactory factory(pool); + Message* fd_proto = factory.GetPrototype(fd_proto_descriptor)->New(); + fd_proto->ParseFromString(linkedin_fd_proto.SerializeAsString()); + + bool& res = cache[file]; + res = HasExtensionFromFile(*fd_proto, file, options, + has_opt_codesize_extension); + delete fd_proto; + return res; +} + +FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, + const Options& options, + bool* has_opt_codesize_extension) { + if (has_opt_codesize_extension) *has_opt_codesize_extension = false; + switch (options.enforce_mode) { + case EnforceOptimizeMode::kSpeed: + return FileOptions::SPEED; + case EnforceOptimizeMode::kLiteRuntime: + return FileOptions::LITE_RUNTIME; + case EnforceOptimizeMode::kCodeSize: + if (file->options().optimize_for() == FileOptions::LITE_RUNTIME) { + return FileOptions::LITE_RUNTIME; } - format_.Outdent(); - if (fallback_tag) { - format_("} else if (static_cast<$uint8$>(tag) == $1$) {\n", - fallback_tag & 0xFF); - format_.Indent(); - GenerateFieldBody(WireFormatLite::GetTagWireType(fallback_tag), field); - format_.Outdent(); + if (HasBootstrapProblem(file, options, has_opt_codesize_extension)) { + return FileOptions::SPEED; } - format_.Outdent(); - format_( - " } else goto handle_unusual;\n" - " continue;\n"); - } // for loop over ordered fields - - // Default case - if (!ordered_fields.empty()) format_("default: {\n"); - if (!ordered_fields.empty()) format_("handle_unusual:\n"); - format_( - " if ((tag & 7) == 4 || tag == 0) {\n" - " ctx->SetLastTag(tag);\n" - " goto success;\n" - " }\n"); - if (IsMapEntryMessage(descriptor)) { - format_(" continue;\n"); - } else { - if (descriptor->extension_range_count() > 0) { - format_("if ("); - for (int i = 0; i < descriptor->extension_range_count(); i++) { - const Descriptor::ExtensionRange* range = - descriptor->extension_range(i); - if (i > 0) format_(" ||\n "); - - uint32 start_tag = WireFormatLite::MakeTag( - range->start, static_cast(0)); - uint32 end_tag = WireFormatLite::MakeTag( - range->end, static_cast(0)); - - if (range->end > FieldDescriptor::kMaxNumber) { - format_("($1$u <= tag)", start_tag); - } else { - format_("($1$u <= tag && tag < $2$u)", start_tag, end_tag); - } + return FileOptions::CODE_SIZE; + case EnforceOptimizeMode::kNoEnforcement: + if (file->options().optimize_for() == FileOptions::CODE_SIZE) { + if (HasBootstrapProblem(file, options, has_opt_codesize_extension)) { + GOOGLE_LOG(WARNING) << "Proto states optimize_for = CODE_SIZE, but we " + "cannot honor that because it contains custom option " + "extensions defined in the same proto."; + return FileOptions::SPEED; } - format_(") {\n"); - format_( - " ptr = _extensions_.ParseField(tag, ptr,\n" - " internal_default_instance(), &_internal_metadata_, ctx);\n" - " CHK_(ptr != nullptr);\n" - " continue;\n" - "}\n"); } - format_( - " ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);\n" - " CHK_(ptr != nullptr);\n" - " continue;\n"); - } - if (!ordered_fields.empty()) format_("}\n"); // default case - format_.Outdent(); - format_.Outdent(); - if (!ordered_fields.empty()) format_(" } // switch\n"); - format_("} // while\n"); - } -}; - -void GenerateParserLoop(const Descriptor* descriptor, int num_hasbits, - const Options& options, - MessageSCCAnalyzer* scc_analyzer, - io::Printer* printer) { - ParseLoopGenerator generator(num_hasbits, options, scc_analyzer, printer); - generator.GenerateParserLoop(descriptor); + return file->options().optimize_for(); + } + + GOOGLE_LOG(FATAL) << "Unknown optimization enforcement requested."; + // The phony return below serves to silence a warning from GCC 8. + return FileOptions::SPEED; +} + +bool EnableMessageOwnedArena(const Descriptor* desc) { + (void)desc; + return false; } } // namespace cpp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.h similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.h index 28cf78e7e..bd4f48bc8 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -36,11 +36,13 @@ #define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ #include +#include #include #include #include #include +#include #include #include #include @@ -57,20 +59,20 @@ namespace protobuf { namespace compiler { namespace cpp { -inline std::string ProtobufNamespace(const Options& options) { +inline std::string ProtobufNamespace(const Options& /* options */) { return "PROTOBUF_NAMESPACE_ID"; } -inline std::string MacroPrefix(const Options& options) { - return options.opensource_runtime ? "GOOGLE_PROTOBUF" : "GOOGLE_PROTOBUF"; +inline std::string MacroPrefix(const Options& /* options */) { + return "GOOGLE_PROTOBUF"; } -inline std::string DeprecatedAttribute(const Options& options, +inline std::string DeprecatedAttribute(const Options& /* options */, const FieldDescriptor* d) { return d->options().deprecated() ? "PROTOBUF_DEPRECATED " : ""; } -inline std::string DeprecatedAttribute(const Options& options, +inline std::string DeprecatedAttribute(const Options& /* options */, const EnumValueDescriptor* d) { return d->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM " : ""; } @@ -83,6 +85,10 @@ extern const char kThinSeparator[]; void SetCommonVars(const Options& options, std::map* variables); +void SetUnknownFieldsVariable(const Descriptor* descriptor, + const Options& options, + std::map* variables); + bool GetBootstrapBasename(const Options& options, const std::string& basename, std::string* bootstrap_basename); bool MaybeBootstrap(const Options& options, GeneratorContext* generator_context, @@ -130,6 +136,14 @@ inline std::string ClassName(const EnumDescriptor* descriptor, bool qualified) { : ClassName(descriptor); } +// Returns the extension name prefixed with the class name if nested but without +// the package name. +std::string ExtensionName(const FieldDescriptor* d); + +std::string QualifiedExtensionName(const FieldDescriptor* d, + const Options& options); +std::string QualifiedExtensionName(const FieldDescriptor* d); + // Type name of default instance. std::string DefaultInstanceType(const Descriptor* descriptor, const Options& options); @@ -172,9 +186,6 @@ std::string ResolveKeyword(const std::string& name); // anyway, so normally this just returns field->name(). std::string FieldName(const FieldDescriptor* field); -// Get the sanitized name that should be used for the given enum in C++ code. -std::string EnumValueName(const EnumValueDescriptor* enum_value); - // Returns an estimate of the compiler's alignment for the field. This // can't guarantee to be correct because the generated code could be compiled on // different systems with different alignment rules. The estimates below assume @@ -197,9 +208,6 @@ inline const Descriptor* FieldScope(const FieldDescriptor* field) { std::string FieldMessageTypeName(const FieldDescriptor* field, const Options& options); -// Strips ".proto" or ".protodevel" from the end of a filename. -PROTOC_EXPORT std::string StripProto(const std::string& filename); - // Get the C++ type name for a primitive type (e.g. "double", "::google::protobuf::int32", etc.). const char* PrimitiveTypeName(FieldDescriptor::CppType type); std::string PrimitiveTypeName(const Options& options, @@ -212,9 +220,6 @@ const char* DeclaredTypeMethodName(FieldDescriptor::Type type); // Return the code that evaluates to the number when compiled. std::string Int32ToString(int number); -// Return the code that evaluates to the number when compiled. -std::string Int64ToString(const Options& options, int64 number); - // Get code that evaluates to the field's default value. std::string DefaultValue(const Options& options, const FieldDescriptor* field); @@ -322,23 +327,52 @@ inline bool IsCord(const FieldDescriptor* field, const Options& options) { EffectiveStringCType(field, options) == FieldOptions::CORD; } +inline bool IsString(const FieldDescriptor* field, const Options& options) { + return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && + EffectiveStringCType(field, options) == FieldOptions::STRING; +} + inline bool IsStringPiece(const FieldDescriptor* field, const Options& options) { return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && EffectiveStringCType(field, options) == FieldOptions::STRING_PIECE; } +class MessageSCCAnalyzer; + // Does the given FileDescriptor use lazy fields? -bool HasLazyFields(const FileDescriptor* file, const Options& options); +bool HasLazyFields(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer); // Is the given field a supported lazy field? -inline bool IsLazy(const FieldDescriptor* field, const Options& options) { +bool IsLazy(const FieldDescriptor* field, const Options& options, + MessageSCCAnalyzer* scc_analyzer); + +inline bool IsLazilyVerifiedLazy(const FieldDescriptor* field, + const Options& options) { return field->options().lazy() && !field->is_repeated() && field->type() == FieldDescriptor::TYPE_MESSAGE && GetOptimizeFor(field->file(), options) != FileOptions::LITE_RUNTIME && !options.opensource_runtime; } +inline bool IsEagerlyVerifiedLazy(const FieldDescriptor* field, + const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + return IsLazy(field, options, scc_analyzer) && !field->options().lazy(); +} + +inline bool IsFieldUsed(const FieldDescriptor* /* field */, + const Options& /* options */) { + return true; +} + +// Returns true if "field" is stripped. +inline bool IsFieldStripped(const FieldDescriptor* /*field*/, + const Options& /*options*/) { + return false; +} + // Does the file contain any definitions that need extension_set.h? bool HasExtensionsOrExtendableMessage(const FileDescriptor* file); @@ -392,14 +426,6 @@ inline bool IsProto2MessageSet(const Descriptor* descriptor, descriptor->full_name() == "google.protobuf.bridge.MessageSet"; } -inline bool IsProto2MessageSetFile(const FileDescriptor* file, - const Options& options) { - return !options.opensource_runtime && - options.enforce_mode != EnforceOptimizeMode::kLiteRuntime && - !options.lite_implicit_weak_fields && - file->name() == "net/proto2/bridge/proto/message_set.proto"; -} - inline bool IsMapEntryMessage(const Descriptor* descriptor) { return descriptor->options().map_entry(); } @@ -410,8 +436,24 @@ bool IsStringOrMessage(const FieldDescriptor* field); std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter); -inline bool HasFieldPresence(const FileDescriptor* file) { - return file->syntax() != FileDescriptor::SYNTAX_PROTO3; +inline bool IsProto3(const FileDescriptor* file) { + return file->syntax() == FileDescriptor::SYNTAX_PROTO3; +} + +inline bool HasHasbit(const FieldDescriptor* field) { + // This predicate includes proto3 message fields only if they have "optional". + // Foo submsg1 = 1; // HasHasbit() == false + // optional Foo submsg2 = 2; // HasHasbit() == true + // This is slightly odd, as adding "optional" to a singular proto3 field does + // not change the semantics or API. However whenever any field in a message + // has a hasbit, it forces reflection to include hasbit offsets for *all* + // fields, even if almost all of them are set to -1 (no hasbit). So to avoid + // causing a sudden size regression for ~all proto3 messages, we give proto3 + // message fields a hasbit only if "optional" is present. If the user is + // explicitly writing "optional", it is likely they are writing it on + // primitive fields also. + return (field->has_optional_keyword() || field->is_required()) && + !field->options().weak(); } // Returns true if 'enum' semantics are such that unknown values are preserved @@ -420,27 +462,11 @@ inline bool HasPreservingUnknownEnumSemantics(const FieldDescriptor* field) { return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3; } -inline bool SupportsArenas(const FileDescriptor* file) { - return file->options().cc_enable_arenas(); -} - -inline bool SupportsArenas(const Descriptor* desc) { - return SupportsArenas(desc->file()); -} - -inline bool SupportsArenas(const FieldDescriptor* field) { - return SupportsArenas(field->file()); -} - inline bool IsCrossFileMessage(const FieldDescriptor* field) { return field->type() == FieldDescriptor::TYPE_MESSAGE && field->message_type()->file() != field->file(); } -inline std::string MessageCreateFunction(const Descriptor* d) { - return SupportsArenas(d) ? "CreateMessage" : "Create"; -} - inline std::string MakeDefaultName(const FieldDescriptor* field) { return "_i_give_permission_to_break_this_code_default_" + FieldName(field) + "_"; @@ -475,16 +501,32 @@ inline std::string IncludeGuard(const FileDescriptor* file, bool pb_h, } } +// Returns the OptimizeMode for this file, furthermore it updates a status +// bool if has_opt_codesize_extension is non-null. If this status bool is true +// it means this file contains an extension that itself is defined as +// optimized_for = CODE_SIZE. +FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, + const Options& options, + bool* has_opt_codesize_extension); inline FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, const Options& options) { - switch (options.enforce_mode) { - case EnforceOptimizeMode::kSpeed: - return FileOptions::SPEED; - case EnforceOptimizeMode::kLiteRuntime: - return FileOptions::LITE_RUNTIME; - case EnforceOptimizeMode::kNoEnforcement: - default: - return file->options().optimize_for(); + return GetOptimizeFor(file, options, nullptr); +} +inline bool NeedsEagerDescriptorAssignment(const FileDescriptor* file, + const Options& options) { + bool has_opt_codesize_extension; + if (GetOptimizeFor(file, options, &has_opt_codesize_extension) == + FileOptions::CODE_SIZE && + has_opt_codesize_extension) { + // If this filedescriptor contains an extension from another file which + // is optimized_for = CODE_SIZE. We need to be careful in the ordering so + // we eagerly build the descriptors in the dependencies before building + // the descriptors of this file. + return true; + } else { + // If we have a generated code based parser we never need eager + // initialization of descriptors of our deps. + return false; } } @@ -498,6 +540,19 @@ inline std::vector FlattenMessagesInFile( return result; } +template +void ForEachMessage(const Descriptor* descriptor, F&& func) { + for (int i = 0; i < descriptor->nested_type_count(); i++) + ForEachMessage(descriptor->nested_type(i), std::forward(func)); + func(descriptor); +} + +template +void ForEachMessage(const FileDescriptor* descriptor, F&& func) { + for (int i = 0; i < descriptor->message_type_count(); i++) + ForEachMessage(descriptor->message_type(i), std::forward(func)); +} + bool HasWeakFields(const Descriptor* desc, const Options& options); bool HasWeakFields(const FileDescriptor* desc, const Options& options); @@ -505,16 +560,16 @@ bool HasWeakFields(const FileDescriptor* desc, const Options& options); // given field. inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field, const Options& options) { - // Do not check "required" for lazy fields. - return IsLazy(field, options); + // Do not check "required" for lazily verified lazy fields. + return IsLazilyVerifiedLazy(field, options); } struct MessageAnalysis { - bool is_recursive; - bool contains_cord; - bool contains_extension; - bool contains_required; - bool constructor_requires_initialization; + bool is_recursive = false; + bool contains_cord = false; + bool contains_extension = false; + bool contains_required = false; + bool contains_weak = false; // Implicit weak as well. }; // This class is used in FileGenerator, to ensure linear instead of @@ -531,6 +586,10 @@ class PROTOC_EXPORT MessageSCCAnalyzer { MessageAnalysis result = GetSCCAnalysis(GetSCC(descriptor)); return result.contains_required || result.contains_extension; } + bool HasWeakField(const Descriptor* descriptor) { + MessageAnalysis result = GetSCCAnalysis(GetSCC(descriptor)); + return result.contains_weak; + } const SCC* GetSCC(const Descriptor* descriptor) { return analyzer_.GetSCC(descriptor); } @@ -552,16 +611,6 @@ class PROTOC_EXPORT MessageSCCAnalyzer { std::map analysis_cache_; }; -inline std::string SccInfoSymbol(const SCC* scc, const Options& options) { - return UniqueName("scc_info_" + ClassName(scc->GetRepresentative()), - scc->GetRepresentative(), options); -} - -inline std::string SccInfoPtrSymbol(const SCC* scc, const Options& options) { - return UniqueName("scc_info_ptr_" + ClassName(scc->GetRepresentative()), - scc->GetRepresentative(), options); -} - void ListAllFields(const Descriptor* d, std::vector* fields); void ListAllFields(const FileDescriptor* d, @@ -601,6 +650,36 @@ bool UsingImplicitWeakFields(const FileDescriptor* file, bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, MessageSCCAnalyzer* scc_analyzer); +inline bool HasSimpleBaseClass(const Descriptor* desc, const Options& options) { + if (!HasDescriptorMethods(desc->file(), options)) return false; + if (desc->extension_range_count() != 0) return false; + if (desc->field_count() == 0) return true; + // TODO(jorg): Support additional common message types with only one + // or two fields + return false; +} + +inline bool HasSimpleBaseClasses(const FileDescriptor* file, + const Options& options) { + bool v = false; + ForEachMessage(file, [&v, &options](const Descriptor* desc) { + v |= HasSimpleBaseClass(desc, options); + }); + return v; +} + +inline std::string SimpleBaseClass(const Descriptor* desc, + const Options& options) { + if (!HasDescriptorMethods(desc->file(), options)) return ""; + if (desc->extension_range_count() != 0) return ""; + if (desc->field_count() == 0) { + return "ZeroFieldsBase"; + } + // TODO(jorg): Support additional common message types with only one + // or two fields + return ""; +} + // Formatter is a functor class which acts as a closure around printer and // the variable map. It's much like printer->Print except it supports both named // variables that are substituted using a key value map and direct arguments. In @@ -664,6 +743,27 @@ class PROTOC_EXPORT Formatter { void Outdent() const { printer_->Outdent(); } io::Printer* printer() const { return printer_; } + class PROTOC_EXPORT ScopedIndenter { + public: + explicit ScopedIndenter(Formatter* format) : format_(format) { + format_->Indent(); + } + ~ScopedIndenter() { format_->Outdent(); } + + private: + Formatter* format_; + }; + + PROTOBUF_NODISCARD ScopedIndenter ScopedIndent() { + return ScopedIndenter(this); + } + template + PROTOBUF_NODISCARD ScopedIndenter ScopedIndent(const char* format, + const Args&&... args) { + (*this)(format, static_cast(args)...); + return ScopedIndenter(this); + } + class PROTOC_EXPORT SaveState { public: explicit SaveState(Formatter* format) @@ -700,8 +800,8 @@ class PROTOC_EXPORT Formatter { std::vector path; descriptor->GetLocationPath(&path); GeneratedCodeInfo::Annotation annotation; - for (int i = 0; i < path.size(); ++i) { - annotation.add_path(path[i]); + for (int index : path) { + annotation.add_path(index); } annotation.set_source_file(descriptor->file()->name()); return annotation.SerializeAsString(); @@ -733,21 +833,22 @@ class PROTOC_EXPORT NamespaceOpener { void ChangeTo(const std::string& name) { std::vector new_stack_ = Split(name, "::", true); - int len = std::min(name_stack_.size(), new_stack_.size()); - int common_idx = 0; + size_t len = std::min(name_stack_.size(), new_stack_.size()); + size_t common_idx = 0; while (common_idx < len) { if (name_stack_[common_idx] != new_stack_[common_idx]) break; common_idx++; } - for (int i = name_stack_.size() - 1; i >= common_idx; i--) { - if (name_stack_[i] == "PROTOBUF_NAMESPACE_ID") { + for (auto it = name_stack_.crbegin(); + it != name_stack_.crend() - common_idx; ++it) { + if (*it == "PROTOBUF_NAMESPACE_ID") { printer_->Print("PROTOBUF_NAMESPACE_CLOSE\n"); } else { - printer_->Print("} // namespace $ns$\n", "ns", name_stack_[i]); + printer_->Print("} // namespace $ns$\n", "ns", *it); } } name_stack_.swap(new_stack_); - for (int i = common_idx; i < name_stack_.size(); i++) { + for (size_t i = common_idx; i < name_stack_.size(); ++i) { if (name_stack_[i] == "PROTOBUF_NAMESPACE_ID") { printer_->Print("PROTOBUF_NAMESPACE_OPEN\n"); } else { @@ -761,10 +862,10 @@ class PROTOC_EXPORT NamespaceOpener { std::vector name_stack_; }; -enum Utf8CheckMode { - STRICT = 0, // Parsing will fail if non UTF-8 data is in string fields. - VERIFY = 1, // Only log an error but parsing will succeed. - NONE = 2, // No UTF-8 check. +enum class Utf8CheckMode { + kStrict = 0, // Parsing will fail if non UTF-8 data is in string fields. + kVerify = 1, // Only log an error but parsing will succeed. + kNone = 2, // No UTF-8 check. }; Utf8CheckMode GetUtf8CheckMode(const FieldDescriptor* field, @@ -843,17 +944,23 @@ struct OneOfRangeImpl { }; Iterator begin() const { return {0, descriptor}; } - Iterator end() const { return {descriptor->oneof_decl_count(), descriptor}; } + Iterator end() const { + return {descriptor->real_oneof_decl_count(), descriptor}; + } const Descriptor* descriptor; }; inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; } -void GenerateParserLoop(const Descriptor* descriptor, int num_hasbits, - const Options& options, - MessageSCCAnalyzer* scc_analyzer, io::Printer* printer); +PROTOC_EXPORT std::string StripProto(const std::string& filename); + +bool EnableMessageOwnedArena(const Descriptor* desc); +bool ShouldVerify(const Descriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer); +bool ShouldVerify(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer); } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.cc similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.cc index bea315e95..130e90ebb 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -29,6 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include + #include #include #include @@ -80,18 +81,14 @@ void SetMessageVariables(const FieldDescriptor* descriptor, } else { (*variables)["lite"] = "Lite"; } - - if (!IsProto3Field(descriptor) && val->type() == FieldDescriptor::TYPE_ENUM) { - const EnumValueDescriptor* default_value = val->default_value_enum(); - (*variables)["default_enum_value"] = Int32ToString(default_value->number()); - } else { - (*variables)["default_enum_value"] = "0"; - } } MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : FieldGenerator(descriptor, options) { + const Options& options, + MessageSCCAnalyzer* scc_analyzer) + : FieldGenerator(descriptor, options), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, &variables_, options); } @@ -104,8 +101,8 @@ void MapFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { " $map_classname$,\n" " $key_cpp$, $val_cpp$,\n" " ::$proto_ns$::internal::WireFormatLite::$key_wire_type$,\n" - " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$,\n" - " $default_enum_value$ > $name$_;\n"); + " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$> " + "$name$_;\n"); } void MapFieldGenerator::GenerateAccessorDeclarations( @@ -135,7 +132,7 @@ void MapFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline const ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >&\n" "$classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_map:$full_name$)\n" " return _internal_$name$();\n" "}\n" @@ -145,7 +142,7 @@ void MapFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline ::$proto_ns$::Map< $key_cpp$, $val_cpp$ >*\n" "$classname$::mutable_$name$() {\n" - "$annotate_accessor$" + "$annotate_mutable$" " // @@protoc_insertion_point(field_mutable_map:$full_name$)\n" " return _internal_mutable_$name$();\n" "}\n"); @@ -163,7 +160,7 @@ void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) const { void MapFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { Formatter format(printer, variables_); - format("$name$_.Swap(&other->$name$_);\n"); + format("$name$_.InternalSwap(&other->$name$_);\n"); } void MapFieldGenerator::GenerateCopyConstructorCode( @@ -235,7 +232,10 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizesToArray( if (utf8_check) { format( "struct Utf8Check {\n" - " static void Check(ConstPtr p) {\n"); + " static void Check(ConstPtr p) {\n" + // p may be unused when GetUtf8CheckMode evaluates to kNone, + // thus disabling the validation. + " (void)p;\n"); format.Indent(); format.Indent(); if (string_key) { @@ -296,6 +296,38 @@ void MapFieldGenerator::GenerateByteSize(io::Printer* printer) const { "}\n"); } +void MapFieldGenerator::GenerateIsInitialized(io::Printer* printer) const { + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (!::$proto_ns$::internal::AllAreInitialized($name$_)) return " + "false;\n"); +} + +void MapFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + if (HasDescriptorMethods(descriptor_->file(), options_)) { + format("$name$_(::$proto_ns$::internal::ConstantInitialized{})"); + } else { + format("$name$_()"); + } +} + +bool MapFieldGenerator::GenerateArenaDestructorCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + if (HasDescriptorMethods(descriptor_->file(), options_)) { + // _this is the object being destructed (we are inside a static method + // here). + format("_this->$name$_. ~MapField();\n"); + return true; + } else { + return false; + } +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.h similarity index 69% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.h index e0c14f3ce..c01ae498b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_map_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_map_field.h @@ -34,6 +34,7 @@ #include #include +#include #include namespace google { @@ -43,22 +44,29 @@ namespace cpp { class MapFieldGenerator : public FieldGenerator { public: - MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - ~MapFieldGenerator(); + MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer); + ~MapFieldGenerator() override; // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const {} - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override {} + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; + bool GenerateArenaDestructorCode(io::Printer* printer) const override; private: + const bool has_required_fields_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.cc similarity index 59% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.cc index b88c1f7e5..70d8a57e3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -35,20 +35,25 @@ #include #include +#include +#include #include #include #include #include #include +#include #include #include #include #include #include +#include #include #include #include +#include #include #include #include @@ -58,6 +63,9 @@ #include +// Must be included last. +#include + namespace google { namespace protobuf { namespace compiler { @@ -68,14 +76,40 @@ using internal::WireFormatLite; namespace { +static constexpr int kNoHasbit = -1; + +// Create an expression that evaluates to +// "for all i, (_has_bits_[i] & masks[i]) == masks[i]" +// masks is allowed to be shorter than _has_bits_, but at least one element of +// masks must be non-zero. +std::string ConditionalToCheckBitmasks( + const std::vector& masks, bool return_success = true, + StringPiece has_bits_var = "_has_bits_") { + std::vector parts; + for (int i = 0; i < masks.size(); i++) { + if (masks[i] == 0) continue; + std::string m = StrCat("0x", strings::Hex(masks[i], strings::ZERO_PAD_8)); + // Each xor evaluates to 0 if the expected bits are present. + parts.push_back( + StrCat("((", has_bits_var, "[", i, "] & ", m, ") ^ ", m, ")")); + } + GOOGLE_CHECK(!parts.empty()); + // If we have multiple parts, each expected to be 0, then bitwise-or them. + std::string result = + parts.size() == 1 + ? parts[0] + : StrCat("(", Join(parts, "\n | "), ")"); + return result + (return_success ? " == 0" : " != 0"); +} + void PrintPresenceCheck(const Formatter& format, const FieldDescriptor* field, const std::vector& has_bit_indices, - io::Printer* printer, int* cached_has_bit_index) { + io::Printer* printer, int* cached_has_word_index) { if (!field->options().weak()) { int has_bit_index = has_bit_indices[field->index()]; - if (*cached_has_bit_index != (has_bit_index / 32)) { - *cached_has_bit_index = (has_bit_index / 32); - format("cached_has_bits = _has_bits_[$1$];\n", *cached_has_bit_index); + if (*cached_has_word_index != (has_bit_index / 32)) { + *cached_has_word_index = (has_bit_index / 32); + format("cached_has_bits = _has_bits_[$1$];\n", *cached_has_word_index); } const std::string mask = StrCat(strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); @@ -132,26 +166,59 @@ bool IsPOD(const FieldDescriptor* field) { } } -// Helper for the code that emits the SharedCtor() method. -bool CanConstructByZeroing(const FieldDescriptor* field, - const Options& options) { +// Helper for the code that emits the SharedCtor() and InternalSwap() methods. +// Anything that is a POD or a "normal" message (represented by a pointer) can +// be manipulated as raw bytes. +bool CanBeManipulatedAsRawBytes(const FieldDescriptor* field, + const Options& options, + MessageSCCAnalyzer* scc_analyzer) { bool ret = CanInitializeByZeroing(field); // Non-repeated, non-lazy message fields are simply raw pointers, so we can - // use memset to initialize these in SharedCtor. We cannot use this in - // Clear, as we need to potentially delete the existing value. - ret = ret || (!field->is_repeated() && !IsLazy(field, options) && - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE); + // swap them or use memset to initialize these in SharedCtor. We cannot use + // this in Clear, as we need to potentially delete the existing value. + ret = + ret || (!field->is_repeated() && !IsLazy(field, options, scc_analyzer) && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE); return ret; } +bool StrContains(const std::string& haystack, const std::string& needle) { + return haystack.find(needle) != std::string::npos; +} + +// Finds runs of fields for which `predicate` is true. +// RunMap maps from fields that start each run to the number of fields in that +// run. This is optimized for the common case that there are very few runs in +// a message and that most of the eligible fields appear together. +using RunMap = std::unordered_map; +RunMap FindRuns(const std::vector& fields, + const std::function& predicate) { + RunMap runs; + const FieldDescriptor* last_start = nullptr; + + for (auto field : fields) { + if (predicate(field)) { + if (last_start == nullptr) { + last_start = field; + } + + runs[last_start]++; + } else { + last_start = nullptr; + } + } + return runs; +} + // Emits an if-statement with a condition that evaluates to true if |field| is // considered non-default (will be sent over the wire), for message types // without true field presence. Should only be called if -// !HasFieldPresence(message_descriptor). +// !HasHasbit(field). bool EmitFieldNonDefaultCondition(io::Printer* printer, const std::string& prefix, const FieldDescriptor* field) { + GOOGLE_CHECK(!HasHasbit(field)); Formatter format(printer); format.Set("prefix", prefix); format.Set("name", FieldName(field)); @@ -159,20 +226,32 @@ bool EmitFieldNonDefaultCondition(io::Printer* printer, // if non-zero (numeric) or non-empty (string). if (!field->is_repeated() && !field->containing_oneof()) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { - format("if ($prefix$$name$().size() > 0) {\n"); + format("if (!$prefix$_internal_$name$().empty()) {\n"); } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // Message fields still have has_$name$() methods. - format("if ($prefix$has_$name$()) {\n"); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE || - field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) { - // Handle float comparison to prevent -Wfloat-equal warnings - format("if (!($prefix$$name$() <= 0 && $prefix$$name$() >= 0)) {\n"); + format("if ($prefix$_internal_has_$name$()) {\n"); + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) { + format( + "static_assert(sizeof(uint32_t) == sizeof(float), \"Code assumes " + "uint32_t and float are the same size.\");\n" + "float tmp_$name$ = $prefix$_internal_$name$();\n" + "uint32_t raw_$name$;\n" + "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n" + "if (raw_$name$ != 0) {\n"); + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE) { + format( + "static_assert(sizeof(uint64_t) == sizeof(double), \"Code assumes " + "uint64_t and double are the same size.\");\n" + "double tmp_$name$ = $prefix$_internal_$name$();\n" + "uint64_t raw_$name$;\n" + "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n" + "if (raw_$name$ != 0) {\n"); } else { - format("if ($prefix$$name$() != 0) {\n"); + format("if ($prefix$_internal_$name$() != 0) {\n"); } format.Indent(); return true; - } else if (field->containing_oneof()) { + } else if (field->real_containing_oneof()) { format("if (_internal_has_$name$()) {\n"); format.Indent(); return true; @@ -182,13 +261,14 @@ bool EmitFieldNonDefaultCondition(io::Printer* printer, // Does the given field have a has_$name$() method? bool HasHasMethod(const FieldDescriptor* field) { - if (HasFieldPresence(field->file())) { + if (!IsProto3(field->file())) { // In proto1/proto2, every field has a has_$name$() method. return true; } // For message types without true field presence, only fields with a message - // type have a has_$name$() method. - return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; + // type or inside an one-of have a has_$name$() method. + return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || + field->has_optional_keyword() || field->real_containing_oneof(); } // Collects map entry message type information. @@ -213,13 +293,6 @@ void CollectMapInfo(const Options& options, const Descriptor* descriptor, "TYPE_" + ToUpper(DeclaredTypeMethodName(key->type())); vars["val_wire_type"] = "TYPE_" + ToUpper(DeclaredTypeMethodName(val->type())); - if (descriptor->file()->syntax() != FileDescriptor::SYNTAX_PROTO3 && - val->type() == FieldDescriptor::TYPE_ENUM) { - const EnumValueDescriptor* default_value = val->default_value_enum(); - vars["default_enum_value"] = Int32ToString(default_value->number()); - } else { - vars["default_enum_value"] = "0"; - } } // Does the given field have a private (internal helper only) has_$name$() @@ -227,50 +300,32 @@ void CollectMapInfo(const Options& options, const Descriptor* descriptor, bool HasPrivateHasMethod(const FieldDescriptor* field) { // Only for oneofs in message types with no field presence. has_$name$(), // based on the oneof case, is still useful internally for generated code. - return (!HasFieldPresence(field->file()) && - field->containing_oneof() != NULL); + return IsProto3(field->file()) && field->real_containing_oneof(); } // TODO(ckennelly): Cull these exclusions if/when these protos do not have -// their methods overriden by subclasses. +// their methods overridden by subclasses. bool ShouldMarkClassAsFinal(const Descriptor* descriptor, const Options& options) { - return false; -} - -bool ShouldMarkClearAsFinal(const Descriptor* descriptor, - const Options& options) { - static std::set exclusions{ - }; - - const std::string name = ClassName(descriptor, true); - return exclusions.find(name) == exclusions.end() || - options.opensource_runtime; -} - -bool ShouldMarkIsInitializedAsFinal(const Descriptor* descriptor, - const Options& options) { - static std::set exclusions{ - }; - - const std::string name = ClassName(descriptor, true); - return exclusions.find(name) == exclusions.end() || - options.opensource_runtime; + return true; } -bool ShouldMarkNewAsFinal(const Descriptor* descriptor, - const Options& options) { - static std::set exclusions{ - }; - const std::string name = ClassName(descriptor, true); - return exclusions.find(name) == exclusions.end() || - options.opensource_runtime; +// Returns true to make the message serialize in order, decided by the following +// factors in the order of precedence. +// --options().message_set_wire_format() == true +// --the message is in the allowlist (true) +// --GOOGLE_PROTOBUF_SHUFFLE_SERIALIZE is defined (false) +// --a ranage of message names that are allowed to stay in order (true) +bool ShouldSerializeInOrder(const Descriptor* descriptor, + const Options& options) { + return true; } bool TableDrivenParsingEnabled(const Descriptor* descriptor, - const Options& options) { + const Options& options, + MessageSCCAnalyzer* scc_analyzer) { if (!options.table_driven_parsing) { return false; } @@ -278,10 +333,16 @@ bool TableDrivenParsingEnabled(const Descriptor* descriptor, // Consider table-driven parsing. We only do this if: // - We have has_bits for fields. This avoids a check on every field we set // when are present (the common case). - if (!HasFieldPresence(descriptor->file())) { - return false; + bool has_hasbit = false; + for (int i = 0; i < descriptor->field_count(); i++) { + if (HasHasbit(descriptor->field(i))) { + has_hasbit = true; + break; + } } + if (!has_hasbit) return false; + const double table_sparseness = 0.5; int max_field_number = 0; for (auto field : FieldRange(descriptor)) { @@ -295,7 +356,7 @@ bool TableDrivenParsingEnabled(const Descriptor* descriptor, } // - There are no lazy fields (they require the non-lite library). - if (IsLazy(field, options)) { + if (IsLazy(field, options, scc_analyzer)) { return false; } } @@ -320,23 +381,6 @@ bool TableDrivenParsingEnabled(const Descriptor* descriptor, return true; } -void SetUnknkownFieldsVariable(const Descriptor* descriptor, - const Options& options, - std::map* variables) { - std::string proto_ns = ProtobufNamespace(options); - if (UseUnknownFieldSet(descriptor->file(), options)) { - (*variables)["unknown_fields_type"] = "::" + proto_ns + "::UnknownFieldSet"; - } else { - (*variables)["unknown_fields_type"] = - PrimitiveTypeName(options, FieldDescriptor::CPPTYPE_STRING); - } - (*variables)["have_unknown_fields"] = - "_internal_metadata_.have_unknown_fields()"; - (*variables)["unknown_fields"] = "_internal_metadata_.unknown_fields()"; - (*variables)["mutable_unknown_fields"] = - "_internal_metadata_.mutable_unknown_fields()"; -} - bool IsCrossFileMapField(const FieldDescriptor* field) { if (!field->is_map()) { return false; @@ -360,59 +404,15 @@ bool IsRequired(const std::vector& v) { return v.front()->is_required(); } -// Allows chunking repeated fields together and non-repeated fields if the -// fields share the same has_byte index. -// TODO(seongkim): use lambda with capture instead of functor. -class MatchRepeatedAndHasByte { - public: - MatchRepeatedAndHasByte(const std::vector* has_bit_indices, - bool has_field_presence) - : has_bit_indices_(*has_bit_indices), - has_field_presence_(has_field_presence) {} - - // Returns true if the following conditions are met: - // --both fields are repeated fields - // --both fields are non-repeated fields with either has_field_presence is - // false or have the same has_byte index. - bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const { - return a->is_repeated() == b->is_repeated() && - (!has_field_presence_ || a->is_repeated() || - has_bit_indices_[a->index()] / 8 == - has_bit_indices_[b->index()] / 8); - } - - private: - const std::vector& has_bit_indices_; - const bool has_field_presence_; -}; - -// Allows chunking required fields separately after chunking with -// MatchRepeatedAndHasByte. -class MatchRepeatedAndHasByteAndRequired : public MatchRepeatedAndHasByte { - public: - MatchRepeatedAndHasByteAndRequired(const std::vector* has_bit_indices, - bool has_field_presence) - : MatchRepeatedAndHasByte(has_bit_indices, has_field_presence) {} - - bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const { - return MatchRepeatedAndHasByte::operator()(a, b) && - a->is_required() == b->is_required(); - } -}; - -// Allows chunking zero-initializable fields separately after chunking with -// MatchRepeatedAndHasByte. -class MatchRepeatedAndHasByteAndZeroInits : public MatchRepeatedAndHasByte { - public: - MatchRepeatedAndHasByteAndZeroInits(const std::vector* has_bit_indices, - bool has_field_presence) - : MatchRepeatedAndHasByte(has_bit_indices, has_field_presence) {} - - bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const { - return MatchRepeatedAndHasByte::operator()(a, b) && - CanInitializeByZeroing(a) == CanInitializeByZeroing(b); +bool HasSingularString(const Descriptor* desc, const Options& options) { + for (const auto* field : FieldRange(desc)) { + if (IsString(field, options) && !IsStringInlined(field, options) && + !field->is_repeated() && !field->real_containing_oneof()) { + return true; + } } -}; + return false; +} // Collects neighboring fields based on a given criteria (equivalent predicate). template @@ -420,22 +420,11 @@ std::vector> CollectFields( const std::vector& fields, const Predicate& equivalent) { std::vector> chunks; - if (fields.empty()) { - return chunks; - } - - const FieldDescriptor* last_field = fields.front(); - std::vector chunk; for (auto field : fields) { - if (!equivalent(last_field, field) && !chunk.empty()) { - chunks.push_back(chunk); - chunk.clear(); + if (chunks.empty() || !equivalent(chunks.back().back(), field)) { + chunks.emplace_back(); } - chunk.push_back(field); - last_field = field; - } - if (!chunk.empty()) { - chunks.push_back(chunk); + chunks.back().push_back(field); } return chunks; } @@ -443,23 +432,23 @@ std::vector> CollectFields( // Returns a bit mask based on has_bit index of "fields" that are typically on // the same chunk. It is used in a group presence check where _has_bits_ is // masked to tell if any thing in "fields" is present. -uint32 GenChunkMask(const std::vector& fields, - const std::vector& has_bit_indices) { +uint32_t GenChunkMask(const std::vector& fields, + const std::vector& has_bit_indices) { GOOGLE_CHECK(!fields.empty()); int first_index_offset = has_bit_indices[fields.front()->index()] / 32; - uint32 chunk_mask = 0; + uint32_t chunk_mask = 0; for (auto field : fields) { // "index" defines where in the _has_bits_ the field appears. int index = has_bit_indices[field->index()]; GOOGLE_CHECK_EQ(first_index_offset, index / 32); - chunk_mask |= static_cast(1) << (index % 32); + chunk_mask |= static_cast(1) << (index % 32); } GOOGLE_CHECK_NE(0, chunk_mask); return chunk_mask; } // Return the number of bits set in n, a non-negative integer. -static int popcnt(uint32 n) { +static int popcnt(uint32_t n) { int result = 0; while (n != 0) { result += (n & 1); @@ -475,20 +464,18 @@ class ColdChunkSkipper { ColdChunkSkipper( const Options& options, const std::vector>& chunks, - const std::vector& has_bit_indices, const double cold_threshold, - bool has_field_presence) + const std::vector& has_bit_indices, const double cold_threshold) : chunks_(chunks), has_bit_indices_(has_bit_indices), access_info_map_(options.access_info_map), - cold_threshold_(cold_threshold), - has_field_presence_(has_field_presence) { + cold_threshold_(cold_threshold) { SetCommonVars(options, &variables_); } // May open an external if check for a batch of cold fields. "from" is the // prefix to _has_bits_ to allow MergeFrom to use "from._has_bits_". // Otherwise, it should be "". - void OnStartChunk(int chunk, int cached_has_bit_index, + void OnStartChunk(int chunk, int cached_has_word_index, const std::string& from, io::Printer* printer); bool OnEndChunk(int chunk, io::Printer* printer); @@ -505,7 +492,6 @@ class ColdChunkSkipper { const double cold_threshold_; std::map variables_; int limit_chunk_ = -1; - bool has_field_presence_; }; // Tuning parameters for ColdChunkSkipper. @@ -518,11 +504,11 @@ bool ColdChunkSkipper::IsColdChunk(int chunk) { } -void ColdChunkSkipper::OnStartChunk(int chunk, int cached_has_bit_index, +void ColdChunkSkipper::OnStartChunk(int chunk, int cached_has_word_index, const std::string& from, io::Printer* printer) { Formatter format(printer, variables_); - if (!access_info_map_ || !has_field_presence_) { + if (!access_info_map_) { return; } else if (chunk < limit_chunk_) { // We are already inside a run of cold chunks. @@ -548,7 +534,7 @@ void ColdChunkSkipper::OnStartChunk(int chunk, int cached_has_bit_index, format("if (PROTOBUF_PREDICT_FALSE("); int first_word = HasbitWord(chunk, 0); while (chunk < limit_chunk_) { - uint32 mask = 0; + uint32_t mask = 0; int this_word = HasbitWord(chunk, 0); // Generate mask for chunks on the same word. for (; chunk < limit_chunk_ && HasbitWord(chunk, 0) == this_word; chunk++) { @@ -564,7 +550,7 @@ void ColdChunkSkipper::OnStartChunk(int chunk, int cached_has_bit_index, format(" ||\n "); } format.Set("mask", strings::Hex(mask, strings::ZERO_PAD_8)); - if (this_word == cached_has_bit_index) { + if (this_word == cached_has_word_index) { format("(cached_has_bits & 0x$mask$u) != 0"); } else { format("($1$_has_bits_[$2$] & 0x$mask$u) != 0", from, this_word); @@ -584,6 +570,88 @@ bool ColdChunkSkipper::OnEndChunk(int chunk, io::Printer* printer) { return true; } +void MaySetAnnotationVariable(const Options& options, + StringPiece annotation_name, + StringPiece injector_template_prefix, + StringPiece injector_template_suffix, + std::map* variables) { + if (options.field_listener_options.forbidden_field_listener_events.count( + std::string(annotation_name))) + return; + (*variables)[StrCat("annotate_", annotation_name)] = strings::Substitute( + StrCat(injector_template_prefix, injector_template_suffix), + (*variables)["classtype"]); +} + +void GenerateExtensionAnnotations( + const Descriptor* descriptor, const Options& options, + std::map* variables) { + const std::map accessor_annotations_to_hooks = { + {"annotate_extension_has", "OnHasExtension"}, + {"annotate_extension_clear", "OnClearExtension"}, + {"annotate_extension_repeated_size", "OnExtensionSize"}, + {"annotate_extension_get", "OnGetExtension"}, + {"annotate_extension_mutable", "OnMutableExtension"}, + {"annotate_extension_set", "OnSetExtension"}, + {"annotate_extension_release", "OnReleaseExtension"}, + {"annotate_repeated_extension_get", "OnGetExtension"}, + {"annotate_repeated_extension_mutable", "OnMutableExtension"}, + {"annotate_repeated_extension_set", "OnSetExtension"}, + {"annotate_repeated_extension_add", "OnAddExtension"}, + {"annotate_repeated_extension_add_mutable", "OnAddMutableExtension"}, + {"annotate_repeated_extension_list", "OnListExtension"}, + {"annotate_repeated_extension_list_mutable", "OnMutableListExtension"}, + }; + for (const auto& annotation : accessor_annotations_to_hooks) { + (*variables)[annotation.first] = ""; + } + if (!options.field_listener_options.inject_field_listener_events || + descriptor->file()->options().optimize_for() == + google::protobuf::FileOptions::LITE_RUNTIME) { + return; + } + for (const auto& annotation : accessor_annotations_to_hooks) { + const std::string& annotation_name = annotation.first; + const std::string& listener_call = annotation.second; + if (!StrContains(annotation_name, "repeated") && + !StrContains(annotation_name, "size") && + !StrContains(annotation_name, "clear")) { + // Primitive fields accessors. + // "Has" is here as users calling "has" on a repeated field is a mistake. + (*variables)[annotation_name] = StrCat( + " _tracker_.", listener_call, + "(this, id.number(), _proto_TypeTraits::GetPtr(id.number(), " + "_extensions_, id.default_value_ref()));"); + } else if (StrContains(annotation_name, "repeated") && + !StrContains(annotation_name, "list") && + !StrContains(annotation_name, "size")) { + // Repeated index accessors. + std::string str_index = "index"; + if (StrContains(annotation_name, "add")) { + str_index = "_extensions_.ExtensionSize(id.number()) - 1"; + } + (*variables)[annotation_name] = + StrCat(" _tracker_.", listener_call, + "(this, id.number(), " + "_proto_TypeTraits::GetPtr(id.number(), _extensions_, ", + str_index, "));"); + } else if (StrContains(annotation_name, "list") || + StrContains(annotation_name, "size")) { + // Repeated full accessors. + (*variables)[annotation_name] = StrCat( + " _tracker_.", listener_call, + "(this, id.number(), _proto_TypeTraits::GetRepeatedPtr(id.number(), " + "_extensions_));"); + } else { + // Generic accessors such as "clear". + // TODO(b/190614678): Generalize clear from both repeated and non repeated + // calls, currently their underlying memory interfaces are very different. + // Or think of removing clear callback as no usages are needed and no + // memory exist after calling clear(). + } + } +} + } // anonymous namespace // =================================================================== @@ -598,6 +666,7 @@ MessageGenerator::MessageGenerator( options_(options), field_generators_(descriptor, options, scc_analyzer), max_has_bit_index_(0), + max_inlined_string_index_(0), num_weak_fields_(0), scc_analyzer_(scc_analyzer), variables_(vars) { @@ -608,37 +677,80 @@ MessageGenerator::MessageGenerator( // Variables that apply to this class variables_["classname"] = classname_; variables_["classtype"] = QualifiedClassName(descriptor_, options); - variables_["scc_info"] = - SccInfoSymbol(scc_analyzer_->GetSCC(descriptor_), options_); variables_["full_name"] = descriptor_->full_name(); variables_["superclass"] = SuperClassName(descriptor_, options_); + variables_["annotate_serialize"] = ""; + variables_["annotate_deserialize"] = ""; + variables_["annotate_reflection"] = ""; + variables_["annotate_bytesize"] = ""; + variables_["annotate_mergefrom"] = ""; + + if (options.field_listener_options.inject_field_listener_events && + descriptor->file()->options().optimize_for() != + google::protobuf::FileOptions::LITE_RUNTIME) { + const std::string injector_template = " _tracker_."; + + MaySetAnnotationVariable(options, "serialize", injector_template, + "OnSerialize(this);\n", &variables_); + MaySetAnnotationVariable(options, "deserialize", injector_template, + "OnDeserialize(this);\n", &variables_); + // TODO(danilak): Ideally annotate_reflection should not exist and we need + // to annotate all reflective calls on our own, however, as this is a cause + // for side effects, i.e. reading values dynamically, we want the users know + // that dynamic access can happen. + MaySetAnnotationVariable(options, "reflection", injector_template, + "OnGetMetadata();\n", &variables_); + MaySetAnnotationVariable(options, "bytesize", injector_template, + "OnByteSize(this);\n", &variables_); + MaySetAnnotationVariable(options, "mergefrom", injector_template, + "OnMergeFrom(this, &from);\n", &variables_); + } + + GenerateExtensionAnnotations(descriptor_, options_, &variables_); + + SetUnknownFieldsVariable(descriptor_, options_, &variables_); // Compute optimized field order to be used for layout and initialization // purposes. for (auto field : FieldRange(descriptor_)) { + if (IsFieldStripped(field, options_)) { + continue; + } + if (IsWeak(field, options_)) { num_weak_fields_++; - } else if (!field->containing_oneof()) { + } else if (!field->real_containing_oneof()) { optimized_order_.push_back(field); } } - message_layout_helper_->OptimizeLayout(&optimized_order_, options_); + message_layout_helper_->OptimizeLayout(&optimized_order_, options_, + scc_analyzer_); - if (HasFieldPresence(descriptor_->file())) { - // We use -1 as a sentinel. - has_bit_indices_.resize(descriptor_->field_count(), -1); - for (auto field : optimized_order_) { - // Skip fields that do not have has bits. - if (field->is_repeated()) { - continue; + // This message has hasbits iff one or more fields need one. + for (auto field : optimized_order_) { + if (HasHasbit(field)) { + if (has_bit_indices_.empty()) { + has_bit_indices_.resize(descriptor_->field_count(), kNoHasbit); } - has_bit_indices_[field->index()] = max_has_bit_index_++; } + if (IsStringInlined(field, options_)) { + if (inlined_string_indices_.empty()) { + inlined_string_indices_.resize(descriptor_->field_count(), kNoHasbit); + } + inlined_string_indices_[field->index()] = max_inlined_string_index_++; + } + } + + if (!has_bit_indices_.empty()) { field_generators_.SetHasBitIndices(has_bit_indices_); } + if (!inlined_string_indices_.empty()) { + field_generators_.SetInlinedStringIndices(inlined_string_indices_); + } + num_required_fields_ = 0; for (int i = 0; i < descriptor->field_count(); i++) { if (descriptor->field(i)->is_required()) { @@ -646,22 +758,36 @@ MessageGenerator::MessageGenerator( } } - table_driven_ = TableDrivenParsingEnabled(descriptor_, options_); + table_driven_ = + TableDrivenParsingEnabled(descriptor_, options_, scc_analyzer_); + parse_function_generator_.reset(new ParseFunctionGenerator( + descriptor_, max_has_bit_index_, has_bit_indices_, + inlined_string_indices_, options_, scc_analyzer_, variables_)); } MessageGenerator::~MessageGenerator() = default; size_t MessageGenerator::HasBitsSize() const { - size_t sizeof_has_bits = (max_has_bit_index_ + 31) / 32 * 4; - if (sizeof_has_bits == 0) { - // Zero-size arrays aren't technically allowed, and MSVC in particular - // doesn't like them. We still need to declare these arrays to make - // other code compile. Since this is an uncommon case, we'll just declare - // them with size 1 and waste some space. Oh well. - sizeof_has_bits = 4; - } + return (max_has_bit_index_ + 31) / 32; +} + +size_t MessageGenerator::InlinedStringDonatedSize() const { + return (max_inlined_string_index_ + 31) / 32; +} + +int MessageGenerator::HasBitIndex(const FieldDescriptor* field) const { + return has_bit_indices_.empty() ? kNoHasbit + : has_bit_indices_[field->index()]; +} + +int MessageGenerator::HasByteIndex(const FieldDescriptor* field) const { + int hasbit = HasBitIndex(field); + return hasbit == kNoHasbit ? kNoHasbit : hasbit / 8; +} - return sizeof_has_bits; +int MessageGenerator::HasWordIndex(const FieldDescriptor* field) const { + int hasbit = HasBitIndex(field); + return hasbit == kNoHasbit ? kNoHasbit : hasbit / 32; } void MessageGenerator::AddGenerators( @@ -673,8 +799,8 @@ void MessageGenerator::AddGenerators( enum_generators_.push_back(enum_generators->back().get()); } for (int i = 0; i < descriptor_->extension_count(); i++) { - extension_generators->emplace_back( - new ExtensionGenerator(descriptor_->extension(i), options_)); + extension_generators->emplace_back(new ExtensionGenerator( + descriptor_->extension(i), options_, scc_analyzer_)); extension_generators_.push_back(extension_generators->back().get()); } } @@ -682,7 +808,7 @@ void MessageGenerator::AddGenerators( void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { Formatter format(printer, variables_); // optimized_fields_ does not contain fields where - // field->containing_oneof() != NULL + // field->real_containing_oneof() // so we need to iterate over those as well. // // We place the non-oneof fields in optimized_order_, as that controls the @@ -694,7 +820,8 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { ordered_fields.insert(ordered_fields.begin(), optimized_order_.begin(), optimized_order_.end()); for (auto field : FieldRange(descriptor_)) { - if (field->containing_oneof() == NULL && !field->options().weak()) { + if (!field->real_containing_oneof() && !field->options().weak() && + !IsFieldStripped(field, options_)) { continue; } ordered_fields.push_back(field); @@ -722,28 +849,35 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { format.AddMap(vars); if (field->is_repeated()) { - format( - "$deprecated_attr$int ${1$$name$_size$}$() const;\n" - "private:\n" - "int ${1$_internal_$name$_size$}$() const;\n" - "public:\n", - field); + format("$deprecated_attr$int ${1$$name$_size$}$() const$2$\n", field, + !IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}"); + if (!IsFieldStripped(field, options_)) { + format( + "private:\n" + "int ${1$_internal_$name$_size$}$() const;\n" + "public:\n", + field); + } } else if (HasHasMethod(field)) { - format( - "$deprecated_attr$bool ${1$has_$name$$}$() const;\n" - "private:\n" - "bool _internal_has_$name$() const;\n" - "public:\n", - field); + format("$deprecated_attr$bool ${1$has_$name$$}$() const$2$\n", field, + !IsFieldStripped(field, options_) ? ";" : " {__builtin_trap();}"); + if (!IsFieldStripped(field, options_)) { + format( + "private:\n" + "bool _internal_has_$name$() const;\n" + "public:\n"); + } } else if (HasPrivateHasMethod(field)) { - format( - "private:\n" - "bool ${1$_internal_has_$name$$}$() const;\n" - "public:\n", - field); + if (!IsFieldStripped(field, options_)) { + format( + "private:\n" + "bool ${1$_internal_has_$name$$}$() const;\n" + "public:\n", + field); + } } - - format("$deprecated_attr$void ${1$clear_$name$$}$();\n", field); + format("$deprecated_attr$void ${1$clear_$name$$}$()$2$\n", field, + !IsFieldStripped(field, options_) ? ";" : "{__builtin_trap();}"); // Generate type-specific accessor declarations. field_generators_.get(field).GenerateAccessorDeclarations(printer); @@ -752,9 +886,206 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { } if (descriptor_->extension_range_count() > 0) { - // Generate accessors for extensions. We just call a macro located in - // extension_set.h since the accessors about 80 lines of static code. - format("$GOOGLE_PROTOBUF$_EXTENSION_ACCESSORS($classname$)\n"); + // Generate accessors for extensions. + // We use "_proto_TypeTraits" as a type name below because "TypeTraits" + // causes problems if the class has a nested message or enum type with that + // name and "_TypeTraits" is technically reserved for the C++ library since + // it starts with an underscore followed by a capital letter. + // + // For similar reason, we use "_field_type" and "_is_packed" as parameter + // names below, so that "field_type" and "is_packed" can be used as field + // names. + format(R"( +template +inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_has$ + return _extensions_.Has(id.number()); +} + +template +inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); +$annotate_extension_clear$ +} + +template +inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_repeated_size$ + return _extensions_.ExtensionSize(id.number()); +} + +template +inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_get$ + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); +} + +template +inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_mutable$ + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); +} + +template +inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); +$annotate_extension_set$ +} + +template +inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); +$annotate_extension_set$ +} +template +inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); +$annotate_extension_set$ +} +template +PROTOBUF_NODISCARD inline + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_release$ + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); +} +template +inline typename _proto_TypeTraits::Singular::MutableType +UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_release$ + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); +} + +template +inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { +$annotate_repeated_extension_get$ + return _proto_TypeTraits::Get(id.number(), _extensions_, index); +} + +template +inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { +$annotate_repeated_extension_mutable$ + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); +} + +template +inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); +$annotate_repeated_extension_set$ +} + +template +inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); +$annotate_repeated_extension_add_mutable$ + return to_add; +} + +template +inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); +$annotate_repeated_extension_add$ +} + +template +inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& +GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_repeated_extension_list$ + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); +} + +template +inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* +MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_repeated_extension_list_mutable$ + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); +} + +)"); // Generate MessageSet specific APIs for proto2 MessageSet. // For testing purposes we don't check for bridge.MessageSet, so // we don't use IsProto2MessageSet @@ -778,19 +1109,23 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { void MessageGenerator::GenerateSingularFieldHasBits( const FieldDescriptor* field, Formatter format) { + if (IsFieldStripped(field, options_)) { + format( + "inline bool $classname$::has_$name$() const { " + "__builtin_trap(); }\n"); + return; + } if (field->options().weak()) { format( "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" + "$annotate_has$" " return _weak_field_map_.Has($number$);\n" "}\n"); return; } - if (HasFieldPresence(descriptor_->file())) { - // N.B.: without field presence, we do not use has-bits or generate - // has_$name$() methods. - int has_bit_index = has_bit_indices_[field->index()]; - GOOGLE_CHECK_GE(has_bit_index, 0); + if (HasHasbit(field)) { + int has_bit_index = HasBitIndex(field); + GOOGLE_CHECK_NE(has_bit_index, kNoHasbit); format.Set("has_array_index", has_bit_index / 32); format.Set("has_mask", @@ -801,7 +1136,7 @@ void MessageGenerator::GenerateSingularFieldHasBits( "(_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n"); if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !IsLazy(field, options_)) { + !IsLazy(field, options_, scc_analyzer_)) { // We maintain the invariant that for a submessage x, has_x() returning // true implies that x_ is not null. By giving this information to the // compiler, we allow it to eliminate unnecessary null checks later on. @@ -812,30 +1147,28 @@ void MessageGenerator::GenerateSingularFieldHasBits( " return value;\n" "}\n" "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" + "$annotate_has$" " return _internal_has_$name$();\n" "}\n"); - } else { + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // Message fields have a has_$name$() method. - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - if (IsLazy(field, options_)) { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return !$name$_.IsCleared();\n" - "}\n"); - } else { - format( - "inline bool $classname$::_internal_has_$name$() const {\n" - " return this != internal_default_instance() " - "&& $name$_ != nullptr;\n" - "}\n"); - } + if (IsLazy(field, options_, scc_analyzer_)) { + format( + "inline bool $classname$::_internal_has_$name$() const {\n" + " return !$name$_.IsCleared();\n" + "}\n"); + } else { format( - "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" - " return _internal_has_$name$();\n" + "inline bool $classname$::_internal_has_$name$() const {\n" + " return this != internal_default_instance() " + "&& $name$_ != nullptr;\n" "}\n"); } + format( + "inline bool $classname$::has_$name$() const {\n" + "$annotate_has$" + " return _internal_has_$name$();\n" + "}\n"); } } @@ -857,6 +1190,17 @@ void MessageGenerator::GenerateOneofHasBits(io::Printer* printer) { void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field, const Formatter& format) { + if (IsFieldStripped(field, options_)) { + if (HasHasMethod(field)) { + format( + "inline bool $classname$::has_$name$() const { " + "__builtin_trap(); }\n"); + } + format( + "inline void $classname$::set_has_$name$() { __builtin_trap(); " + "}\n"); + return; + } // Singular field in a oneof // N.B.: Without field presence, we do not use has-bits or generate // has_$name$() methods, but oneofs still have set_has_$name$(). @@ -872,7 +1216,7 @@ void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field, " return $oneof_name$_case() == k$field_name$;\n" "}\n" "inline bool $classname$::has_$name$() const {\n" - "$annotate_accessor$" + "$annotate_has$" " return _internal_has_$name$();\n" "}\n"); } else if (HasPrivateHasMethod(field)) { @@ -891,17 +1235,20 @@ void MessageGenerator::GenerateOneofMemberHasBits(const FieldDescriptor* field, void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field, bool is_inline, Formatter format) { + if (IsFieldStripped(field, options_)) { + format("void $classname$::clear_$name$() { __builtin_trap(); }\n"); + return; + } + // Generate clear_$name$(). if (is_inline) { format("inline "); } - format( - "void $classname$::clear_$name$() {\n" - "$annotate_accessor$"); + format("void $classname$::clear_$name$() {\n"); format.Indent(); - if (field->containing_oneof()) { + if (field->real_containing_oneof()) { // Clear this field only if it is the active field in this oneof, // otherwise ignore format("if (_internal_has_$name$()) {\n"); @@ -912,19 +1259,15 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field, format("}\n"); } else { field_generators_.get(field).GenerateClearingCode(format.printer()); - if (HasFieldPresence(descriptor_->file())) { - if (!field->is_repeated() && !field->options().weak()) { - int has_bit_index = has_bit_indices_[field->index()]; - GOOGLE_CHECK_GE(has_bit_index, 0); - - format.Set("has_array_index", has_bit_index / 32); - format.Set("has_mask", - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); - format("_has_bits_[$has_array_index$] &= ~0x$has_mask$u;\n"); - } + if (HasHasbit(field)) { + int has_bit_index = HasBitIndex(field); + format.Set("has_array_index", has_bit_index / 32); + format.Set("has_mask", + strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); + format("_has_bits_[$has_array_index$] &= ~0x$has_mask$u;\n"); } } - + format("$annotate_clear$"); format.Outdent(); format("}\n"); } @@ -936,6 +1279,10 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) { for (auto field : FieldRange(descriptor_)) { PrintFieldComment(format, field); + if (IsFieldStripped(field, options_)) { + continue; + } + std::map vars; SetCommonFieldVariables(field, &vars, options_); @@ -944,19 +1291,25 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) { // Generate has_$name$() or $name$_size(). if (field->is_repeated()) { - format( - "inline int $classname$::_internal_$name$_size() const {\n" - " return $name$_$1$.size();\n" - "}\n" - "inline int $classname$::$name$_size() const {\n" - "$annotate_accessor$" - " return _internal_$name$_size();\n" - "}\n", - IsImplicitWeakField(field, options_, scc_analyzer_) && - field->message_type() - ? ".weak" - : ""); - } else if (field->containing_oneof()) { + if (IsFieldStripped(field, options_)) { + format( + "inline int $classname$::$name$_size() const { " + "__builtin_trap(); }\n"); + } else { + format( + "inline int $classname$::_internal_$name$_size() const {\n" + " return $name$_$1$.size();\n" + "}\n" + "inline int $classname$::$name$_size() const {\n" + "$annotate_size$" + " return _internal_$name$_size();\n" + "}\n", + IsImplicitWeakField(field, options_, scc_analyzer_) && + field->message_type() + ? ".weak" + : ""); + } + } else if (field->real_containing_oneof()) { format.Set("field_name", UnderscoresToCamelCase(field->name(), true)); format.Set("oneof_name", field->containing_oneof()->name()); format.Set("oneof_index", @@ -972,7 +1325,9 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) { } // Generate type-specific accessors. - field_generators_.get(field).GenerateInlineAccessorDefinitions(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateInlineAccessorDefinitions(printer); + } format("\n"); } @@ -997,24 +1352,25 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "::$proto_ns$::internal::MapEntry$lite$<$classname$, \n" " $key_cpp$, $val_cpp$,\n" " ::$proto_ns$::internal::WireFormatLite::$key_wire_type$,\n" - " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$,\n" - " $default_enum_value$ > {\n" + " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$> {\n" "public:\n" " typedef ::$proto_ns$::internal::MapEntry$lite$<$classname$, \n" " $key_cpp$, $val_cpp$,\n" " ::$proto_ns$::internal::WireFormatLite::$key_wire_type$,\n" - " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$,\n" - " $default_enum_value$ > SuperType;\n" + " ::$proto_ns$::internal::WireFormatLite::$val_wire_type$> " + "SuperType;\n" " $classname$();\n" - " $classname$(::$proto_ns$::Arena* arena);\n" + " explicit constexpr $classname$(\n" + " ::$proto_ns$::internal::ConstantInitialized);\n" + " explicit $classname$(::$proto_ns$::Arena* arena);\n" " void MergeFrom(const $classname$& other);\n" " static const $classname$* internal_default_instance() { return " "reinterpret_cast(&_$classname$_default_instance_); }\n"); auto utf8_check = GetUtf8CheckMode(descriptor_->field(0), options_); if (descriptor_->field(0)->type() == FieldDescriptor::TYPE_STRING && - utf8_check != NONE) { - if (utf8_check == STRICT) { + utf8_check != Utf8CheckMode::kNone) { + if (utf8_check == Utf8CheckMode::kStrict) { format( " static bool ValidateKey(std::string* s) {\n" " return ::$proto_ns$::internal::WireFormatLite::" @@ -1023,7 +1379,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " }\n", descriptor_->field(0)->full_name()); } else { - GOOGLE_CHECK(utf8_check == VERIFY); + GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify); format( " static bool ValidateKey(std::string* s) {\n" "#ifndef NDEBUG\n" @@ -1031,6 +1387,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " s->data(), static_cast(s->size()), " "::$proto_ns$::internal::" "WireFormatLite::PARSE, \"$1$\");\n" + "#else\n" + " (void) s;\n" "#endif\n" " return true;\n" " }\n", @@ -1040,8 +1398,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format(" static bool ValidateKey(void*) { return true; }\n"); } if (descriptor_->field(1)->type() == FieldDescriptor::TYPE_STRING && - utf8_check != NONE) { - if (utf8_check == STRICT) { + utf8_check != Utf8CheckMode::kNone) { + if (utf8_check == Utf8CheckMode::kStrict) { format( " static bool ValidateValue(std::string* s) {\n" " return ::$proto_ns$::internal::WireFormatLite::" @@ -1050,7 +1408,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " }\n", descriptor_->field(1)->full_name()); } else { - GOOGLE_CHECK(utf8_check = VERIFY); + GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify); format( " static bool ValidateValue(std::string* s) {\n" "#ifndef NDEBUG\n" @@ -1058,6 +1416,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " s->data(), static_cast(s->size()), " "::$proto_ns$::internal::" "WireFormatLite::PARSE, \"$1$\");\n" + "#else\n" + " (void) s;\n" "#endif\n" " return true;\n" " }\n", @@ -1068,20 +1428,11 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { } if (HasDescriptorMethods(descriptor_->file(), options_)) { format( - " void MergeFrom(const ::$proto_ns$::Message& other) final;\n" - " ::$proto_ns$::Metadata GetMetadata() const final;\n" - " private:\n" - " static ::$proto_ns$::Metadata GetMetadataStatic() {\n" - " ::$proto_ns$::internal::AssignDescriptors(&::$desc_table$);\n" - " return ::$desc_table$.file_level_metadata[$1$];\n" - " }\n" - "\n" - " public:\n" - "};\n", - index_in_file_messages_); - } else { - format("};\n"); + " using ::$proto_ns$::Message::MergeFrom;\n" + "" + " ::$proto_ns$::Metadata GetMetadata() const final;\n"); } + format("};\n"); return; } @@ -1093,9 +1444,20 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format(" public:\n"); format.Indent(); + if (EnableMessageOwnedArena(descriptor_)) { + format( + "inline $classname$() : $classname$(" + "::$proto_ns$::Arena::InternalHelper<$classname$>::\n" + " CreateMessageOwnedArena(), true) {}\n"); + } else { + format("inline $classname$() : $classname$(nullptr) {}\n"); + } + if (!HasSimpleBaseClass(descriptor_, options_)) { + format("~$classname$() override;\n"); + } format( - "$classname$();\n" - "virtual ~$classname$();\n" + "explicit constexpr " + "$classname$(::$proto_ns$::internal::ConstantInitialized);\n" "\n" "$classname$(const $classname$& from);\n" "$classname$($classname$&& from) noexcept\n" @@ -1108,8 +1470,13 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " return *this;\n" "}\n" "inline $classname$& operator=($classname$&& from) noexcept {\n" - " if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {\n" - " if (this != &from) InternalSwap(&from);\n" + " if (this == &from) return *this;\n" + " if (GetOwningArena() == from.GetOwningArena()\n" + "#ifdef PROTOBUF_FORCE_COPY_IN_MOVE\n" + " && GetOwningArena() != nullptr\n" + "#endif // !PROTOBUF_FORCE_COPY_IN_MOVE\n" + " ) {\n" + " InternalSwap(&from);\n" " } else {\n" " CopyFrom(from);\n" " }\n" @@ -1120,14 +1487,11 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { if (options_.table_driven_serialization) { format( "private:\n" - "const void* InternalGetTable() const;\n" + "const void* InternalGetTable() const override;\n" "public:\n" "\n"); } - std::map vars; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); - format.AddMap(vars); if (PublicUnknownFieldsAccessors(descriptor_)) { format( "inline const $unknown_fields_type$& unknown_fields() const {\n" @@ -1139,21 +1503,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "\n"); } - // N.B.: We exclude GetArena() when arena support is disabled, falling back on - // MessageLite's implementation which returns NULL rather than generating our - // own method which returns NULL, in order to reduce code size. - if (SupportsArenas(descriptor_)) { - // virtual method version of GetArenaNoVirtual(), required for generic - // dispatch given a MessageLite* (e.g., in RepeatedField::AddAllocated()). - format( - "inline ::$proto_ns$::Arena* GetArena() const final {\n" - " return GetArenaNoVirtual();\n" - "}\n" - "inline void* GetMaybeArenaPointer() const final {\n" - " return MaybeArenaPtr();\n" - "}\n"); - } - // Only generate this member if it's not disabled. if (HasDescriptorMethods(descriptor_->file(), options_) && !descriptor_->options().no_standard_descriptor_accessor()) { @@ -1174,16 +1523,17 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { // separately. format( "static const ::$proto_ns$::Descriptor* GetDescriptor() {\n" - " return GetMetadataStatic().descriptor;\n" + " return default_instance().GetMetadata().descriptor;\n" "}\n" "static const ::$proto_ns$::Reflection* GetReflection() {\n" - " return GetMetadataStatic().reflection;\n" + " return default_instance().GetMetadata().reflection;\n" "}\n"); } format( - "static const $classname$& default_instance();\n" - "\n"); + "static const $classname$& default_instance() {\n" + " return *internal_default_instance();\n" + "}\n"); // Generate enum values for every field in oneofs. One list is generated for // each oneof with an additional *_NOT_SET value. @@ -1191,10 +1541,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true)); format.Indent(); for (auto field : FieldRange(oneof)) { - std::string oneof_enum_case_field_name = - UnderscoresToCamelCase(field->name(), true); - format("k$1$ = $2$,\n", oneof_enum_case_field_name, // 1 - field->number()); // 2 + format("$1$ = $2$,\n", OneofCaseConstantName(field), // 1 + field->number()); // 2 } format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name())); format.Outdent(); @@ -1205,7 +1553,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { // TODO(gerbens) make this private, while still granting other protos access. format( - "static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY\n" "static inline const $classname$* internal_default_instance() {\n" " return reinterpret_cast(\n" " &_$classname$_default_instance_);\n" @@ -1221,12 +1568,14 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "\n"); if (HasDescriptorMethods(descriptor_->file(), options_)) { format( - "void PackFrom(const ::$proto_ns$::Message& message) {\n" - " _any_metadata_.PackFrom(message);\n" + "bool PackFrom(const ::$proto_ns$::Message& message) {\n" + " return _any_metadata_.PackFrom(GetArena(), message);\n" "}\n" - "void PackFrom(const ::$proto_ns$::Message& message,\n" - " const std::string& type_url_prefix) {\n" - " _any_metadata_.PackFrom(message, type_url_prefix);\n" + "bool PackFrom(const ::$proto_ns$::Message& message,\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " + "type_url_prefix) {\n" + " return _any_metadata_.PackFrom(GetArena(), message, " + "type_url_prefix);\n" "}\n" "bool UnpackTo(::$proto_ns$::Message* message) const {\n" " return _any_metadata_.UnpackTo(message);\n" @@ -1238,15 +1587,17 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "template " "::value>::type>\n" - "void PackFrom(const T& message) {\n" - " _any_metadata_.PackFrom(message);\n" + "bool PackFrom(const T& message) {\n" + " return _any_metadata_.PackFrom(GetArena(), message);\n" "}\n" "template " "::value>::type>\n" - "void PackFrom(const T& message,\n" - " const std::string& type_url_prefix) {\n" - " _any_metadata_.PackFrom(message, type_url_prefix);" + "bool PackFrom(const T& message,\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " + "type_url_prefix) {\n" + " return _any_metadata_.PackFrom(GetArena(), message, " + "type_url_prefix);" "}\n" "template " @@ -1257,13 +1608,15 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { } else { format( "template \n" - "void PackFrom(const T& message) {\n" - " _any_metadata_.PackFrom(message);\n" + "bool PackFrom(const T& message) {\n" + " return _any_metadata_.PackFrom(GetArena(), message);\n" "}\n" "template \n" - "void PackFrom(const T& message,\n" - " const std::string& type_url_prefix) {\n" - " _any_metadata_.PackFrom(message, type_url_prefix);\n" + "bool PackFrom(const T& message,\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " + "type_url_prefix) {\n" + " return _any_metadata_.PackFrom(GetArena(), message, " + "type_url_prefix);\n" "}\n" "template \n" "bool UnpackTo(T* message) const {\n" @@ -1274,50 +1627,39 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "template bool Is() const {\n" " return _any_metadata_.Is();\n" "}\n" - "static bool ParseAnyTypeUrl(const string& type_url,\n" + "static bool ParseAnyTypeUrl(::PROTOBUF_NAMESPACE_ID::ConstStringParam " + "type_url,\n" " std::string* full_type_name);\n"); } - format.Set("new_final", - ShouldMarkNewAsFinal(descriptor_, options_) ? "final" : ""); - format( "friend void swap($classname$& a, $classname$& b) {\n" " a.Swap(&b);\n" + "}\n" + "inline void Swap($classname$* other) {\n" + " if (other == this) return;\n" + "#ifdef PROTOBUF_FORCE_COPY_IN_SWAP\n" + " if (GetOwningArena() != nullptr &&\n" + " GetOwningArena() == other->GetOwningArena()) {\n " + "#else // PROTOBUF_FORCE_COPY_IN_SWAP\n" + " if (GetOwningArena() == other->GetOwningArena()) {\n" + "#endif // !PROTOBUF_FORCE_COPY_IN_SWAP\n" + " InternalSwap(other);\n" + " } else {\n" + " ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n" + " }\n" + "}\n" + "void UnsafeArenaSwap($classname$* other) {\n" + " if (other == this) return;\n" + " $DCHK$(GetOwningArena() == other->GetOwningArena());\n" + " InternalSwap(other);\n" "}\n"); - if (SupportsArenas(descriptor_)) { - format( - "inline void Swap($classname$* other) {\n" - " if (other == this) return;\n" - " if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {\n" - " InternalSwap(other);\n" - " } else {\n" - " ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n" - " }\n" - "}\n" - "void UnsafeArenaSwap($classname$* other) {\n" - " if (other == this) return;\n" - " $DCHK$(GetArenaNoVirtual() == other->GetArenaNoVirtual());\n" - " InternalSwap(other);\n" - "}\n"); - } else { - format( - "inline void Swap($classname$* other) {\n" - " if (other == this) return;\n" - " InternalSwap(other);\n" - "}\n"); - } - format( "\n" "// implements Message ----------------------------------------------\n" "\n" - "inline $classname$* New() const$ new_final$ {\n" - " return CreateMaybeMessage<$classname$>(nullptr);\n" - "}\n" - "\n" - "$classname$* New(::$proto_ns$::Arena* arena) const$ new_final$ {\n" + "$classname$* New(::$proto_ns$::Arena* arena = nullptr) const final {\n" " return CreateMaybeMessage<$classname$>(arena);\n" "}\n"); @@ -1329,51 +1671,78 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { if (HasGeneratedMethods(descriptor_->file(), options_)) { if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "void CopyFrom(const ::$proto_ns$::Message& from) final;\n" - "void MergeFrom(const ::$proto_ns$::Message& from) final;\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + // Use Message's built-in MergeFrom and CopyFrom when the passed-in + // argument is a generic Message instance, and only define the + // custom MergeFrom and CopyFrom instances when the source of the + // merge/copy is known to be the same class as the destination. + // TODO(jorg): Define MergeFrom in terms of MergeImpl, rather than + // the other way around, to save even more code size. + "using $superclass$::CopyFrom;\n" + "void CopyFrom(const $classname$& from);\n" + "" + "using $superclass$::MergeFrom;\n" + "void MergeFrom(const $classname$& from);\n" + "private:\n" + "static void MergeImpl(::$proto_ns$::Message* to, const " + "::$proto_ns$::Message& from);\n" + "public:\n"); + } else { + format( + "using $superclass$::CopyFrom;\n" + "inline void CopyFrom(const $classname$& from) {\n" + " $superclass$::CopyImpl(this, from);\n" + "}\n" + "" + "using $superclass$::MergeFrom;\n" + "void MergeFrom(const $classname$& from) {\n" + " $superclass$::MergeImpl(this, from);\n" + "}\n" + "public:\n"); + } } else { format( - "void CheckTypeAndMergeFrom(const ::$proto_ns$::MessageLite& from)\n" - " final;\n"); + "void CheckTypeAndMergeFrom(const ::$proto_ns$::MessageLite& from)" + " final;\n" + "void CopyFrom(const $classname$& from);\n" + "void MergeFrom(const $classname$& from);\n"); } - format.Set("clear_final", - ShouldMarkClearAsFinal(descriptor_, options_) ? "final" : ""); - format.Set( - "is_initialized_final", - ShouldMarkIsInitializedAsFinal(descriptor_, options_) ? "final" : ""); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;\n" + "bool IsInitialized() const final;\n" + "\n" + "size_t ByteSizeLong() const final;\n"); - format( - "void CopyFrom(const $classname$& from);\n" - "void MergeFrom(const $classname$& from);\n" - "PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear()$ clear_final$;\n" - "bool IsInitialized() const$ is_initialized_final$;\n" - "\n" - "size_t ByteSizeLong() const final;\n" - "const char* _InternalParse(const char* ptr, " - "::$proto_ns$::internal::ParseContext* ctx) final;\n" - "$uint8$* _InternalSerialize(\n" - " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "const final;\n"); + parse_function_generator_->GenerateMethodDecls(printer); - // DiscardUnknownFields() is implemented in message.cc using reflections. We - // need to implement this function in generated code for messages. - if (!UseUnknownFieldSet(descriptor_->file(), options_)) { - format("void DiscardUnknownFields()$ full_final$;\n"); + format( + "$uint8$* _InternalSerialize(\n" + " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " + "const final;\n"); } } - format( - "int GetCachedSize() const final { return _cached_size_.Get(); }" - "\n\nprivate:\n" - "inline void SharedCtor();\n" - "inline void SharedDtor();\n" - "void SetCachedSize(int size) const$ full_final$;\n" - "void InternalSwap($classname$* other);\n"); + if (options_.field_listener_options.inject_field_listener_events) { + format("static constexpr int _kInternalFieldNumber = $1$;\n", + descriptor_->field_count()); + } - format( - // Friend AnyMetadata so that it can call this FullMessageName() method. + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "int GetCachedSize() const final { return _cached_size_.Get(); }" + "\n\nprivate:\n" + "void SharedCtor();\n" + "void SharedDtor();\n" + "void SetCachedSize(int size) const$ full_final$;\n" + "void InternalSwap($classname$* other);\n"); + } + + format( + // Friend AnyMetadata so that it can call this FullMessageName() method. + "\nprivate:\n" "friend class ::$proto_ns$::internal::AnyMetadata;\n" "static $1$ FullMessageName() {\n" " return \"$full_name$\";\n" @@ -1381,52 +1750,35 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { options_.opensource_runtime ? "::PROTOBUF_NAMESPACE_ID::StringPiece" : "::StringPiece"); - if (SupportsArenas(descriptor_)) { + format( + // TODO(gerbens) Make this private! Currently people are deriving from + // protos to give access to this constructor, breaking the invariants + // we rely on. + "protected:\n" + "explicit $classname$(::$proto_ns$::Arena* arena,\n" + " bool is_message_owned = false);\n" + "private:\n"); + + if (!HasSimpleBaseClass(descriptor_, options_)) { format( - // TODO(gerbens) Make this private! Currently people are deriving from - // protos to give access to this constructor, breaking the invariants - // we rely on. - "protected:\n" - "explicit $classname$(::$proto_ns$::Arena* arena);\n" - "private:\n" "static void ArenaDtor(void* object);\n" "inline void RegisterArenaDtor(::$proto_ns$::Arena* arena);\n"); } - if (SupportsArenas(descriptor_)) { - format( - "private:\n" - "inline ::$proto_ns$::Arena* GetArenaNoVirtual() const {\n" - " return _internal_metadata_.arena();\n" - "}\n" - "inline void* MaybeArenaPtr() const {\n" - " return _internal_metadata_.raw_arena_ptr();\n" - "}\n"); - } else { - format( - "private:\n" - "inline ::$proto_ns$::Arena* GetArenaNoVirtual() const {\n" - " return nullptr;\n" - "}\n" - "inline void* MaybeArenaPtr() const {\n" - " return nullptr;\n" - "}\n"); - } - format( "public:\n" "\n"); if (HasDescriptorMethods(descriptor_->file(), options_)) { + if (HasGeneratedMethods(descriptor_->file(), options_)) { + format( + "static const ClassData _class_data_;\n" + "const ::$proto_ns$::Message::ClassData*" + "GetClassData() const final;\n" + "\n"); + } format( "::$proto_ns$::Metadata GetMetadata() const final;\n" - "private:\n" - "static ::$proto_ns$::Metadata GetMetadataStatic() {\n" - " ::$proto_ns$::internal::AssignDescriptors(&::$desc_table$);\n" - " return ::$desc_table$.file_level_metadata[kIndexInFileMessages];\n" - "}\n" - "\n" - "public:\n" "\n"); } else { format( @@ -1482,11 +1834,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { // TODO(seongkim): Remove hack to track field access and remove this class. format("class _Internal;\n"); - for (auto field : FieldRange(descriptor_)) { // set_has_***() generated in all oneofs. if (!field->is_repeated() && !field->options().weak() && - field->containing_oneof()) { + field->real_containing_oneof()) { format("void set_has_$1$();\n", FieldName(field)); } } @@ -1508,6 +1859,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "size_t RequiredFieldsByteSizeFallback() const;\n\n"); } + if (HasGeneratedMethods(descriptor_->file(), options_)) { + parse_function_generator_->GenerateDataDecls(printer); + } + // Prepare decls for _cached_size_ and _has_bits_. Their position in the // output will be determined later. @@ -1517,10 +1872,9 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { const size_t sizeof_has_bits = HasBitsSize(); const std::string has_bits_decl = - sizeof_has_bits == 0 - ? "" - : StrCat("::$proto_ns$::internal::HasBits<", - sizeof_has_bits / 4, "> _has_bits_;\n"); + sizeof_has_bits == 0 ? "" + : StrCat("::$proto_ns$::internal::HasBits<", + sizeof_has_bits, "> _has_bits_;\n"); // To minimize padding, data members are divided into three sections: // (1) members assumed to align to 8 bytes @@ -1536,25 +1890,28 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "\n"); } - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "::$proto_ns$::internal::InternalMetadataWithArena " - "_internal_metadata_;\n"); - } else { - format( - "::$proto_ns$::internal::InternalMetadataWithArenaLite " - "_internal_metadata_;\n"); + if (options_.field_listener_options.inject_field_listener_events && + descriptor_->file()->options().optimize_for() != + google::protobuf::FileOptions::LITE_RUNTIME) { + format("static ::$proto_ns$::AccessListener<$1$> _tracker_;\n", + ClassName(descriptor_)); } - if (SupportsArenas(descriptor_)) { - format( - "template friend class " - "::$proto_ns$::Arena::InternalHelper;\n" - "typedef void InternalArenaConstructable_;\n" - "typedef void DestructorSkippable_;\n"); + // Generate _inlined_string_donated_ for inlined string type. + // TODO(congliu): To avoid affecting the locality of `_has_bits_`, should this + // be below or above `_has_bits_`? + if (!inlined_string_indices_.empty()) { + format("::$proto_ns$::internal::HasBits<$1$> _inlined_string_donated_;\n", + InlinedStringDonatedSize()); } - if (HasFieldPresence(descriptor_->file())) { + format( + "template friend class " + "::$proto_ns$::Arena::InternalHelper;\n" + "typedef void InternalArenaConstructable_;\n" + "typedef void DestructorSkippable_;\n"); + + if (!has_bit_indices_.empty()) { // _has_bits_ is frequently accessed, so to reduce code size and improve // speed, it should be close to the start of the object. Placing // _cached_size_ together with _has_bits_ improves cache locality despite @@ -1576,20 +1933,25 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { // For each oneof generate a union for (auto oneof : OneOfRange(descriptor_)) { std::string camel_oneof_name = UnderscoresToCamelCase(oneof->name(), true); + format("union $1$Union {\n", camel_oneof_name); + format.Indent(); format( - "union $1$Union {\n" // explicit empty constructor is needed when union contains // ArenaStringPtr members for string fields. - " $1$Union() {}\n", + "constexpr $1$Union() : _constinit_{} {}\n" + " ::$proto_ns$::internal::ConstantInitialized _constinit_;\n", camel_oneof_name); - format.Indent(); for (auto field : FieldRange(oneof)) { - field_generators_.get(field).GeneratePrivateMembers(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GeneratePrivateMembers(printer); + } } format.Outdent(); format("} $1$_;\n", oneof->name()); for (auto field : FieldRange(oneof)) { - field_generators_.get(field).GenerateStaticMembers(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateStaticMembers(printer); + } } } @@ -1601,11 +1963,11 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { } // Generate _oneof_case_. - if (descriptor_->oneof_decl_count() > 0) { + if (descriptor_->real_oneof_decl_count() > 0) { format( "$uint32$ _oneof_case_[$1$];\n" "\n", - descriptor_->oneof_decl_count()); + descriptor_->real_oneof_decl_count()); } if (num_weak_fields_) { @@ -1645,29 +2007,6 @@ void MessageGenerator::GenerateInlineMethods(io::Printer* printer) { } } -void MessageGenerator::GenerateExtraDefaultFields(io::Printer* printer) { - // Generate oneof default instance and weak field instances for reflection - // usage. - Formatter format(printer, variables_); - if (descriptor_->oneof_decl_count() > 0 || num_weak_fields_ > 0) { - for (auto oneof : OneOfRange(descriptor_)) { - for (auto field : FieldRange(oneof)) { - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - EffectiveStringCType(field, options_) != FieldOptions::STRING)) { - format("const "); - } - field_generators_.get(field).GeneratePrivateMembers(printer); - } - } - for (auto field : FieldRange(descriptor_)) { - if (field->options().weak()) { - format(" const ::$proto_ns$::Message* $1$_;\n", FieldName(field)); - } - } - } -} - bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, size_t aux_offset) { Formatter format(printer, variables_); @@ -1693,14 +2032,14 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, "$3$,\n", offset, aux_offset, max_field_number); - if (!HasFieldPresence(descriptor_->file())) { - // If we don't have field presence, then _has_bits_ does not exist. + if (has_bit_indices_.empty()) { + // If no fields have hasbits, then _has_bits_ does not exist. format("-1,\n"); } else { format("PROTOBUF_FIELD_OFFSET($classtype$, _has_bits_),\n"); } - if (descriptor_->oneof_decl_count() > 0) { + if (descriptor_->real_oneof_decl_count() > 0) { format("PROTOBUF_FIELD_OFFSET($classtype$, _oneof_case_),\n"); } else { format("-1, // no _oneof_case_\n"); @@ -1713,7 +2052,7 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, } // TODO(ckennelly): Consolidate this with the calculation for - // AuxillaryParseTableField. + // AuxiliaryParseTableField. format( "PROTOBUF_FIELD_OFFSET($classtype$, _internal_metadata_),\n" "&$package_ns$::_$classname$_default_instance_,\n"); @@ -1732,51 +2071,57 @@ bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, void MessageGenerator::GenerateSchema(io::Printer* printer, int offset, int has_offset) { Formatter format(printer, variables_); - has_offset = - HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_) - ? offset + has_offset - : -1; + has_offset = !has_bit_indices_.empty() || IsMapEntryMessage(descriptor_) + ? offset + has_offset + : -1; + int inlined_string_indices_offset; + if (inlined_string_indices_.empty()) { + inlined_string_indices_offset = -1; + } else { + GOOGLE_DCHECK_NE(has_offset, -1); + GOOGLE_DCHECK(!IsMapEntryMessage(descriptor_)); + inlined_string_indices_offset = has_offset + has_bit_indices_.size(); + } - format("{ $1$, $2$, sizeof($classtype$)},\n", offset, has_offset); + format("{ $1$, $2$, $3$, sizeof($classtype$)},\n", offset, has_offset, + inlined_string_indices_offset); } namespace { // We need to calculate for each field what function the table driven code // should use to serialize it. This returns the index in a lookup table. -uint32 CalcFieldNum(const FieldGenerator& generator, - const FieldDescriptor* field, const Options& options) { +uint32_t CalcFieldNum(const FieldGenerator& generator, + const FieldDescriptor* field, const Options& options) { bool is_a_map = IsMapEntryMessage(field->containing_type()); int type = field->type(); if (type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { + // string field if (generator.IsInlined()) { type = internal::FieldMetadata::kInlinedType; - } - // string field - if (IsCord(field, options)) { + } else if (IsCord(field, options)) { type = internal::FieldMetadata::kCordType; } else if (IsStringPiece(field, options)) { type = internal::FieldMetadata::kStringPieceType; } } - if (field->containing_oneof()) { + + if (field->real_containing_oneof()) { return internal::FieldMetadata::CalculateType( type, internal::FieldMetadata::kOneOf); - } - if (field->is_packed()) { + } else if (field->is_packed()) { return internal::FieldMetadata::CalculateType( type, internal::FieldMetadata::kPacked); } else if (field->is_repeated()) { return internal::FieldMetadata::CalculateType( type, internal::FieldMetadata::kRepeated); - } else if (!HasFieldPresence(field->file()) && - field->containing_oneof() == NULL && !is_a_map) { + } else if (HasHasbit(field) || field->real_containing_oneof() || is_a_map) { return internal::FieldMetadata::CalculateType( - type, internal::FieldMetadata::kNoPresence); + type, internal::FieldMetadata::kPresence); } else { return internal::FieldMetadata::CalculateType( - type, internal::FieldMetadata::kPresence); + type, internal::FieldMetadata::kNoPresence); } } @@ -1801,7 +2146,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { const FieldDescriptor* field = sorted[i]; const FieldGenerator& generator = field_generators_.get(field); - uint32 tag = internal::WireFormatLite::MakeTag( + uint32_t tag = internal::WireFormatLite::MakeTag( field->number(), WireFormat::WireTypeForFieldType(field->type())); std::map vars; @@ -1858,7 +2203,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { if (i == sorted.size()) break; const FieldDescriptor* field = sorted[i]; - uint32 tag = internal::WireFormatLite::MakeTag( + uint32_t tag = internal::WireFormatLite::MakeTag( field->number(), WireFormat::WireTypeForFieldType(field->type())); if (field->is_packed()) { tag = internal::WireFormatLite::MakeTag( @@ -1866,7 +2211,7 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { } std::string classfieldname = FieldName(field); - if (field->containing_oneof()) { + if (field->real_containing_oneof()) { classfieldname = field->containing_oneof()->name(); } format.Set("field_name", classfieldname); @@ -1898,14 +2243,13 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { const FieldGenerator& generator = field_generators_.get(field); int type = CalcFieldNum(generator, field, options_); - if (IsLazy(field, options_)) { + if (IsLazy(field, options_, scc_analyzer_)) { type = internal::FieldMetadata::kSpecial; ptr = "reinterpret_cast(::" + variables_["proto_ns"] + "::internal::LazyFieldSerializer"; - if (field->containing_oneof()) { + if (field->real_containing_oneof()) { ptr += "OneOf"; - } else if (!HasFieldPresence(descriptor_->file()) || - has_bit_indices_[field->index()] == -1) { + } else if (!HasHasbit(field)) { ptr += "NoPresence"; } ptr += ")"; @@ -1920,16 +2264,15 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { "reinterpret_cast(::$proto_ns$::internal::WeakFieldSerializer)},\n", tag); - } else if (field->containing_oneof()) { + } else if (field->real_containing_oneof()) { format.Set("oneofoffset", - sizeof(uint32) * field->containing_oneof()->index()); + sizeof(uint32_t) * field->containing_oneof()->index()); format( "{PROTOBUF_FIELD_OFFSET($classtype$, $field_name$_), $1$," " PROTOBUF_FIELD_OFFSET($classtype$, _oneof_case_) + " "$oneofoffset$, $2$, $3$},\n", tag, type, ptr); - } else if (HasFieldPresence(descriptor_->file()) && - has_bit_indices_[field->index()] != -1) { + } else if (HasHasbit(field)) { format.Set("hasbitsoffset", has_bit_indices_[field->index()]); format( "{PROTOBUF_FIELD_OFFSET($classtype$, $field_name$_), " @@ -1956,70 +2299,6 @@ int MessageGenerator::GenerateFieldMetadata(io::Printer* printer) { return num_field_metadata; } -void MessageGenerator::GenerateFieldDefaultInstances(io::Printer* printer) { - // Construct the default instances for all fields that need one. - for (auto field : FieldRange(descriptor_)) { - field_generators_.get(field).GenerateDefaultInstanceAllocator(printer); - } -} - -void MessageGenerator::GenerateDefaultInstanceInitializer( - io::Printer* printer) { - Formatter format(printer, variables_); - - // The default instance needs all of its embedded message pointers - // cross-linked to other default instances. We can't do this initialization - // in the constructor because some other default instances may not have been - // constructed yet at that time. - // TODO(kenton): Maybe all message fields (even for non-default messages) - // should be initialized to point at default instances rather than NULL? - for (auto field : FieldRange(descriptor_)) { - Formatter::SaveState saver(&format); - - if (!field->is_repeated() && !IsLazy(field, options_) && - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - (field->containing_oneof() == NULL || - HasDescriptorMethods(descriptor_->file(), options_))) { - std::string name; - if (field->containing_oneof() || field->options().weak()) { - name = "_" + classname_ + "_default_instance_."; - } else { - name = - "_" + classname_ + "_default_instance_._instance.get_mutable()->"; - } - name += FieldName(field); - format.Set("name", name); - if (IsWeak(field, options_)) { - format( - "$package_ns$::$name$_ = reinterpret_cast(&$1$);\n" - "if ($package_ns$::$name$_ == nullptr) {\n" - " $package_ns$::$name$_ = " - "::$proto_ns$::Empty::internal_default_instance();\n" - "}\n", - QualifiedDefaultInstanceName(field->message_type(), - options_)); // 1 - continue; - } - if (IsImplicitWeakField(field, options_, scc_analyzer_)) { - format( - "$package_ns$::$name$_ = reinterpret_cast<$1$*>(\n" - " $2$);\n", - FieldMessageTypeName(field, options_), - QualifiedDefaultInstancePtr(field->message_type(), options_)); - } else { - format( - "$package_ns$::$name$_ = const_cast< $1$*>(\n" - " $1$::internal_default_instance());\n", - FieldMessageTypeName(field, options_)); - } - } else if (field->containing_oneof() && - HasDescriptorMethods(descriptor_->file(), options_)) { - field_generators_.get(field).GenerateConstructorCode(printer); - } - } -} - void MessageGenerator::GenerateClassMethods(io::Printer* printer) { Formatter format(printer, variables_); if (IsMapEntryMessage(descriptor_)) { @@ -2031,28 +2310,28 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { " MergeFromInternal(other);\n" "}\n"); if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - " return GetMetadataStatic();\n" - "}\n"); - format( - "void $classname$::MergeFrom(\n" - " const ::$proto_ns$::Message& other) {\n" - " ::$proto_ns$::Message::MergeFrom(other);\n" - "}\n" - "\n"); + if (!descriptor_->options().map_entry()) { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + "$annotate_reflection$" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } else { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } } return; } - // TODO(gerbens) Remove this function. With a little bit of cleanup and - // refactoring this is superfluous. - format("void $classname$::InitAsDefaultInstance() {\n"); - format.Indent(); - GenerateDefaultInstanceInitializer(printer); - format.Outdent(); - format("}\n"); - if (IsAnyMessage(descriptor_, options_)) { if (HasDescriptorMethods(descriptor_->file(), options_)) { format( @@ -2065,8 +2344,9 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { "}\n"); } format( - "bool $classname$::ParseAnyTypeUrl(const string& type_url,\n" - " std::string* full_type_name) {\n" + "bool $classname$::ParseAnyTypeUrl(\n" + " ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url,\n" + " std::string* full_type_name) {\n" " return ::$proto_ns$::internal::ParseAnyTypeUrl(type_url,\n" " full_type_name);\n" "}\n" @@ -2077,16 +2357,18 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { "class $classname$::_Internal {\n" " public:\n"); format.Indent(); - if (HasFieldPresence(descriptor_->file()) && HasBitsSize() != 0) { + if (!has_bit_indices_.empty()) { format( "using HasBits = decltype(std::declval<$classname$>()._has_bits_);\n"); } for (auto field : FieldRange(descriptor_)) { field_generators_.get(field).GenerateInternalAccessorDeclarations(printer); - if (HasFieldPresence(descriptor_->file()) && !field->is_repeated() && - !field->options().weak() && !field->containing_oneof()) { - int has_bit_index = has_bit_indices_[field->index()]; - GOOGLE_CHECK_GE(has_bit_index, 0); + if (IsFieldStripped(field, options_)) { + continue; + } + if (HasHasbit(field)) { + int has_bit_index = HasBitIndex(field); + GOOGLE_CHECK_NE(has_bit_index, kNoHasbit) << field->full_name(); format( "static void set_has_$1$(HasBits* has_bits) {\n" " (*has_bits)[$2$] |= $3$u;\n" @@ -2094,20 +2376,35 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { FieldName(field), has_bit_index / 32, (1u << (has_bit_index % 32))); } } + if (num_required_fields_ > 0) { + const std::vector masks_for_has_bits = RequiredFieldsBitMask(); + format( + "static bool MissingRequiredFields(const HasBits& has_bits) " + "{\n" + " return $1$;\n" + "}\n", + ConditionalToCheckBitmasks(masks_for_has_bits, false, "has_bits")); + } + format.Outdent(); format("};\n\n"); for (auto field : FieldRange(descriptor_)) { - field_generators_.get(field).GenerateInternalAccessorDefinitions(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateInternalAccessorDefinitions(printer); + } } // Generate non-inline field definitions. for (auto field : FieldRange(descriptor_)) { + if (IsFieldStripped(field, options_)) { + continue; + } field_generators_.get(field).GenerateNonInlineAccessorDefinitions(printer); if (IsCrossFileMaybeMap(field)) { Formatter::SaveState saver(&format); std::map vars; SetCommonFieldVariables(field, &vars, options_); - if (field->containing_oneof()) { + if (field->real_containing_oneof()) { SetCommonOneofFieldVariables(field, &vars); } format.AddMap(vars); @@ -2118,7 +2415,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { GenerateStructors(printer); format("\n"); - if (descriptor_->oneof_decl_count() > 0) { + if (descriptor_->real_oneof_decl_count() > 0) { GenerateOneofClear(printer); format("\n"); } @@ -2127,8 +2424,12 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { GenerateClear(printer); format("\n"); - GenerateMergeFromCodedStream(printer); - format("\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + parse_function_generator_->GenerateMethodImpls(printer); + format("\n"); + + parse_function_generator_->GenerateDataDefinitions(printer); + } GenerateSerializeWithCachedSizesToArray(printer); format("\n"); @@ -2139,6 +2440,9 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { GenerateMergeFrom(printer); format("\n"); + GenerateClassSpecificMergeFrom(printer); + format("\n"); + GenerateCopyFrom(printer); format("\n"); @@ -2146,6 +2450,8 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { format("\n"); } + GenerateVerify(printer); + GenerateSwap(printer); format("\n"); @@ -2158,11 +2464,24 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { index_in_file_messages_); } if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - " return GetMetadataStatic();\n" - "}\n" - "\n"); + if (!descriptor_->options().map_entry()) { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + "$annotate_reflection$" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } else { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } } else { format( "std::string $classname$::GetTypeName() const {\n" @@ -2171,6 +2490,14 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { "\n"); } + if (options_.field_listener_options.inject_field_listener_events && + descriptor_->file()->options().optimize_for() != + google::protobuf::FileOptions::LITE_RUNTIME) { + format( + "::$proto_ns$::AccessListener<$classtype$> " + "$1$::_tracker_(&FullMessageName);\n", + ClassName(descriptor_)); + } } size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { @@ -2215,7 +2542,6 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { case FieldOptions::STRING: if (generator.IsInlined()) { processing_type = internal::TYPE_STRING_INLINED; - break; } break; case FieldOptions::CORD: @@ -2230,7 +2556,6 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { case FieldOptions::STRING: if (generator.IsInlined()) { processing_type = internal::TYPE_BYTES_INLINED; - break; } break; case FieldOptions::CORD: @@ -2245,7 +2570,7 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { processing_type |= static_cast( field->is_repeated() ? internal::kRepeatedMask : 0); processing_type |= static_cast( - field->containing_oneof() ? internal::kOneofMask : 0); + field->real_containing_oneof() ? internal::kOneofMask : 0); if (field->is_map()) { processing_type = internal::TYPE_MAP; @@ -2255,7 +2580,7 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { WireFormat::TagSize(field->number(), field->type()); std::map vars; - if (field->containing_oneof() != NULL) { + if (field->real_containing_oneof()) { vars["name"] = field->containing_oneof()->name(); vars["presence"] = StrCat(field->containing_oneof()->index()); } else { @@ -2290,14 +2615,14 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { std::vector ordered_fields = SortFieldsByNumber(descriptor_); - format("::$proto_ns$::internal::AuxillaryParseTableField(),\n"); + format("::$proto_ns$::internal::AuxiliaryParseTableField(),\n"); int last_field_number = 1; for (auto field : ordered_fields) { Formatter::SaveState saver(&format); GOOGLE_CHECK_GE(field->number(), last_field_number); for (; last_field_number < field->number(); last_field_number++) { - format("::$proto_ns$::internal::AuxillaryParseTableField(),\n"); + format("::$proto_ns$::internal::AuxiliaryParseTableField(),\n"); } std::map vars; @@ -2308,11 +2633,11 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { case FieldDescriptor::CPPTYPE_ENUM: if (HasPreservingUnknownEnumSemantics(field)) { format( - "{::$proto_ns$::internal::AuxillaryParseTableField::enum_aux{" + "{::$proto_ns$::internal::AuxiliaryParseTableField::enum_aux{" "nullptr}},\n"); } else { format( - "{::$proto_ns$::internal::AuxillaryParseTableField::enum_aux{" + "{::$proto_ns$::internal::AuxiliaryParseTableField::enum_aux{" "$1$_IsValid}},\n", ClassName(field->enum_type(), true)); } @@ -2321,7 +2646,7 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { case FieldDescriptor::CPPTYPE_MESSAGE: { if (field->is_map()) { format( - "{::$proto_ns$::internal::AuxillaryParseTableField::map_" + "{::$proto_ns$::internal::AuxiliaryParseTableField::map_" "aux{&::$proto_ns$::internal::ParseMap<$1$>}},\n", QualifiedClassName(field->message_type(), options_)); last_field_number++; @@ -2332,7 +2657,7 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { field->message_type(), options_)); format( - "{::$proto_ns$::internal::AuxillaryParseTableField::message_aux{\n" + "{::$proto_ns$::internal::AuxiliaryParseTableField::message_aux{\n" " &$default_instance$}},\n"); last_field_number++; break; @@ -2355,7 +2680,7 @@ size_t MessageGenerator::GenerateParseAuxTable(io::Printer* printer) { break; } format( - "{::$proto_ns$::internal::AuxillaryParseTableField::string_aux{\n" + "{::$proto_ns$::internal::AuxiliaryParseTableField::string_aux{\n" " $1$,\n" " \"$2$\"\n" "}},\n", @@ -2375,7 +2700,7 @@ std::pair MessageGenerator::GenerateOffsets( io::Printer* printer) { Formatter format(printer, variables_); - if (HasFieldPresence(descriptor_->file()) || IsMapEntryMessage(descriptor_)) { + if (!has_bit_indices_.empty() || IsMapEntryMessage(descriptor_)) { format("PROTOBUF_FIELD_OFFSET($classtype$, _has_bits_),\n"); } else { format("~0u, // no _has_bits_\n"); @@ -2386,7 +2711,7 @@ std::pair MessageGenerator::GenerateOffsets( } else { format("~0u, // no _extensions_\n"); } - if (descriptor_->oneof_decl_count() > 0) { + if (descriptor_->real_oneof_decl_count() > 0) { format("PROTOBUF_FIELD_OFFSET($classtype$, _oneof_case_[0]),\n"); } else { format("~0u, // no _oneof_case_\n"); @@ -2396,36 +2721,63 @@ std::pair MessageGenerator::GenerateOffsets( } else { format("~0u, // no _weak_field_map_\n"); } - const int kNumGenericOffsets = 5; // the number of fixed offsets above + if (!inlined_string_indices_.empty()) { + format("PROTOBUF_FIELD_OFFSET($classtype$, _inlined_string_donated_),\n"); + } else { + format("~0u, // no _inlined_string_donated_\n"); + } + const int kNumGenericOffsets = 6; // the number of fixed offsets above const size_t offsets = kNumGenericOffsets + descriptor_->field_count() + - descriptor_->oneof_decl_count(); + descriptor_->real_oneof_decl_count(); size_t entries = offsets; for (auto field : FieldRange(descriptor_)) { - if (field->containing_oneof() || field->options().weak()) { - format("offsetof($classtype$DefaultTypeInternal, $1$_)", - FieldName(field)); + if (IsFieldStripped(field, options_)) { + format("~0u, // stripped\n"); + continue; + } + // TODO(sbenza): We should not have an entry in the offset table for fields + // that do not use them. + if (field->options().weak() || field->real_containing_oneof()) { + // Mark the field to prevent unintentional access through reflection. + // Don't use the top bit because that is for unused fields. + format("::$proto_ns$::internal::kInvalidFieldOffsetTag"); } else { format("PROTOBUF_FIELD_OFFSET($classtype$, $1$_)", FieldName(field)); } - uint32 tag = field_generators_.get(field).CalculateFieldTag(); - if (tag != 0) { - format(" | $1$", tag); + // Some information about a field is in the pdproto profile. The profile is + // only available at compile time. So we embed such information in the + // offset of the field, so that the information is available when + // reflectively accessing the field at run time. + // + // Embed whether the field is used to the MSB of the offset. + if (!IsFieldUsed(field, options_)) { + format(" | 0x80000000u // unused\n"); } + // Embed whether the field is eagerly verified lazy or inlined string to the + // LSB of the offset. + if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) { + format(" | 0x1u // eagerly verified lazy\n"); + } else if (IsStringInlined(field, options_)) { + format(" | 0x1u // inlined\n"); + } format(",\n"); } + int count = 0; for (auto oneof : OneOfRange(descriptor_)) { format("PROTOBUF_FIELD_OFFSET($classtype$, $1$_),\n", oneof->name()); + count++; } + GOOGLE_CHECK_EQ(count, descriptor_->real_oneof_decl_count()); if (IsMapEntryMessage(descriptor_)) { entries += 2; format( "0,\n" "1,\n"); - } else if (HasFieldPresence(descriptor_->file())) { + } else if (!has_bit_indices_.empty()) { entries += has_bit_indices_.size(); for (int i = 0; i < has_bit_indices_.size(); i++) { const std::string index = @@ -2433,20 +2785,24 @@ std::pair MessageGenerator::GenerateOffsets( format("$1$,\n", index); } } + if (!inlined_string_indices_.empty()) { + entries += inlined_string_indices_.size(); + for (int inlined_string_indice : inlined_string_indices_) { + const std::string index = inlined_string_indice >= 0 + ? StrCat(inlined_string_indice) + : "~0u"; + format("$1$,\n", index); + } + } return std::make_pair(entries, offsets); } void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); - format("void $classname$::SharedCtor() {\n"); - if (scc_analyzer_->GetSCCAnalysis(scc_analyzer_->GetSCC(descriptor_)) - .constructor_requires_initialization) { - format(" ::$proto_ns$::internal::InitSCC(&$scc_info$.base);\n"); - } - - format.Indent(); + format("inline void $classname$::SharedCtor() {\n"); std::vector processed(optimized_order_.size(), false); GenerateConstructorBody(printer, processed, false); @@ -2455,18 +2811,16 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { format("clear_has_$1$();\n", oneof->name()); } - format.Outdent(); format("}\n\n"); } void MessageGenerator::GenerateSharedDestructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); - format("void $classname$::SharedDtor() {\n"); + format("inline void $classname$::SharedDtor() {\n"); format.Indent(); - if (SupportsArenas(descriptor_)) { - format("$DCHK$(GetArenaNoVirtual() == nullptr);\n"); - } + format("$DCHK$(GetArenaForAllocation() == nullptr);\n"); // Write the destructors for each field except oneof members. // optimized_order_ does not contain oneof fields. for (auto field : optimized_order_) { @@ -2492,6 +2846,7 @@ void MessageGenerator::GenerateSharedDestructorCode(io::Printer* printer) { } void MessageGenerator::GenerateArenaDestructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); // Generate the ArenaDtor() method. Track whether any fields actually produced @@ -2522,17 +2877,12 @@ void MessageGenerator::GenerateArenaDestructorCode(io::Printer* printer) { // and returns false for oneof fields. for (auto oneof : OneOfRange(descriptor_)) { for (auto field : FieldRange(oneof)) { - if (field_generators_.get(field).GenerateArenaDestructorCode(printer)) { + if (!IsFieldStripped(field, options_) && + field_generators_.get(field).GenerateArenaDestructorCode(printer)) { need_registration = true; } } } - if (num_weak_fields_) { - // _this is the object being destructed (we are inside a static method - // here). - format("_this->_weak_field_map_.ClearAll();\n"); - need_registration = true; - } format.Outdent(); format("}\n"); @@ -2552,30 +2902,54 @@ void MessageGenerator::GenerateArenaDestructorCode(io::Printer* printer) { } } -void MessageGenerator::GenerateConstructorBody(io::Printer* printer, - std::vector processed, - bool copy_constructor) const { +void MessageGenerator::GenerateConstexprConstructor(io::Printer* printer) { Formatter format(printer, variables_); - const FieldDescriptor* last_start = NULL; - // RunMap maps from fields that start each run to the number of fields in that - // run. This is optimized for the common case that there are very few runs in - // a message and that most of the eligible fields appear together. - typedef std::unordered_map RunMap; - RunMap runs; - for (auto field : optimized_order_) { - if ((copy_constructor && IsPOD(field)) || - (!copy_constructor && CanConstructByZeroing(field, options_))) { - if (last_start == NULL) { - last_start = field; - } + format( + "constexpr $classname$::$classname$(\n" + " ::$proto_ns$::internal::ConstantInitialized)"); + format.Indent(); + const char* field_sep = ":"; + const auto put_sep = [&] { + format("\n$1$ ", field_sep); + field_sep = ","; + }; - runs[last_start]++; - } else { - last_start = NULL; + if (!IsMapEntryMessage(descriptor_)) { + // Process non-oneof fields first. + for (auto field : optimized_order_) { + auto& gen = field_generators_.get(field); + put_sep(); + gen.GenerateConstinitInitializer(printer); + } + + if (IsAnyMessage(descriptor_, options_)) { + put_sep(); + format("_any_metadata_(&type_url_, &value_)"); + } + + if (descriptor_->real_oneof_decl_count() != 0) { + put_sep(); + format("_oneof_case_{}"); } } + format.Outdent(); + format("{}\n"); +} + +void MessageGenerator::GenerateConstructorBody(io::Printer* printer, + std::vector processed, + bool copy_constructor) const { + Formatter format(printer, variables_); + + const RunMap runs = FindRuns( + optimized_order_, [copy_constructor, this](const FieldDescriptor* field) { + return (copy_constructor && IsPOD(field)) || + (!copy_constructor && + CanBeManipulatedAsRawBytes(field, options_, scc_analyzer_)); + }); + std::string pod_template; if (copy_constructor) { pod_template = @@ -2584,8 +2958,10 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer, " reinterpret_cast(&$first$_)) + sizeof($last$_));\n"; } else { pod_template = - "::memset(&$first$_, 0, static_cast(\n" - " reinterpret_cast(&$last$_) -\n" + "::memset(reinterpret_cast(this) + static_cast(\n" + " reinterpret_cast(&$first$_) - " + "reinterpret_cast(this)),\n" + " 0, static_cast(reinterpret_cast(&$last$_) -\n" " reinterpret_cast(&$first$_)) + sizeof($last$_));\n"; } @@ -2595,7 +2971,7 @@ void MessageGenerator::GenerateConstructorBody(io::Printer* printer, } const FieldDescriptor* field = optimized_order_[i]; - RunMap::const_iterator it = runs.find(field); + const auto it = runs.find(field); // We only apply the memset technique to runs of more than one field, as // assignment is better than memset for generated code clarity. @@ -2628,19 +3004,20 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { std::string superclass; superclass = SuperClassName(descriptor_, options_); - std::string initializer_with_arena = superclass + "()"; + std::string initializer_with_arena = superclass + "(arena, is_message_owned)"; if (descriptor_->extension_range_count() > 0) { initializer_with_arena += ",\n _extensions_(arena)"; } - initializer_with_arena += ",\n _internal_metadata_(arena)"; - // Initialize member variables with arena constructor. for (auto field : optimized_order_) { + GOOGLE_DCHECK(!IsFieldStripped(field, options_)); bool has_arena_constructor = field->is_repeated(); - if (field->containing_oneof() == NULL && - (IsLazy(field, options_) || IsStringPiece(field, options_))) { + if (!field->real_containing_oneof() && + (IsLazy(field, options_, scc_analyzer_) || + IsStringPiece(field, options_) || + (IsString(field, options_) && IsStringInlined(field, options_)))) { has_arena_constructor = true; } if (has_arena_constructor) { @@ -2656,8 +3033,7 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { initializer_with_arena += ", _weak_field_map_(arena)"; } - std::string initializer_null = - superclass + "(), _internal_metadata_(nullptr)"; + std::string initializer_null = superclass + "()"; if (IsAnyMessage(descriptor_, options_)) { initializer_null += ", _any_metadata_(&type_url_, &value_)"; } @@ -2666,23 +3042,34 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { } format( - "$classname$::$classname$()\n" - " : $1$ {\n" - " SharedCtor();\n" - " // @@protoc_insertion_point(constructor:$full_name$)\n" - "}\n", - initializer_null); + "$classname$::$classname$(::$proto_ns$::Arena* arena,\n" + " bool is_message_owned)\n" + " : $1$ {\n", + initializer_with_arena); + + if (!inlined_string_indices_.empty()) { + // Donate inline string fields. + format(" if (arena != nullptr) {\n"); + for (size_t i = 0; i < InlinedStringDonatedSize(); ++i) { + format(" _inlined_string_donated_[$1$] = ~0u;\n", i); + } + format(" }\n"); + } - if (SupportsArenas(descriptor_)) { + if (!HasSimpleBaseClass(descriptor_, options_)) { format( - "$classname$::$classname$(::$proto_ns$::Arena* arena)\n" - " : $1$ {\n" " SharedCtor();\n" - " RegisterArenaDtor(arena);\n" - " // @@protoc_insertion_point(arena_constructor:$full_name$)\n" - "}\n", - initializer_with_arena); + " if (!is_message_owned) {\n" + " RegisterArenaDtor(arena);\n" + " }\n"); } + format( + " // @@protoc_insertion_point(arena_constructor:$full_name$)\n" + "}\n"); + + std::map vars; + SetUnknownFieldsVariable(descriptor_, options_, &vars); + format.AddMap(vars); // Generate the copy constructor. if (UsingImplicitWeakFields(descriptor_->file(), options_)) { @@ -2702,12 +3089,12 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { format.Indent(); format.Indent(); format.Indent(); - format(",\n_internal_metadata_(nullptr)"); - if (HasFieldPresence(descriptor_->file())) { - if (!IsProto2MessageSet(descriptor_, options_)) { - format(",\n_has_bits_(from._has_bits_)"); - } + // Do not copy inlined_string_donated_, because this is not an arena + // constructor. + + if (!has_bit_indices_.empty()) { + format(",\n_has_bits_(from._has_bits_)"); } std::vector processed(optimized_order_.size(), false); @@ -2733,10 +3120,14 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { format.Outdent(); format(" {\n"); - format("_internal_metadata_.MergeFrom(from._internal_metadata_);\n"); + format( + "_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._internal_" + "metadata_);\n"); if (descriptor_->extension_range_count() > 0) { - format("_extensions_.MergeFrom(from._extensions_);\n"); + format( + "_extensions_.MergeFrom(internal_default_instance(), " + "from._extensions_);\n"); } GenerateConstructorBody(printer, processed, true); @@ -2751,7 +3142,9 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { for (auto field : FieldRange(oneof)) { format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); - field_generators_.get(field).GenerateMergingCode(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateMergingCode(printer); + } format("break;\n"); format.Outdent(); format("}\n"); @@ -2776,34 +3169,36 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { GenerateSharedConstructorCode(printer); // Generate the destructor. - format( - "$classname$::~$classname$() {\n" - " // @@protoc_insertion_point(destructor:$full_name$)\n" - " SharedDtor();\n" - "}\n" - "\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "$classname$::~$classname$() {\n" + " // @@protoc_insertion_point(destructor:$full_name$)\n" + " if (GetArenaForAllocation() != nullptr) return;\n" + " SharedDtor();\n" + " _internal_metadata_.Delete<$unknown_fields_type$>();\n" + "}\n" + "\n"); + } else { + // For messages using simple base classes, having no destructor + // allows our vtable to share the same destructor as every other + // message with a simple base class. This works only as long as + // we have no fields needing destruction, of course. (No strings + // or extensions) + } // Generate the shared destructor code. GenerateSharedDestructorCode(printer); // Generate the arena-specific destructor code. - if (SupportsArenas(descriptor_)) { - GenerateArenaDestructorCode(printer); - } - - // Generate SetCachedSize. - format( - "void $classname$::SetCachedSize(int size) const {\n" - " _cached_size_.Set(size);\n" - "}\n"); + GenerateArenaDestructorCode(printer); - format( - "const $classname$& $classname$::default_instance() {\n" - " " - "::$proto_ns$::internal::InitSCC(&::$scc_info$.base)" - ";\n" - " return *internal_default_instance();\n" - "}\n\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + // Generate SetCachedSize. + format( + "void $classname$::SetCachedSize(int size) const {\n" + " _cached_size_.Set(size);\n" + "}\n"); + } } void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) { @@ -2812,14 +3207,16 @@ void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) { "template<> " "PROTOBUF_NOINLINE " "$classtype$* Arena::CreateMaybeMessage< $classtype$ >(Arena* arena) {\n" - " return Arena::$1$Internal< $classtype$ >(arena);\n" - "}\n", - MessageCreateFunction(descriptor_)); + " return Arena::CreateMessageInternal< $classtype$ >(arena);\n" + "}\n"); } void MessageGenerator::GenerateClear(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); - // Performance tuning parameters + + // The maximum number of bytes we will memset to zero without checking their + // hasbit to see if a zero-init is necessary. const int kMaxUnconditionalPrimitiveBytesClear = 4; format( @@ -2834,162 +3231,118 @@ void MessageGenerator::GenerateClear(io::Printer* printer) { "// Prevent compiler warnings about cached_has_bits being unused\n" "(void) cached_has_bits;\n\n"); - int cached_has_bit_index = -1; - - // Step 1: Extensions if (descriptor_->extension_range_count() > 0) { format("_extensions_.Clear();\n"); } - int unconditional_budget = kMaxUnconditionalPrimitiveBytesClear; - for (int i = 0; i < optimized_order_.size(); i++) { - const FieldDescriptor* field = optimized_order_[i]; - - if (!CanInitializeByZeroing(field)) { - continue; + // Collect fields into chunks. Each chunk may have an if() condition that + // checks all hasbits in the chunk and skips it if none are set. + int zero_init_bytes = 0; + for (const auto& field : optimized_order_) { + if (CanInitializeByZeroing(field)) { + zero_init_bytes += EstimateAlignmentSize(field); } - - unconditional_budget -= EstimateAlignmentSize(field); } + bool merge_zero_init = zero_init_bytes > kMaxUnconditionalPrimitiveBytesClear; + int chunk_count = 0; - std::vector> chunks_frag = CollectFields( + std::vector> chunks = CollectFields( optimized_order_, - MatchRepeatedAndHasByteAndZeroInits( - &has_bit_indices_, HasFieldPresence(descriptor_->file()))); + [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { + chunk_count++; + // This predicate guarantees that there is only a single zero-init + // (memset) per chunk, and if present it will be at the beginning. + bool same = HasByteIndex(a) == HasByteIndex(b) && + a->is_repeated() == b->is_repeated() && + (CanInitializeByZeroing(a) == CanInitializeByZeroing(b) || + (CanInitializeByZeroing(a) && + (chunk_count == 1 || merge_zero_init))); + if (!same) chunk_count = 0; + return same; + }); + + ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, kColdRatio); + int cached_has_word_index = -1; - // Merge next non-zero initializable chunk if it has the same has_byte index - // and not meeting unconditional clear condition. - std::vector> chunks; - if (!HasFieldPresence(descriptor_->file())) { - // Don't bother with merging without has_bit field. - chunks = chunks_frag; - } else { - // Note that only the next chunk is considered for merging. - for (int i = 0; i < chunks_frag.size(); i++) { - chunks.push_back(chunks_frag[i]); - const FieldDescriptor* field = chunks_frag[i].front(); - const FieldDescriptor* next_field = - (i + 1) < chunks_frag.size() ? chunks_frag[i + 1].front() : nullptr; - if (CanInitializeByZeroing(field) && - (chunks_frag[i].size() == 1 || unconditional_budget < 0) && - next_field != nullptr && - has_bit_indices_[field->index()] / 8 == - has_bit_indices_[next_field->index()] / 8) { - GOOGLE_CHECK(!CanInitializeByZeroing(next_field)); - // Insert next chunk to the current one and skip next chunk. - chunks.back().insert(chunks.back().end(), chunks_frag[i + 1].begin(), - chunks_frag[i + 1].end()); - i++; - } - } - } - - ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, kColdRatio, - HasFieldPresence(descriptor_->file())); for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { std::vector& chunk = chunks[chunk_index]; - GOOGLE_CHECK(!chunk.empty()); - - // Step 2: Repeated fields don't use _has_bits_; emit code to clear them - // here. - if (chunk.front()->is_repeated()) { - for (int i = 0; i < chunk.size(); i++) { - const FieldDescriptor* field = chunk[i]; - const FieldGenerator& generator = field_generators_.get(field); - - generator.GenerateMessageClearingCode(printer); - } - continue; - } - - cold_skipper.OnStartChunk(chunk_index, cached_has_bit_index, "", printer); + cold_skipper.OnStartChunk(chunk_index, cached_has_word_index, "", printer); - // Step 3: Non-repeated fields that can be cleared by memset-to-0, then - // non-repeated, non-zero initializable fields. - int last_chunk = HasFieldPresence(descriptor_->file()) - ? has_bit_indices_[chunk.front()->index()] / 8 - : 0; - int last_chunk_start = 0; - int memset_run_start = -1; - int memset_run_end = -1; + const FieldDescriptor* memset_start = nullptr; + const FieldDescriptor* memset_end = nullptr; + bool saw_non_zero_init = false; - for (int i = 0; i < chunk.size(); i++) { - const FieldDescriptor* field = chunk[i]; + for (const auto& field : chunk) { if (CanInitializeByZeroing(field)) { - if (memset_run_start == -1) { - memset_run_start = i; - } - memset_run_end = i; + GOOGLE_CHECK(!saw_non_zero_init); + if (!memset_start) memset_start = field; + memset_end = field; + } else { + saw_non_zero_init = true; } } - const bool have_outer_if = - HasFieldPresence(descriptor_->file()) && chunk.size() > 1 && - (memset_run_end != chunk.size() - 1 || unconditional_budget < 0); + // Whether we wrap this chunk in: + // if (cached_has_bits & 1 && + (memset_end != chunk.back() || merge_zero_init); if (have_outer_if) { - uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_); - const int count = popcnt(last_chunk_mask); + // Emit an if() that will let us skip the whole chunk if none are set. + uint32_t chunk_mask = GenChunkMask(chunk, has_bit_indices_); + std::string chunk_mask_str = + StrCat(strings::Hex(chunk_mask, strings::ZERO_PAD_8)); // Check (up to) 8 has_bits at a time if we have more than one field in // this chunk. Due to field layout ordering, we may check // _has_bits_[last_chunk * 8 / 32] multiple times. - GOOGLE_DCHECK_LE(2, count); - GOOGLE_DCHECK_GE(8, count); + GOOGLE_DCHECK_LE(2, popcnt(chunk_mask)); + GOOGLE_DCHECK_GE(8, popcnt(chunk_mask)); - if (cached_has_bit_index != last_chunk / 4) { - cached_has_bit_index = last_chunk / 4; - format("cached_has_bits = _has_bits_[$1$];\n", cached_has_bit_index); + if (cached_has_word_index != HasWordIndex(chunk.front())) { + cached_has_word_index = HasWordIndex(chunk.front()); + format("cached_has_bits = _has_bits_[$1$];\n", cached_has_word_index); } - format("if (cached_has_bits & 0x$1$u) {\n", - StrCat(strings::Hex(last_chunk_mask, strings::ZERO_PAD_8))); + format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); format.Indent(); } - if (memset_run_start != -1) { - if (memset_run_start == memset_run_end) { + if (memset_start) { + if (memset_start == memset_end) { // For clarity, do not memset a single field. - const FieldGenerator& generator = - field_generators_.get(chunk[memset_run_start]); - generator.GenerateMessageClearingCode(printer); + field_generators_.get(memset_start) + .GenerateMessageClearingCode(printer); } else { - const std::string first_field_name = FieldName(chunk[memset_run_start]); - const std::string last_field_name = FieldName(chunk[memset_run_end]); - format( "::memset(&$1$_, 0, static_cast(\n" " reinterpret_cast(&$2$_) -\n" " reinterpret_cast(&$1$_)) + sizeof($2$_));\n", - first_field_name, last_field_name); + FieldName(memset_start), FieldName(memset_end)); } - - // Advance last_chunk_start to skip over the fields we zeroed/memset. - last_chunk_start = memset_run_end + 1; } - // Go back and emit clears for each of the fields we processed. - for (int j = last_chunk_start; j < chunk.size(); j++) { - const FieldDescriptor* field = chunk[j]; - const FieldGenerator& generator = field_generators_.get(field); - + // Clear all non-zero-initializable fields in the chunk. + for (const auto& field : chunk) { + if (CanInitializeByZeroing(field)) continue; // It's faster to just overwrite primitive types, but we should only // clear strings and messages if they were set. // // TODO(kenton): Let the CppFieldGenerator decide this somehow. - bool should_check_bit = - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - field->cpp_type() == FieldDescriptor::CPPTYPE_STRING; + bool have_enclosing_if = + HasBitIndex(field) != kNoHasbit && + (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || + field->cpp_type() == FieldDescriptor::CPPTYPE_STRING); - bool have_enclosing_if = false; - if (should_check_bit && - // If no field presence, then always clear strings/messages as well. - HasFieldPresence(descriptor_->file())) { + if (have_enclosing_if) { PrintPresenceCheck(format, field, has_bit_indices_, printer, - &cached_has_bit_index); - have_enclosing_if = true; + &cached_has_word_index); } - generator.GenerateMessageClearingCode(printer); + field_generators_.get(field).GenerateMessageClearingCode(printer); if (have_enclosing_if) { format.Outdent(); @@ -3004,7 +3357,7 @@ void MessageGenerator::GenerateClear(io::Printer* printer) { if (cold_skipper.OnEndChunk(chunk_index, printer)) { // Reset here as it may have been updated in just closed if statement. - cached_has_bit_index = -1; + cached_has_word_index = -1; } } @@ -3017,12 +3370,17 @@ void MessageGenerator::GenerateClear(io::Printer* printer) { format("_weak_field_map_.ClearAll();\n"); } - if (HasFieldPresence(descriptor_->file())) { + // We don't clear donated status. + + if (!has_bit_indices_.empty()) { // Step 5: Everything else. format("_has_bits_.Clear();\n"); } - format("_internal_metadata_.Clear();\n"); + std::map vars; + SetUnknownFieldsVariable(descriptor_, options_, &vars); + format.AddMap(vars); + format("_internal_metadata_.Clear<$unknown_fields_type$>();\n"); format.Outdent(); format("}\n"); @@ -3030,8 +3388,8 @@ void MessageGenerator::GenerateClear(io::Printer* printer) { void MessageGenerator::GenerateOneofClear(io::Printer* printer) { // Generated function clears the active field and union case (e.g. foo_case_). - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - auto oneof = descriptor_->oneof_decl(i); + int i = 0; + for (auto oneof : OneOfRange(descriptor_)) { Formatter format(printer, variables_); format.Set("oneofname", oneof->name()); @@ -3045,7 +3403,7 @@ void MessageGenerator::GenerateOneofClear(io::Printer* printer) { format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); // We clear only allocated objects in oneofs - if (!IsStringOrMessage(field)) { + if (!IsStringOrMessage(field) || IsFieldStripped(field, options_)) { format("// No need to clear\n"); } else { field_generators_.get(field).GenerateClearingCode(printer); @@ -3068,10 +3426,12 @@ void MessageGenerator::GenerateOneofClear(io::Printer* printer) { format( "}\n" "\n"); + i++; } } void MessageGenerator::GenerateSwap(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("void $classname$::InternalSwap($classname$* other) {\n"); @@ -3080,29 +3440,68 @@ void MessageGenerator::GenerateSwap(io::Printer* printer) { if (HasGeneratedMethods(descriptor_->file(), options_)) { if (descriptor_->extension_range_count() > 0) { - format("_extensions_.Swap(&other->_extensions_);\n"); + format("_extensions_.InternalSwap(&other->_extensions_);\n"); } - format("_internal_metadata_.Swap(&other->_internal_metadata_);\n"); + std::map vars; + SetUnknownFieldsVariable(descriptor_, options_, &vars); + format.AddMap(vars); + if (HasSingularString(descriptor_, options_)) { + format( + "auto* lhs_arena = GetArenaForAllocation();\n" + "auto* rhs_arena = other->GetArenaForAllocation();\n"); + } + format("_internal_metadata_.InternalSwap(&other->_internal_metadata_);\n"); - if (HasFieldPresence(descriptor_->file())) { - for (int i = 0; i < HasBitsSize() / 4; ++i) { + if (!has_bit_indices_.empty()) { + for (int i = 0; i < HasBitsSize(); ++i) { format("swap(_has_bits_[$1$], other->_has_bits_[$1$]);\n", i); } } - for (int i = 0; i < optimized_order_.size(); i++) { - // optimized_order_ does not contain oneof fields, but the field - // generators for these fields do not emit swapping code on their own. + // If possible, we swap several fields at once, including padding. + const RunMap runs = + FindRuns(optimized_order_, [this](const FieldDescriptor* field) { + return CanBeManipulatedAsRawBytes(field, options_, scc_analyzer_); + }); + + for (int i = 0; i < optimized_order_.size(); ++i) { const FieldDescriptor* field = optimized_order_[i]; - field_generators_.get(field).GenerateSwappingCode(printer); + const auto it = runs.find(field); + + // We only apply the memswap technique to runs of more than one field, as + // `swap(field_, other.field_)` is better than + // `memswap<...>(&field_, &other.field_)` for generated code readability. + if (it != runs.end() && it->second > 1) { + // Use a memswap, then skip run_length fields. + const size_t run_length = it->second; + const std::string first_field_name = FieldName(field); + const std::string last_field_name = + FieldName(optimized_order_[i + run_length - 1]); + + format.Set("first", first_field_name); + format.Set("last", last_field_name); + + format( + "::PROTOBUF_NAMESPACE_ID::internal::memswap<\n" + " PROTOBUF_FIELD_OFFSET($classname$, $last$_)\n" + " + sizeof($classname$::$last$_)\n" + " - PROTOBUF_FIELD_OFFSET($classname$, $first$_)>(\n" + " reinterpret_cast(&$first$_),\n" + " reinterpret_cast(&other->$first$_));\n"); + + i += run_length - 1; + // ++i at the top of the loop. + } else { + field_generators_.get(field).GenerateSwappingCode(printer); + } } for (auto oneof : OneOfRange(descriptor_)) { format("swap($1$_, other->$1$_);\n", oneof->name()); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { format("swap(_oneof_case_[$1$], other->_oneof_case_[$1$]);\n", i); } @@ -3119,143 +3518,152 @@ void MessageGenerator::GenerateSwap(io::Printer* printer) { void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { Formatter format(printer, variables_); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - // Generate the generalized MergeFrom (aka that which takes in the Message - // base class as a parameter). - format( - "void $classname$::MergeFrom(const ::$proto_ns$::Message& from) {\n" - "// @@protoc_insertion_point(generalized_merge_from_start:" - "$full_name$)\n" - " $DCHK$_NE(&from, this);\n"); - format.Indent(); - - // Cast the message to the proper type. If we find that the message is - // *not* of the proper type, we can still call Merge via the reflection - // system, as the GOOGLE_CHECK above ensured that we have the same descriptor - // for each message. - format( - "const $classname$* source =\n" - " ::$proto_ns$::DynamicCastToGenerated<$classname$>(\n" - " &from);\n" - "if (source == nullptr) {\n" - "// @@protoc_insertion_point(generalized_merge_from_cast_fail:" - "$full_name$)\n" - " ::$proto_ns$::internal::ReflectionOps::Merge(from, this);\n" - "} else {\n" - "// @@protoc_insertion_point(generalized_merge_from_cast_success:" - "$full_name$)\n" - " MergeFrom(*source);\n" - "}\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + if (HasDescriptorMethods(descriptor_->file(), options_)) { + // We don't override the generalized MergeFrom (aka that which + // takes in the Message base class as a parameter); instead we just + // let the base Message::MergeFrom take care of it. The base MergeFrom + // knows how to quickly confirm the types exactly match, and if so, will + // use GetClassData() to retrieve the address of MergeImpl, which calls + // the fast MergeFrom overload. Most callers avoid all this by passing + // a "from" message that is the same type as the message being merged + // into, rather than a generic Message. - format.Outdent(); - format("}\n\n"); + format( + "const ::$proto_ns$::Message::ClassData " + "$classname$::_class_data_ = {\n" + " ::$proto_ns$::Message::CopyWithSizeCheck,\n" + " $classname$::MergeImpl\n" + "};\n" + "const ::$proto_ns$::Message::ClassData*" + "$classname$::GetClassData() const { return &_class_data_; }\n" + "\n" + "void $classname$::MergeImpl(::$proto_ns$::Message* to,\n" + " const ::$proto_ns$::Message& from) {\n" + " static_cast<$classname$ *>(to)->MergeFrom(\n" + " static_cast(from));\n" + "}\n" + "\n"); + } else { + // Generate CheckTypeAndMergeFrom(). + format( + "void $classname$::CheckTypeAndMergeFrom(\n" + " const ::$proto_ns$::MessageLite& from) {\n" + " MergeFrom(*::$proto_ns$::internal::DownCast(\n" + " &from));\n" + "}\n"); + } } else { - // Generate CheckTypeAndMergeFrom(). + // In the simple case, we just define ClassData that vectors back to the + // simple implementation of Copy and Merge. format( - "void $classname$::CheckTypeAndMergeFrom(\n" - " const ::$proto_ns$::MessageLite& from) {\n" - " MergeFrom(*::$proto_ns$::internal::DownCast(\n" - " &from));\n" - "}\n" + "const ::$proto_ns$::Message::ClassData " + "$classname$::_class_data_ = {\n" + " $superclass$::CopyImpl,\n" + " $superclass$::MergeImpl,\n" + "};\n" + "const ::$proto_ns$::Message::ClassData*" + "$classname$::GetClassData() const { return &_class_data_; }\n" + "\n" "\n"); } +} +void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; // Generate the class-specific MergeFrom, which avoids the GOOGLE_CHECK and cast. + Formatter format(printer, variables_); format( "void $classname$::MergeFrom(const $classname$& from) {\n" + "$annotate_mergefrom$" "// @@protoc_insertion_point(class_specific_merge_from_start:" "$full_name$)\n" " $DCHK$_NE(&from, this);\n"); format.Indent(); - if (descriptor_->extension_range_count() > 0) { - format("_extensions_.MergeFrom(from._extensions_);\n"); - } - format( - "_internal_metadata_.MergeFrom(from._internal_metadata_);\n" "$uint32$ cached_has_bits = 0;\n" "(void) cached_has_bits;\n\n"); - if (HasFieldPresence(descriptor_->file())) { - std::vector> chunks = CollectFields( - optimized_order_, MatchRepeatedAndHasByte(&has_bit_indices_, true)); - - ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, - kColdRatio, true); + std::vector> chunks = CollectFields( + optimized_order_, + [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { + return HasByteIndex(a) == HasByteIndex(b); + }); - // cached_has_bit_index maintains that: - // cached_has_bits = from._has_bits_[cached_has_bit_index] - // for cached_has_bit_index >= 0 - int cached_has_bit_index = -1; + ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, kColdRatio); - for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { - const std::vector& chunk = chunks[chunk_index]; - GOOGLE_CHECK(!chunk.empty()); + // cached_has_word_index maintains that: + // cached_has_bits = from._has_bits_[cached_has_word_index] + // for cached_has_word_index >= 0 + int cached_has_word_index = -1; - // Merge Repeated fields. These fields do not require a - // check as we can simply iterate over them. - if (chunk.front()->is_repeated()) { - for (int i = 0; i < chunk.size(); i++) { - const FieldDescriptor* field = chunk[i]; + for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { + const std::vector& chunk = chunks[chunk_index]; + bool have_outer_if = + chunk.size() > 1 && HasByteIndex(chunk.front()) != kNoHasbit; + cold_skipper.OnStartChunk(chunk_index, cached_has_word_index, "from.", + printer); - const FieldGenerator& generator = field_generators_.get(field); - generator.GenerateMergingCode(printer); - } - continue; - } + if (have_outer_if) { + // Emit an if() that will let us skip the whole chunk if none are set. + uint32_t chunk_mask = GenChunkMask(chunk, has_bit_indices_); + std::string chunk_mask_str = + StrCat(strings::Hex(chunk_mask, strings::ZERO_PAD_8)); - // Merge Optional and Required fields (after a _has_bit_ check). - cold_skipper.OnStartChunk(chunk_index, cached_has_bit_index, "from.", - printer); + // Check (up to) 8 has_bits at a time if we have more than one field in + // this chunk. Due to field layout ordering, we may check + // _has_bits_[last_chunk * 8 / 32] multiple times. + GOOGLE_DCHECK_LE(2, popcnt(chunk_mask)); + GOOGLE_DCHECK_GE(8, popcnt(chunk_mask)); - int last_chunk = has_bit_indices_[chunk.front()->index()] / 8; - GOOGLE_DCHECK_NE(-1, last_chunk); + if (cached_has_word_index != HasWordIndex(chunk.front())) { + cached_has_word_index = HasWordIndex(chunk.front()); + format("cached_has_bits = from._has_bits_[$1$];\n", + cached_has_word_index); + } - const bool have_outer_if = chunk.size() > 1; - if (have_outer_if) { - uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_); - const int count = popcnt(last_chunk_mask); + format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); + format.Indent(); + } - // Check (up to) 8 has_bits at a time if we have more than one field in - // this chunk. Due to field layout ordering, we may check - // _has_bits_[last_chunk * 8 / 32] multiple times. - GOOGLE_DCHECK_LE(2, count); - GOOGLE_DCHECK_GE(8, count); + // Go back and emit merging code for each of the fields we processed. + bool deferred_has_bit_changes = false; + for (const auto field : chunk) { + const FieldGenerator& generator = field_generators_.get(field); - if (cached_has_bit_index != last_chunk / 4) { - cached_has_bit_index = last_chunk / 4; - format("cached_has_bits = from._has_bits_[$1$];\n", - cached_has_bit_index); + if (field->is_repeated()) { + generator.GenerateMergingCode(printer); + } else if (field->is_optional() && !HasHasbit(field)) { + // Merge semantics without true field presence: primitive fields are + // merged only if non-zero (numeric) or non-empty (string). + bool have_enclosing_if = + EmitFieldNonDefaultCondition(printer, "from.", field); + generator.GenerateMergingCode(printer); + if (have_enclosing_if) { + format.Outdent(); + format("}\n"); } - format("if (cached_has_bits & 0x$1$u) {\n", - StrCat(strings::Hex(last_chunk_mask, strings::ZERO_PAD_8))); + } else if (field->options().weak() || + cached_has_word_index != HasWordIndex(field)) { + // Check hasbit, not using cached bits. + GOOGLE_CHECK(HasHasbit(field)); + format("if (from._internal_has_$1$()) {\n", FieldName(field)); format.Indent(); - } - - // Go back and emit merging code for each of the fields we processed. - bool deferred_has_bit_changes = false; - for (const auto field : chunk) { - const FieldGenerator& generator = field_generators_.get(field); - - // Attempt to use the state of cached_has_bits, if possible. + generator.GenerateMergingCode(printer); + format.Outdent(); + format("}\n"); + } else { + // Check hasbit, using cached bits. + GOOGLE_CHECK(HasHasbit(field)); int has_bit_index = has_bit_indices_[field->index()]; - if (!field->options().weak() && - cached_has_bit_index == has_bit_index / 32) { - const std::string mask = StrCat( - strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); - - format("if (cached_has_bits & 0x$1$u) {\n", mask); - } else { - format("if (from._internal_has_$1$()) {\n", FieldName(field)); - } + const std::string mask = StrCat( + strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); + format("if (cached_has_bits & 0x$1$u) {\n", mask); format.Indent(); if (have_outer_if && IsPOD(field)) { - // GenerateCopyConstructorCode for enum and primitive scalar fields - // does not do _has_bits_ modifications. We defer _has_bits_ - // manipulation until the end of the outer if. - // + // Defer hasbit modification until the end of chunk. // This can reduce the number of loads/stores by up to 7 per 8 fields. deferred_has_bit_changes = true; generator.GenerateCopyConstructorCode(printer); @@ -3266,38 +3674,22 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { format.Outdent(); format("}\n"); } + } - if (have_outer_if) { - if (deferred_has_bit_changes) { - // Flush the has bits for the primitives we deferred. - GOOGLE_CHECK_LE(0, cached_has_bit_index); - format("_has_bits_[$1$] |= cached_has_bits;\n", cached_has_bit_index); - } - - format.Outdent(); - format("}\n"); + if (have_outer_if) { + if (deferred_has_bit_changes) { + // Flush the has bits for the primitives we deferred. + GOOGLE_CHECK_LE(0, cached_has_word_index); + format("_has_bits_[$1$] |= cached_has_bits;\n", cached_has_word_index); } - if (cold_skipper.OnEndChunk(chunk_index, printer)) { - // Reset here as it may have been updated in just closed if statement. - cached_has_bit_index = -1; - } + format.Outdent(); + format("}\n"); } - } else { - // proto3 - for (const auto field : optimized_order_) { - const FieldGenerator& generator = field_generators_.get(field); - // Merge semantics without true field presence: primitive fields are - // merged only if non-zero (numeric) or non-empty (string). - bool have_enclosing_if = - EmitFieldNonDefaultCondition(printer, "from.", field); - generator.GenerateMergingCode(printer); - - if (have_enclosing_if) { - format.Outdent(); - format("}\n"); - } + if (cold_skipper.OnEndChunk(chunk_index, printer)) { + // Reset here as it may have been updated in just closed if statement. + cached_has_word_index = -1; } } @@ -3308,7 +3700,9 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { for (auto field : FieldRange(oneof)) { format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); - field_generators_.get(field).GenerateMergingCode(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateMergingCode(printer); + } format("break;\n"); format.Outdent(); format("}\n"); @@ -3325,45 +3719,36 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { format("_weak_field_map_.MergeFrom(from._weak_field_map_);\n"); } + // Merging of extensions and unknown fields is done last, to maximize + // the opportunity for tail calls. + if (descriptor_->extension_range_count() > 0) { + format( + "_extensions_.MergeFrom(internal_default_instance(), " + "from._extensions_);\n"); + } + + format( + "_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._internal_" + "metadata_);\n"); + format.Outdent(); format("}\n"); } void MessageGenerator::GenerateCopyFrom(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (HasDescriptorMethods(descriptor_->file(), options_)) { - // Generate the generalized CopyFrom (aka that which takes in the Message - // base class as a parameter). - format( - "void $classname$::CopyFrom(const ::$proto_ns$::Message& from) {\n" - "// @@protoc_insertion_point(generalized_copy_from_start:" - "$full_name$)\n"); - format.Indent(); - - format("if (&from == this) return;\n"); - - if (!options_.opensource_runtime) { - // This check is disabled in the opensource release because we're - // concerned that many users do not define NDEBUG in their release - // builds. - format( - "#ifndef NDEBUG\n" - "size_t from_size = from.ByteSizeLong();\n" - "#endif\n" - "Clear();\n" - "#ifndef NDEBUG\n" - "$CHK$_EQ(from_size, from.ByteSizeLong())\n" - " << \"Source of CopyFrom changed when clearing target. Either \"\n" - " << \"source is a nested message in target (not allowed), or \"\n" - " << \"another thread is modifying the source.\";\n" - "#endif\n"); - } else { - format("Clear();\n"); - } - format("MergeFrom(from);\n"); - - format.Outdent(); - format("}\n\n"); + // We don't override the generalized CopyFrom (aka that which + // takes in the Message base class as a parameter); instead we just + // let the base Message::CopyFrom take care of it. The base MergeFrom + // knows how to quickly confirm the types exactly match, and if so, will + // use GetClassData() to get the address of Message::CopyWithSizeCheck, + // which calls Clear() and then MergeFrom(), as well as making sure that + // clearing the destination message doesn't alter the size of the source, + // when in debug builds. + // Most callers avoid this by passing a "from" message that is the same + // type as the message being merged into, rather than a generic Message. } // Generate the class-specific CopyFrom. @@ -3386,8 +3771,8 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* printer) { "#ifndef NDEBUG\n" "$CHK$_EQ(from_size, from.ByteSizeLong())\n" " << \"Source of CopyFrom changed when clearing target. Either \"\n" - " << \"source is a nested message in target (not allowed), or \"\n" - " << \"another thread is modifying the source.\";\n" + " \"source is a nested message in target (not allowed), or \"\n" + " \"another thread is modifying the source.\";\n" "#endif\n"); } else { format("Clear();\n"); @@ -3398,22 +3783,7 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* printer) { format("}\n"); } -void MessageGenerator::GenerateMergeFromCodedStream(io::Printer* printer) { - std::map vars = variables_; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); - Formatter format(printer, vars); - if (descriptor_->options().message_set_wire_format()) { - // Special-case MessageSet. - format( - "const char* $classname$::_InternalParse(const char* ptr,\n" - " ::$proto_ns$::internal::ParseContext* ctx) {\n" - " return _extensions_.ParseMessageSet(ptr, \n" - " internal_default_instance(), &_internal_metadata_, ctx);\n" - "}\n"); - return; - } - GenerateParserLoop(descriptor_, max_has_bit_index_, options_, scc_analyzer_, - printer); +void MessageGenerator::GenerateVerify(io::Printer* printer) { } void MessageGenerator::GenerateSerializeOneofFields( @@ -3455,9 +3825,9 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* printer, bool have_enclosing_if = false; if (field->options().weak()) { - } else if (!field->is_repeated() && HasFieldPresence(descriptor_->file())) { + } else if (HasHasbit(field)) { // Attempt to use the state of cached_has_bits, if possible. - int has_bit_index = has_bit_indices_[field->index()]; + int has_bit_index = HasBitIndex(field); if (cached_has_bits_index == has_bit_index / 32) { const std::string mask = StrCat(strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8)); @@ -3469,7 +3839,7 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* printer, format.Indent(); have_enclosing_if = true; - } else if (!HasFieldPresence(descriptor_->file())) { + } else if (field->is_optional() && !HasHasbit(field)) { have_enclosing_if = EmitFieldNonDefaultCondition(printer, "this->", field); } @@ -3491,11 +3861,12 @@ void MessageGenerator::GenerateSerializeOneExtensionRange( format("// Extension range [$start$, $end$)\n"); format( "target = _extensions_._InternalSerialize(\n" - " $start$, $end$, target, stream);\n\n"); + "internal_default_instance(), $start$, $end$, target, stream);\n\n"); } void MessageGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. @@ -3503,10 +3874,12 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray( "$uint8$* $classname$::_InternalSerialize(\n" " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " "const {\n" + "$annotate_serialize$" " target = _extensions_." - "InternalSerializeMessageSetWithCachedSizesToArray(target, stream);\n"); + "InternalSerializeMessageSetWithCachedSizesToArray(\n" // + "internal_default_instance(), target, stream);\n"); std::map vars; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); + SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); format( " target = ::$proto_ns$::internal::" @@ -3521,13 +3894,32 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray( format( "$uint8$* $classname$::_InternalSerialize(\n" " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "const {\n"); + "const {\n" + "$annotate_serialize$"); format.Indent(); format("// @@protoc_insertion_point(serialize_to_array_start:$full_name$)\n"); + if (!ShouldSerializeInOrder(descriptor_, options_)) { + format.Outdent(); + format("#ifdef NDEBUG\n"); + format.Indent(); + } + GenerateSerializeWithCachedSizesBody(printer); + if (!ShouldSerializeInOrder(descriptor_, options_)) { + format.Outdent(); + format("#else // NDEBUG\n"); + format.Indent(); + + GenerateSerializeWithCachedSizesBodyShuffled(printer); + + format.Outdent(); + format("#endif // !NDEBUG\n"); + format.Indent(); + } + format("// @@protoc_insertion_point(serialize_to_array_end:$full_name$)\n"); format.Outdent(); @@ -3538,6 +3930,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray( void MessageGenerator::GenerateSerializeWithCachedSizesBody( io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); // If there are multiple fields in a row from the same oneof then we // coalesce them and emit a switch statement. This is more efficient @@ -3549,8 +3942,8 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( LazySerializerEmitter(MessageGenerator* mg, io::Printer* printer) : mg_(mg), format_(printer), - eager_(!HasFieldPresence(mg->descriptor_->file())), - cached_has_bit_index_(-1) {} + eager_(IsProto3(mg->descriptor_->file())), + cached_has_bit_index_(kNoHasbit) {} ~LazySerializerEmitter() { Flush(); } @@ -3560,7 +3953,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( if (eager_ || MustFlush(field)) { Flush(); } - if (field->containing_oneof() == NULL) { + if (!field->real_containing_oneof()) { // TODO(ckennelly): Defer non-oneof fields similarly to oneof fields. if (!field->options().weak() && !field->is_repeated() && !eager_) { @@ -3585,6 +3978,12 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( } } + void EmitIfNotNull(const FieldDescriptor* field) { + if (field != nullptr) { + Emit(field); + } + } + void Flush() { if (!v_.empty()) { mg_->GenerateSerializeOneofFields(format_.printer(), v_); @@ -3611,6 +4010,61 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( int cached_has_bit_index_; }; + class LazyExtensionRangeEmitter { + public: + LazyExtensionRangeEmitter(MessageGenerator* mg, io::Printer* printer) + : mg_(mg), format_(printer) {} + + void AddToRange(const Descriptor::ExtensionRange* range) { + if (!has_current_range_) { + current_combined_range_ = *range; + has_current_range_ = true; + } else { + current_combined_range_.start = + std::min(current_combined_range_.start, range->start); + current_combined_range_.end = + std::max(current_combined_range_.end, range->end); + } + } + + void Flush() { + if (has_current_range_) { + mg_->GenerateSerializeOneExtensionRange(format_.printer(), + ¤t_combined_range_); + } + has_current_range_ = false; + } + + private: + MessageGenerator* mg_; + Formatter format_; + bool has_current_range_ = false; + Descriptor::ExtensionRange current_combined_range_; + }; + + // We need to track the largest weak field, because weak fields are serialized + // differently than normal fields. The WeakFieldMap::FieldWriter will + // serialize all weak fields that are ordinally between the last serialized + // weak field and the current field. In order to guarantee that all weak + // fields are serialized, we need to make sure to emit the code to serialize + // the largest weak field present at some point. + class LargestWeakFieldHolder { + public: + const FieldDescriptor* Release() { + const FieldDescriptor* result = field_; + field_ = nullptr; + return result; + } + void ReplaceIfLarger(const FieldDescriptor* field) { + if (field_ == nullptr || field_->number() < field->number()) { + field_ = field; + } + } + + private: + const FieldDescriptor* field_ = nullptr; + }; + std::vector ordered_fields = SortFieldsByNumber(descriptor_); @@ -3634,7 +4088,8 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( // Merge the fields and the extension ranges, both sorted by field number. { LazySerializerEmitter e(this, printer); - const FieldDescriptor* last_weak_field = nullptr; + LazyExtensionRangeEmitter re(this, printer); + LargestWeakFieldHolder largest_weak_field; int i, j; for (i = 0, j = 0; i < ordered_fields.size() || j < sorted_extensions.size();) { @@ -3642,32 +4097,29 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( (i < descriptor_->field_count() && ordered_fields[i]->number() < sorted_extensions[j]->start)) { const FieldDescriptor* field = ordered_fields[i++]; + if (IsFieldStripped(field, options_)) { + continue; + } + re.Flush(); if (field->options().weak()) { - last_weak_field = field; + largest_weak_field.ReplaceIfLarger(field); PrintFieldComment(format, field); } else { - if (last_weak_field != nullptr) { - e.Emit(last_weak_field); - last_weak_field = nullptr; - } + e.EmitIfNotNull(largest_weak_field.Release()); e.Emit(field); } } else { - if (last_weak_field != nullptr) { - e.Emit(last_weak_field); - last_weak_field = nullptr; - } + e.EmitIfNotNull(largest_weak_field.Release()); e.Flush(); - GenerateSerializeOneExtensionRange(printer, sorted_extensions[j++]); + re.AddToRange(sorted_extensions[j++]); } } - if (last_weak_field != nullptr) { - e.Emit(last_weak_field); - } + re.Flush(); + e.EmitIfNotNull(largest_weak_field.Release()); } std::map vars; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); + SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); format.Indent(); @@ -3686,9 +4138,101 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( format("}\n"); } -std::vector MessageGenerator::RequiredFieldsBitMask() const { +void MessageGenerator::GenerateSerializeWithCachedSizesBodyShuffled( + io::Printer* printer) { + Formatter format(printer, variables_); + + std::vector ordered_fields = + SortFieldsByNumber(descriptor_); + ordered_fields.erase( + std::remove_if(ordered_fields.begin(), ordered_fields.end(), + [this](const FieldDescriptor* f) { + return !IsFieldUsed(f, options_); + }), + ordered_fields.end()); + + std::vector sorted_extensions; + sorted_extensions.reserve(descriptor_->extension_range_count()); + for (int i = 0; i < descriptor_->extension_range_count(); ++i) { + sorted_extensions.push_back(descriptor_->extension_range(i)); + } + std::sort(sorted_extensions.begin(), sorted_extensions.end(), + ExtensionRangeSorter()); + + int num_fields = ordered_fields.size() + sorted_extensions.size(); + constexpr int kLargePrime = 1000003; + GOOGLE_CHECK_LT(num_fields, kLargePrime) + << "Prime offset must be greater than the number of fields to ensure " + "those are coprime."; + + if (num_weak_fields_) { + format( + "::$proto_ns$::internal::WeakFieldMap::FieldWriter field_writer(" + "_weak_field_map_);\n"); + } + + format("for (int i = $1$; i >= 0; i-- ) {\n", num_fields - 1); + + format.Indent(); + format("switch(i) {\n"); + format.Indent(); + + int index = 0; + for (const auto* f : ordered_fields) { + format("case $1$: {\n", index++); + format.Indent(); + + GenerateSerializeOneField(printer, f, -1); + + format("break;\n"); + format.Outdent(); + format("}\n"); + } + + for (const auto* r : sorted_extensions) { + format("case $1$: {\n", index++); + format.Indent(); + + GenerateSerializeOneExtensionRange(printer, r); + + format("break;\n"); + format.Outdent(); + format("}\n"); + } + + format( + "default: {\n" + " $DCHK$(false) << \"Unexpected index: \" << i;\n" + "}\n"); + format.Outdent(); + format("}\n"); + + format.Outdent(); + format("}\n"); + + std::map vars; + SetUnknownFieldsVariable(descriptor_, options_, &vars); + format.AddMap(vars); + format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); + format.Indent(); + if (UseUnknownFieldSet(descriptor_->file(), options_)) { + format( + "target = " + "::$proto_ns$::internal::WireFormat::" + "InternalSerializeUnknownFieldsToArray(\n" + " $unknown_fields$, target, stream);\n"); + } else { + format( + "target = stream->WriteRaw($unknown_fields$.data(),\n" + " static_cast($unknown_fields$.size()), target);\n"); + } + format.Outdent(); + format("}\n"); +} + +std::vector MessageGenerator::RequiredFieldsBitMask() const { const int array_size = HasBitsSize(); - std::vector masks(array_size, 0); + std::vector masks(array_size, 0); for (auto field : FieldRange(descriptor_)) { if (!field->is_required()) { @@ -3696,44 +4240,24 @@ std::vector MessageGenerator::RequiredFieldsBitMask() const { } const int has_bit_index = has_bit_indices_[field->index()]; - masks[has_bit_index / 32] |= static_cast(1) << (has_bit_index % 32); + masks[has_bit_index / 32] |= static_cast(1) + << (has_bit_index % 32); } return masks; } -// Create an expression that evaluates to -// "for all i, (_has_bits_[i] & masks[i]) == masks[i]" -// masks is allowed to be shorter than _has_bits_, but at least one element of -// masks must be non-zero. -static std::string ConditionalToCheckBitmasks( - const std::vector& masks) { - std::vector parts; - for (int i = 0; i < masks.size(); i++) { - if (masks[i] == 0) continue; - std::string m = StrCat("0x", strings::Hex(masks[i], strings::ZERO_PAD_8)); - // Each xor evaluates to 0 if the expected bits are present. - parts.push_back( - StrCat("((_has_bits_[", i, "] & ", m, ") ^ ", m, ")")); - } - GOOGLE_CHECK(!parts.empty()); - // If we have multiple parts, each expected to be 0, then bitwise-or them. - std::string result = - parts.size() == 1 - ? parts[0] - : StrCat("(", Join(parts, "\n | "), ")"); - return result + " == 0"; -} - void MessageGenerator::GenerateByteSize(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. std::map vars; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); + SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); format( "size_t $classname$::ByteSizeLong() const {\n" + "$annotate_bytesize$" "// @@protoc_insertion_point(message_set_byte_size_start:$full_name$)\n" " size_t total_size = _extensions_.MessageSetByteSize();\n" " if ($have_unknown_fields$) {\n" @@ -3748,7 +4272,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { return; } - if (num_required_fields_ > 1 && HasFieldPresence(descriptor_->file())) { + if (num_required_fields_ > 1) { // Emit a function (rarely used, we hope) that handles the required fields // by checking for each one individually. format( @@ -3779,6 +4303,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { format( "size_t $classname$::ByteSizeLong() const {\n" + "$annotate_bytesize$" "// @@protoc_insertion_point(message_byte_size_start:$full_name$)\n"); format.Indent(); format( @@ -3792,15 +4317,15 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { } std::map vars; - SetUnknkownFieldsVariable(descriptor_, options_, &vars); + SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); // Handle required fields (if any). We expect all of them to be // present, so emit one conditional that checks for that. If they are all // present then the fast path executes; otherwise the slow path executes. - if (num_required_fields_ > 1 && HasFieldPresence(descriptor_->file())) { + if (num_required_fields_ > 1) { // The fast path works if all required fields are present. - const std::vector masks_for_has_bits = RequiredFieldsBitMask(); + const std::vector masks_for_has_bits = RequiredFieldsBitMask(); format("if ($1$) { // All required fields are present.\n", ConditionalToCheckBitmasks(masks_for_has_bits)); format.Indent(); @@ -3832,75 +4357,45 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { std::vector> chunks = CollectFields( optimized_order_, - MatchRepeatedAndHasByteAndRequired( - &has_bit_indices_, HasFieldPresence(descriptor_->file()))); + [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { + return a->label() == b->label() && HasByteIndex(a) == HasByteIndex(b); + }); // Remove chunks with required fields. chunks.erase(std::remove_if(chunks.begin(), chunks.end(), IsRequired), chunks.end()); - ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, kColdRatio, - HasFieldPresence(descriptor_->file())); + ColdChunkSkipper cold_skipper(options_, chunks, has_bit_indices_, kColdRatio); + int cached_has_word_index = -1; format( "$uint32$ cached_has_bits = 0;\n" "// Prevent compiler warnings about cached_has_bits being unused\n" "(void) cached_has_bits;\n\n"); - int cached_has_bit_index = -1; - for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) { const std::vector& chunk = chunks[chunk_index]; - GOOGLE_CHECK(!chunk.empty()); - - // Handle repeated fields. - if (chunk.front()->is_repeated()) { - for (int i = 0; i < chunk.size(); i++) { - const FieldDescriptor* field = chunk[i]; - - PrintFieldComment(format, field); - const FieldGenerator& generator = field_generators_.get(field); - generator.GenerateByteSize(printer); - format("\n"); - } - continue; - } - - cold_skipper.OnStartChunk(chunk_index, cached_has_bit_index, "", printer); - - // Handle optional (non-repeated/oneof) fields. - // - // These are handled in chunks of 8. The first chunk is - // the non-requireds-non-repeateds-non-unions-non-extensions in - // descriptor_->field(0), descriptor_->field(1), ... descriptor_->field(7), - // and the second chunk is the same for - // descriptor_->field(8), descriptor_->field(9), ... - // descriptor_->field(15), - // etc. - int last_chunk = HasFieldPresence(descriptor_->file()) - ? has_bit_indices_[chunk.front()->index()] / 8 - : 0; - GOOGLE_DCHECK_NE(-1, last_chunk); - const bool have_outer_if = - HasFieldPresence(descriptor_->file()) && chunk.size() > 1; + chunk.size() > 1 && HasWordIndex(chunk[0]) != kNoHasbit; + cold_skipper.OnStartChunk(chunk_index, cached_has_word_index, "", printer); if (have_outer_if) { - uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_); - const int count = popcnt(last_chunk_mask); + // Emit an if() that will let us skip the whole chunk if none are set. + uint32_t chunk_mask = GenChunkMask(chunk, has_bit_indices_); + std::string chunk_mask_str = + StrCat(strings::Hex(chunk_mask, strings::ZERO_PAD_8)); // Check (up to) 8 has_bits at a time if we have more than one field in // this chunk. Due to field layout ordering, we may check // _has_bits_[last_chunk * 8 / 32] multiple times. - GOOGLE_DCHECK_LE(2, count); - GOOGLE_DCHECK_GE(8, count); + GOOGLE_DCHECK_LE(2, popcnt(chunk_mask)); + GOOGLE_DCHECK_GE(8, popcnt(chunk_mask)); - if (cached_has_bit_index != last_chunk / 4) { - cached_has_bit_index = last_chunk / 4; - format("cached_has_bits = _has_bits_[$1$];\n", cached_has_bit_index); + if (cached_has_word_index != HasWordIndex(chunk.front())) { + cached_has_word_index = HasWordIndex(chunk.front()); + format("cached_has_bits = _has_bits_[$1$];\n", cached_has_word_index); } - format("if (cached_has_bits & 0x$1$u) {\n", - StrCat(strings::Hex(last_chunk_mask, strings::ZERO_PAD_8))); + format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); format.Indent(); } @@ -3908,13 +4403,17 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { for (int j = 0; j < chunk.size(); j++) { const FieldDescriptor* field = chunk[j]; const FieldGenerator& generator = field_generators_.get(field); + bool have_enclosing_if = false; + bool need_extra_newline = false; PrintFieldComment(format, field); - bool have_enclosing_if = false; - if (HasFieldPresence(descriptor_->file())) { + if (field->is_repeated()) { + // No presence check is required. + need_extra_newline = true; + } else if (HasHasbit(field)) { PrintPresenceCheck(format, field, has_bit_indices_, printer, - &cached_has_bit_index); + &cached_has_word_index); have_enclosing_if = true; } else { // Without field presence: field is serialized only if it has a @@ -3931,6 +4430,9 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { "}\n" "\n"); } + if (need_extra_newline) { + format("\n"); + } } if (have_outer_if) { @@ -3940,7 +4442,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { if (cold_skipper.OnEndChunk(chunk_index, printer)) { // Reset here as it may have been updated in just closed if statement. - cached_has_bit_index = -1; + cached_has_word_index = -1; } } @@ -3953,7 +4455,9 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { PrintFieldComment(format, field); format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); - field_generators_.get(field).GenerateByteSize(printer); + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateByteSize(printer); + } format("break;\n"); format.Outdent(); format("}\n"); @@ -3972,37 +4476,37 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { format("total_size += _weak_field_map_.ByteSizeLong();\n"); } - format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); if (UseUnknownFieldSet(descriptor_->file(), options_)) { // We go out of our way to put the computation of the uncommon path of // unknown fields in tail position. This allows for better code generation // of this function for simple protos. format( - " return ::$proto_ns$::internal::ComputeUnknownFieldsSize(\n" - " _internal_metadata_, total_size, &_cached_size_);\n"); + "return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);\n"); } else { + format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); format(" total_size += $unknown_fields$.size();\n"); - } - format("}\n"); + format("}\n"); - // We update _cached_size_ even though this is a const method. Because - // const methods might be called concurrently this needs to be atomic - // operations or the program is undefined. In practice, since any concurrent - // writes will be writing the exact same value, normal writes will work on - // all common processors. We use a dedicated wrapper class to abstract away - // the underlying atomic. This makes it easier on platforms where even relaxed - // memory order might have perf impact to replace it with ordinary loads and - // stores. - format( - "int cached_size = ::$proto_ns$::internal::ToCachedSize(total_size);\n" - "SetCachedSize(cached_size);\n" - "return total_size;\n"); + // We update _cached_size_ even though this is a const method. Because + // const methods might be called concurrently this needs to be atomic + // operations or the program is undefined. In practice, since any + // concurrent writes will be writing the exact same value, normal writes + // will work on all common processors. We use a dedicated wrapper class to + // abstract away the underlying atomic. This makes it easier on platforms + // where even relaxed memory order might have perf impact to replace it with + // ordinary loads and stores. + format( + "int cached_size = ::$proto_ns$::internal::ToCachedSize(total_size);\n" + "SetCachedSize(cached_size);\n" + "return total_size;\n"); + } format.Outdent(); format("}\n"); } void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("bool $classname$::IsInitialized() const {\n"); format.Indent(); @@ -4014,57 +4518,15 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { "}\n\n"); } - if (HasFieldPresence(descriptor_->file())) { - // Check that all required fields in this message are set. We can do this - // most efficiently by checking 32 "has bits" at a time. - const std::vector masks = RequiredFieldsBitMask(); - - for (int i = 0; i < masks.size(); i++) { - uint32 mask = masks[i]; - if (mask == 0) { - continue; - } - - // TODO(ckennelly): Consider doing something similar to ByteSizeLong(), - // where we check all of the required fields in a single branch (assuming - // that we aren't going to benefit from early termination). - format("if ((_has_bits_[$1$] & 0x$2$) != 0x$2$) return false;\n", - i, // 1 - StrCat(strings::Hex(mask, strings::ZERO_PAD_8))); // 2 - } + if (num_required_fields_ > 0) { + format( + "if (_Internal::MissingRequiredFields(_has_bits_))" + " return false;\n"); } // Now check that all non-oneof embedded messages are initialized. for (auto field : optimized_order_) { - // TODO(ckennelly): Push this down into a generator? - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !ShouldIgnoreRequiredFieldCheck(field, options_) && - scc_analyzer_->HasRequiredFields(field->message_type())) { - if (field->is_repeated()) { - if (IsImplicitWeakField(field, options_, scc_analyzer_)) { - format( - "if " - "(!::$proto_ns$::internal::AllAreInitializedWeak($1$_.weak)" - ")" - " return false;\n", - FieldName(field)); - } else { - format( - "if (!::$proto_ns$::internal::AllAreInitialized($1$_))" - " return false;\n", - FieldName(field)); - } - } else if (field->options().weak()) { - continue; - } else { - GOOGLE_CHECK(!field->containing_oneof()); - format( - "if (_internal_has_$1$()) {\n" - " if (!$1$_->IsInitialized()) return false;\n" - "}\n", - FieldName(field)); - } - } + field_generators_.get(field).GenerateIsInitialized(printer); } if (num_weak_fields_) { // For Weak fields. @@ -4092,22 +4554,9 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { for (auto field : FieldRange(oneof)) { format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); - - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !ShouldIgnoreRequiredFieldCheck(field, options_) && - scc_analyzer_->HasRequiredFields(field->message_type())) { - GOOGLE_CHECK(!(field->options().weak() || !field->containing_oneof())); - if (field->options().weak()) { - // Just skip. - } else { - format( - "if (has_$1$()) {\n" - " if (!this->$1$().IsInitialized()) return false;\n" - "}\n", - FieldName(field)); - } + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateIsInitialized(printer); } - format("break;\n"); format.Outdent(); format("}\n"); @@ -4131,3 +4580,5 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { } // namespace compiler } // namespace protobuf } // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.h similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.h index bc4febf5c..64af2bf89 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message.h @@ -35,13 +35,16 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ +#include #include #include #include + #include #include #include #include +#include namespace google { namespace protobuf { @@ -82,17 +85,6 @@ class MessageGenerator { // Source file stuff. - // Generate extra fields - void GenerateExtraDefaultFields(io::Printer* printer); - - // Generates code that creates default instances for fields. - void GenerateFieldDefaultInstances(io::Printer* printer); - - // Generates code that initializes the message's default instance. This - // is separate from allocating because all default instances must be - // allocated before any can be initialized. - void GenerateDefaultInstanceInitializer(io::Printer* printer); - // Generate all non-inline methods for this class. void GenerateClassMethods(io::Printer* printer); @@ -113,7 +105,7 @@ class MessageGenerator { bool GenerateParseTable(io::Printer* printer, size_t offset, size_t aux_offset); - // Generate the field offsets array. Returns the a pair of the total numer + // Generate the field offsets array. Returns the a pair of the total number // of entries generated and the index of the first has_bit entry. std::pair GenerateOffsets(io::Printer* printer); void GenerateSchema(io::Printer* printer, int offset, int has_offset); @@ -135,15 +127,21 @@ class MessageGenerator { // Generate the arena-specific destructor code. void GenerateArenaDestructorCode(io::Printer* printer); + // Generate the constexpr constructor for constant initialization of the + // default instance. + void GenerateConstexprConstructor(io::Printer* printer); + // Generate standard Message methods. void GenerateClear(io::Printer* printer); void GenerateOneofClear(io::Printer* printer); - void GenerateMergeFromCodedStream(io::Printer* printer); + void GenerateVerify(io::Printer* printer); void GenerateSerializeWithCachedSizes(io::Printer* printer); void GenerateSerializeWithCachedSizesToArray(io::Printer* printer); void GenerateSerializeWithCachedSizesBody(io::Printer* printer); + void GenerateSerializeWithCachedSizesBodyShuffled(io::Printer* printer); void GenerateByteSize(io::Printer* printer); void GenerateMergeFrom(io::Printer* printer); + void GenerateClassSpecificMergeFrom(io::Printer* printer); void GenerateCopyFrom(io::Printer* printer); void GenerateSwap(io::Printer* printer); void GenerateIsInitialized(io::Printer* printer); @@ -180,7 +178,12 @@ class MessageGenerator { bool copy_constructor) const; size_t HasBitsSize() const; - std::vector RequiredFieldsBitMask() const; + size_t InlinedStringDonatedSize() const; + int HasBitIndex(const FieldDescriptor* a) const; + int HasByteIndex(const FieldDescriptor* a) const; + int HasWordIndex(const FieldDescriptor* a) const; + bool SameHasByte(const FieldDescriptor* a, const FieldDescriptor* b) const; + std::vector RequiredFieldsBitMask() const; const Descriptor* descriptor_; int index_in_file_messages_; @@ -195,6 +198,13 @@ class MessageGenerator { std::vector optimized_order_; std::vector has_bit_indices_; int max_has_bit_index_; + + // A map from field index to inlined_string index. For non-inlined-string + // fields, the element is -1. + std::vector inlined_string_indices_; + // The count of inlined_string fields in the message. + int max_inlined_string_index_; + std::vector enum_generators_; std::vector extension_generators_; int num_required_fields_; @@ -203,6 +213,7 @@ class MessageGenerator { bool table_driven_; std::unique_ptr message_layout_helper_; + std::unique_ptr parse_function_generator_; MessageSCCAnalyzer* scc_analyzer_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.cc similarity index 66% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.cc index 12c6524b5..619990337 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -66,10 +66,11 @@ void SetMessageVariables(const FieldDescriptor* descriptor, (*variables)["type_default_instance_ptr"] = QualifiedDefaultInstancePtr(descriptor->message_type(), options); (*variables)["type_reference_function"] = - implicit_weak - ? (" " + (*variables)["proto_ns"] + "::internal::StrongReference(" + - (*variables)["type_default_instance"] + ");\n") - : ""; + implicit_weak ? (" ::" + (*variables)["proto_ns"] + + "::internal::StrongReference(reinterpret_cast(\n" + + (*variables)["type_default_instance"] + "));\n") + : ""; // NOTE: Escaped here to unblock proto1->proto2 migration. // TODO(liujisi): Extend this to apply for other conflicting methods. (*variables)["release_name"] = @@ -86,7 +87,9 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, MessageSCCAnalyzer* scc_analyzer) : FieldGenerator(descriptor, options), implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)) { + IsImplicitWeakField(descriptor, options, scc_analyzer)), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); } @@ -104,50 +107,51 @@ void MessageFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { void MessageFieldGenerator::GenerateAccessorDeclarations( io::Printer* printer) const { Formatter format(printer, variables_); + if (IsFieldStripped(descriptor_, options_)) { + format( + "$deprecated_attr$const $type$& ${1$$name$$}$() const { " + "__builtin_trap(); }\n" + "PROTOBUF_NODISCARD $deprecated_attr$$type$* " + "${1$$release_name$$}$() { " + "__builtin_trap(); }\n" + "$deprecated_attr$$type$* ${1$mutable_$name$$}$() { " + "__builtin_trap(); }\n" + "$deprecated_attr$void ${1$set_allocated_$name$$}$" + "($type$* $name$) { __builtin_trap(); }\n" + "$deprecated_attr$void " + "${1$unsafe_arena_set_allocated_$name$$}$(\n" + " $type$* $name$) { __builtin_trap(); }\n" + "$deprecated_attr$$type$* ${1$unsafe_arena_release_$name$$}$() { " + "__builtin_trap(); }\n", + descriptor_); + return; + } format( "$deprecated_attr$const $type$& ${1$$name$$}$() const;\n" - "$deprecated_attr$$type$* ${1$$release_name$$}$();\n" + "PROTOBUF_NODISCARD $deprecated_attr$$type$* " + "${1$$release_name$$}$();\n" "$deprecated_attr$$type$* ${1$mutable_$name$$}$();\n" "$deprecated_attr$void ${1$set_allocated_$name$$}$" - "($type$* $name$);\n" - "private:\n" - "const $type$& ${1$_internal_$name$$}$() const;\n" - "$type$* ${1$_internal_mutable_$name$$}$();\n" - "public:\n", + "($type$* $name$);\n", descriptor_); - if (SupportsArenas(descriptor_)) { + if (!IsFieldStripped(descriptor_, options_)) { format( - "$deprecated_attr$void " - "${1$unsafe_arena_set_allocated_$name$$}$(\n" - " $type$* $name$);\n" - "$deprecated_attr$$type$* ${1$unsafe_arena_release_$name$$}$();\n", + "private:\n" + "const $type$& ${1$_internal_$name$$}$() const;\n" + "$type$* ${1$_internal_mutable_$name$$}$();\n" + "public:\n", descriptor_); } + format( + "$deprecated_attr$void " + "${1$unsafe_arena_set_allocated_$name$$}$(\n" + " $type$* $name$);\n" + "$deprecated_attr$$type$* ${1$unsafe_arena_release_$name$$}$();\n", + descriptor_); } void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions( io::Printer* printer) const { - Formatter format(printer, variables_); - if (SupportsArenas(descriptor_)) { - format( - "void $classname$::unsafe_arena_set_allocated_$name$(\n" - " $type$* $name$) {\n" - "$annotate_accessor$" - // If we're not on an arena, free whatever we were holding before. - // (If we are on arena, we can just forget the earlier pointer.) - " if (GetArenaNoVirtual() == nullptr) {\n" - " delete $name$_;\n" - " }\n" - " $name$_ = $name$;\n" - " if ($name$) {\n" - " $set_hasbit$\n" - " } else {\n" - " $clear_hasbit$\n" - " }\n" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated" - ":$full_name$)\n" - "}\n"); - } } void MessageFieldGenerator::GenerateInlineAccessorDefinitions( @@ -157,30 +161,60 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( "inline const $type$& $classname$::_internal_$name$() const {\n" "$type_reference_function$" " const $type$* p = $casted_member$;\n" - " return p != nullptr ? *p : *reinterpret_cast(\n" - " &$type_default_instance$);\n" + " return p != nullptr ? *p : reinterpret_cast(\n" + " $type_default_instance$);\n" "}\n" "inline const $type$& $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" "}\n"); - if (SupportsArenas(descriptor_)) { + format( + "inline void $classname$::unsafe_arena_set_allocated_$name$(\n" + " $type$* $name$) {\n" + // If we're not on an arena, free whatever we were holding before. + // (If we are on arena, we can just forget the earlier pointer.) + " if (GetArenaForAllocation() == nullptr) {\n" + " delete reinterpret_cast<::$proto_ns$::MessageLite*>($name$_);\n" + " }\n"); + if (implicit_weak_field_) { format( - "inline $type$* $classname$::$release_name$() {\n" - " auto temp = unsafe_arena_release_$name$();\n" - " if (GetArenaNoVirtual() != nullptr) {\n" - " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" - " }\n" - " return temp;\n" - "}\n" - "inline $type$* $classname$::unsafe_arena_release_$name$() {\n"); + " $name$_ = " + "reinterpret_cast<::$proto_ns$::MessageLite*>($name$);\n"); } else { - format("inline $type$* $classname$::$release_name$() {\n"); + format(" $name$_ = $name$;\n"); } format( - "$annotate_accessor$" + " if ($name$) {\n" + " $set_hasbit$\n" + " } else {\n" + " $clear_hasbit$\n" + " }\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_unsafe_arena_set_allocated" + ":$full_name$)\n" + "}\n"); + format( + "inline $type$* $classname$::$release_name$() {\n" + "$type_reference_function$" + "$annotate_release$" + " $clear_hasbit$\n" + " $type$* temp = $casted_member$;\n" + " $name$_ = nullptr;\n" + "#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE\n" + " auto* old = reinterpret_cast<::$proto_ns$::MessageLite*>(temp);\n" + " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" + " if (GetArenaForAllocation() == nullptr) { delete old; }\n" + "#else // PROTOBUF_FORCE_COPY_IN_RELEASE\n" + " if (GetArenaForAllocation() != nullptr) {\n" + " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" + " }\n" + "#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE\n" + " return temp;\n" + "}\n" + "inline $type$* $classname$::unsafe_arena_release_$name$() {\n" + "$annotate_release$" " // @@protoc_insertion_point(field_release:$full_name$)\n" "$type_reference_function$" " $clear_hasbit$\n" @@ -194,7 +228,7 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( "$type_reference_function$" " $set_hasbit$\n" " if ($name$_ == nullptr) {\n" - " auto* p = CreateMaybeMessage<$type$>(GetArenaNoVirtual());\n"); + " auto* p = CreateMaybeMessage<$type$>(GetArenaForAllocation());\n"); if (implicit_weak_field_) { format(" $name$_ = reinterpret_cast<::$proto_ns$::MessageLite*>(p);\n"); } else { @@ -205,17 +239,17 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( " return $casted_member$;\n" "}\n" "inline $type$* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" + " $type$* _msg = _internal_mutable_$name$();\n" + "$annotate_mutable$" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return _internal_mutable_$name$();\n" + " return _msg;\n" "}\n"); // We handle the most common case inline, and delegate less common cases to // the slow fallback function. format( "inline void $classname$::set_allocated_$name$($type$* $name$) {\n" - "$annotate_accessor$" - " ::$proto_ns$::Arena* message_arena = GetArenaNoVirtual();\n"); + " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n"); format(" if (message_arena == nullptr) {\n"); if (IsCrossFileMessage(descriptor_)) { format( @@ -226,20 +260,20 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( format( " }\n" " if ($name$) {\n"); - if (SupportsArenas(descriptor_->message_type()) && - IsCrossFileMessage(descriptor_)) { + if (IsCrossFileMessage(descriptor_)) { // We have to read the arena through the virtual method, because the type // isn't defined in this file. format( " ::$proto_ns$::Arena* submessage_arena =\n" - " " - "reinterpret_cast<::$proto_ns$::MessageLite*>($name$)->GetArena();\n"); - } else if (!SupportsArenas(descriptor_->message_type())) { - format(" ::$proto_ns$::Arena* submessage_arena = nullptr;\n"); + " ::$proto_ns$::Arena::InternalHelper<\n" + " ::$proto_ns$::MessageLite>::GetOwningArena(\n" + " reinterpret_cast<::$proto_ns$::MessageLite*>(" + "$name$));\n"); } else { format( " ::$proto_ns$::Arena* submessage_arena =\n" - " ::$proto_ns$::Arena::GetArena($name$);\n"); + " ::$proto_ns$::Arena::InternalHelper<$type$>::GetOwningArena(" + "$name$);\n"); } format( " if (message_arena != submessage_arena) {\n" @@ -256,6 +290,7 @@ void MessageFieldGenerator::GenerateInlineAccessorDefinitions( format(" $name$_ = $name$;\n"); } format( + "$annotate_set$" " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n"); } @@ -297,49 +332,27 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions( "*::$proto_ns$::internal::ImplicitWeakMessage::default_instance();\n" " }\n" "}\n"); - if (SupportsArenas(descriptor_)) { - format( - "::$proto_ns$::MessageLite*\n" - "$classname$::_Internal::mutable_$name$($classname$* msg) {\n"); - if (HasFieldPresence(descriptor_->file())) { - format(" msg->$set_hasbit$\n"); - } - format( - " if (msg->$name$_ == nullptr) {\n" - " if ($type_default_instance_ptr$ == nullptr) {\n" - " msg->$name$_ = ::$proto_ns$::Arena::CreateMessage<\n" - " ::$proto_ns$::internal::ImplicitWeakMessage>(\n" - " msg->GetArenaNoVirtual());\n" - " } else {\n" - " msg->$name$_ = reinterpret_cast(\n" - " $type_default_instance_ptr$)->New(" - "msg->GetArenaNoVirtual());\n" - " }\n" - " }\n" - " return msg->$name$_;\n" - "}\n"); - } else { - format( - "::$proto_ns$::MessageLite*\n" - "$classname$::_Internal::mutable_$name$($classname$* msg) {\n"); - if (HasFieldPresence(descriptor_->file())) { - format(" msg->$set_hasbit$\n"); - } - format( - " if (msg->$name$_ == nullptr) {\n" - " if ($type_default_instance_ptr$ == nullptr) {\n" - " msg->$name$_ = " - "new ::$proto_ns$::internal::ImplicitWeakMessage;\n" - " } else {\n" - " msg->$name$_ = " - "reinterpret_cast(\n" - " $type_default_instance_ptr$)->New();\n" - " }\n" - " }\n" - " return msg->$name$_;\n" - "}\n"); + format( + "::$proto_ns$::MessageLite*\n" + "$classname$::_Internal::mutable_$name$($classname$* msg) {\n"); + if (HasHasbit(descriptor_)) { + format(" msg->$set_hasbit$\n"); } + format( + " if (msg->$name$_ == nullptr) {\n" + " if ($type_default_instance_ptr$ == nullptr) {\n" + " msg->$name$_ = ::$proto_ns$::Arena::CreateMessage<\n" + " ::$proto_ns$::internal::ImplicitWeakMessage>(\n" + " msg->GetArenaForAllocation());\n" + " } else {\n" + " msg->$name$_ = \n" + " reinterpret_cast(\n" + " $type_default_instance_ptr$)->New(\n" + " msg->GetArenaForAllocation());\n" + " }\n" + " }\n" + " return msg->$name$_;\n" + "}\n"); } else { // This inline accessor directly returns member field and is used in // Serialize such that AFDO profile correctly captures access information to @@ -353,12 +366,14 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions( } void MessageFieldGenerator::GenerateClearingCode(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); - if (!HasFieldPresence(descriptor_->file())) { + if (!HasHasbit(descriptor_)) { // If we don't have has-bits, message presence is indicated only by ptr != // NULL. Thus on clear, we need to delete the object. format( - "if (GetArenaNoVirtual() == nullptr && $name$_ != nullptr) {\n" + "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n" " delete $name$_;\n" "}\n" "$name$_ = nullptr;\n"); @@ -369,12 +384,14 @@ void MessageFieldGenerator::GenerateClearingCode(io::Printer* printer) const { void MessageFieldGenerator::GenerateMessageClearingCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); - if (!HasFieldPresence(descriptor_->file())) { + if (!HasHasbit(descriptor_)) { // If we don't have has-bits, message presence is indicated only by ptr != // NULL. Thus on clear, we need to delete the object. format( - "if (GetArenaNoVirtual() == nullptr && $name$_ != nullptr) {\n" + "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n" " delete $name$_;\n" "}\n" "$name$_ = nullptr;\n"); @@ -386,6 +403,8 @@ void MessageFieldGenerator::GenerateMessageClearingCode( } void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); if (implicit_weak_field_) { format( @@ -399,11 +418,15 @@ void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const { } void MessageFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format("swap($name$_, other->$name$_);\n"); } void MessageFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); if (options_.opensource_runtime) { // TODO(gerbens) Remove this when we don't need to destruct default @@ -418,12 +441,16 @@ void MessageFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { void MessageFieldGenerator::GenerateConstructorCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format("$name$_ = nullptr;\n"); } void MessageFieldGenerator::GenerateCopyConstructorCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format( "if (from._internal_has_$name$()) {\n" @@ -435,6 +462,8 @@ void MessageFieldGenerator::GenerateCopyConstructorCode( void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format( "target = stream->EnsureSpace(target);\n" @@ -444,6 +473,8 @@ void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( } void MessageFieldGenerator::GenerateByteSize(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format( "total_size += $tag_size$ +\n" @@ -451,6 +482,24 @@ void MessageFieldGenerator::GenerateByteSize(io::Printer* printer) const { " *$field_member$);\n"); } +void MessageFieldGenerator::GenerateIsInitialized(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (_internal_has_$name$()) {\n" + " if (!$name$_->IsInitialized()) return false;\n" + "}\n"); +} + +void MessageFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_(nullptr)"); +} + // =================================================================== MessageOneofFieldGenerator::MessageOneofFieldGenerator( @@ -467,24 +516,23 @@ void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions( Formatter format(printer, variables_); format( "void $classname$::set_allocated_$name$($type$* $name$) {\n" - "$annotate_accessor$" - " ::$proto_ns$::Arena* message_arena = GetArenaNoVirtual();\n" + " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n" " clear_$oneof_name$();\n" " if ($name$) {\n"); - if (SupportsArenas(descriptor_->message_type()) && - descriptor_->file() != descriptor_->message_type()->file()) { + if (descriptor_->file() != descriptor_->message_type()->file()) { // We have to read the arena through the virtual method, because the type // isn't defined in this file. format( " ::$proto_ns$::Arena* submessage_arena =\n" - " " - "reinterpret_cast<::$proto_ns$::MessageLite*>($name$)->GetArena();\n"); - } else if (!SupportsArenas(descriptor_->message_type())) { - format(" ::$proto_ns$::Arena* submessage_arena = nullptr;\n"); + " ::$proto_ns$::Arena::InternalHelper<\n" + " ::$proto_ns$::MessageLite>::GetOwningArena(\n" + " reinterpret_cast<::$proto_ns$::MessageLite*>(" + "$name$));\n"); } else { format( " ::$proto_ns$::Arena* submessage_arena =\n" - " ::$proto_ns$::Arena::GetArena($name$);\n"); + " ::$proto_ns$::Arena::InternalHelper<" + "$type$>::GetOwningArena($name$);\n"); } format( " if (message_arena != submessage_arena) {\n" @@ -494,6 +542,7 @@ void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions( " set_has_$name$();\n" " $field_member$ = $name$;\n" " }\n" + "$annotate_set$" " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n"); } @@ -503,18 +552,14 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions( Formatter format(printer, variables_); format( "inline $type$* $classname$::$release_name$() {\n" - "$annotate_accessor$" + "$annotate_release$" " // @@protoc_insertion_point(field_release:$full_name$)\n" " if (_internal_has_$name$()) {\n" " clear_has_$oneof_name$();\n" - " $type$* temp = $field_member$;\n"); - if (SupportsArenas(descriptor_)) { - format( - " if (GetArenaNoVirtual() != nullptr) {\n" - " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" - " }\n"); - } - format( + " $type$* temp = $field_member$;\n" + " if (GetArenaForAllocation() != nullptr) {\n" + " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n" + " }\n" " $field_member$ = nullptr;\n" " return temp;\n" " } else {\n" @@ -526,73 +571,66 @@ void MessageOneofFieldGenerator::GenerateInlineAccessorDefinitions( "inline const $type$& $classname$::_internal_$name$() const {\n" " return _internal_has_$name$()\n" " ? *$field_member$\n" - " : *reinterpret_cast< $type$*>(&$type_default_instance$);\n" + " : reinterpret_cast< $type$&>($type_default_instance$);\n" "}\n" "inline const $type$& $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" - "}\n"); - - if (SupportsArenas(descriptor_)) { - format( - "inline $type$* $classname$::unsafe_arena_release_$name$() {\n" - "$annotate_accessor$" - " // @@protoc_insertion_point(field_unsafe_arena_release" - ":$full_name$)\n" - " if (_internal_has_$name$()) {\n" - " clear_has_$oneof_name$();\n" - " $type$* temp = $field_member$;\n" - " $field_member$ = nullptr;\n" - " return temp;\n" - " } else {\n" - " return nullptr;\n" - " }\n" - "}\n" - "inline void $classname$::unsafe_arena_set_allocated_$name$" - "($type$* $name$) {\n" - "$annotate_accessor$" - // We rely on the oneof clear method to free the earlier contents of - // this oneof. We can directly use the pointer we're given to set the - // new value. - " clear_$oneof_name$();\n" - " if ($name$) {\n" - " set_has_$name$();\n" - " $field_member$ = $name$;\n" - " }\n" - " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" - "$full_name$)\n" - "}\n"); - } - - format( + "}\n" + "inline $type$* $classname$::unsafe_arena_release_$name$() {\n" + "$annotate_release$" + " // @@protoc_insertion_point(field_unsafe_arena_release" + ":$full_name$)\n" + " if (_internal_has_$name$()) {\n" + " clear_has_$oneof_name$();\n" + " $type$* temp = $field_member$;\n" + " $field_member$ = nullptr;\n" + " return temp;\n" + " } else {\n" + " return nullptr;\n" + " }\n" + "}\n" + "inline void $classname$::unsafe_arena_set_allocated_$name$" + "($type$* $name$) {\n" + // We rely on the oneof clear method to free the earlier contents of + // this oneof. We can directly use the pointer we're given to set the + // new value. + " clear_$oneof_name$();\n" + " if ($name$) {\n" + " set_has_$name$();\n" + " $field_member$ = $name$;\n" + " }\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:" + "$full_name$)\n" + "}\n" "inline $type$* $classname$::_internal_mutable_$name$() {\n" " if (!_internal_has_$name$()) {\n" " clear_$oneof_name$();\n" " set_has_$name$();\n" - " $field_member$ = CreateMaybeMessage< $type$ >(\n" - " GetArenaNoVirtual());\n" + " $field_member$ = CreateMaybeMessage< $type$ " + ">(GetArenaForAllocation());\n" " }\n" " return $field_member$;\n" "}\n" "inline $type$* $classname$::mutable_$name$() {\n" - "$annotate_accessor$" + " $type$* _msg = _internal_mutable_$name$();\n" + "$annotate_mutable$" " // @@protoc_insertion_point(field_mutable:$full_name$)\n" - " return _internal_mutable_$name$();\n" + " return _msg;\n" "}\n"); } void MessageOneofFieldGenerator::GenerateClearingCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); - if (SupportsArenas(descriptor_)) { - format( - "if (GetArenaNoVirtual() == nullptr) {\n" - " delete $field_member$;\n" - "}\n"); - } else { - format("delete $field_member$;\n"); - } + format( + "if (GetArenaForAllocation() == nullptr) {\n" + " delete $field_member$;\n" + "}\n"); } void MessageOneofFieldGenerator::GenerateMessageClearingCode( @@ -617,6 +655,17 @@ void MessageOneofFieldGenerator::GenerateConstructorCode( // space only when this field is used. } +void MessageOneofFieldGenerator::GenerateIsInitialized( + io::Printer* printer) const { + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (_internal_has_$name$()) {\n" + " if (!$field_member$->IsInitialized()) return false;\n" + "}\n"); +} + // =================================================================== RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( @@ -624,7 +673,9 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( MessageSCCAnalyzer* scc_analyzer) : FieldGenerator(descriptor, options), implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)) { + IsImplicitWeakField(descriptor, options, scc_analyzer)), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); } @@ -643,14 +694,35 @@ void RepeatedMessageFieldGenerator::GeneratePrivateMembers( void RepeatedMessageFieldGenerator::GenerateAccessorDeclarations( io::Printer* printer) const { Formatter format(printer, variables_); + if (IsFieldStripped(descriptor_, options_)) { + format( + "$deprecated_attr$$type$* ${1$mutable_$name$$}$(int index) { " + "__builtin_trap(); }\n" + "$deprecated_attr$::$proto_ns$::RepeatedPtrField< $type$ >*\n" + " ${1$mutable_$name$$}$() { __builtin_trap(); }\n" + "$deprecated_attr$const $type$& ${1$$name$$}$(int index) const { " + "__builtin_trap(); }\n" + "$deprecated_attr$$type$* ${1$add_$name$$}$() { " + "__builtin_trap(); }\n" + "$deprecated_attr$const ::$proto_ns$::RepeatedPtrField< $type$ >&\n" + " ${1$$name$$}$() const { __builtin_trap(); }\n", + descriptor_); + return; + } format( "$deprecated_attr$$type$* ${1$mutable_$name$$}$(int index);\n" "$deprecated_attr$::$proto_ns$::RepeatedPtrField< $type$ >*\n" - " ${1$mutable_$name$$}$();\n" - "private:\n" - "const $type$& ${1$_internal_$name$$}$(int index) const;\n" - "$type$* ${1$_internal_add_$name$$}$();\n" - "public:\n" + " ${1$mutable_$name$$}$();\n", + descriptor_); + if (!IsFieldStripped(descriptor_, options_)) { + format( + "private:\n" + "const $type$& ${1$_internal_$name$$}$(int index) const;\n" + "$type$* ${1$_internal_add_$name$$}$();\n" + "public:\n", + descriptor_); + } + format( "$deprecated_attr$const $type$& ${1$$name$$}$(int index) const;\n" "$deprecated_attr$$type$* ${1$add_$name$$}$();\n" "$deprecated_attr$const ::$proto_ns$::RepeatedPtrField< $type$ >&\n" @@ -665,7 +737,7 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( format( "inline $type$* $classname$::mutable_$name$(int index) {\n" - "$annotate_accessor$" + "$annotate_mutable$" // TODO(dlj): move insertion points " // @@protoc_insertion_point(field_mutable:$full_name$)\n" "$type_reference_function$" @@ -673,7 +745,7 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline ::$proto_ns$::RepeatedPtrField< $type$ >*\n" "$classname$::mutable_$name$() {\n" - "$annotate_accessor$" + "$annotate_mutable_list$" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" "$type_reference_function$" " return &$name$_$weak$;\n" @@ -684,7 +756,7 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( "inline const $type$& $classname$::_internal_$name$(int index) const " "{\n" " return $name$_$weak$.InternalCheckedGet(index,\n" - " *reinterpret_cast(&$type_default_instance$));\n" + " reinterpret_cast($type_default_instance$));\n" "}\n"); } else { format( @@ -697,7 +769,7 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( format( "inline const $type$& $classname$::$name$(int index) const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$(index);\n" "}\n" @@ -705,15 +777,16 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( " return $name$_$weak$.Add();\n" "}\n" "inline $type$* $classname$::add_$name$() {\n" - "$annotate_accessor$" + " $type$* _add = _internal_add_$name$();\n" + "$annotate_add_mutable$" " // @@protoc_insertion_point(field_add:$full_name$)\n" - " return _internal_add_$name$();\n" + " return _add;\n" "}\n"); format( "inline const ::$proto_ns$::RepeatedPtrField< $type$ >&\n" "$classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_list$" " // @@protoc_insertion_point(field_list:$full_name$)\n" "$type_reference_function$" " return $name$_$weak$;\n" @@ -722,18 +795,24 @@ void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions( void RepeatedMessageFieldGenerator::GenerateClearingCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format("$name$_.Clear();\n"); } void RepeatedMessageFieldGenerator::GenerateMergingCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format("$name$_.MergeFrom(from.$name$_);\n"); } void RepeatedMessageFieldGenerator::GenerateSwappingCode( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format("$name$_.InternalSwap(&other->$name$_);\n"); } @@ -745,6 +824,8 @@ void RepeatedMessageFieldGenerator::GenerateConstructorCode( void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); if (implicit_weak_field_) { format( @@ -770,6 +851,8 @@ void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray( void RepeatedMessageFieldGenerator::GenerateByteSize( io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + Formatter format(printer, variables_); format( "total_size += $tag_size$UL * this->_internal_$name$_size();\n" @@ -779,6 +862,30 @@ void RepeatedMessageFieldGenerator::GenerateByteSize( "}\n"); } +void RepeatedMessageFieldGenerator::GenerateIsInitialized( + io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + if (implicit_weak_field_) { + format( + "if (!::$proto_ns$::internal::AllAreInitializedWeak($name$_.weak))\n" + " return false;\n"); + } else { + format( + "if (!::$proto_ns$::internal::AllAreInitialized($name$_))\n" + " return false;\n"); + } +} + +void RepeatedMessageFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_()"); +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.h similarity index 59% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.h index fe5cf13cb..2beac6253 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_field.h @@ -50,27 +50,33 @@ class MessageFieldGenerator : public FieldGenerator { MessageFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~MessageFieldGenerator(); + ~MessageFieldGenerator() override; // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateInternalAccessorDeclarations(io::Printer* printer) const; - void GenerateInternalAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const override; + void GenerateInternalAccessorDeclarations( + io::Printer* printer) const override; + void GenerateInternalAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; protected: const bool implicit_weak_field_; + const bool has_required_fields_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); @@ -81,19 +87,21 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { MessageOneofFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~MessageOneofFieldGenerator(); + ~MessageOneofFieldGenerator() override; // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; // MessageFieldGenerator, from which we inherit, overrides this so we need to // override it as well. - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); @@ -104,22 +112,26 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~RepeatedMessageFieldGenerator(); + ~RepeatedMessageFieldGenerator() override; // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const {} - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override {} + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: const bool implicit_weak_field_; + const bool has_required_fields_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h index 67eeff0ae..9d8063d9c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h @@ -43,6 +43,8 @@ namespace protobuf { namespace compiler { namespace cpp { +class MessageSCCAnalyzer; + // Provides an abstract interface to optimize message layout // by rearranging the fields of a message. class MessageLayoutHelper { @@ -50,7 +52,8 @@ class MessageLayoutHelper { virtual ~MessageLayoutHelper() {} virtual void OptimizeLayout(std::vector* fields, - const Options& options) = 0; + const Options& options, + MessageSCCAnalyzer* scc_analyzer) = 0; }; } // namespace cpp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_names.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_names.h new file mode 100644 index 000000000..6bcbff061 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_names.h @@ -0,0 +1,96 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__ + +#include + +#include + +namespace google { +namespace protobuf { + +class Descriptor; +class EnumDescriptor; +class EnumValueDescriptor; +class FieldDescriptor; + +namespace compiler { +namespace cpp { + +// Returns the unqualified C++ name. +// +// For example, if you had: +// package foo.bar; +// message Baz { message Qux {} } +// Then the non-qualified version would be: +// Baz_Qux +std::string ClassName(const Descriptor* descriptor); +std::string ClassName(const EnumDescriptor* enum_descriptor); + +// Returns the fully qualified C++ name. +// +// For example, if you had: +// package foo.bar; +// message Baz { message Qux {} } +// Then the qualified ClassName for Qux would be: +// ::foo::bar::Baz_Qux +std::string QualifiedClassName(const Descriptor* d); +std::string QualifiedClassName(const EnumDescriptor* d); +std::string QualifiedExtensionName(const FieldDescriptor* d); + +// Get the (unqualified) name that should be used for this field in C++ code. +// The name is coerced to lower-case to emulate proto1 behavior. People +// should be using lowercase-with-underscores style for proto field names +// anyway, so normally this just returns field->name(). +std::string FieldName(const FieldDescriptor* field); + +// Requires that this field is in a oneof. Returns the (unqualified) case +// constant for this field. +std::string OneofCaseConstantName(const FieldDescriptor* field); +// Returns the quafilied case constant for this field. +std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field); + +// Get the (unqualified) name that should be used for this enum value in C++ +// code. +std::string EnumValueName(const EnumValueDescriptor* enum_value); + +// Strips ".proto" or ".protodevel" from the end of a filename. +PROTOC_EXPORT std::string StripProto(const std::string& filename); + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#include + +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_options.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_options.h similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_options.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_options.h index d8fe3a7ae..d0f16d034 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_options.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_options.h @@ -33,6 +33,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ +#include #include namespace google { @@ -44,10 +45,16 @@ namespace cpp { enum class EnforceOptimizeMode { kNoEnforcement, // Use the runtime specified by the file specific options. - kSpeed, // This is the full runtime. + kSpeed, // Full runtime with a generated code implementation. + kCodeSize, // Full runtime with a reflective implementation. kLiteRuntime, }; +struct FieldListenerOptions { + bool inject_field_listener_events = false; + std::set forbidden_field_listener_events; +}; + // Generator options (see generator.cc for a description of each): struct Options { std::string dllexport_decl; @@ -62,11 +69,22 @@ struct Options { bool bootstrap = false; bool opensource_runtime = false; bool annotate_accessor = false; + bool unused_field_stripping = false; + bool profile_driven_inline_string = true; + bool force_inline_string = false; std::string runtime_include_base; int num_cc_files = 0; std::string annotation_pragma_name; std::string annotation_guard_name; const AccessInfoMap* access_info_map = nullptr; + enum { + kTCTableNever, + kTCTableGuarded, + kTCTableAlways + } tctable_mode = kTCTableNever; + FieldListenerOptions field_listener_options; + bool eagerly_verified_lazy = false; + bool force_eagerly_verified_lazy = false; }; } // namespace cpp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc index 2f78bda52..0b660c75b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc @@ -118,7 +118,8 @@ class FieldGroup { // // OTHER these fields are initialized one-by-one. void PaddingOptimizer::OptimizeLayout( - std::vector* fields, const Options& options) { + std::vector* fields, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { // The sorted numeric order of Family determines the declaration order in the // memory layout. enum Family { @@ -147,7 +148,7 @@ void PaddingOptimizer::OptimizeLayout( f = STRING; } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { f = MESSAGE; - if (IsLazy(field, options)) { + if (IsLazy(field, options, scc_analyzer)) { f = LAZY_MESSAGE; } } else if (CanInitializeByZeroing(field)) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h index 2382081ba..ebdb17de6 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h @@ -53,7 +53,8 @@ class PaddingOptimizer : public MessageLayoutHelper { ~PaddingOptimizer() override {} void OptimizeLayout(std::vector* fields, - const Options& options) override; + const Options& options, + MessageSCCAnalyzer* scc_analyzer) override; }; } // namespace cpp diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc new file mode 100644 index 000000000..810f240a8 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc @@ -0,0 +1,1303 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +namespace { +using google::protobuf::internal::TcFieldData; +using google::protobuf::internal::WireFormat; +using google::protobuf::internal::WireFormatLite; + +std::vector GetOrderedFields( + const Descriptor* descriptor, const Options& options) { + std::vector ordered_fields; + for (auto field : FieldRange(descriptor)) { + if (!IsFieldStripped(field, options)) { + ordered_fields.push_back(field); + } + } + std::sort(ordered_fields.begin(), ordered_fields.end(), + [](const FieldDescriptor* a, const FieldDescriptor* b) { + return a->number() < b->number(); + }); + return ordered_fields; +} + +bool HasInternalAccessors(const FieldOptions::CType ctype) { + return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD; +} + +int TagSize(uint32_t field_number) { + if (field_number < 16) return 1; + GOOGLE_CHECK_LT(field_number, (1 << 14)) + << "coded tag for " << field_number << " too big for uint16_t"; + return 2; +} + +const char* CodedTagType(int tag_size) { + return tag_size == 1 ? "uint8_t" : "uint16_t"; +} + +const char* TagType(const FieldDescriptor* field) { + return CodedTagType(TagSize(field->number())); +} + +std::string TcParserName(const Options& options) { + return StrCat("::", ProtobufNamespace(options), + "::internal::TcParser::"); +} + +std::string MessageTcParseFunctionName(const FieldDescriptor* field, + const Options& options) { + if (field->message_type()->field_count() == 0 || + !HasGeneratedMethods(field->message_type()->file(), options)) { + // For files with `option optimize_for = CODE_SIZE`, or which derive from + // `ZeroFieldsBase`, we need to call the `_InternalParse` function, because + // there is no generated tailcall function. For tailcall parsing, this is + // done by helpers in TcParser. + return StrCat(TcParserName(options), + (field->is_repeated() ? "Repeated" : "Singular"), + "ParseMessage<", + QualifiedClassName(field->message_type()), // + ", ", TagType(field), ">"); + } + // This matches macros in generated_message_tctable_impl.h: + return StrCat("PROTOBUF_TC_PARSE_", + (field->is_repeated() ? "REPEATED" : "SINGULAR"), + TagSize(field->number()), "(", + QualifiedClassName(field->message_type()), ")"); +} + +std::string FieldParseFunctionName(const FieldDescriptor* field, + const Options& options); + +} // namespace + +TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, + const Options& options, + const std::vector& has_bit_indices, + MessageSCCAnalyzer* scc_analyzer) { + std::vector ordered_fields = + GetOrderedFields(descriptor, options); + + // The table size is rounded up to the nearest power of 2, clamping at 2^5. + // Note that this is a naive approach: a better approach should only consider + // table-eligible fields. We may also want to push rarely-encountered fields + // into the fallback, to make the table smaller. + table_size_log2 = ordered_fields.size() >= 16 ? 5 + : ordered_fields.size() >= 8 ? 4 + : ordered_fields.size() >= 4 ? 3 + : ordered_fields.size() >= 2 ? 2 + : 1; + const unsigned table_size = 1 << table_size_log2; + + // Construct info for each possible entry. Fields that do not use table-driven + // parsing will still have an entry that nominates the fallback function. + fast_path_fields.resize(table_size); + + for (const auto* field : ordered_fields) { + // Eagerly assume slow path. If we can handle this field on the fast path, + // we will pop its entry from `fallback_fields`. + fallback_fields.push_back(field); + + // Anything difficult slow path: + if (field->is_map()) continue; + if (field->real_containing_oneof()) continue; + if (field->options().weak()) continue; + if (IsImplicitWeakField(field, options, scc_analyzer)) continue; + if (IsLazy(field, options, scc_analyzer)) continue; + + // The largest tag that can be read by the tailcall parser is two bytes + // when varint-coded. This allows 14 bits for the numeric tag value: + // byte 0 byte 1 + // 1nnnnttt 0nnnnnnn + // ^^^^^^^ ^^^^^^^ + uint32_t tag = WireFormat::MakeTag(field); + if (tag >= 1 << 14) { + continue; + } else if (tag >= 1 << 7) { + tag = ((tag << 1) & 0x7F00) | 0x80 | (tag & 0x7F); + } + // The field index is determined by the low bits of the field number, where + // the table size determines the width of the mask. The largest table + // supported is 32 entries. The parse loop uses these bits directly, so that + // the dispatch does not require arithmetic: + // byte 0 byte 1 + // 1nnnnttt 0nnnnnnn + // ^^^^^ + // This means that any field number that does not fit in the lower 4 bits + // will always have the top bit of its table index asserted: + uint32_t idx = (tag >> 3) & (table_size - 1); + // If this entry in the table is already used, then this field will be + // handled by the generated fallback function. + if (!fast_path_fields[idx].func_name.empty()) continue; + + // Determine the hasbit mask for this field, if needed. (Note that fields + // without hasbits use different parse functions.) + int hasbit_idx; + if (HasHasbit(field)) { + hasbit_idx = has_bit_indices[field->index()]; + GOOGLE_CHECK_NE(-1, hasbit_idx) << field->DebugString(); + // The tailcall parser can only update the first 32 hasbits. If this + // field's has-bit is beyond that, then it will need to be handled by the + // fallback parse function. + if (hasbit_idx >= 32) continue; + } else { + // The tailcall parser only ever syncs 32 has-bits, so if there is no + // presence, set a bit that will not be used. + hasbit_idx = 63; + } + + // Determine the name of the fastpath parse function to use for this field. + std::string name; + + switch (field->type()) { + case FieldDescriptor::TYPE_MESSAGE: + name = MessageTcParseFunctionName(field, options); + break; + + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED64: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_BOOL: + name = FieldParseFunctionName(field, options); + break; + + case FieldDescriptor::TYPE_BYTES: + if (field->options().ctype() == FieldOptions::STRING && + field->default_value_string().empty() && + !IsStringInlined(field, options)) { + name = FieldParseFunctionName(field, options); + } + break; + + default: + break; + } + + if (name.empty()) { + continue; + } + // This field made it into the fast path, so remove it from the fallback + // fields and fill in the table entry. + fallback_fields.pop_back(); + fast_path_fields[idx].func_name = name; + fast_path_fields[idx].bits = TcFieldData(tag, hasbit_idx, 0); + fast_path_fields[idx].field = field; + } + + // If there are no fallback fields, and at most one extension range, the + // parser can use a generic fallback function. Otherwise, a message-specific + // fallback routine is needed. + use_generated_fallback = + !fallback_fields.empty() || descriptor->extension_range_count() > 1; +} + +ParseFunctionGenerator::ParseFunctionGenerator( + const Descriptor* descriptor, int max_has_bit_index, + const std::vector& has_bit_indices, + const std::vector& inlined_string_indices, const Options& options, + MessageSCCAnalyzer* scc_analyzer, + const std::map& vars) + : descriptor_(descriptor), + scc_analyzer_(scc_analyzer), + options_(options), + variables_(vars), + inlined_string_indices_(inlined_string_indices), + num_hasbits_(max_has_bit_index) { + if (should_generate_tctable()) { + tc_table_info_.reset(new TailCallTableInfo(descriptor_, options_, + has_bit_indices, scc_analyzer)); + } + SetCommonVars(options_, &variables_); + SetUnknownFieldsVariable(descriptor_, options_, &variables_); + variables_["classname"] = ClassName(descriptor, false); +} + +void ParseFunctionGenerator::GenerateMethodDecls(io::Printer* printer) { + Formatter format(printer, variables_); + if (should_generate_tctable()) { + auto declare_function = [&format](const char* name, + const std::string& guard) { + if (!guard.empty()) { + format.Outdent(); + format("#if $1$\n", guard); + format.Indent(); + } + format("static const char* $1$(PROTOBUF_TC_PARAM_DECL);\n", name); + if (!guard.empty()) { + format.Outdent(); + format("#endif // $1$\n", guard); + format.Indent(); + } + }; + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + format.Indent(); + } + format("// The Tct_* functions are internal to the protobuf runtime:\n"); + // These guards are defined in port_def.inc: + declare_function("Tct_ParseS1", "PROTOBUF_TC_STATIC_PARSE_SINGULAR1"); + declare_function("Tct_ParseS2", "PROTOBUF_TC_STATIC_PARSE_SINGULAR2"); + declare_function("Tct_ParseR1", "PROTOBUF_TC_STATIC_PARSE_REPEATED1"); + declare_function("Tct_ParseR2", "PROTOBUF_TC_STATIC_PARSE_REPEATED2"); + if (tc_table_info_->use_generated_fallback) { + format.Outdent(); + format( + " private:\n" + " "); + declare_function("Tct_ParseFallback", ""); + format(" public:\n"); + format.Indent(); + } + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#endif\n"); + format.Indent(); + } + } + format( + "const char* _InternalParse(const char* ptr, " + "::$proto_ns$::internal::ParseContext* ctx) final;\n"); +} + +void ParseFunctionGenerator::GenerateMethodImpls(io::Printer* printer) { + Formatter format(printer, variables_); + bool need_parse_function = true; + if (descriptor_->options().message_set_wire_format()) { + // Special-case MessageSet. + need_parse_function = false; + format( + "const char* $classname$::_InternalParse(const char* ptr,\n" + " ::$proto_ns$::internal::ParseContext* ctx) {\n" + "$annotate_deserialize$" + " return _extensions_.ParseMessageSet(ptr, \n" + " internal_default_instance(), &_internal_metadata_, ctx);\n" + "}\n"); + } + if (!should_generate_tctable()) { + if (need_parse_function) { + GenerateLoopingParseFunction(format); + } + return; + } + if (should_generate_guarded_tctable()) { + format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n\n"); + } + if (need_parse_function) { + GenerateTailcallParseFunction(format); + } + if (tc_table_info_->use_generated_fallback) { + GenerateTailcallFallbackFunction(format); + } + GenerateTailcallFieldParseFunctions(format); + if (should_generate_guarded_tctable()) { + if (need_parse_function) { + format("\n#else // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n\n"); + GenerateLoopingParseFunction(format); + } + format("\n#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + } +} + +bool ParseFunctionGenerator::should_generate_tctable() const { + if (options_.tctable_mode == Options::kTCTableNever) { + return false; + } + return true; +} + +void ParseFunctionGenerator::GenerateTailcallParseFunction(Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + + // Generate an `_InternalParse` that starts the tail-calling loop. + format( + "const char* $classname$::_InternalParse(\n" + " const char* ptr, ::$proto_ns$::internal::ParseContext* ctx) {\n" + "$annotate_deserialize$" + " ptr = ::$proto_ns$::internal::TcParser::ParseLoop(\n" + " this, ptr, ctx, &_table_.header);\n"); + format( + " return ptr;\n" + "}\n\n"); +} + +void ParseFunctionGenerator::GenerateTailcallFallbackFunction( + Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + format( + "const char* $classname$::Tct_ParseFallback(PROTOBUF_TC_PARAM_DECL) {\n" + "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) return nullptr\n"); + format.Indent(); + format("auto* typed_msg = static_cast<$classname$*>(msg);\n"); + + if (num_hasbits_ > 0) { + // Sync hasbits + format("typed_msg->_has_bits_[0] = hasbits;\n"); + } + + format.Set("msg", "typed_msg->"); + format.Set("this", "typed_msg"); + format.Set("has_bits", "typed_msg->_has_bits_"); + format.Set("next_tag", "goto next_tag"); + GenerateParseIterationBody(format, descriptor_, + tc_table_info_->fallback_fields); + + format.Outdent(); + format( + "next_tag:\n" + "message_done:\n" + " return ptr;\n" + "#undef CHK_\n" + "}\n"); +} + +void ParseFunctionGenerator::GenerateTailcallFieldParseFunctions( + Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + // There are four cases where a tailcall target are needed for messages: + // {singular, repeated} x {1, 2}-byte tag + struct { + const char* type; + int size; + } const kTagLayouts[] = { + {"uint8_t", 1}, + {"uint16_t", 2}, + }; + // Singular: + for (const auto& layout : kTagLayouts) { + // Guard macros are defined in port_def.inc. + format( + "#if PROTOBUF_TC_STATIC_PARSE_SINGULAR$1$\n" + "const char* $classname$::Tct_ParseS$1$(PROTOBUF_TC_PARAM_DECL) {\n" + " if (PROTOBUF_PREDICT_FALSE(data.coded_tag<$2$>() != 0))\n" + " PROTOBUF_MUSTTAIL " + "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" + " ptr += $1$;\n" + " hasbits |= (uint64_t{1} << data.hasbit_idx());\n" + " ::$proto_ns$::internal::TcParser::SyncHasbits" + "(msg, hasbits, table);\n" + " auto& field = ::$proto_ns$::internal::TcParser::" + "RefAt<$classtype$*>(msg, data.offset());\n" + " if (field == nullptr)\n" + " field = CreateMaybeMessage<$classtype$>(ctx->data().arena);\n" + " return ctx->ParseMessage(field, ptr);\n" + "}\n" + "#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR$1$\n", + layout.size, layout.type); + } + // Repeated: + for (const auto& layout : kTagLayouts) { + // Guard macros are defined in port_def.inc. + format( + "#if PROTOBUF_TC_STATIC_PARSE_REPEATED$1$\n" + "const char* $classname$::Tct_ParseR$1$(PROTOBUF_TC_PARAM_DECL) {\n" + " if (PROTOBUF_PREDICT_FALSE(data.coded_tag<$2$>() != 0)) {\n" + " PROTOBUF_MUSTTAIL " + "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" + " }\n" + " ptr += $1$;\n" + " auto& field = ::$proto_ns$::internal::TcParser::RefAt<" + "::$proto_ns$::RepeatedPtrField<$classname$>>(msg, data.offset());\n" + " ::$proto_ns$::internal::TcParser::SyncHasbits" + "(msg, hasbits, table);\n" + " ptr = ctx->ParseMessage(field.Add(), ptr);\n" + " return ptr;\n" + "}\n" + "#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED$1$\n", + layout.size, layout.type); + } +} + +void ParseFunctionGenerator::GenerateDataDecls(io::Printer* printer) { + if (!should_generate_tctable()) { + return; + } + Formatter format(printer, variables_); + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + format.Indent(); + } + format( + "static const ::$proto_ns$::internal::TcParseTable<$1$>\n" + " _table_;\n", + tc_table_info_->table_size_log2); + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + format.Indent(); + } +} + +void ParseFunctionGenerator::GenerateDataDefinitions(io::Printer* printer) { + if (!should_generate_tctable()) { + return; + } + Formatter format(printer, variables_); + if (should_generate_guarded_tctable()) { + format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + } + GenerateTailCallTable(format); + if (should_generate_guarded_tctable()) { + format("#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + } +} + +void ParseFunctionGenerator::GenerateLoopingParseFunction(Formatter& format) { + format( + "const char* $classname$::_InternalParse(const char* ptr, " + "::$proto_ns$::internal::ParseContext* ctx) {\n" + "$annotate_deserialize$" + "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure\n"); + format.Indent(); + format.Set("msg", ""); + format.Set("this", "this"); + int hasbits_size = 0; + if (num_hasbits_ > 0) { + hasbits_size = (num_hasbits_ + 31) / 32; + } + // For now only optimize small hasbits. + if (hasbits_size != 1) hasbits_size = 0; + if (hasbits_size) { + format("_Internal::HasBits has_bits{};\n"); + format.Set("has_bits", "has_bits"); + } else { + format.Set("has_bits", "_has_bits_"); + } + format.Set("next_tag", "continue"); + format("while (!ctx->Done(&ptr)) {\n"); + format.Indent(); + + GenerateParseIterationBody(format, descriptor_, + GetOrderedFields(descriptor_, options_)); + + format.Outdent(); + format("} // while\n"); + + format.Outdent(); + format("message_done:\n"); + if (hasbits_size) format(" _has_bits_.Or(has_bits);\n"); + + format( + " return ptr;\n" + "failure:\n" + " ptr = nullptr;\n" + " goto message_done;\n" + "#undef CHK_\n" + "}\n"); +} + +void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + // All entries without a fast-path parsing function need a fallback. + std::string fallback; + if (tc_table_info_->use_generated_fallback) { + fallback = ClassName(descriptor_) + "::Tct_ParseFallback"; + } else { + fallback = TcParserName(options_) + "GenericFallback"; + if (GetOptimizeFor(descriptor_->file(), options_) == + FileOptions::LITE_RUNTIME) { + fallback += "Lite"; + } + } + + // For simplicity and speed, the table is not covering all proto + // configurations. This model uses a fallback to cover all situations that + // the table can't accommodate, together with unknown fields or extensions. + // These are number of fields over 32, fields with 3 or more tag bytes, + // maps, weak fields, lazy, more than 1 extension range. In the cases + // the table is sufficient we can use a generic routine, that just handles + // unknown fields and potentially an extension range. + format( + "const ::$proto_ns$::internal::TcParseTable<$1$>\n" + " $classname$::_table_ = {\n", + tc_table_info_->table_size_log2); + { + auto table_scope = format.ScopedIndent(); + format("{\n"); + { + auto header_scope = format.ScopedIndent(); + if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { + format("PROTOBUF_FIELD_OFFSET($classname$, _has_bits_),\n"); + } else { + format("0, // no _has_bits_\n"); + } + if (descriptor_->extension_range_count() == 1) { + format( + "PROTOBUF_FIELD_OFFSET($classname$, _extensions_),\n" + "$1$, $2$, // extension_range_{low,high}\n", + descriptor_->extension_range(0)->start, + descriptor_->extension_range(0)->end); + } else { + format("0, 0, 0, // no _extensions_\n"); + } + format( + "$1$, 0, $2$, // fast_idx_mask, reserved, num_fields\n" + "&$3$._instance,\n" + "$4$ // fallback\n", + (((1 << tc_table_info_->table_size_log2) - 1) << 3), + descriptor_->field_count(), + DefaultInstanceName(descriptor_, options_), fallback); + } + format("}, {\n"); + { + auto fast_scope = format.ScopedIndent(); + GenerateFastFieldEntries(format, fallback); + } + format("},\n"); // entries[] + } + format("};\n\n"); // _table_ +} + +void ParseFunctionGenerator::GenerateFastFieldEntries( + Formatter& format, const std::string& fallback) { + for (const auto& info : tc_table_info_->fast_path_fields) { + if (info.field != nullptr) { + PrintFieldComment(format, info.field); + } + format("{$1$, ", info.func_name.empty() ? fallback : info.func_name); + if (info.bits.data) { + GOOGLE_DCHECK_NE(nullptr, info.field); + format( + "{$1$, $2$, " + "static_cast(PROTOBUF_FIELD_OFFSET($classname$, $3$_))}", + info.bits.coded_tag(), info.bits.hasbit_idx(), FieldName(info.field)); + } else { + format("{}"); + } + format("},\n"); + } +} + +void ParseFunctionGenerator::GenerateArenaString(Formatter& format, + const FieldDescriptor* field) { + if (HasHasbit(field)) { + format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); + } + std::string default_string = + field->default_value_string().empty() + ? "::" + ProtobufNamespace(options_) + + "::internal::GetEmptyStringAlreadyInited()" + : QualifiedClassName(field->containing_type(), options_) + + "::" + MakeDefaultName(field) + ".get()"; + format( + "if (arena != nullptr) {\n" + " ptr = ctx->ReadArenaString(ptr, &$msg$$name$_, arena"); + if (IsStringInlined(field, options_)) { + GOOGLE_DCHECK(!inlined_string_indices_.empty()); + int inlined_string_index = inlined_string_indices_[field->index()]; + GOOGLE_DCHECK_GE(inlined_string_index, 0); + format( + ", $msg$_internal_$name$_donated()" + ", &$msg$_inlined_string_donated_[$1$]" + ", ~0x$2$u", + inlined_string_index / 32, + strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8)); + } else { + GOOGLE_DCHECK(field->default_value_string().empty()); + } + format( + ");\n" + "} else {\n" + " ptr = ::$proto_ns$::internal::InlineGreedyStringParser(" + "$msg$$name$_.MutableNoArenaNoDefault(&$1$), ptr, ctx);\n" + "}\n" + "const std::string* str = &$msg$$name$_.Get(); (void)str;\n", + default_string); +} + +void ParseFunctionGenerator::GenerateStrings(Formatter& format, + const FieldDescriptor* field, + bool check_utf8) { + FieldOptions::CType ctype = FieldOptions::STRING; + if (!options_.opensource_runtime) { + // Open source doesn't support other ctypes; + ctype = field->options().ctype(); + } + if (!field->is_repeated() && !options_.opensource_runtime && + GetOptimizeFor(field->file(), options_) != FileOptions::LITE_RUNTIME && + // For now only use arena string for strings with empty defaults. + field->default_value_string().empty() && + !field->real_containing_oneof() && ctype == FieldOptions::STRING) { + GenerateArenaString(format, field); + } else { + std::string parser_name; + switch (ctype) { + case FieldOptions::STRING: + parser_name = "GreedyStringParser"; + break; + case FieldOptions::CORD: + parser_name = "CordParser"; + break; + case FieldOptions::STRING_PIECE: + parser_name = "StringPieceParser"; + break; + } + format( + "auto str = $msg$$1$$2$_$name$();\n" + "ptr = ::$proto_ns$::internal::Inline$3$(str, ptr, ctx);\n", + HasInternalAccessors(ctype) ? "_internal_" : "", + field->is_repeated() && !field->is_packable() ? "add" : "mutable", + parser_name); + } + if (!check_utf8) return; // return if this is a bytes field + auto level = GetUtf8CheckMode(field, options_); + switch (level) { + case Utf8CheckMode::kNone: + return; + case Utf8CheckMode::kVerify: + format("#ifndef NDEBUG\n"); + break; + case Utf8CheckMode::kStrict: + format("CHK_("); + break; + } + std::string field_name; + field_name = "nullptr"; + if (HasDescriptorMethods(field->file(), options_)) { + field_name = StrCat("\"", field->full_name(), "\""); + } + format("::$proto_ns$::internal::VerifyUTF8(str, $1$)", field_name); + switch (level) { + case Utf8CheckMode::kNone: + return; + case Utf8CheckMode::kVerify: + format( + ";\n" + "#endif // !NDEBUG\n"); + break; + case Utf8CheckMode::kStrict: + format(");\n"); + break; + } +} + +void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format, + const FieldDescriptor* field) { + if (field->is_packable()) { + if (field->type() == FieldDescriptor::TYPE_ENUM && + !HasPreservingUnknownEnumSemantics(field)) { + std::string enum_type = QualifiedClassName(field->enum_type(), options_); + format( + "ptr = " + "::$proto_ns$::internal::Packed$1$Parser<$unknown_fields_type$>(" + "$msg$_internal_mutable_$name$(), ptr, ctx, $2$_IsValid, " + "&$msg$_internal_metadata_, $3$);\n", + DeclaredTypeMethodName(field->type()), enum_type, field->number()); + } else { + format( + "ptr = ::$proto_ns$::internal::Packed$1$Parser(" + "$msg$_internal_mutable_$name$(), ptr, ctx);\n", + DeclaredTypeMethodName(field->type())); + } + } else { + auto field_type = field->type(); + switch (field_type) { + case FieldDescriptor::TYPE_STRING: + GenerateStrings(format, field, true /* utf8 */); + break; + case FieldDescriptor::TYPE_BYTES: + GenerateStrings(format, field, false /* utf8 */); + break; + case FieldDescriptor::TYPE_MESSAGE: { + if (field->is_map()) { + const FieldDescriptor* val = + field->message_type()->FindFieldByName("value"); + GOOGLE_CHECK(val); + if (val->type() == FieldDescriptor::TYPE_ENUM && + !HasPreservingUnknownEnumSemantics(field)) { + format( + "auto object = " + "::$proto_ns$::internal::InitEnumParseWrapper<" + "$unknown_fields_type$>(&$msg$$name$_, $1$_IsValid, " + "$2$, &$msg$_internal_metadata_);\n" + "ptr = ctx->ParseMessage(&object, ptr);\n", + QualifiedClassName(val->enum_type(), options_), + field->number()); + } else { + format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); + } + } else if (IsLazy(field, options_, scc_analyzer_)) { + if (field->real_containing_oneof()) { + format( + "if (!$msg$_internal_has_$name$()) {\n" + " $msg$clear_$1$();\n" + " $msg$$1$_.$name$_ = ::$proto_ns$::Arena::CreateMessage<\n" + " ::$proto_ns$::internal::LazyField>(" + "$msg$GetArenaForAllocation());\n" + " $msg$set_has_$name$();\n" + "}\n" + "auto* lazy_field = $msg$$1$_.$name$_;\n", + field->containing_oneof()->name()); + } else if (HasHasbit(field)) { + format( + "_Internal::set_has_$name$(&$has_bits$);\n" + "auto* lazy_field = &$msg$$name$_;\n"); + } else { + format("auto* lazy_field = &$msg$$name$_;\n"); + } + format( + "::$proto_ns$::internal::LazyFieldParseHelper<\n" + " ::$proto_ns$::internal::LazyField> parse_helper(\n" + " $1$::default_instance(),\n" + " $msg$GetArenaForAllocation(), lazy_field);\n" + "ptr = ctx->ParseMessage(&parse_helper, ptr);\n", + FieldMessageTypeName(field, options_)); + } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) { + if (!field->is_repeated()) { + format( + "ptr = ctx->ParseMessage(_Internal::mutable_$name$($this$), " + "ptr);\n"); + } else { + format( + "ptr = ctx->ParseMessage($msg$$name$_.AddWeak(" + "reinterpret_cast($1$ptr_)" + "), ptr);\n", + QualifiedDefaultInstanceName(field->message_type(), options_)); + } + } else if (IsWeak(field, options_)) { + format( + "{\n" + " auto* default_ = &reinterpret_cast($1$);\n" + " ptr = ctx->ParseMessage($msg$_weak_field_map_.MutableMessage(" + "$2$, default_), ptr);\n" + "}\n", + QualifiedDefaultInstanceName(field->message_type(), options_), + field->number()); + } else { + format( + "ptr = ctx->ParseMessage($msg$_internal_$mutable_field$(), " + "ptr);\n"); + } + break; + } + default: + GOOGLE_LOG(FATAL) << "Illegal combination for length delimited wiretype " + << " filed type is " << field->type(); + } + } +} + +static bool ShouldRepeat(const FieldDescriptor* descriptor, + WireFormatLite::WireType wiretype) { + constexpr int kMaxTwoByteFieldNumber = 16 * 128; + return descriptor->number() < kMaxTwoByteFieldNumber && + descriptor->is_repeated() && + (!descriptor->is_packable() || + wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED); +} + +void ParseFunctionGenerator::GenerateFieldBody( + Formatter& format, WireFormatLite::WireType wiretype, + const FieldDescriptor* field) { + Formatter::SaveState formatter_state(&format); + format.AddMap( + {{"name", FieldName(field)}, + {"primitive_type", PrimitiveTypeName(options_, field->cpp_type())}}); + if (field->is_repeated()) { + format.AddMap({{"put_field", StrCat("add_", FieldName(field))}, + {"mutable_field", StrCat("add_", FieldName(field))}}); + } else { + format.AddMap( + {{"put_field", StrCat("set_", FieldName(field))}, + {"mutable_field", StrCat("mutable_", FieldName(field))}}); + } + uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype); + switch (wiretype) { + case WireFormatLite::WIRETYPE_VARINT: { + std::string type = PrimitiveTypeName(options_, field->cpp_type()); + if (field->type() == FieldDescriptor::TYPE_ENUM) { + format.Set("enum_type", + QualifiedClassName(field->enum_type(), options_)); + format( + "$uint64$ val = ::$proto_ns$::internal::ReadVarint64(&ptr);\n" + "CHK_(ptr);\n"); + if (!HasPreservingUnknownEnumSemantics(field)) { + format("if (PROTOBUF_PREDICT_TRUE($enum_type$_IsValid(val))) {\n"); + format.Indent(); + } + format("$msg$_internal_$put_field$(static_cast<$enum_type$>(val));\n"); + if (!HasPreservingUnknownEnumSemantics(field)) { + format.Outdent(); + format( + "} else {\n" + " ::$proto_ns$::internal::WriteVarint(" + "$1$, val, $msg$mutable_unknown_fields());\n" + "}\n", + field->number()); + } + } else { + std::string size = (field->type() == FieldDescriptor::TYPE_INT32 || + field->type() == FieldDescriptor::TYPE_SINT32 || + field->type() == FieldDescriptor::TYPE_UINT32) + ? "32" + : "64"; + std::string zigzag; + if ((field->type() == FieldDescriptor::TYPE_SINT32 || + field->type() == FieldDescriptor::TYPE_SINT64)) { + zigzag = "ZigZag"; + } + if (field->is_repeated() || field->real_containing_oneof()) { + format( + "$msg$_internal_$put_field$(" + "::$proto_ns$::internal::ReadVarint$1$$2$(&ptr));\n" + "CHK_(ptr);\n", + zigzag, size); + } else { + if (HasHasbit(field)) { + format("_Internal::set_has_$name$(&$has_bits$);\n"); + } + format( + "$msg$$name$_ = ::$proto_ns$::internal::ReadVarint$1$$2$(&ptr);\n" + "CHK_(ptr);\n", + zigzag, size); + } + } + break; + } + case WireFormatLite::WIRETYPE_FIXED32: + case WireFormatLite::WIRETYPE_FIXED64: { + if (field->is_repeated() || field->real_containing_oneof()) { + format( + "$msg$_internal_$put_field$(" + "::$proto_ns$::internal::UnalignedLoad<$primitive_type$>(ptr));\n" + "ptr += sizeof($primitive_type$);\n"); + } else { + if (HasHasbit(field)) { + format("_Internal::set_has_$name$(&$has_bits$);\n"); + } + format( + "$msg$$name$_ = " + "::$proto_ns$::internal::UnalignedLoad<$primitive_type$>(ptr);\n" + "ptr += sizeof($primitive_type$);\n"); + } + break; + } + case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { + GenerateLengthDelim(format, field); + format("CHK_(ptr);\n"); + break; + } + case WireFormatLite::WIRETYPE_START_GROUP: { + format( + "ptr = ctx->ParseGroup($msg$_internal_$mutable_field$(), ptr, $1$);\n" + "CHK_(ptr);\n", + tag); + break; + } + case WireFormatLite::WIRETYPE_END_GROUP: { + GOOGLE_LOG(FATAL) << "Can't have end group field\n"; + break; + } + } // switch (wire_type) +} + +// Returns the tag for this field and in case of repeated packable fields, +// sets a fallback tag in fallback_tag_ptr. +static uint32_t ExpectedTag(const FieldDescriptor* field, + uint32_t* fallback_tag_ptr) { + uint32_t expected_tag; + if (field->is_packable()) { + auto expected_wiretype = WireFormat::WireTypeForFieldType(field->type()); + expected_tag = WireFormatLite::MakeTag(field->number(), expected_wiretype); + GOOGLE_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + auto fallback_wiretype = WireFormatLite::WIRETYPE_LENGTH_DELIMITED; + uint32_t fallback_tag = + WireFormatLite::MakeTag(field->number(), fallback_wiretype); + + if (field->is_packed()) std::swap(expected_tag, fallback_tag); + *fallback_tag_ptr = fallback_tag; + } else { + auto expected_wiretype = WireFormat::WireTypeForField(field); + expected_tag = WireFormatLite::MakeTag(field->number(), expected_wiretype); + } + return expected_tag; +} + +// These variables are used by the generated parse iteration, and must already +// be defined in the generated code: +// - `const char* ptr`: the input buffer. +// - `ParseContext* ctx`: the associated context for `ptr`. +// - implicit `this`: i.e., we must be in a non-static member function. +// +// The macro `CHK_(x)` must be defined. It should return an error condition if +// the macro parameter is false. +// +// Whenever an END_GROUP tag was read, or tag 0 was read, the generated code +// branches to the label `message_done`. +// +// These formatter variables are used: +// - `next_tag`: a single statement to begin parsing the next tag. +// +// At the end of the generated code, the enclosing function should proceed to +// parse the next tag in the stream. +void ParseFunctionGenerator::GenerateParseIterationBody( + Formatter& format, const Descriptor* descriptor, + const std::vector& ordered_fields) { + format( + "$uint32$ tag;\n" + "ptr = ::$proto_ns$::internal::ReadTag(ptr, &tag);\n"); + + if (!ordered_fields.empty()) { + GenerateFieldSwitch(format, ordered_fields); + // Each field `case` only considers field number. Field numbers that are + // not defined in the message, or tags with an incompatible wire type, are + // considered "unusual" cases. They will be handled by the logic below. + format.Outdent(); + format("handle_unusual:\n"); + format.Indent(); + } + + // Unusual/extension/unknown case: + format( + "if ((tag == 0) || ((tag & 7) == 4)) {\n" + " CHK_(ptr);\n" + " ctx->SetLastTag(tag);\n" + " goto message_done;\n" + "}\n"); + if (IsMapEntryMessage(descriptor)) { + format("$next_tag$;\n"); + } else { + if (descriptor->extension_range_count() > 0) { + format("if ("); + for (int i = 0; i < descriptor->extension_range_count(); i++) { + const Descriptor::ExtensionRange* range = + descriptor->extension_range(i); + if (i > 0) format(" ||\n "); + + uint32_t start_tag = WireFormatLite::MakeTag( + range->start, static_cast(0)); + uint32_t end_tag = WireFormatLite::MakeTag( + range->end, static_cast(0)); + + if (range->end > FieldDescriptor::kMaxNumber) { + format("($1$u <= tag)", start_tag); + } else { + format("($1$u <= tag && tag < $2$u)", start_tag, end_tag); + } + } + format( + ") {\n" + " ptr = $msg$_extensions_.ParseField(tag, ptr, " + "internal_default_instance(), &$msg$_internal_metadata_, ctx);\n" + " CHK_(ptr != nullptr);\n" + " $next_tag$;\n" + "}\n"); + } + format( + "ptr = UnknownFieldParse(\n" + " tag,\n" + " $msg$_internal_metadata_.mutable_unknown_fields<" + "$unknown_fields_type$>(),\n" + " ptr, ctx);\n" + "CHK_(ptr != nullptr);\n"); + } +} + +void ParseFunctionGenerator::GenerateFieldSwitch( + Formatter& format, + const std::vector& ordered_fields) { + format("switch (tag >> 3) {\n"); + format.Indent(); + + for (const auto* field : ordered_fields) { + PrintFieldComment(format, field); + format("case $1$:\n", field->number()); + format.Indent(); + uint32_t fallback_tag = 0; + uint32_t expected_tag = ExpectedTag(field, &fallback_tag); + format("if (PROTOBUF_PREDICT_TRUE(static_cast<$uint8$>(tag) == $1$)) {\n", + expected_tag & 0xFF); + format.Indent(); + auto wiretype = WireFormatLite::GetTagWireType(expected_tag); + uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype); + int tag_size = io::CodedOutputStream::VarintSize32(tag); + bool is_repeat = ShouldRepeat(field, wiretype); + if (is_repeat) { + format( + "ptr -= $1$;\n" + "do {\n" + " ptr += $1$;\n", + tag_size); + format.Indent(); + } + GenerateFieldBody(format, wiretype, field); + if (is_repeat) { + format.Outdent(); + format( + " if (!ctx->DataAvailable(ptr)) break;\n" + "} while (::$proto_ns$::internal::ExpectTag<$1$>(ptr));\n", + tag); + } + format.Outdent(); + if (fallback_tag) { + format("} else if (static_cast<$uint8$>(tag) == $1$) {\n", + fallback_tag & 0xFF); + format.Indent(); + GenerateFieldBody(format, WireFormatLite::GetTagWireType(fallback_tag), + field); + format.Outdent(); + } + format( + "} else\n" + " goto handle_unusual;\n" + "$next_tag$;\n"); + format.Outdent(); + } // for loop over ordered fields + + format( + "default:\n" + " goto handle_unusual;\n"); + format.Outdent(); + format("} // switch\n"); +} + +namespace { + +std::string FieldParseFunctionName(const FieldDescriptor* field, + const Options& options) { + ParseCardinality card = // + field->is_packed() ? ParseCardinality::kPacked + : field->is_repeated() ? ParseCardinality::kRepeated + : field->real_containing_oneof() ? ParseCardinality::kOneof + : ParseCardinality::kSingular; + + TypeFormat type_format; + switch (field->type()) { + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_SFIXED64: + case FieldDescriptor::TYPE_DOUBLE: + type_format = TypeFormat::kFixed64; + break; + + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_FLOAT: + type_format = TypeFormat::kFixed32; + break; + + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + type_format = TypeFormat::kVar64; + break; + + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_UINT32: + type_format = TypeFormat::kVar32; + break; + + case FieldDescriptor::TYPE_SINT64: + type_format = TypeFormat::kSInt64; + break; + + case FieldDescriptor::TYPE_SINT32: + type_format = TypeFormat::kSInt32; + break; + + case FieldDescriptor::TYPE_BOOL: + type_format = TypeFormat::kBool; + break; + + case FieldDescriptor::TYPE_BYTES: + type_format = TypeFormat::kBytes; + break; + + case FieldDescriptor::TYPE_STRING: + switch (GetUtf8CheckMode(field, options)) { + case Utf8CheckMode::kNone: + type_format = TypeFormat::kBytes; + break; + case Utf8CheckMode::kStrict: + type_format = TypeFormat::kString; + break; + case Utf8CheckMode::kVerify: + type_format = TypeFormat::kStringValidateOnly; + break; + default: + GOOGLE_LOG(DFATAL) << "Mode not handled: " + << static_cast(GetUtf8CheckMode(field, options)); + return ""; + } + break; + + default: + GOOGLE_LOG(DFATAL) << "Type not handled: " << field->DebugString(); + return ""; + } + + return "::" + ProtobufNamespace(options) + "::internal::TcParser::" + + GetTailCallFieldHandlerName(card, type_format, + TagSize(field->number()), options); +} + +} // namespace + +std::string GetTailCallFieldHandlerName(ParseCardinality card, + TypeFormat type_format, + int tag_length_bytes, + const Options& options) { + std::string name; + + // The field implementation functions are prefixed by cardinality: + // `Singular` for optional or implicit fields. + // `Repeated` for non-packed repeated. + // `Packed` for packed repeated. + switch (card) { + case ParseCardinality::kSingular: + name.append("Singular"); + break; + case ParseCardinality::kOneof: + name.append("Oneof"); + break; + case ParseCardinality::kRepeated: + name.append("Repeated"); + break; + case ParseCardinality::kPacked: + name.append("Packed"); + break; + } + + // Next in the function name is the TypeFormat-specific name. + switch (type_format) { + case TypeFormat::kFixed64: + case TypeFormat::kFixed32: + name.append("Fixed"); + break; + + case TypeFormat::kVar64: + case TypeFormat::kVar32: + case TypeFormat::kSInt64: + case TypeFormat::kSInt32: + case TypeFormat::kBool: + name.append("Varint"); + break; + + case TypeFormat::kBytes: + case TypeFormat::kString: + case TypeFormat::kStringValidateOnly: + name.append("String"); + break; + + default: + break; + } + + name.append("<"); + + // Determine the numeric layout type for the parser to use, independent of + // the specific parsing logic used. + switch (type_format) { + case TypeFormat::kVar64: + case TypeFormat::kFixed64: + name.append("uint64_t, "); + break; + + case TypeFormat::kSInt64: + name.append("int64_t, "); + break; + + case TypeFormat::kVar32: + case TypeFormat::kFixed32: + name.append("uint32_t, "); + break; + + case TypeFormat::kSInt32: + name.append("int32_t, "); + break; + + case TypeFormat::kBool: + name.append("bool, "); + break; + + default: + break; + } + + name.append(CodedTagType(tag_length_bytes)); + + switch (type_format) { + case TypeFormat::kVar64: + case TypeFormat::kVar32: + case TypeFormat::kBool: + StrAppend(&name, ", ", TcParserName(options), "kNoConversion"); + break; + + case TypeFormat::kSInt64: + case TypeFormat::kSInt32: + StrAppend(&name, ", ", TcParserName(options), "kZigZag"); + break; + + case TypeFormat::kBytes: + StrAppend(&name, ", ", TcParserName(options), "kNoUtf8"); + break; + + case TypeFormat::kString: + StrAppend(&name, ", ", TcParserName(options), "kUtf8"); + break; + + case TypeFormat::kStringValidateOnly: + StrAppend(&name, ", ", TcParserName(options), "kUtf8ValidateOnly"); + break; + + default: + break; + } + + name.append(">"); + return name; +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h new file mode 100644 index 000000000..b921067bd --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h @@ -0,0 +1,199 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +// Helper class for generating tailcall parsing functions. +struct TailCallTableInfo { + TailCallTableInfo(const Descriptor* descriptor, const Options& options, + const std::vector& has_bit_indices, + MessageSCCAnalyzer* scc_analyzer); + // Information to generate field entries. + struct FieldInfo { + const FieldDescriptor* field; + google::protobuf::internal::TcFieldData bits; + std::string func_name; + }; + // Fields parsed by the table fast-path. + std::vector fast_path_fields; + // Fields parsed by slow-path fallback. + std::vector fallback_fields; + // Table size. + int table_size_log2; + // Mask for has-bits of required fields. + uint32_t has_hasbits_required_mask; + // True if a generated fallback function is required instead of generic. + bool use_generated_fallback; +}; + +// ParseFunctionGenerator generates the _InternalParse function for a message +// (and any associated supporting members). +class ParseFunctionGenerator { + public: + ParseFunctionGenerator(const Descriptor* descriptor, int max_has_bit_index, + const std::vector& has_bit_indices, + const std::vector& inlined_string_indices, + const Options& options, + MessageSCCAnalyzer* scc_analyzer, + const std::map& vars); + + // Emits class-level method declarations to `printer`: + void GenerateMethodDecls(io::Printer* printer); + + // Emits out-of-class method implementation definitions to `printer`: + void GenerateMethodImpls(io::Printer* printer); + + // Emits class-level data member declarations to `printer`: + void GenerateDataDecls(io::Printer* printer); + + // Emits out-of-class data member definitions to `printer`: + void GenerateDataDefinitions(io::Printer* printer); + + private: + // Returns true if tailcall table code should be generated. + bool should_generate_tctable() const; + + // Returns true if tailcall table code should be generated, but inside an + // #ifdef guard. + bool should_generate_guarded_tctable() const { + return should_generate_tctable() && + options_.tctable_mode == Options::kTCTableGuarded; + } + + // Generates a tail-calling `_InternalParse` function. + void GenerateTailcallParseFunction(Formatter& format); + + // Generates a fallback function for tailcall table-based parsing. + void GenerateTailcallFallbackFunction(Formatter& format); + + // Generates functions for parsing this message as a field. + void GenerateTailcallFieldParseFunctions(Formatter& format); + + // Generates a looping `_InternalParse` function. + void GenerateLoopingParseFunction(Formatter& format); + + // Generates the tail-call table definition. + void GenerateTailCallTable(Formatter& format); + void GenerateFastFieldEntries(Formatter& format, const std::string& fallback); + + // Generates parsing code for an `ArenaString` field. + void GenerateArenaString(Formatter& format, const FieldDescriptor* field); + + // Generates parsing code for a string-typed field. + void GenerateStrings(Formatter& format, const FieldDescriptor* field, + bool check_utf8); + + // Generates parsing code for a length-delimited field (strings, messages, + // etc.). + void GenerateLengthDelim(Formatter& format, const FieldDescriptor* field); + + // Generates the parsing code for a known field. + void GenerateFieldBody(Formatter& format, + google::protobuf::internal::WireFormatLite::WireType wiretype, + const FieldDescriptor* field); + + // Generates code to parse the next field from the input stream. + void GenerateParseIterationBody( + Formatter& format, const Descriptor* descriptor, + const std::vector& ordered_fields); + + // Generates a `switch` statement to parse each of `ordered_fields`. + void GenerateFieldSwitch( + Formatter& format, + const std::vector& ordered_fields); + + const Descriptor* descriptor_; + MessageSCCAnalyzer* scc_analyzer_; + const Options& options_; + std::map variables_; + std::unique_ptr tc_table_info_; + std::vector inlined_string_indices_; + int num_hasbits_; +}; + +enum class ParseCardinality { + kSingular, + kOneof, + kRepeated, + kPacked, +}; + +// TypeFormat defines parsing types, which encapsulates the expected wire +// format, conversion or validation, and the in-memory layout. +enum class TypeFormat { + // Fixed types: + kFixed64, // fixed64, sfixed64, double + kFixed32, // fixed32, sfixed32, float + + // Varint types: + kVar64, // int64, uint64 + kVar32, // int32, uint32 + kSInt64, // sint64 + kSInt32, // sint32 + kBool, // bool + + // Length-delimited types: + kBytes, // bytes + kString, // string (proto3/UTF-8 strict) + kStringValidateOnly, // string (proto2/UTF-8 validate only) +}; + +// Returns the name of a field parser function. +// +// These are out-of-line functions generated by +// parse_function_inc_generator_main. +std::string GetTailCallFieldHandlerName(ParseCardinality card, + TypeFormat type_format, + int tag_length_bytes, + const Options& options); + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc index 10e468b0b..373f38d80 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc @@ -36,13 +36,12 @@ #include +#include +#include #include #include #include #include - -#include -#include #include #include @@ -81,13 +80,9 @@ class TestGenerator : public CodeGenerator { // Check field accessors for a required string: TryInsert("test.pb.h", "field_get:foo.Bar.requiredString", context); TryInsert("test.pb.h", "field_set:foo.Bar.requiredString", context); - TryInsert("test.pb.h", "field_set_char:foo.Bar.requiredString", context); - TryInsert("test.pb.h", "field_set_pointer:foo.Bar.requiredString", context); TryInsert("test.pb.h", "field_mutable:foo.Bar.requiredString", context); TryInsert("test.pb.h", "field_set_allocated:foo.Bar.requiredString", context); - TryInsert("test.pb.h", "field_set_char:foo.Bar.requiredString", context); - TryInsert("test.pb.h", "field_set_pointer:foo.Bar.requiredString", context); // Check field accessors for a repeated string: TryInsert("test.pb.h", "field_get:foo.Bar.repeatedString", context); @@ -105,12 +100,8 @@ class TestGenerator : public CodeGenerator { // Check field accessors for a string inside oneof{}: TryInsert("test.pb.h", "field_get:foo.Bar.oneOfString", context); TryInsert("test.pb.h", "field_set:foo.Bar.oneOfString", context); - TryInsert("test.pb.h", "field_set_char:foo.Bar.oneOfString", context); - TryInsert("test.pb.h", "field_set_pointer:foo.Bar.oneOfString", context); TryInsert("test.pb.h", "field_mutable:foo.Bar.oneOfString", context); TryInsert("test.pb.h", "field_set_allocated:foo.Bar.oneOfString", context); - TryInsert("test.pb.h", "field_set_char:foo.Bar.oneOfString", context); - TryInsert("test.pb.h", "field_set_pointer:foo.Bar.oneOfString", context); // Check field accessors for an optional message: TryInsert("test.pb.h", "field_get:foo.Bar.optMessage", context); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index 042776c2d..ffccf08aa 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -33,6 +33,7 @@ // Sanjay Ghemawat, Jeff Dean, and others. #include + #include #include #include @@ -152,7 +153,7 @@ void PrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( " return $name$_;\n" "}\n" "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" "}\n" @@ -161,8 +162,8 @@ void PrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( " $name$_ = value;\n" "}\n" "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" " _internal_set_$name$(value);\n" + "$annotate_set$" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -208,15 +209,30 @@ void PrimitiveFieldGenerator::GenerateByteSize(io::Printer* printer) const { Formatter format(printer, variables_); int fixed_size = FixedSize(descriptor_->type()); if (fixed_size == -1) { - format( - "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " this->_internal_$name$());\n"); + if (internal::WireFormat::TagSize(descriptor_->number(), + descriptor_->type()) == 1) { + // Adding one is very common and it turns out it can be done for + // free inside of WireFormatLite, so we can save an instruction here. + format( + "total_size += ::$proto_ns$::internal::WireFormatLite::" + "$declared_type$SizePlusOne(this->_internal_$name$());\n"); + } else { + format( + "total_size += $tag_size$ +\n" + " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" + " this->_internal_$name$());\n"); + } } else { format("total_size += $tag_size$ + $fixed_size$;\n"); } } +void PrimitiveFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_($default$)"); +} + // =================================================================== PrimitiveOneofFieldGenerator::PrimitiveOneofFieldGenerator( @@ -245,13 +261,13 @@ void PrimitiveOneofFieldGenerator::GenerateInlineAccessorDefinitions( " $field_member$ = value;\n" "}\n" "inline $type$ $classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$();\n" "}\n" "inline void $classname$::set_$name$($type$ value) {\n" - "$annotate_accessor$" " _internal_set_$name$(value);\n" + "$annotate_set$" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n"); } @@ -295,7 +311,7 @@ void RepeatedPrimitiveFieldGenerator::GeneratePrivateMembers( io::Printer* printer) const { Formatter format(printer, variables_); format("::$proto_ns$::RepeatedField< $type$ > $name$_;\n"); - if (descriptor_->is_packed() && + if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && HasGeneratedMethods(descriptor_->file(), options_)) { format("mutable std::atomic _$name$_cached_byte_size_;\n"); } @@ -331,12 +347,12 @@ void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( " return $name$_.Get(index);\n" "}\n" "inline $type$ $classname$::$name$(int index) const {\n" - "$annotate_accessor$" + "$annotate_get$" " // @@protoc_insertion_point(field_get:$full_name$)\n" " return _internal_$name$(index);\n" "}\n" "inline void $classname$::set_$name$(int index, $type$ value) {\n" - "$annotate_accessor$" + "$annotate_set$" " $name$_.Set(index, value);\n" " // @@protoc_insertion_point(field_set:$full_name$)\n" "}\n" @@ -344,8 +360,8 @@ void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( " $name$_.Add(value);\n" "}\n" "inline void $classname$::add_$name$($type$ value) {\n" - "$annotate_accessor$" " _internal_add_$name$(value);\n" + "$annotate_add$" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" @@ -354,7 +370,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline const ::$proto_ns$::RepeatedField< $type$ >&\n" "$classname$::$name$() const {\n" - "$annotate_accessor$" + "$annotate_list$" " // @@protoc_insertion_point(field_list:$full_name$)\n" " return _internal_$name$();\n" "}\n" @@ -364,7 +380,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline ::$proto_ns$::RepeatedField< $type$ >*\n" "$classname$::mutable_$name$() {\n" - "$annotate_accessor$" + "$annotate_mutable_list$" " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" " return _internal_mutable_$name$();\n" "}\n"); @@ -403,13 +419,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); if (descriptor_->is_packed()) { - if (FixedSize(descriptor_->type()) > 0) { - format( - "if (this->_internal_$name$_size() > 0) {\n" - " target = stream->WriteFixedPacked($number$, _internal_$name$(), " - "target);\n" - "}\n"); - } else { + if (FixedSize(descriptor_->type()) == -1) { format( "{\n" " int byte_size = " @@ -419,6 +429,12 @@ void RepeatedPrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray( " $number$, _internal_$name$(), byte_size, target);\n" " }\n" "}\n"); + } else { + format( + "if (this->_internal_$name$_size() > 0) {\n" + " target = stream->WriteFixedPacked($number$, _internal_$name$(), " + "target);\n" + "}\n"); } } else { format( @@ -454,11 +470,14 @@ void RepeatedPrimitiveFieldGenerator::GenerateByteSize( " total_size += $tag_size$ +\n" " ::$proto_ns$::internal::WireFormatLite::Int32Size(\n" " static_cast<$int32$>(data_size));\n" - "}\n" - "int cached_size = ::$proto_ns$::internal::ToCachedSize(data_size);\n" - "_$name$_cached_byte_size_.store(cached_size,\n" - " std::memory_order_relaxed);\n" - "total_size += data_size;\n"); + "}\n"); + if (FixedSize(descriptor_->type()) == -1) { + format( + "int cached_size = ::$proto_ns$::internal::ToCachedSize(data_size);\n" + "_$name$_cached_byte_size_.store(cached_size,\n" + " std::memory_order_relaxed);\n"); + } + format("total_size += data_size;\n"); } else { format( "total_size += $tag_size$ *\n" @@ -470,6 +489,16 @@ void RepeatedPrimitiveFieldGenerator::GenerateByteSize( format("}\n"); } +void RepeatedPrimitiveFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_()"); + if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 && + HasGeneratedMethods(descriptor_->file(), options_)) { + format("\n, _$name$_cached_byte_size_(0)"); + } +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.h similarity index 68% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.h index fe54ce332..ff7c208ff 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_primitive_field.h @@ -51,16 +51,18 @@ class PrimitiveFieldGenerator : public FieldGenerator { ~PrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); @@ -73,10 +75,10 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { ~PrimitiveOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); @@ -89,16 +91,18 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { ~RepeatedPrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_service.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_service.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_service.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_service.cc index 994e653e8..6b1ca83ed 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_service.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_service.cc @@ -241,12 +241,12 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { for (int i = 0; i < descriptor_->method_count(); i++) { const MethodDescriptor* method = descriptor_->method(i); - Formatter format(printer, vars_); - InitMethodVariables(method, options_, &format); + Formatter format_method(printer, vars_); + InitMethodVariables(method, options_, &format_method); // Note: down_cast does not work here because it only works on pointers, // not references. - format( + format_method( " case $1$:\n" " $name$(controller,\n" " ::$proto_ns$::internal::DownCast(\n" diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_service.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_service.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_service.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_service.h diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.cc new file mode 100644 index 000000000..607e81500 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -0,0 +1,915 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include +#include +#include +#include +#include + + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { + +namespace { + +void SetStringVariables(const FieldDescriptor* descriptor, + std::map* variables, + const Options& options) { + SetCommonFieldVariables(descriptor, variables, options); + (*variables)["default"] = DefaultValue(options, descriptor); + (*variables)["default_length"] = + StrCat(descriptor->default_value_string().length()); + std::string default_variable_string = MakeDefaultName(descriptor); + (*variables)["default_variable_name"] = default_variable_string; + + if (!descriptor->default_value_string().empty()) { + (*variables)["lazy_variable"] = + QualifiedClassName(descriptor->containing_type(), options) + + "::" + default_variable_string; + } + + (*variables)["default_string"] = + descriptor->default_value_string().empty() + ? "::" + (*variables)["proto_ns"] + + "::internal::GetEmptyStringAlreadyInited()" + : (*variables)["lazy_variable"] + ".get()"; + (*variables)["init_value"] = + descriptor->default_value_string().empty() + ? "&::" + (*variables)["proto_ns"] + + "::internal::GetEmptyStringAlreadyInited()" + : "nullptr"; + (*variables)["default_value_tag"] = + "::" + (*variables)["proto_ns"] + "::internal::ArenaStringPtr::" + + (descriptor->default_value_string().empty() ? "Empty" : "NonEmpty") + + "Default{}"; + (*variables)["default_variable_or_tag"] = + (*variables)[descriptor->default_value_string().empty() + ? "default_value_tag" + : "lazy_variable"]; + (*variables)["pointer_type"] = + descriptor->type() == FieldDescriptor::TYPE_BYTES ? "void" : "char"; + (*variables)["setter"] = + descriptor->type() == FieldDescriptor::TYPE_BYTES ? "SetBytes" : "Set"; + (*variables)["null_check"] = (*variables)["DCHK"] + "(value != nullptr);\n"; + // NOTE: Escaped here to unblock proto1->proto2 migration. + // TODO(liujisi): Extend this to apply for other conflicting methods. + (*variables)["release_name"] = + SafeFunctionName(descriptor->containing_type(), descriptor, "release_"); + (*variables)["full_name"] = descriptor->full_name(); + + if (options.opensource_runtime) { + (*variables)["string_piece"] = "::std::string"; + } else { + (*variables)["string_piece"] = "::StringPiece"; + } +} + +} // namespace + +// =================================================================== + +StringFieldGenerator::StringFieldGenerator(const FieldDescriptor* descriptor, + const Options& options) + : FieldGenerator(descriptor, options), + inlined_(IsStringInlined(descriptor, options)) { + SetStringVariables(descriptor, &variables_, options); +} + +StringFieldGenerator::~StringFieldGenerator() {} + +void StringFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { + Formatter format(printer, variables_); + if (!inlined_) { + format("::$proto_ns$::internal::ArenaStringPtr $name$_;\n"); + } else { + // `_init_inline_xxx` is used for initializing default instances. + format( + "::$proto_ns$::internal::InlinedStringField $name$_;\n" + "static std::true_type _init_inline_$name$_;\n"); + } +} + +void StringFieldGenerator::GenerateStaticMembers(io::Printer* printer) const { + Formatter format(printer, variables_); + if (!descriptor_->default_value_string().empty()) { + format( + "static const ::$proto_ns$::internal::LazyString" + " $default_variable_name$;\n"); + } +} + +void StringFieldGenerator::GenerateAccessorDeclarations( + io::Printer* printer) const { + Formatter format(printer, variables_); + // If we're using StringFieldGenerator for a field with a ctype, it's + // because that ctype isn't actually implemented. In particular, this is + // true of ctype=CORD and ctype=STRING_PIECE in the open source release. + // We aren't releasing Cord because it has too many Google-specific + // dependencies and we aren't releasing StringPiece because it's hardly + // useful outside of Google and because it would get confusing to have + // multiple instances of the StringPiece class in different libraries (PCRE + // already includes it for their C++ bindings, which came from Google). + // + // In any case, we make all the accessors private while still actually + // using a string to represent the field internally. This way, we can + // guarantee that if we do ever implement the ctype, it won't break any + // existing users who might be -- for whatever reason -- already using .proto + // files that applied the ctype. The field can still be accessed via the + // reflection interface since the reflection interface is independent of + // the string's underlying representation. + + bool unknown_ctype = descriptor_->options().ctype() != + EffectiveStringCType(descriptor_, options_); + + if (unknown_ctype) { + format.Outdent(); + format( + " private:\n" + " // Hidden due to unknown ctype option.\n"); + format.Indent(); + } + + format( + "$deprecated_attr$const std::string& ${1$$name$$}$() const;\n" + "template \n" + "$deprecated_attr$void ${1$set_$name$$}$(ArgT0&& arg0, ArgT... args);\n", + descriptor_); + format( + "$deprecated_attr$std::string* ${1$mutable_$name$$}$();\n" + "PROTOBUF_NODISCARD $deprecated_attr$std::string* " + "${1$$release_name$$}$();\n" + "$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* " + "$name$);\n", + descriptor_); + format( + "private:\n" + "const std::string& _internal_$name$() const;\n" + "inline PROTOBUF_ALWAYS_INLINE void " + "_internal_set_$name$(const std::string& value);\n" + "std::string* _internal_mutable_$name$();\n"); + if (inlined_) { + format( + "inline PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() " + "const;\n"); + } + format("public:\n"); + + if (unknown_ctype) { + format.Outdent(); + format(" public:\n"); + format.Indent(); + } +} + +void StringFieldGenerator::GenerateInlineAccessorDefinitions( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "inline const std::string& $classname$::$name$() const {\n" + "$annotate_get$" + " // @@protoc_insertion_point(field_get:$full_name$)\n"); + if (!descriptor_->default_value_string().empty()) { + format( + " if ($name$_.IsDefault(nullptr)) return " + "$default_variable_name$.get();\n"); + } + format( + " return _internal_$name$();\n" + "}\n"); + if (!inlined_) { + format( + "template \n" + "inline PROTOBUF_ALWAYS_INLINE\n" + "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" + " $set_hasbit$\n" + " $name$_.$setter$($default_value_tag$, static_cast(arg0)," + " args..., GetArenaForAllocation());\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n"); + } else { + format( + "template \n" + "inline PROTOBUF_ALWAYS_INLINE\n" + "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" + " $set_hasbit$\n" + " $name$_.$setter$(nullptr, static_cast(arg0)," + " args..., GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n" + "inline bool $classname$::_internal_$name$_donated() const {\n" + " bool value = $inlined_string_donated$\n" + " return value;\n" + "}\n"); + } + format( + "inline std::string* $classname$::mutable_$name$() {\n" + " std::string* _s = _internal_mutable_$name$();\n" + "$annotate_mutable$" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return _s;\n" + "}\n" + "inline const std::string& $classname$::_internal_$name$() const {\n" + " return $name$_.Get();\n" + "}\n" + "inline void $classname$::_internal_set_$name$(const std::string& " + "value) {\n" + " $set_hasbit$\n"); + if (!inlined_) { + format( + " $name$_.Set($default_value_tag$, value, GetArenaForAllocation());\n" + "}\n"); + } else { + format( + " $name$_.Set(nullptr, value, GetArenaForAllocation(),\n" + " _internal_$name$_donated(), &$donating_states_word$, " + "$mask_for_undonate$);\n" + "}\n"); + } + format( + "inline std::string* $classname$::_internal_mutable_$name$() {\n" + " $set_hasbit$\n"); + if (!inlined_) { + format( + " return $name$_.Mutable($default_variable_or_tag$, " + "GetArenaForAllocation());\n" + "}\n"); + } else { + format( + " return $name$_.Mutable($default_variable_or_tag$, " + "GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n" + "}\n"); + } + format( + "inline std::string* $classname$::$release_name$() {\n" + "$annotate_release$" + " // @@protoc_insertion_point(field_release:$full_name$)\n"); + + if (HasHasbit(descriptor_)) { + format( + " if (!_internal_has_$name$()) {\n" + " return nullptr;\n" + " }\n" + " $clear_hasbit$\n"); + if (!inlined_) { + format( + " auto* p = $name$_.ReleaseNonDefault($init_value$, " + "GetArenaForAllocation());\n"); + if (descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " if ($name$_.IsDefault($init_value$)) {\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + " }\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } + format(" return p;\n"); + } else { + format( + " return $name$_.Release(nullptr, GetArenaForAllocation(), " + "_internal_$name$_donated());\n"); + } + } else { + format( + " return $name$_.Release($init_value$, GetArenaForAllocation());\n"); + } + + format( + "}\n" + "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" + " if ($name$ != nullptr) {\n" + " $set_hasbit$\n" + " } else {\n" + " $clear_hasbit$\n" + " }\n"); + if (!inlined_) { + format( + " $name$_.SetAllocated($init_value$, $name$,\n" + " GetArenaForAllocation());\n"); + if (descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " if ($name$_.IsDefault($init_value$)) {\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + " }\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } + } else { + // Currently, string fields with default value can't be inlined. + format( + " $name$_.SetAllocated(nullptr, $name$, GetArenaForAllocation(), " + "_internal_$name$_donated(), &$donating_states_word$, " + "$mask_for_undonate$);\n"); + } + format( + "$annotate_set$" + " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" + "}\n"); +} + +void StringFieldGenerator::GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const { + Formatter format(printer, variables_); + if (!descriptor_->default_value_string().empty()) { + format( + "const ::$proto_ns$::internal::LazyString " + "$classname$::$default_variable_name$" + "{{{$default$, $default_length$}}, {nullptr}};\n"); + } +} + +void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const { + Formatter format(printer, variables_); + if (descriptor_->default_value_string().empty()) { + format("$name$_.ClearToEmpty();\n"); + } else { + GOOGLE_DCHECK(!inlined_); + format( + "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n"); + } +} + +void StringFieldGenerator::GenerateMessageClearingCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + // Two-dimension specialization here: supporting arenas, field presence, or + // not, and default value is the empty string or not. Complexity here ensures + // the minimal number of branches / amount of extraneous code at runtime + // (given that the below methods are inlined one-liners)! + + // If we have a hasbit, then the Clear() method of the protocol buffer + // will have checked that this field is set. If so, we can avoid redundant + // checks against the default variable. + const bool must_be_present = HasHasbit(descriptor_); + + if (inlined_ && must_be_present) { + // Calling mutable_$name$() gives us a string reference and sets the has bit + // for $name$ (in proto2). We may get here when the string field is inlined + // but the string's contents have not been changed by the user, so we cannot + // make an assertion about the contents of the string and could never make + // an assertion about the string instance. + // + // For non-inlined strings, we distinguish from non-default by comparing + // instances, rather than contents. + format("$DCHK$(!$name$_.IsDefault(nullptr));\n"); + } + + if (descriptor_->default_value_string().empty()) { + if (must_be_present) { + format("$name$_.ClearNonDefaultToEmpty();\n"); + } else { + format("$name$_.ClearToEmpty();\n"); + } + } else { + // Clear to a non-empty default is more involved, as we try to use the + // Arena if one is present and may need to reallocate the string. + format( + "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n "); + } +} + +void StringFieldGenerator::GenerateMergingCode(io::Printer* printer) const { + Formatter format(printer, variables_); + // TODO(gpike): improve this + format("_internal_set_$name$(from._internal_$name$());\n"); +} + +void StringFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { + Formatter format(printer, variables_); + if (!inlined_) { + format( + "::$proto_ns$::internal::ArenaStringPtr::InternalSwap(\n" + " $init_value$,\n" + " &$name$_, lhs_arena,\n" + " &other->$name$_, rhs_arena\n" + ");\n"); + } else { + // At this point, it's guaranteed that the two fields being swapped are on + // the same arena. + format( + "$name$_.Swap(&other->$name$_, nullptr, GetArenaForAllocation(), " + "_internal_$name$_donated(), other->_internal_$name$_donated(), " + "&$donating_states_word$, &(other->$donating_states_word$), " + "$mask_for_undonate$);\n"); + } +} + +void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { + Formatter format(printer, variables_); + if (inlined_ && descriptor_->default_value_string().empty()) { + // Automatic initialization will construct the string. + return; + } + GOOGLE_DCHECK(!inlined_); + format("$name$_.UnsafeSetDefault($init_value$);\n"); + if (IsString(descriptor_, options_) && + descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } +} + +void StringFieldGenerator::GenerateCopyConstructorCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + GenerateConstructorCode(printer); + + if (HasHasbit(descriptor_)) { + format("if (from._internal_has_$name$()) {\n"); + } else { + format("if (!from._internal_$name$().empty()) {\n"); + } + + format.Indent(); + + if (!inlined_) { + format( + "$name$_.Set($default_value_tag$, from._internal_$name$(), \n" + " GetArenaForAllocation());\n"); + } else { + format( + "$name$_.Set(nullptr, from._internal_$name$(),\n" + " GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n"); + } + + format.Outdent(); + format("}\n"); +} + +void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { + Formatter format(printer, variables_); + if (inlined_) { + // The destructor is automatically invoked. + return; + } + + format("$name$_.DestroyNoArena($init_value$);\n"); +} + +void StringFieldGenerator::GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const { + Formatter format(printer, variables_); + if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { + GenerateUtf8CheckCodeForString( + descriptor_, options_, false, + "this->_internal_$name$().data(), " + "static_cast(this->_internal_$name$().length()),\n", + format); + } + format( + "target = stream->Write$declared_type$MaybeAliased(\n" + " $number$, this->_internal_$name$(), target);\n"); +} + +void StringFieldGenerator::GenerateByteSize(io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "total_size += $tag_size$ +\n" + " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" + " this->_internal_$name$());\n"); +} + +void StringFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + if (inlined_) { + format("$name$_(nullptr, false)"); + return; + } + if (descriptor_->default_value_string().empty()) { + format("$name$_(&::$proto_ns$::internal::fixed_address_empty_string)"); + } else { + format("$name$_(nullptr)"); + } +} + +// =================================================================== + +StringOneofFieldGenerator::StringOneofFieldGenerator( + const FieldDescriptor* descriptor, const Options& options) + : StringFieldGenerator(descriptor, options) { + SetCommonOneofFieldVariables(descriptor, &variables_); + variables_["field_name"] = UnderscoresToCamelCase(descriptor->name(), true); + variables_["oneof_index"] = + StrCat(descriptor->containing_oneof()->index()); +} + +StringOneofFieldGenerator::~StringOneofFieldGenerator() {} + +void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "inline const std::string& $classname$::$name$() const {\n" + "$annotate_get$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$();\n" + "}\n" + "template \n" + "inline void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" + " if (!_internal_has_$name$()) {\n" + " clear_$oneof_name$();\n" + " set_has_$name$();\n" + " $field_member$.UnsafeSetDefault($init_value$);\n" + " }\n" + " $field_member$.$setter$($default_value_tag$," + " static_cast(arg0), args..., GetArenaForAllocation());\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n" + "inline std::string* $classname$::mutable_$name$() {\n" + " std::string* _s = _internal_mutable_$name$();\n" + "$annotate_mutable$" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return _s;\n" + "}\n" + "inline const std::string& $classname$::_internal_$name$() const {\n" + " if (_internal_has_$name$()) {\n" + " return $field_member$.Get();\n" + " }\n" + " return $default_string$;\n" + "}\n" + "inline void $classname$::_internal_set_$name$(const std::string& " + "value) {\n" + " if (!_internal_has_$name$()) {\n" + " clear_$oneof_name$();\n" + " set_has_$name$();\n" + " $field_member$.UnsafeSetDefault($init_value$);\n" + " }\n" + " $field_member$.Set($default_value_tag$, value, " + "GetArenaForAllocation());\n" + "}\n"); + format( + "inline std::string* $classname$::_internal_mutable_$name$() {\n" + " if (!_internal_has_$name$()) {\n" + " clear_$oneof_name$();\n" + " set_has_$name$();\n" + " $field_member$.UnsafeSetDefault($init_value$);\n" + " }\n" + " return $field_member$.Mutable(\n" + " $default_variable_or_tag$, GetArenaForAllocation());\n" + "}\n" + "inline std::string* $classname$::$release_name$() {\n" + "$annotate_release$" + " // @@protoc_insertion_point(field_release:$full_name$)\n" + " if (_internal_has_$name$()) {\n" + " clear_has_$oneof_name$();\n" + " return $field_member$.ReleaseNonDefault($init_value$, " + "GetArenaForAllocation());\n" + " } else {\n" + " return nullptr;\n" + " }\n" + "}\n" + "inline void $classname$::set_allocated_$name$(std::string* $name$) {\n" + " if (has_$oneof_name$()) {\n" + " clear_$oneof_name$();\n" + " }\n" + " if ($name$ != nullptr) {\n" + " set_has_$name$();\n" + " $field_member$.UnsafeSetDefault($name$);\n" + " ::$proto_ns$::Arena* arena = GetArenaForAllocation();\n" + " if (arena != nullptr) {\n" + " arena->Own($name$);\n" + " }\n" + " }\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" + "}\n"); +} + +void StringOneofFieldGenerator::GenerateClearingCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "$field_member$.Destroy($default_value_tag$, " + "GetArenaForAllocation());\n"); +} + +void StringOneofFieldGenerator::GenerateMessageClearingCode( + io::Printer* printer) const { + return GenerateClearingCode(printer); +} + +void StringOneofFieldGenerator::GenerateSwappingCode( + io::Printer* printer) const { + // Don't print any swapping code. Swapping the union will swap this field. +} + +void StringOneofFieldGenerator::GenerateConstructorCode( + io::Printer* printer) const { + // Nothing required here. +} + +// =================================================================== + +RepeatedStringFieldGenerator::RepeatedStringFieldGenerator( + const FieldDescriptor* descriptor, const Options& options) + : FieldGenerator(descriptor, options) { + SetStringVariables(descriptor, &variables_, options); +} + +RepeatedStringFieldGenerator::~RepeatedStringFieldGenerator() {} + +void RepeatedStringFieldGenerator::GeneratePrivateMembers( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("::$proto_ns$::RepeatedPtrField $name$_;\n"); +} + +void RepeatedStringFieldGenerator::GenerateAccessorDeclarations( + io::Printer* printer) const { + Formatter format(printer, variables_); + // See comment above about unknown ctypes. + bool unknown_ctype = descriptor_->options().ctype() != + EffectiveStringCType(descriptor_, options_); + + if (unknown_ctype) { + format.Outdent(); + format( + " private:\n" + " // Hidden due to unknown ctype option.\n"); + format.Indent(); + } + + format( + "$deprecated_attr$const std::string& ${1$$name$$}$(int index) const;\n" + "$deprecated_attr$std::string* ${1$mutable_$name$$}$(int index);\n" + "$deprecated_attr$void ${1$set_$name$$}$(int index, const " + "std::string& value);\n" + "$deprecated_attr$void ${1$set_$name$$}$(int index, std::string&& " + "value);\n" + "$deprecated_attr$void ${1$set_$name$$}$(int index, const " + "char* value);\n", + descriptor_); + if (!options_.opensource_runtime) { + format( + "$deprecated_attr$void ${1$set_$name$$}$(int index, " + "StringPiece value);\n", + descriptor_); + } + format( + "$deprecated_attr$void ${1$set_$name$$}$(" + "int index, const $pointer_type$* value, size_t size);\n" + "$deprecated_attr$std::string* ${1$add_$name$$}$();\n" + "$deprecated_attr$void ${1$add_$name$$}$(const std::string& value);\n" + "$deprecated_attr$void ${1$add_$name$$}$(std::string&& value);\n" + "$deprecated_attr$void ${1$add_$name$$}$(const char* value);\n", + descriptor_); + if (!options_.opensource_runtime) { + format( + "$deprecated_attr$void ${1$add_$name$$}$(StringPiece value);\n", + descriptor_); + } + format( + "$deprecated_attr$void ${1$add_$name$$}$(const $pointer_type$* " + "value, size_t size)" + ";\n" + "$deprecated_attr$const ::$proto_ns$::RepeatedPtrField& " + "${1$$name$$}$() " + "const;\n" + "$deprecated_attr$::$proto_ns$::RepeatedPtrField* " + "${1$mutable_$name$$}$()" + ";\n" + "private:\n" + "const std::string& ${1$_internal_$name$$}$(int index) const;\n" + "std::string* _internal_add_$name$();\n" + "public:\n", + descriptor_); + + if (unknown_ctype) { + format.Outdent(); + format(" public:\n"); + format.Indent(); + } +} + +void RepeatedStringFieldGenerator::GenerateInlineAccessorDefinitions( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "inline std::string* $classname$::add_$name$() {\n" + " std::string* _s = _internal_add_$name$();\n" + "$annotate_add_mutable$" + " // @@protoc_insertion_point(field_add_mutable:$full_name$)\n" + " return _s;\n" + "}\n"); + if (options_.safe_boundary_check) { + format( + "inline const std::string& $classname$::_internal_$name$(int index) " + "const {\n" + " return $name$_.InternalCheckedGet(\n" + " index, ::$proto_ns$::internal::GetEmptyStringAlreadyInited());\n" + "}\n"); + } else { + format( + "inline const std::string& $classname$::_internal_$name$(int index) " + "const {\n" + " return $name$_.Get(index);\n" + "}\n"); + } + format( + "inline const std::string& $classname$::$name$(int index) const {\n" + "$annotate_get$" + " // @@protoc_insertion_point(field_get:$full_name$)\n" + " return _internal_$name$(index);\n" + "}\n" + "inline std::string* $classname$::mutable_$name$(int index) {\n" + "$annotate_mutable$" + " // @@protoc_insertion_point(field_mutable:$full_name$)\n" + " return $name$_.Mutable(index);\n" + "}\n" + "inline void $classname$::set_$name$(int index, const std::string& " + "value) " + "{\n" + " $name$_.Mutable(index)->assign(value);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n" + "inline void $classname$::set_$name$(int index, std::string&& value) {\n" + " $name$_.Mutable(index)->assign(std::move(value));\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n" + "inline void $classname$::set_$name$(int index, const char* value) {\n" + " $null_check$" + " $name$_.Mutable(index)->assign(value);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set_char:$full_name$)\n" + "}\n"); + if (!options_.opensource_runtime) { + format( + "inline void " + "$classname$::set_$name$(int index, StringPiece value) {\n" + " $name$_.Mutable(index)->assign(value.data(), value.size());\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set_string_piece:$full_name$)\n" + "}\n"); + } + format( + "inline void " + "$classname$::set_$name$" + "(int index, const $pointer_type$* value, size_t size) {\n" + " $name$_.Mutable(index)->assign(\n" + " reinterpret_cast(value), size);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set_pointer:$full_name$)\n" + "}\n" + "inline std::string* $classname$::_internal_add_$name$() {\n" + " return $name$_.Add();\n" + "}\n" + "inline void $classname$::add_$name$(const std::string& value) {\n" + " $name$_.Add()->assign(value);\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add:$full_name$)\n" + "}\n" + "inline void $classname$::add_$name$(std::string&& value) {\n" + " $name$_.Add(std::move(value));\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add:$full_name$)\n" + "}\n" + "inline void $classname$::add_$name$(const char* value) {\n" + " $null_check$" + " $name$_.Add()->assign(value);\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add_char:$full_name$)\n" + "}\n"); + if (!options_.opensource_runtime) { + format( + "inline void $classname$::add_$name$(StringPiece value) {\n" + " $name$_.Add()->assign(value.data(), value.size());\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add_string_piece:$full_name$)\n" + "}\n"); + } + format( + "inline void " + "$classname$::add_$name$(const $pointer_type$* value, size_t size) {\n" + " $name$_.Add()->assign(reinterpret_cast(value), size);\n" + "$annotate_add$" + " // @@protoc_insertion_point(field_add_pointer:$full_name$)\n" + "}\n" + "inline const ::$proto_ns$::RepeatedPtrField&\n" + "$classname$::$name$() const {\n" + "$annotate_list$" + " // @@protoc_insertion_point(field_list:$full_name$)\n" + " return $name$_;\n" + "}\n" + "inline ::$proto_ns$::RepeatedPtrField*\n" + "$classname$::mutable_$name$() {\n" + "$annotate_mutable_list$" + " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n" + " return &$name$_;\n" + "}\n"); +} + +void RepeatedStringFieldGenerator::GenerateClearingCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_.Clear();\n"); +} + +void RepeatedStringFieldGenerator::GenerateMergingCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_.MergeFrom(from.$name$_);\n"); +} + +void RepeatedStringFieldGenerator::GenerateSwappingCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_.InternalSwap(&other->$name$_);\n"); +} + +void RepeatedStringFieldGenerator::GenerateConstructorCode( + io::Printer* printer) const { + // Not needed for repeated fields. +} + +void RepeatedStringFieldGenerator::GenerateCopyConstructorCode( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_.CopyFrom(from.$name$_);"); +} + +void RepeatedStringFieldGenerator::GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "for (int i = 0, n = this->_internal_$name$_size(); i < n; i++) {\n" + " const auto& s = this->_internal_$name$(i);\n"); + // format("for (const std::string& s : this->$name$()) {\n"); + format.Indent(); + if (descriptor_->type() == FieldDescriptor::TYPE_STRING) { + GenerateUtf8CheckCodeForString(descriptor_, options_, false, + "s.data(), static_cast(s.length()),\n", + format); + } + format.Outdent(); + format( + " target = stream->Write$declared_type$($number$, s, target);\n" + "}\n"); +} + +void RepeatedStringFieldGenerator::GenerateByteSize( + io::Printer* printer) const { + Formatter format(printer, variables_); + format( + "total_size += $tag_size$ *\n" + " ::$proto_ns$::internal::FromIntSize($name$_.size());\n" + "for (int i = 0, n = $name$_.size(); i < n; i++) {\n" + " total_size += " + "::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" + " $name$_.Get(i));\n" + "}\n"); +} + +void RepeatedStringFieldGenerator::GenerateConstinitInitializer( + io::Printer* printer) const { + Formatter format(printer, variables_); + format("$name$_()"); +} + +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.h similarity index 63% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.h index f39a93abe..3f05443f5 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_string_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_string_field.h @@ -51,32 +51,27 @@ class StringFieldGenerator : public FieldGenerator { ~StringFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateStaticMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - bool GenerateArenaDestructorCode(io::Printer* printer) const; - void GenerateDefaultInstanceAllocator(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - uint32 CalculateFieldTag() const; - bool IsInlined() const { return inlined_; } - - bool MergeFromCodedStreamNeedsArena() const; - - protected: - const bool lite_; - bool inlined_; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateStaticMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; + bool IsInlined() const override { return inlined_; } private: + bool inlined_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); }; @@ -87,15 +82,14 @@ class StringOneofFieldGenerator : public StringFieldGenerator { ~StringOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; // StringFieldGenerator, from which we inherit, overrides this so we need to // override it as well. - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator); @@ -108,16 +102,18 @@ class RepeatedStringFieldGenerator : public FieldGenerator { ~RepeatedStringFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedStringFieldGenerator); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto index 479710821..466a84194 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto @@ -41,7 +41,7 @@ syntax = "proto2"; // Some generic_services option(s) added automatically. // See: http://go/proto2-generic-services-default -option cc_generic_services = true; // auto-added +option cc_generic_services = true; // auto-added // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. @@ -158,11 +158,11 @@ message TestConflictingEnumNames { // NO_PROTO3 optional while conflicting_enum = 1; // NO_PROTO3 } // NO_PROTO3 -enum bool { // NO_PROTO3 - default = 0; // NO_PROTO3 - NOT_EQ = 1; // NO_PROTO3 - volatile = 2; // NO_PROTO3 - return = 3; // NO_PROTO3 +enum bool { // NO_PROTO3 + default = 0; // NO_PROTO3 + NOT_EQ = 1; // NO_PROTO3 + volatile = 2; // NO_PROTO3 + return = 3; // NO_PROTO3 } // NO_PROTO3 message DummyMessage {} @@ -173,7 +173,7 @@ message NULL { extend TestConflictingSymbolNames { // NO_PROTO3 optional int32 void = 314253; // NO_PROTO3 -} // NO_PROTO3 +} // NO_PROTO3 // Message names that could conflict. message Shutdown {} diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.inc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.inc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.inc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.inc index 2efbd6d38..782d2263b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/cpp_unittest.inc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/cpp_unittest.inc @@ -44,12 +44,12 @@ // correctly and produces the interfaces we expect, which is why this test // is written this way. -#include - +#include +#include #include #include -#include +#include #include #if !defined(GOOGLE_PROTOBUF_CMAKE_BUILD) && !defined(_MSC_VER) // We exclude this large proto from cmake build because it's too large for @@ -90,6 +90,8 @@ namespace cpp { namespace cpp_unittest { +void DoNothing() {} + class MockErrorCollector : public MultiFileErrorCollector { public: MockErrorCollector() {} @@ -99,9 +101,9 @@ class MockErrorCollector : public MultiFileErrorCollector { // implements ErrorCollector --------------------------------------- void AddError(const std::string& filename, int line, int column, - const std::string& message) { - strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", - filename, line, column, message); + const std::string& message) override { + strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, column, + message); } }; @@ -205,10 +207,10 @@ TEST(GENERATED_MESSAGE_TEST_NAME, Trigraph) { TEST(GENERATED_MESSAGE_TEST_NAME, ExtremeSmallIntegerDefault) { const UNITTEST::TestExtremeDefaultValues& extreme_default = UNITTEST::TestExtremeDefaultValues::default_instance(); - EXPECT_EQ(~0x7fffffff, kint32min); - EXPECT_EQ(PROTOBUF_LONGLONG(~0x7fffffffffffffff), kint64min); - EXPECT_EQ(kint32min, extreme_default.really_small_int32()); - EXPECT_EQ(kint64min, extreme_default.really_small_int64()); + EXPECT_EQ(std::numeric_limits::min(), + extreme_default.really_small_int32()); + EXPECT_EQ(std::numeric_limits::min(), + extreme_default.really_small_int64()); } TEST(GENERATED_MESSAGE_TEST_NAME, Accessors) { @@ -371,7 +373,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ClearOneField) { UNITTEST::TestAllTypes message; TestUtil::SetAllFields(&message); - int64 original_value = message.optional_int64(); + int64_t original_value = message.optional_int64(); // Clear the field and make sure it shows up as cleared. message.clear_optional_int64(); @@ -403,69 +405,6 @@ TEST(GENERATED_MESSAGE_TEST_NAME, StringCharStarLength) { EXPECT_EQ("wx", message.repeated_string(0)); } -TEST(GENERATED_MESSAGE_TEST_NAME, StringMove) { - // Verify that we trigger the move behavior on a scalar setter. - protobuf_unittest_no_arena::TestAllTypes message; - { - std::string tmp(32, 'a'); - - const char* old_data = tmp.data(); - message.set_optional_string(std::move(tmp)); - const char* new_data = message.optional_string().data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'a'), message.optional_string()); - - std::string tmp2(32, 'b'); - old_data = tmp2.data(); - message.set_optional_string(std::move(tmp2)); - new_data = message.optional_string().data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'b'), message.optional_string()); - } - - // Verify that we trigger the move behavior on a oneof setter. - { - std::string tmp(32, 'a'); - - const char* old_data = tmp.data(); - message.set_oneof_string(std::move(tmp)); - const char* new_data = message.oneof_string().data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'a'), message.oneof_string()); - - std::string tmp2(32, 'b'); - old_data = tmp2.data(); - message.set_oneof_string(std::move(tmp2)); - new_data = message.oneof_string().data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'b'), message.oneof_string()); - } - - // Verify that we trigger the move behavior on a repeated setter. - { - std::string tmp(32, 'a'); - - const char* old_data = tmp.data(); - message.add_repeated_string(std::move(tmp)); - const char* new_data = message.repeated_string(0).data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'a'), message.repeated_string(0)); - - std::string tmp2(32, 'b'); - old_data = tmp2.data(); - message.set_repeated_string(0, std::move(tmp2)); - new_data = message.repeated_string(0).data(); - - EXPECT_EQ(old_data, new_data); - EXPECT_EQ(std::string(32, 'b'), message.repeated_string(0)); - } -} - TEST(GENERATED_MESSAGE_TEST_NAME, CopyFrom) { UNITTEST::TestAllTypes message1, message2; @@ -563,7 +502,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ADLSwap) { // Note the address of one of the repeated fields, to verify it was swapped // rather than copied. - const int32* addr = &message1.repeated_int32().Get(0); + const int32_t* addr = &message1.repeated_int32().Get(0); using std::swap; swap(message1, message2); @@ -571,7 +510,12 @@ TEST(GENERATED_MESSAGE_TEST_NAME, ADLSwap) { TestUtil::ExpectAllFieldsSet(message2); TestUtil::ExpectClear(message1); +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + EXPECT_NE(addr, &message2.repeated_int32().Get(0)); + EXPECT_EQ(*addr, message2.repeated_int32().Get(0)); +#else EXPECT_EQ(addr, &message2.repeated_int32().Get(0)); +#endif } TEST(GENERATED_MESSAGE_TEST_NAME, CopyConstructor) { @@ -713,7 +657,7 @@ TEST(GENERATED_MESSAGE_TEST_NAME, NonEmptyMergeFrom) { // This tests concatenating. message2.add_repeated_int32(message1.repeated_int32(1)); - int32 i = message1.repeated_int32(0); + int32_t i = message1.repeated_int32(0); message1.clear_repeated_int32(); message1.add_repeated_int32(i); @@ -730,8 +674,8 @@ TEST(GENERATED_MESSAGE_TEST_NAME, SerializationToArray) { TestUtil::SetAllFields(&message1); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); TestUtil::ExpectAllFieldsSet(message2); @@ -744,8 +688,9 @@ TEST(GENERATED_MESSAGE_TEST_NAME, PackedFieldsSerializationToArray) { TestUtil::SetPackedFields(&packed_message1); int packed_size = packed_message1.ByteSizeLong(); packed_data.resize(packed_size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&packed_data)); - uint8* end = packed_message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = + reinterpret_cast(::google::protobuf::string_as_array(&packed_data)); + uint8_t* end = packed_message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(packed_size, end - start); EXPECT_TRUE(packed_message2.ParseFromString(packed_data)); TestUtil::ExpectPackedFieldsSet(packed_message2); @@ -998,12 +943,12 @@ TEST(GENERATED_MESSAGE_TEST_NAME, TestOneofSpaceUsed) { // Setting a message in oneof should delete the other fields and increase the // size by the size of the nested message type. NestedMessage is simple enough - // that it is equal to sizeof(NestedMessage) + // that it is equal to sizeof(NestedMessage). It may be backed by LazyField, + // increasing space used by LazyField and backing Cord. message1.mutable_foo_message(); ASSERT_EQ(sizeof(UNITTEST::TestOneof2::NestedMessage), message1.foo_message().SpaceUsedLong()); - EXPECT_EQ(empty_message_size + - sizeof(UNITTEST::TestOneof2::NestedMessage), + EXPECT_LE(empty_message_size + sizeof(UNITTEST::TestOneof2::NestedMessage), message1.SpaceUsedLong()); } @@ -1214,10 +1159,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test { // implements TestService ---------------------------------------- - void Foo(RpcController* controller, - const UNITTEST::FooRequest* request, - UNITTEST::FooResponse* response, - Closure* done) { + void Foo(RpcController* controller, const UNITTEST::FooRequest* request, + UNITTEST::FooResponse* response, Closure* done) override { ASSERT_FALSE(called_); called_ = true; method_ = "Foo"; @@ -1227,10 +1170,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test { done_ = done; } - void Bar(RpcController* controller, - const UNITTEST::BarRequest* request, - UNITTEST::BarResponse* response, - Closure* done) { + void Bar(RpcController* controller, const UNITTEST::BarRequest* request, + UNITTEST::BarResponse* response, Closure* done) override { ASSERT_FALSE(called_); called_ = true; method_ = "Bar"; @@ -1269,11 +1210,9 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test { // implements TestService ---------------------------------------- - void CallMethod(const MethodDescriptor* method, - RpcController* controller, - const Message* request, - Message* response, - Closure* done) { + void CallMethod(const MethodDescriptor* method, RpcController* controller, + const Message* request, Message* response, + Closure* done) override { ASSERT_FALSE(called_); called_ = true; method_ = method; @@ -1296,28 +1235,28 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test { class MockController : public RpcController { public: - void Reset() { + void Reset() override { ADD_FAILURE() << "Reset() not expected during this test."; } - bool Failed() const { + bool Failed() const override { ADD_FAILURE() << "Failed() not expected during this test."; return false; } - std::string ErrorText() const { + std::string ErrorText() const override { ADD_FAILURE() << "ErrorText() not expected during this test."; return ""; } - void StartCancel() { + void StartCancel() override { ADD_FAILURE() << "StartCancel() not expected during this test."; } - void SetFailed(const std::string& reason) { + void SetFailed(const std::string& reason) override { ADD_FAILURE() << "SetFailed() not expected during this test."; } - bool IsCanceled() const { + bool IsCanceled() const override { ADD_FAILURE() << "IsCanceled() not expected during this test."; return false; } - void NotifyOnCancel(Closure* callback) { + void NotifyOnCancel(Closure* callback) override { ADD_FAILURE() << "NotifyOnCancel() not expected during this test."; } }; @@ -1329,7 +1268,7 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test { stub_(&mock_channel_), done_(::google::protobuf::NewPermanentCallback(&DoNothing)) {} - virtual void SetUp() { + void SetUp() override { ASSERT_TRUE(foo_ != NULL); ASSERT_TRUE(bar_ != NULL); } @@ -1470,7 +1409,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, NotImplemented) { public: ExpectUnimplementedController() : called_(false) {} - void SetFailed(const std::string& reason) { + void SetFailed(const std::string& reason) override { EXPECT_FALSE(called_); called_ = true; EXPECT_EQ("Method Foo() not implemented.", reason); @@ -1492,8 +1431,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, NotImplemented) { class OneofTest : public testing::Test { protected: - virtual void SetUp() { - } + void SetUp() override {} void ExpectEnumCasesWork(const UNITTEST::TestOneof2 &message) { switch (message.foo_case()) { @@ -1683,6 +1621,26 @@ TEST_F(OneofTest, SetAllocatedString) { EXPECT_EQ(kHello, message.foo_string()); } +TEST_F(OneofTest, ArenaSetAllocatedString) { + // Check that set_allocated_foo() works for strings. + Arena arena; + UNITTEST::TestOneof2* message = + Arena::CreateMessage(&arena); + + EXPECT_FALSE(message->has_foo_string()); + const std::string kHello("hello"); + message->set_foo_string(kHello); + EXPECT_TRUE(message->has_foo_string()); + + message->set_allocated_foo_string(NULL); + EXPECT_FALSE(message->has_foo_string()); + EXPECT_EQ("", message->foo_string()); + + message->set_allocated_foo_string(new std::string(kHello)); + EXPECT_TRUE(message->has_foo_string()); + EXPECT_EQ(kHello, message->foo_string()); +} + TEST_F(OneofTest, SetMessage) { // Check that setting a message field works @@ -1891,8 +1849,8 @@ std::string data; message1.set_foo_int(123); int size = message1.ByteSizeLong(); data.resize(size); -uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); -uint8* end = message1.SerializeWithCachedSizesToArray(start); +uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); +uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foo_int(), 123); @@ -1905,8 +1863,8 @@ EXPECT_EQ(message2.foo_int(), 123); message1.set_foo_string("foo"); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foo_string(), "foo"); @@ -1920,8 +1878,8 @@ EXPECT_EQ(message2.foo_int(), 123); message1.set_foo_bytes("qux"); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foo_bytes(), "qux"); @@ -1934,8 +1892,8 @@ EXPECT_EQ(message2.foo_int(), 123); message1.set_foo_enum(UNITTEST::TestOneof2::FOO); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foo_enum(), UNITTEST::TestOneof2::FOO); @@ -1948,8 +1906,8 @@ EXPECT_EQ(message2.foo_int(), 123); message1.mutable_foo_message()->set_qux_int(234); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foo_message().qux_int(), 234); @@ -1962,8 +1920,8 @@ EXPECT_EQ(message2.foo_int(), 123); message1.mutable_foogroup()->set_a(345); int size = message1.ByteSizeLong(); data.resize(size); - uint8* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); - uint8* end = message1.SerializeWithCachedSizesToArray(start); + uint8_t* start = reinterpret_cast(::google::protobuf::string_as_array(&data)); + uint8_t* end = message1.SerializeWithCachedSizesToArray(start); EXPECT_EQ(size, end - start); EXPECT_TRUE(message2.ParseFromString(data)); EXPECT_EQ(message2.foogroup().a(), 345); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/metadata_test.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/metadata_test.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/metadata_test.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/metadata_test.cc index a16c8b530..b5cac8f42 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/cpp/metadata_test.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/cpp/metadata_test.cc @@ -30,14 +30,13 @@ #include +#include +#include #include #include #include #include #include - -#include -#include #include #include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc index 978fdf02b..86bacf810 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc @@ -65,11 +65,11 @@ class MockErrorCollector : public MultiFileErrorCollector { MockErrorCollector() {} ~MockErrorCollector() {} - string text_; + std::string text_; // implements ErrorCollector --------------------------------------- - void AddError(const string& filename, int line, int column, - const string& message) { + void AddError(const std::string& filename, int line, int column, + const std::string& message) { strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, column, message); } @@ -77,14 +77,14 @@ class MockErrorCollector : public MultiFileErrorCollector { class MockGeneratorContext : public GeneratorContext { public: - void ExpectFileMatches(const string& virtual_filename, - const string& physical_filename) { + void ExpectFileMatches(const std::string& virtual_filename, + const std::string& physical_filename) { auto it = files_.find(virtual_filename); ASSERT_TRUE(it != files_.end()) << "Generator failed to generate file: " << virtual_filename; - string expected_contents = *it->second; + std::string expected_contents = *it->second; - string actual_contents; + std::string actual_contents; GOOGLE_CHECK_OK( File::GetContentsAsText(TestSourceDir() + "/" + physical_filename, &actual_contents, true)) @@ -97,7 +97,7 @@ class MockGeneratorContext : public GeneratorContext { // implements GeneratorContext -------------------------------------- - virtual io::ZeroCopyOutputStream* Open(const string& filename) { + virtual io::ZeroCopyOutputStream* Open(const std::string& filename) { auto& map_slot = files_[filename]; map_slot.reset(new std::string); return new io::StringOutputStream(map_slot.get()); @@ -110,7 +110,7 @@ class MockGeneratorContext : public GeneratorContext { class GenerateAndTest { public: GenerateAndTest() {} - void Run(const FileDescriptor* proto_file, string file1, string file2) { + void Run(const FileDescriptor* proto_file, std::string file1, std::string file2) { ASSERT_TRUE(proto_file != NULL) << TestSourceDir(); ASSERT_TRUE(generator_.Generate(proto_file, parameter_, &context_, &error_)); @@ -123,14 +123,14 @@ class GenerateAndTest { private: Generator generator_; MockGeneratorContext context_; - string error_; - string parameter_; + std::string error_; + std::string parameter_; }; TEST(CsharpBootstrapTest, GeneratedCsharpDescriptorMatches) { // Skip this whole test if the csharp directory doesn't exist (i.e., a C++11 // only distribution). - string descriptor_file_name = + std::string descriptor_file_name = "../csharp/src/Google.Protobuf/Reflection/Descriptor.cs"; if (!File::Exists(TestSourceDir() + "/" + descriptor_file_name)) { return; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc index a4e9ff407..225d6dc54 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc @@ -47,7 +47,7 @@ namespace csharp { // is inlined in the relevant code. If more control is required, that code can be moved here. void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) { - string comments = location.leading_comments.empty() ? + std::string comments = location.leading_comments.empty() ? location.trailing_comments : location.leading_comments; if (comments.empty()) { return; @@ -56,7 +56,7 @@ void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) { // node of a summary element, not part of an attribute. comments = StringReplace(comments, "&", "&", true); comments = StringReplace(comments, "<", "<", true); - std::vector lines; + std::vector lines; lines = Split(comments, "\n", false); // TODO: We really should work out which part to put in the summary and which to put in the remarks... // but that needs to be part of a bigger effort to understand the markdown better anyway. @@ -66,17 +66,18 @@ void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) { // to preserve the blank lines themselves, as this is relevant in the markdown. // Note that we can't remove leading or trailing whitespace as *that's* relevant in markdown too. // (We don't skip "just whitespace" lines, either.) - for (std::vector::iterator it = lines.begin(); it != lines.end(); ++it) { - string line = *it; - if (line.empty()) { - last_was_empty = true; - } else { - if (last_was_empty) { - printer->Print("///\n"); - } - last_was_empty = false; - printer->Print("///$line$\n", "line", *it); + for (std::vector::iterator it = lines.begin(); + it != lines.end(); ++it) { + std::string line = *it; + if (line.empty()) { + last_was_empty = true; + } else { + if (last_was_empty) { + printer->Print("///\n"); } + last_was_empty = false; + printer->Print("///$line$\n", "line", *it); + } } printer->Print("/// \n"); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_doc_comment.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_doc_comment.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_doc_comment.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_doc_comment.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum.cc index 2baefd84e..73679caf3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -48,7 +48,7 @@ namespace compiler { namespace csharp { EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, const Options* options) : - SourceGeneratorBase(descriptor->file(), options), + SourceGeneratorBase(options), descriptor_(descriptor) { } @@ -61,12 +61,13 @@ void EnumGenerator::Generate(io::Printer* printer) { "access_level", class_access_level(), "name", descriptor_->name()); printer->Indent(); - std::set used_names; + std::set used_names; std::set used_number; for (int i = 0; i < descriptor_->value_count(); i++) { WriteEnumValueDocComment(printer, descriptor_->value(i)); - string original_name = descriptor_->value(i)->name(); - string name = GetEnumValueName(descriptor_->name(), descriptor_->value(i)->name()); + std::string original_name = descriptor_->value(i)->name(); + std::string name = + GetEnumValueName(descriptor_->name(), descriptor_->value(i)->name()); // Make sure we don't get any duplicate names due to prefix removal. while (!used_names.insert(name).second) { // It's possible we'll end up giving this warning multiple times, but that's better than not at all. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum_field.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum_field.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum_field.h similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum_field.h index 9f1a2ea77..e282d7239 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_enum_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_enum_field.h @@ -51,11 +51,11 @@ class EnumFieldGenerator : public PrimitiveFieldGenerator { EnumFieldGenerator(const EnumFieldGenerator&) = delete; EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; }; class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator { @@ -68,10 +68,10 @@ class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator { EnumOneofFieldGenerator(const EnumOneofFieldGenerator&) = delete; EnumOneofFieldGenerator& operator=(const EnumOneofFieldGenerator&) = delete; - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.cc similarity index 93% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.cc index 454f4cb14..477b49e5f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -51,7 +51,7 @@ namespace compiler { namespace csharp { void FieldGeneratorBase::SetCommonFieldVariables( - std::map* variables) { + std::map* variables) { // Note: this will be valid even though the tag emitted for packed and unpacked versions of // repeated fields varies by wire format. The wire format is encoded in the bottom 3 bits, which // never effects the tag size. @@ -63,7 +63,7 @@ void FieldGeneratorBase::SetCommonFieldVariables( uint tag = internal::WireFormat::MakeTag(descriptor_); uint8 tag_array[5]; io::CodedOutputStream::WriteTagToArray(tag, tag_array); - string tag_bytes = StrCat(tag_array[0]); + std::string tag_bytes = StrCat(tag_array[0]); for (int i = 1; i < part_tag_size; i++) { tag_bytes += ", " + StrCat(tag_array[i]); } @@ -96,20 +96,20 @@ void FieldGeneratorBase::SetCommonFieldVariables( (*variables)["default_value"] = default_value(); (*variables)["capitalized_type_name"] = capitalized_type_name(); (*variables)["number"] = number(); - if (has_default_value() && !IsProto2(descriptor_->file())) { + if (has_default_value() && !SupportsPresenceApi(descriptor_)) { (*variables)["name_def_message"] = (*variables)["name"] + "_ = " + (*variables)["default_value"]; } else { (*variables)["name_def_message"] = (*variables)["name"] + "_"; } - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { (*variables)["has_property_check"] = "Has" + (*variables)["property_name"]; (*variables)["other_has_property_check"] = "other.Has" + (*variables)["property_name"]; (*variables)["has_not_property_check"] = "!" + (*variables)["has_property_check"]; (*variables)["other_has_not_property_check"] = "!" + (*variables)["other_has_property_check"]; if (presenceIndex_ != -1) { - string hasBitsNumber = StrCat(presenceIndex_ / 32); - string hasBitsMask = StrCat(1 << (presenceIndex_ % 32)); + std::string hasBitsNumber = StrCat(presenceIndex_ / 32); + std::string hasBitsMask = StrCat(1 << (presenceIndex_ % 32)); (*variables)["has_field_check"] = "(_hasBits" + hasBitsNumber + " & " + hasBitsMask + ") != 0"; (*variables)["set_has_field"] = "_hasBits" + hasBitsNumber + " |= " + hasBitsMask; (*variables)["clear_has_field"] = "_hasBits" + hasBitsNumber + " &= ~" + hasBitsMask; @@ -123,9 +123,9 @@ void FieldGeneratorBase::SetCommonFieldVariables( } void FieldGeneratorBase::SetCommonOneofFieldVariables( - std::map* variables) { + std::map* variables) { (*variables)["oneof_name"] = oneof_name(); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { (*variables)["has_property_check"] = "Has" + property_name(); } else { (*variables)["has_property_check"] = @@ -137,7 +137,7 @@ void FieldGeneratorBase::SetCommonOneofFieldVariables( FieldGeneratorBase::FieldGeneratorBase(const FieldDescriptor* descriptor, int presenceIndex, const Options* options) - : SourceGeneratorBase(descriptor->file(), options), + : SourceGeneratorBase(options), descriptor_(descriptor), presenceIndex_(presenceIndex) { SetCommonFieldVariables(&variables_); @@ -161,6 +161,18 @@ void FieldGeneratorBase::GenerateExtensionCode(io::Printer* printer) { // and repeated fields need this default is to not generate any code } +void FieldGeneratorBase::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { + // for some field types the value of "use_parse_context" doesn't matter, + // so we fallback to the default implementation. + GenerateParsingCode(printer); +} + +void FieldGeneratorBase::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { + // for some field types the value of "use_write_context" doesn't matter, + // so we fallback to the default implementation. + GenerateSerializationCode(printer); +} + void FieldGeneratorBase::AddDeprecatedFlag(io::Printer* printer) { if (descriptor_->options().deprecated()) { printer->Print("[global::System.ObsoleteAttribute]\n"); @@ -204,7 +216,7 @@ std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) { if (IsWrapperType(descriptor)) { const FieldDescriptor* wrapped_field = descriptor->message_type()->field(0); - string wrapped_field_type_name = type_name(wrapped_field); + std::string wrapped_field_type_name = type_name(wrapped_field); // String and ByteString go to the same type; other wrapped types // go to the nullable equivalent. if (wrapped_field->type() == FieldDescriptor::TYPE_STRING || diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.h index 594461da7..f875fa11a 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -61,7 +61,9 @@ class FieldGeneratorBase : public SourceGeneratorBase { virtual void GenerateMembers(io::Printer* printer) = 0; virtual void GenerateMergingCode(io::Printer* printer) = 0; virtual void GenerateParsingCode(io::Printer* printer) = 0; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); virtual void GenerateSerializationCode(io::Printer* printer) = 0; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); virtual void GenerateSerializedSizeCode(io::Printer* printer) = 0; virtual void WriteHash(io::Printer* printer) = 0; @@ -72,14 +74,15 @@ class FieldGeneratorBase : public SourceGeneratorBase { protected: const FieldDescriptor* descriptor_; const int presenceIndex_; - std::map variables_; + std::map variables_; void AddDeprecatedFlag(io::Printer* printer); void AddNullCheck(io::Printer* printer); void AddNullCheck(io::Printer* printer, const std::string& name); void AddPublicMemberAttributes(io::Printer* printer); - void SetCommonOneofFieldVariables(std::map* variables); + void SetCommonOneofFieldVariables( + std::map* variables); std::string oneof_property_name(); std::string oneof_name(); @@ -94,7 +97,7 @@ class FieldGeneratorBase : public SourceGeneratorBase { std::string capitalized_type_name(); private: - void SetCommonFieldVariables(std::map* variables); + void SetCommonFieldVariables(std::map* variables); std::string GetStringDefaultValueInternal(const FieldDescriptor* descriptor); std::string GetBytesDefaultValueInternal(const FieldDescriptor* descriptor); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.cc similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.cc index b33552203..5ce065173 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.cc @@ -48,19 +48,24 @@ namespace protobuf { namespace compiler { namespace csharp { +Generator::Generator() {} +Generator::~Generator() {} + +uint64_t Generator::GetSupportedFeatures() const { + return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL; +} + void GenerateFile(const FileDescriptor* file, io::Printer* printer, const Options* options) { ReflectionClassGenerator reflectionClassGenerator(file, options); reflectionClassGenerator.Generate(printer); } -bool Generator::Generate( - const FileDescriptor* file, - const string& parameter, - GeneratorContext* generator_context, - string* error) const { - - std::vector > options; +bool Generator::Generate(const FileDescriptor* file, + const std::string& parameter, + GeneratorContext* generator_context, + std::string* error) const { + std::vector > options; ParseGeneratorParameter(parameter, &options); struct Options cli_options; @@ -81,7 +86,7 @@ bool Generator::Generate( } } - string filename_error = ""; + std::string filename_error = ""; std::string filename = GetOutputFile(file, cli_options.file_extension, cli_options.base_namespace_specified, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.h index da72e0e77..f41f9b835 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator.h @@ -50,11 +50,14 @@ namespace csharp { // CodeGenerator with the CommandLineInterface in your main() function. class PROTOC_EXPORT Generator : public CodeGenerator { public: - virtual bool Generate( - const FileDescriptor* file, - const string& parameter, - GeneratorContext* generator_context, - string* error) const; + Generator(); + ~Generator(); + bool Generate( + const FileDescriptor* file, + const std::string& parameter, + GeneratorContext* generator_context, + std::string* error) const override; + uint64_t GetSupportedFeatures() const override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.cc similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 98aa246c2..32ef3994f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -143,7 +143,7 @@ std::string GetExtensionClassUnqualifiedName(const FileDescriptor* descriptor) { std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter, bool preserve_period) { - string result; + std::string result; // Note: I distrust ctype.h due to locales. for (int i = 0; i < input.size(); i++) { if ('a' <= input[i] && input[i] <= 'z') { @@ -195,7 +195,7 @@ std::string UnderscoresToPascalCase(const std::string& input) { // Lower letter Alphanumeric Same as current // Upper letter Alphanumeric Lower std::string ShoutyToPascalCase(const std::string& input) { - string result; + std::string result; // Simple way of implementing "always start with upper" char previous = '_'; for (int i = 0; i < input.size(); i++) { @@ -325,7 +325,7 @@ std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { if (!result.empty()) { result += '.'; } - string classname; + std::string classname; if (file->package().empty()) { classname = name; } else { @@ -396,19 +396,20 @@ std::string GetPropertyName(const FieldDescriptor* descriptor) { std::string GetOutputFile(const FileDescriptor* descriptor, const std::string file_extension, const bool generate_directories, - const std::string base_namespace, string* error) { - string relative_filename = GetFileNameBase(descriptor) + file_extension; + const std::string base_namespace, + std::string* error) { + std::string relative_filename = GetFileNameBase(descriptor) + file_extension; if (!generate_directories) { return relative_filename; } - string ns = GetFileNamespace(descriptor); - string namespace_suffix = ns; + std::string ns = GetFileNamespace(descriptor); + std::string namespace_suffix = ns; if (!base_namespace.empty()) { // Check that the base_namespace is either equal to or a leading part of // the file namespace. This isn't just a simple prefix; "Foo.B" shouldn't // be regarded as a prefix of "Foo.Bar". The simplest option is to add "." // to both. - string extended_ns = ns + "."; + std::string extended_ns = ns + "."; if (extended_ns.find(base_namespace + ".") != 0) { *error = "Namespace " + ns + " is not a prefix namespace of base namespace " + base_namespace; return ""; // This will be ignored, because we've set an error. @@ -419,7 +420,7 @@ std::string GetOutputFile(const FileDescriptor* descriptor, } } - string namespace_dir = StringReplace(namespace_suffix, ".", "/", true); + std::string namespace_dir = StringReplace(namespace_suffix, ".", "/", true); if (!namespace_dir.empty()) { namespace_dir += "/"; } @@ -515,13 +516,13 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, } } else { if (IsWrapperType(descriptor)) { - if (descriptor->containing_oneof()) { + if (descriptor->real_containing_oneof()) { return new WrapperOneofFieldGenerator(descriptor, presenceIndex, options); } else { return new WrapperFieldGenerator(descriptor, presenceIndex, options); } } else { - if (descriptor->containing_oneof()) { + if (descriptor->real_containing_oneof()) { return new MessageOneofFieldGenerator(descriptor, presenceIndex, options); } else { return new MessageFieldGenerator(descriptor, presenceIndex, options); @@ -532,7 +533,7 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, if (descriptor->is_repeated()) { return new RepeatedEnumFieldGenerator(descriptor, presenceIndex, options); } else { - if (descriptor->containing_oneof()) { + if (descriptor->real_containing_oneof()) { return new EnumOneofFieldGenerator(descriptor, presenceIndex, options); } else { return new EnumFieldGenerator(descriptor, presenceIndex, options); @@ -542,7 +543,7 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, if (descriptor->is_repeated()) { return new RepeatedPrimitiveFieldGenerator(descriptor, presenceIndex, options); } else { - if (descriptor->containing_oneof()) { + if (descriptor->real_containing_oneof()) { return new PrimitiveOneofFieldGenerator(descriptor, presenceIndex, options); } else { return new PrimitiveFieldGenerator(descriptor, presenceIndex, options); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.h similarity index 83% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.h index 6354e9e6a..a6009c8b1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_helpers.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_helpers.h @@ -138,7 +138,7 @@ inline bool IsDescriptorOptionMessage(const Descriptor* descriptor) { if (!IsDescriptorProto(descriptor->file())) { return false; } - const string name = descriptor->full_name(); + const std::string name = descriptor->full_name(); return name == "google.protobuf.FileOptions" || name == "google.protobuf.MessageOptions" || name == "google.protobuf.FieldOptions" || @@ -158,6 +158,33 @@ inline bool IsProto2(const FileDescriptor* descriptor) { return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO2; } +inline bool SupportsPresenceApi(const FieldDescriptor* descriptor) { + // Unlike most languages, we don't generate Has/Clear members for message + // types, because they can always be set to null in C#. They're not really + // needed for oneof fields in proto2 either, as everything can be done via + // oneof case, but we follow the convention from other languages. Proto3 + // oneof fields never have Has/Clear members - but will also never have + // the explicit optional keyword either. + // + // None of the built-in helpers (descriptor->has_presence() etc) describe + // quite the behavior we want, so the rules are explicit below. + + if (descriptor->is_repeated() || + descriptor->type() == FieldDescriptor::TYPE_MESSAGE) { + return false; + } + // has_optional_keyword() has more complex rules for proto2, but that + // doesn't matter given the first part of this condition. + return IsProto2(descriptor->file()) || descriptor->has_optional_keyword(); +} + +inline bool RequiresPresenceBit(const FieldDescriptor* descriptor) { + return SupportsPresenceApi(descriptor) && + !IsNullable(descriptor) && + !descriptor->is_extension() && + !descriptor->real_containing_oneof(); +} + } // namespace csharp } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.cc similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.cc index f3f09ea45..44c13e2f6 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.cc @@ -94,15 +94,27 @@ void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) { } void MapFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void MapFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$name$_.AddEntriesFrom(input, _map_$name$_codec);\n"); + use_parse_context + ? "$name$_.AddEntriesFrom(ref input, _map_$name$_codec);\n" + : "$name$_.AddEntriesFrom(input, _map_$name$_codec);\n"); } void MapFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void MapFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { printer->Print( variables_, - "$name$_.WriteTo(output, _map_$name$_codec);\n"); + use_write_context + ? "$name$_.WriteTo(ref output, _map_$name$_codec);\n" + : "$name$_.WriteTo(output, _map_$name$_codec);\n"); } void MapFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.h similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.h index b920b9f22..9b5e214e6 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_map_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_map_field.h @@ -51,17 +51,19 @@ class MapFieldGenerator : public FieldGeneratorBase { MapFieldGenerator(const MapFieldGenerator&) = delete; MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.cc index 67f289291..998087492 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -60,7 +60,7 @@ bool CompareFieldNumbers(const FieldDescriptor* d1, const FieldDescriptor* d2) { MessageGenerator::MessageGenerator(const Descriptor* descriptor, const Options* options) - : SourceGeneratorBase(descriptor->file(), options), + : SourceGeneratorBase(options), descriptor_(descriptor), has_bit_field_count_(0), end_tag_(GetGroupEndTag(descriptor)), @@ -72,15 +72,13 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, std::sort(fields_by_number_.begin(), fields_by_number_.end(), CompareFieldNumbers); - if (IsProto2(descriptor_->file())) { - int primitiveCount = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (!IsNullable(field)) { - primitiveCount++; - if (has_bit_field_count_ == 0 || (primitiveCount % 32) == 0) { - has_bit_field_count_++; - } + int presence_bit_count = 0; + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (RequiresPresenceBit(field)) { + presence_bit_count++; + if (has_bit_field_count_ == 0 || (presence_bit_count % 32) == 0) { + has_bit_field_count_++; } } } @@ -114,7 +112,7 @@ void MessageGenerator::AddSerializableAttribute(io::Printer* printer) { } void MessageGenerator::Generate(io::Printer* printer) { - std::map vars; + std::map vars; vars["class_name"] = class_name(); vars["access_level"] = class_access_level(); @@ -127,12 +125,15 @@ void MessageGenerator::Generate(io::Printer* printer) { "$access_level$ sealed partial class $class_name$ : "); if (has_extension_ranges_) { - printer->Print(vars, "pb::IExtendableMessage<$class_name$>"); + printer->Print(vars, "pb::IExtendableMessage<$class_name$>\n"); } else { - printer->Print(vars, "pb::IMessage<$class_name$>"); + printer->Print(vars, "pb::IMessage<$class_name$>\n"); } - printer->Print(" {\n"); + printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n"); + printer->Print(" , pb::IBufferMessage\n"); + printer->Print("#endif\n"); + printer->Print("{\n"); printer->Indent(); // All static fields and properties @@ -222,11 +223,12 @@ void MessageGenerator::Generate(io::Printer* printer) { printer->Print("\n"); } - // oneof properties - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - vars["name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false); - vars["property_name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true); - vars["original_name"] = descriptor_->oneof_decl(i)->name(); + // oneof properties (for real oneofs, which come before synthetic ones) + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { + const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + vars["name"] = UnderscoresToCamelCase(oneof->name(), false); + vars["property_name"] = UnderscoresToCamelCase(oneof->name(), true); + vars["original_name"] = oneof->name(); printer->Print( vars, "private object $name$_;\n" @@ -234,8 +236,8 @@ void MessageGenerator::Generate(io::Printer* printer) { "public enum $property_name$OneofCase {\n"); printer->Indent(); printer->Print("None = 0,\n"); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < oneof->field_count(); j++) { + const FieldDescriptor* field = oneof->field(j); printer->Print("$field_property_name$ = $index$,\n", "field_property_name", GetPropertyName(field), "index", StrCat(field->number())); @@ -372,7 +374,7 @@ bool MessageGenerator::HasNestedGeneratedTypes() } void MessageGenerator::GenerateCloningCode(io::Printer* printer) { - std::map vars; + std::map vars; WriteGeneratedCodeAttributes(printer); vars["class_name"] = class_name(); printer->Print( @@ -382,23 +384,24 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) { for (int i = 0; i < has_bit_field_count_; i++) { printer->Print("_hasBits$i$ = other._hasBits$i$;\n", "i", StrCat(i)); } - // Clone non-oneof fields first + // Clone non-oneof fields first (treating optional proto3 fields as non-oneof) for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->field(i))); - generator->GenerateCloningCode(printer); + const FieldDescriptor* field = descriptor_->field(i); + if (field->real_containing_oneof()) { + continue; } - } - // Clone just the right field for each oneof - for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) { - vars["name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false); - vars["property_name"] = UnderscoresToCamelCase( - descriptor_->oneof_decl(i)->name(), true); + std::unique_ptr generator(CreateFieldGeneratorInternal(field)); + generator->GenerateCloningCode(printer); + } + // Clone just the right field for each real oneof + for (int i = 0; i < descriptor_->real_oneof_decl_count(); ++i) { + const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + vars["name"] = UnderscoresToCamelCase(oneof->name(), false); + vars["property_name"] = UnderscoresToCamelCase(oneof->name(), true); printer->Print(vars, "switch (other.$property_name$Case) {\n"); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < oneof->field_count(); j++) { + const FieldDescriptor* field = oneof->field(j); std::unique_ptr generator(CreateFieldGeneratorInternal(field)); vars["field_property_name"] = GetPropertyName(field); printer->Print( @@ -435,7 +438,7 @@ void MessageGenerator::GenerateFreezingCode(io::Printer* printer) { } void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { - std::map vars; + std::map vars; vars["class_name"] = class_name(); // Equality @@ -461,9 +464,9 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { CreateFieldGeneratorInternal(descriptor_->field(i))); generator->WriteEquals(printer); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - printer->Print("if ($property_name$Case != other.$property_name$Case) return false;\n", - "property_name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true)); + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { + printer->Print("if ($property_name$Case != other.$property_name$Case) return false;\n", + "property_name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true)); } if (has_extension_ranges_) { printer->Print( @@ -488,9 +491,9 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { CreateFieldGeneratorInternal(descriptor_->field(i))); generator->WriteHash(printer); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - printer->Print("hash ^= (int) $name$Case_;\n", - "name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false)); + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { + printer->Print("hash ^= (int) $name$Case_;\n", + "name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false)); } if (has_extension_ranges_) { printer->Print( @@ -517,34 +520,26 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) WriteGeneratedCodeAttributes(printer); printer->Print( "public void WriteTo(pb::CodedOutputStream output) {\n"); + printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n"); printer->Indent(); + printer->Print("output.WriteRawMessage(this);\n"); + printer->Outdent(); + printer->Print("#else\n"); + printer->Indent(); + GenerateWriteToBody(printer, false); + printer->Outdent(); + printer->Print("#endif\n"); + printer->Print("}\n\n"); - // Serialize all the fields - for (int i = 0; i < fields_by_number().size(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(fields_by_number()[i])); - generator->GenerateSerializationCode(printer); - } - - if (has_extension_ranges_) { - // Serialize extensions - printer->Print( - "if (_extensions != null) {\n" - " _extensions.WriteTo(output);\n" - "}\n"); - } - - // Serialize unknown fields - printer->Print( - "if (_unknownFields != null) {\n" - " _unknownFields.WriteTo(output);\n" - "}\n"); - - // TODO(jonskeet): Memoize size of frozen messages? + printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n"); + WriteGeneratedCodeAttributes(printer); + printer->Print("void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {\n"); + printer->Indent(); + GenerateWriteToBody(printer, true); printer->Outdent(); - printer->Print( - "}\n" - "\n"); + printer->Print("}\n"); + printer->Print("#endif\n\n"); + WriteGeneratedCodeAttributes(printer); printer->Print( "public int CalculateSize() {\n"); @@ -573,11 +568,44 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) printer->Print("}\n\n"); } +void MessageGenerator::GenerateWriteToBody(io::Printer* printer, bool use_write_context) { + // Serialize all the fields + for (int i = 0; i < fields_by_number().size(); i++) { + std::unique_ptr generator( + CreateFieldGeneratorInternal(fields_by_number()[i])); + generator->GenerateSerializationCode(printer, use_write_context); + } + + if (has_extension_ranges_) { + // Serialize extensions + printer->Print( + use_write_context + ? "if (_extensions != null) {\n" + " _extensions.WriteTo(ref output);\n" + "}\n" + : "if (_extensions != null) {\n" + " _extensions.WriteTo(output);\n" + "}\n"); + } + + // Serialize unknown fields + printer->Print( + use_write_context + ? "if (_unknownFields != null) {\n" + " _unknownFields.WriteTo(ref output);\n" + "}\n" + : "if (_unknownFields != null) {\n" + " _unknownFields.WriteTo(output);\n" + "}\n"); + + // TODO(jonskeet): Memoize size of frozen messages? +} + void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { // Note: These are separate from GenerateMessageSerializationMethods() // because they need to be generated even for messages that are optimized // for code size. - std::map vars; + std::map vars; vars["class_name"] = class_name(); WriteGeneratedCodeAttributes(printer); @@ -589,22 +617,24 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { "if (other == null) {\n" " return;\n" "}\n"); - // Merge non-oneof fields + // Merge non-oneof fields, treating optional proto3 fields as normal fields for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->field(i))); - generator->GenerateMergingCode(printer); + const FieldDescriptor* field = descriptor_->field(i); + if (field->real_containing_oneof()) { + continue; } - } - // Merge oneof fields - for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) { - vars["name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false); - vars["property_name"] = UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true); + std::unique_ptr generator(CreateFieldGeneratorInternal(field)); + generator->GenerateMergingCode(printer); + } + // Merge oneof fields (for non-synthetic oneofs) + for (int i = 0; i < descriptor_->real_oneof_decl_count(); ++i) { + const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + vars["name"] = UnderscoresToCamelCase(oneof->name(), false); + vars["property_name"] = UnderscoresToCamelCase(oneof->name(), true); printer->Print(vars, "switch (other.$property_name$Case) {\n"); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < oneof->field_count(); j++) { + const FieldDescriptor* field = oneof->field(j); vars["field_property_name"] = GetPropertyName(field); printer->Print( vars, @@ -630,10 +660,34 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { printer->Outdent(); printer->Print("}\n\n"); - WriteGeneratedCodeAttributes(printer); printer->Print("public void MergeFrom(pb::CodedInputStream input) {\n"); + printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n"); + printer->Indent(); + printer->Print("input.ReadRawMessage(this);\n"); + printer->Outdent(); + printer->Print("#else\n"); + printer->Indent(); + GenerateMainParseLoop(printer, false); + printer->Outdent(); + printer->Print("#endif\n"); + printer->Print("}\n\n"); + + printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n"); + WriteGeneratedCodeAttributes(printer); + printer->Print("void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {\n"); printer->Indent(); + GenerateMainParseLoop(printer, true); + printer->Outdent(); + printer->Print("}\n"); // method + printer->Print("#endif\n\n"); + +} + +void MessageGenerator::GenerateMainParseLoop(io::Printer* printer, bool use_parse_context) { + std::map vars; + vars["maybe_ref_input"] = use_parse_context ? "ref input" : "input"; + printer->Print( "uint tag;\n" "while ((tag = input.ReadTag()) != 0) {\n" @@ -647,16 +701,16 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { "end_tag", StrCat(end_tag_)); } if (has_extension_ranges_) { - printer->Print( + printer->Print(vars, "default:\n" - " if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) {\n" - " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n" + " if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, $maybe_ref_input$)) {\n" + " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, $maybe_ref_input$);\n" " }\n" " break;\n"); } else { - printer->Print( + printer->Print(vars, "default:\n" - " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n" + " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, $maybe_ref_input$);\n" " break;\n"); } for (int i = 0; i < fields_by_number().size(); i++) { @@ -683,7 +737,7 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { printer->Indent(); std::unique_ptr generator( CreateFieldGeneratorInternal(field)); - generator->GenerateParsingCode(printer); + generator->GenerateParsingCode(printer, use_parse_context); printer->Print("break;\n"); printer->Outdent(); printer->Print("}\n"); @@ -692,14 +746,11 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { printer->Print("}\n"); // switch printer->Outdent(); printer->Print("}\n"); // while - printer->Outdent(); - printer->Print("}\n\n"); // method } // it's a waste of space to track presence for all values, so we only track them if they're not nullable int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) { - if (IsNullable(descriptor) || !IsProto2(descriptor->file()) || - descriptor->is_extension()) { + if (!RequiresPresenceBit(descriptor)) { return -1; } @@ -709,7 +760,7 @@ int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) { if (field == descriptor) { return index; } - if (!IsNullable(field)) { + if (RequiresPresenceBit(field)) { index++; } } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.h index 5642dc881..d02767e44 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message.h @@ -66,7 +66,9 @@ class MessageGenerator : public SourceGeneratorBase { bool has_extension_ranges_; void GenerateMessageSerializationMethods(io::Printer* printer); + void GenerateWriteToBody(io::Printer* printer, bool use_write_context); void GenerateMergingMethods(io::Printer* printer); + void GenerateMainParseLoop(io::Printer* printer, bool use_parse_context); int GetPresenceIndex(const FieldDescriptor* descriptor); FieldGeneratorBase* CreateFieldGeneratorInternal( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.cc index 412579831..034fbd924 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.cc @@ -53,7 +53,7 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, int presenceIndex, const Options *options) : FieldGeneratorBase(descriptor, presenceIndex, options) { - if (!IsProto2(descriptor_->file())) { + if (!SupportsPresenceApi(descriptor_)) { variables_["has_property_check"] = name() + "_ != null"; variables_["has_not_property_check"] = name() + "_ == null"; } @@ -77,7 +77,7 @@ void MessageFieldGenerator::GenerateMembers(io::Printer* printer) { " $name$_ = value;\n" " }\n" "}\n"); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { printer->Print( variables_, "/// Gets whether the $descriptor_name$ field is set\n"); @@ -228,7 +228,7 @@ void MessageOneofFieldGenerator::GenerateMembers(io::Printer* printer) { " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$property_name$;\n" " }\n" "}\n"); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { printer->Print( variables_, "/// Gets whether the \"$descriptor_name$\" field is set\n"); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.h similarity index 72% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.h index 2463d912b..1436fe200 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_message_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_message_field.h @@ -51,19 +51,19 @@ class MessageFieldGenerator : public FieldGeneratorBase { MessageFieldGenerator(const MessageFieldGenerator&) = delete; MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; class MessageOneofFieldGenerator : public MessageFieldGenerator { @@ -77,11 +77,11 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { MessageOneofFieldGenerator& operator=(const MessageOneofFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_names.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_names.h similarity index 85% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_names.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_names.h index 44852721a..67e53b640 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_names.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_names.h @@ -60,14 +60,14 @@ namespace csharp { // // Returns: // The namespace to use for given file descriptor. -string PROTOC_EXPORT GetFileNamespace(const FileDescriptor* descriptor); +std::string PROTOC_EXPORT GetFileNamespace(const FileDescriptor* descriptor); // Requires: // descriptor != NULL // // Returns: // The fully-qualified C# class name. -string PROTOC_EXPORT GetClassName(const Descriptor* descriptor); +std::string PROTOC_EXPORT GetClassName(const Descriptor* descriptor); // Requires: // descriptor != NULL @@ -76,7 +76,8 @@ string PROTOC_EXPORT GetClassName(const Descriptor* descriptor); // The fully-qualified name of the C# class that provides // access to the file descriptor. Proto compiler generates // such class for each .proto file processed. -string PROTOC_EXPORT GetReflectionClassName(const FileDescriptor* descriptor); +std::string PROTOC_EXPORT +GetReflectionClassName(const FileDescriptor* descriptor); // Generates output file name for given file descriptor. If generate_directories // is true, the output file will be put under directory corresponding to file's @@ -92,10 +93,11 @@ string PROTOC_EXPORT GetReflectionClassName(const FileDescriptor* descriptor); // The file name to use as output file for given file descriptor. In case // of failure, this function will return empty string and error parameter // will contain the error message. -string PROTOC_EXPORT GetOutputFile(const FileDescriptor* descriptor, - const string file_extension, - const bool generate_directories, - const string base_namespace, string* error); +std::string PROTOC_EXPORT GetOutputFile(const FileDescriptor* descriptor, + const std::string file_extension, + const bool generate_directories, + const std::string base_namespace, + std::string* error); } // namespace csharp } // namespace compiler diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_options.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_options.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_options.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_options.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc index eb7f70dda..9df1dd6ab 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -53,7 +53,7 @@ PrimitiveFieldGenerator::PrimitiveFieldGenerator( // TODO(jonskeet): Make this cleaner... is_value_type = descriptor->type() != FieldDescriptor::TYPE_STRING && descriptor->type() != FieldDescriptor::TYPE_BYTES; - if (!is_value_type && !IsProto2(descriptor_->file())) { + if (!is_value_type && !SupportsPresenceApi(descriptor_)) { variables_["has_property_check"] = variables_["property_name"] + ".Length != 0"; variables_["other_has_property_check"] = "other." + variables_["property_name"] + ".Length != 0"; } @@ -63,42 +63,65 @@ PrimitiveFieldGenerator::~PrimitiveFieldGenerator() { } void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { - // TODO(jonskeet): Work out whether we want to prevent the fields from ever being - // null, or whether we just handle it, in the cases of bytes and string. - // (Basically, should null-handling code be in the getter or the setter?) + + // Note: in multiple places, this code assumes that all fields + // that support presence are either nullable, or use a presence field bit. + // Fields which are oneof members are not generated here; they're generated in PrimitiveOneofFieldGenerator below. + // Extensions are not generated here either. + + + // Proto2 allows different default values to be specified. These are retained + // via static fields. They don't particularly need to be, but we don't need + // to change that. In Proto3 the default value we don't generate these + // fields, just using the literal instead. if (IsProto2(descriptor_->file())) { + // Note: "private readonly static" isn't as idiomatic as + // "private static readonly", but changing this now would create a lot of + // churn in generated code with near-to-zero benefit. printer->Print( variables_, "private readonly static $type_name$ $property_name$DefaultValue = $default_value$;\n\n"); + variables_["default_value_access"] = + variables_["property_name"] + "DefaultValue"; + } else { + variables_["default_value_access"] = variables_["default_value"]; } + // Declare the field itself. printer->Print( variables_, "private $type_name$ $name_def_message$;\n"); WritePropertyDocComment(printer, descriptor_); AddPublicMemberAttributes(printer); - if (IsProto2(descriptor_->file())) { - if (presenceIndex_ == -1) { + + // Most of the work is done in the property: + // Declare the property itself (the same for all options) + printer->Print(variables_, "$access_level$ $type_name$ $property_name$ {\n"); + + // Specify the "getter", which may need to check for a presence field. + if (SupportsPresenceApi(descriptor_)) { + if (IsNullable(descriptor_)) { printer->Print( variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $name$_ ?? $property_name$DefaultValue; }\n" - " set {\n"); + " get { return $name$_ ?? $default_value_access$; }\n"); } else { printer->Print( variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { if ($has_field_check$) { return $name$_; } else { return $property_name$DefaultValue; } }\n" - " set {\n"); + // Note: it's possible that this could be rewritten as a + // conditional ?: expression, but there's no significant benefit + // to changing it. + " get { if ($has_field_check$) { return $name$_; } else { return $default_value_access$; } }\n"); } } else { printer->Print( variables_, - "$access_level$ $type_name$ $property_name$ {\n" - " get { return $name$_; }\n" - " set {\n"); + " get { return $name$_; }\n"); } + + // Specify the "setter", which may need to set a field bit as well as the + // value. + printer->Print(" set {\n"); if (presenceIndex_ != -1) { printer->Print( variables_, @@ -116,8 +139,11 @@ void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { printer->Print( " }\n" "}\n"); - if (IsProto2(descriptor_->file())) { - printer->Print(variables_, "/// Gets whether the \"$descriptor_name$\" field is set\n"); + + // The "HasFoo" property, where required. + if (SupportsPresenceApi(descriptor_)) { + printer->Print(variables_, + "/// Gets whether the \"$descriptor_name$\" field is set\n"); AddPublicMemberAttributes(printer); printer->Print( variables_, @@ -133,8 +159,11 @@ void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { "$has_field_check$; }\n}\n"); } } - if (IsProto2(descriptor_->file())) { - printer->Print(variables_, "/// Clears the value of the \"$descriptor_name$\" field\n"); + + // The "ClearFoo" method, where required. + if (SupportsPresenceApi(descriptor_)) { + printer->Print(variables_, + "/// Clears the value of the \"$descriptor_name$\" field\n"); AddPublicMemberAttributes(printer); printer->Print( variables_, @@ -270,7 +299,7 @@ void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) { " $oneof_name$Case_ = $oneof_property_name$OneofCase.$property_name$;\n" " }\n" "}\n"); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { printer->Print( variables_, "/// Gets whether the \"$descriptor_name$\" field is set\n"); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.h similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.h index 5edcc42b7..a2c11050e 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_primitive_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_primitive_field.h @@ -53,18 +53,18 @@ class PrimitiveFieldGenerator : public FieldGeneratorBase { PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); - - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; + + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; protected: bool is_value_type; @@ -81,11 +81,11 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { PrimitiveOneofFieldGenerator& operator=(const PrimitiveOneofFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index 37154e3ce..644fbf16f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -53,7 +53,7 @@ namespace csharp { ReflectionClassGenerator::ReflectionClassGenerator(const FileDescriptor* file, const Options* options) - : SourceGeneratorBase(file, options), + : SourceGeneratorBase(options), file_(file) { namespace_ = GetFileNamespace(file); reflectionClassname_ = GetReflectionClassUnqualifiedName(file); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_reflection_class.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_reflection_class.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_reflection_class.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_reflection_class.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc index 73309a7ed..04bc7bbb1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc @@ -78,15 +78,27 @@ void RepeatedEnumFieldGenerator::GenerateMergingCode(io::Printer* printer) { } void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); + use_parse_context + ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n" + : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); } void RepeatedEnumFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void RepeatedEnumFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { printer->Print( variables_, - "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); + use_write_context + ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" + : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); } void RepeatedEnumFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h similarity index 75% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h index c7a632a17..2e265702f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h @@ -54,18 +54,20 @@ class RepeatedEnumFieldGenerator : public FieldGeneratorBase { RepeatedEnumFieldGenerator& operator=(const RepeatedEnumFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc index 4b4b37de1..8a93cd13c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc @@ -93,15 +93,27 @@ void RepeatedMessageFieldGenerator::GenerateMergingCode(io::Printer* printer) { } void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); + use_parse_context + ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n" + : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); } void RepeatedMessageFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void RepeatedMessageFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { printer->Print( variables_, - "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); + use_write_context + ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" + : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); } void RepeatedMessageFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h index 74f6874df..a2267adf3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h @@ -54,18 +54,20 @@ class RepeatedMessageFieldGenerator : public FieldGeneratorBase { RepeatedMessageFieldGenerator& operator=( const RepeatedMessageFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc index c1444ea12..0eacf91ce 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc @@ -78,15 +78,27 @@ void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) } void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); + use_parse_context + ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n" + : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n"); } void RepeatedPrimitiveFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void RepeatedPrimitiveFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { printer->Print( variables_, - "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); + use_write_context + ? "$name$_.WriteTo(ref output, _repeated_$name$_codec);\n" + : "$name$_.WriteTo(output, _repeated_$name$_codec);\n"); } void RepeatedPrimitiveFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h index 2a3be4816..d432f37b2 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h @@ -50,18 +50,20 @@ class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) = delete; RepeatedPrimitiveFieldGenerator& operator=(const RepeatedPrimitiveFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc similarity index 86% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc index ee7502fb0..7157e6ee1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc @@ -46,9 +46,8 @@ namespace protobuf { namespace compiler { namespace csharp { -SourceGeneratorBase::SourceGeneratorBase(const FileDescriptor* descriptor, - const Options *options) - : descriptor_(descriptor), options_(options) { +SourceGeneratorBase::SourceGeneratorBase( + const Options *options) : options_(options) { } SourceGeneratorBase::~SourceGeneratorBase() { @@ -56,6 +55,10 @@ SourceGeneratorBase::~SourceGeneratorBase() { void SourceGeneratorBase::WriteGeneratedCodeAttributes(io::Printer* printer) { printer->Print("[global::System.Diagnostics.DebuggerNonUserCodeAttribute]\n"); + // The second argument of the [GeneratedCode] attribute could be set to current protoc + // version, but that would cause excessive code churn in the pre-generated + // code in the repository every time the protobuf version number is updated. + printer->Print("[global::System.CodeDom.Compiler.GeneratedCode(\"protoc\", null)]\n"); } std::string SourceGeneratorBase::class_access_level() { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h index 695c4225d..17a526916 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h @@ -45,7 +45,7 @@ struct Options; class SourceGeneratorBase { protected: - SourceGeneratorBase(const FileDescriptor* descriptor, const Options* options); + SourceGeneratorBase(const Options* options); virtual ~SourceGeneratorBase(); SourceGeneratorBase(const SourceGeneratorBase&) = delete; @@ -59,7 +59,6 @@ class SourceGeneratorBase { void WriteGeneratedCodeAttributes(io::Printer* printer); private: - const FileDescriptor* descriptor_; const Options *options_; }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc index add20ab9f..578f54ba6 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc @@ -81,7 +81,7 @@ void WrapperFieldGenerator::GenerateMembers(io::Printer* printer) { " $name$_ = value;\n" " }\n" "}\n\n"); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { printer->Print( variables_, "/// Gets whether the $descriptor_name$ field is set\n"); @@ -114,20 +114,37 @@ void WrapperFieldGenerator::GenerateMergingCode(io::Printer* printer) { } void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$type_name$ value = _single_$name$_codec.Read(input);\n" - "if ($has_not_property_check$ || value != $default_value$) {\n" - " $property_name$ = value;\n" - "}\n"); + use_parse_context + ? "$type_name$ value = _single_$name$_codec.Read(ref input);\n" + "if ($has_not_property_check$ || value != $default_value$) {\n" + " $property_name$ = value;\n" + "}\n" + : "$type_name$ value = _single_$name$_codec.Read(input);\n" + "if ($has_not_property_check$ || value != $default_value$) {\n" + " $property_name$ = value;\n" + "}\n"); } void WrapperFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void WrapperFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { printer->Print( variables_, - "if ($has_property_check$) {\n" - " _single_$name$_codec.WriteTagAndValue(output, $property_name$);\n" - "}\n"); + use_write_context + ? "if ($has_property_check$) {\n" + " _single_$name$_codec.WriteTagAndValue(ref output, $property_name$);\n" + "}\n" + : "if ($has_property_check$) {\n" + " _single_$name$_codec.WriteTagAndValue(output, $property_name$);\n" + "}\n"); } void WrapperFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { @@ -219,7 +236,7 @@ void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) { " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None : $oneof_property_name$OneofCase.$property_name$;\n" " }\n" "}\n"); - if (IsProto2(descriptor_->file())) { + if (SupportsPresenceApi(descriptor_)) { printer->Print( variables_, "/// Gets whether the \"$descriptor_name$\" field is set\n"); @@ -248,18 +265,32 @@ void WrapperOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) { } void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) { + GenerateParsingCode(printer, true); +} + +void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) { printer->Print( variables_, - "$property_name$ = _oneof_$name$_codec.Read(input);\n"); + use_parse_context + ? "$property_name$ = _oneof_$name$_codec.Read(ref input);\n" + : "$property_name$ = _oneof_$name$_codec.Read(input);\n"); } void WrapperOneofFieldGenerator::GenerateSerializationCode(io::Printer* printer) { + GenerateSerializationCode(printer, true); +} + +void WrapperOneofFieldGenerator::GenerateSerializationCode(io::Printer* printer, bool use_write_context) { // TODO: I suspect this is wrong... printer->Print( variables_, - "if ($has_property_check$) {\n" - " _oneof_$name$_codec.WriteTagAndValue(output, ($type_name$) $oneof_name$_);\n" - "}\n"); + use_write_context + ? "if ($has_property_check$) {\n" + " _oneof_$name$_codec.WriteTagAndValue(ref output, ($type_name$) $oneof_name$_);\n" + "}\n" + : "if ($has_property_check$) {\n" + " _oneof_$name$_codec.WriteTagAndValue(output, ($type_name$) $oneof_name$_);\n" + "}\n"); } void WrapperOneofFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h similarity index 68% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h index 394e27de5..57c4f5e76 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h @@ -53,18 +53,20 @@ class WrapperFieldGenerator : public FieldGeneratorBase { WrapperFieldGenerator(const WrapperFieldGenerator&) = delete; WrapperFieldGenerator& operator=(const WrapperFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; private: bool is_value_type; // True for int32 etc; false for bytes and string @@ -80,11 +82,13 @@ class WrapperOneofFieldGenerator : public WrapperFieldGenerator { WrapperOneofFieldGenerator(const WrapperOneofFieldGenerator&) = delete; WrapperOneofFieldGenerator& operator=(const WrapperOneofFieldGenerator&) = delete; - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.cc similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.cc index 400d5d07e..3bcb0c90c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.cc @@ -231,8 +231,9 @@ const FileDescriptor* Importer::Import(const std::string& filename) { return pool_.FindFileByName(filename); } -void Importer::AddUnusedImportTrackFile(const std::string& file_name) { - pool_.AddUnusedImportTrackFile(file_name); +void Importer::AddUnusedImportTrackFile(const std::string& file_name, + bool is_error) { + pool_.AddUnusedImportTrackFile(file_name, is_error); } void Importer::ClearUnusedImportTrackFiles() { @@ -289,11 +290,11 @@ static std::string CanonicalizePath(std::string path) { std::vector canonical_parts; std::vector parts = Split( path, "/", true); // Note: Removes empty parts. - for (int i = 0; i < parts.size(); i++) { - if (parts[i] == ".") { + for (const std::string& part : parts) { + if (part == ".") { // Ignore. } else { - canonical_parts.push_back(parts[i]); + canonical_parts.push_back(part); } } std::string result = Join(canonical_parts, "/"); @@ -463,10 +464,10 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( return NULL; } - for (int i = 0; i < mappings_.size(); i++) { + for (const auto& mapping : mappings_) { std::string temp_disk_file; - if (ApplyMapping(virtual_file, mappings_[i].virtual_path, - mappings_[i].disk_path, &temp_disk_file)) { + if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path, + &temp_disk_file)) { io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file); if (stream != NULL) { if (disk_file != NULL) { @@ -489,6 +490,22 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( io::ZeroCopyInputStream* DiskSourceTree::OpenDiskFile( const std::string& filename) { + struct stat sb; + int ret = 0; + do { + ret = stat(filename.c_str(), &sb); + } while (ret != 0 && errno == EINTR); +#if defined(_WIN32) + if (ret == 0 && sb.st_mode & S_IFDIR) { + last_error_message_ = "Input file is a directory."; + return NULL; + } +#else + if (ret == 0 && S_ISDIR(sb.st_mode)) { + last_error_message_ = "Input file is a directory."; + return NULL; + } +#endif int file_descriptor; do { file_descriptor = open(filename.c_str(), O_RDONLY); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.h similarity index 97% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.h index 1a0b47ae2..08a49c552 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer.h @@ -178,7 +178,8 @@ class PROTOBUF_EXPORT Importer { // contents are stored. inline const DescriptorPool* pool() const { return &pool_; } - void AddUnusedImportTrackFile(const std::string& file_name); + void AddUnusedImportTrackFile(const std::string& file_name, + bool is_error = false); void ClearUnusedImportTrackFiles(); @@ -201,8 +202,8 @@ class PROTOBUF_EXPORT MultiFileErrorCollector { virtual void AddError(const std::string& filename, int line, int column, const std::string& message) = 0; - virtual void AddWarning(const std::string& filename, int line, int column, - const std::string& message) {} + virtual void AddWarning(const std::string& /* filename */, int /* line */, + int /* column */, const std::string& /* message */) {} private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MultiFileErrorCollector); @@ -254,7 +255,7 @@ class PROTOBUF_EXPORT DiskSourceTree : public SourceTree { // and then you do: // Open("bar/qux"); // the DiskSourceTree will first try to open foo/bar/qux, then baz/bar/qux, - // returning the first one that opens successfuly. + // returning the first one that opens successfully. // // disk_path may be an absolute path or relative to the current directory, // just like a path you'd pass to open(). diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer_unittest.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer_unittest.cc index 111d66f8b..daa197f46 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/importer_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/importer_unittest.cc @@ -74,14 +74,14 @@ class MockErrorCollector : public MultiFileErrorCollector { // implements ErrorCollector --------------------------------------- void AddError(const std::string& filename, int line, int column, const std::string& message) { - strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, - column, message); + strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, column, + message); } void AddWarning(const std::string& filename, int line, int column, const std::string& message) { - strings::SubstituteAndAppend(&warning_text_, "$0:$1:$2: $3\n", filename, - line, column, message); + strings::SubstituteAndAppend(&warning_text_, "$0:$1:$2: $3\n", filename, line, + column, message); } }; @@ -463,13 +463,14 @@ TEST_F(DiskSourceTreeTest, DiskFileToVirtualFileCanonicalization) { source_tree_.DiskFileToVirtualFile("../../baz", &virtual_file, &shadowing_disk_file)); - // "/foo" is not mapped (it should not be misintepreted as being under "."). + // "/foo" is not mapped (it should not be misinterpreted as being under "."). EXPECT_EQ(DiskSourceTree::NO_MAPPING, source_tree_.DiskFileToVirtualFile("/foo", &virtual_file, &shadowing_disk_file)); #ifdef WIN32 - // "C:\foo" is not mapped (it should not be misintepreted as being under "."). + // "C:\foo" is not mapped (it should not be misinterpreted as being under + // "."). EXPECT_EQ(DiskSourceTree::NO_MAPPING, source_tree_.DiskFileToVirtualFile("C:\\foo", &virtual_file, &shadowing_disk_file)); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_context.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_context.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_context.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_context.cc index d74a7ed63..fea870f1c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_context.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_context.cc @@ -108,6 +108,7 @@ void Context::InitializeFieldGeneratorInfoForMessage( InitializeFieldGeneratorInfoForMessage(message->nested_type(i)); } std::vector fields; + fields.reserve(message->field_count()); for (int i = 0; i < message->field_count(); ++i) { fields.push_back(message->field(i)); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_context.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_context.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_context.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_context.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment.cc similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment.cc index 2376488f0..80b79025d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment.cc @@ -36,6 +36,7 @@ #include +#include #include #include @@ -186,6 +187,21 @@ void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) { printer->Print(" */\n"); } +void WriteDeprecatedJavadoc(io::Printer* printer, const FieldDescriptor* field, + const FieldAccessorType type) { + if (!field->options().deprecated()) { + return; + } + + // Lite codegen does not annotate set & clear methods with @Deprecated. + if (field->file()->options().optimize_for() == FileOptions::LITE_RUNTIME && + (type == SETTER || type == CLEARER)) { + return; + } + + printer->Print(" * @deprecated\n"); +} + void WriteFieldAccessorDocComment(io::Printer* printer, const FieldDescriptor* field, const FieldAccessorType type, @@ -194,6 +210,7 @@ void WriteFieldAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * $def$\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: printer->Print(" * @return Whether the $name$ field is set.\n", "name", @@ -252,6 +269,7 @@ void WriteFieldEnumValueAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * $def$\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: // Should never happen @@ -321,6 +339,7 @@ void WriteFieldStringBytesAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * $def$\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: // Should never happen diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum.cc similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum.cc index 9415eb5d2..51032c274 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum.cc @@ -77,9 +77,10 @@ void EnumGenerator::Generate(io::Printer* printer) { WriteEnumDocComment(printer, descriptor_); MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_); printer->Print( - "public enum $classname$\n" + "$deprecation$public enum $classname$\n" " implements com.google.protobuf.ProtocolMessageEnum {\n", - "classname", descriptor_->name()); + "classname", descriptor_->name(), "deprecation", + descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""); printer->Annotate("classname", descriptor_); printer->Indent(); @@ -142,9 +143,13 @@ void EnumGenerator::Generate(io::Printer* printer) { vars["number"] = StrCat(descriptor_->value(i)->number()); vars["{"] = ""; vars["}"] = ""; + vars["deprecation"] = descriptor_->value(i)->options().deprecated() + ? "@java.lang.Deprecated " + : ""; WriteEnumValueDocComment(printer, descriptor_->value(i)); printer->Print(vars, - "public static final int ${$$name$_VALUE$}$ = $number$;\n"); + "$deprecation$public static final int ${$$name$_VALUE$}$ = " + "$number$;\n"); printer->Annotate("{", "}", descriptor_->value(i)); } printer->Print("\n"); @@ -228,7 +233,25 @@ void EnumGenerator::Generate(io::Printer* printer) { if (HasDescriptorMethods(descriptor_, context_->EnforceLite())) { printer->Print( "public final com.google.protobuf.Descriptors.EnumValueDescriptor\n" - " getValueDescriptor() {\n" + " getValueDescriptor() {\n"); + if (SupportUnknownEnumValue(descriptor_->file())) { + if (ordinal_is_index) { + printer->Print( + " if (this == UNRECOGNIZED) {\n" + " throw new java.lang.IllegalStateException(\n" + " \"Can't get the descriptor of an unrecognized enum " + "value.\");\n" + " }\n"); + } else { + printer->Print( + " if (index == -1) {\n" + " throw new java.lang.IllegalStateException(\n" + " \"Can't get the descriptor of an unrecognized enum " + "value.\");\n" + " }\n"); + } + } + printer->Print( " return getDescriptor().getValues().get($index_text$);\n" "}\n" "public final com.google.protobuf.Descriptors.EnumDescriptor\n" @@ -279,15 +302,22 @@ void EnumGenerator::Generate(io::Printer* printer) { // for every enum. printer->Print("values();\n"); } else { + printer->Print("getStaticValuesArray();\n"); + printer->Print("private static $classname$[] getStaticValuesArray() {\n", + "classname", descriptor_->name()); + printer->Indent(); printer->Print( - "{\n" - " "); + "return new $classname$[] {\n" + " ", + "classname", descriptor_->name()); for (int i = 0; i < descriptor_->value_count(); i++) { printer->Print("$name$, ", "name", descriptor_->value(i)->name()); } printer->Print( "\n" "};\n"); + printer->Outdent(); + printer->Print("}"); } printer->Print( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.cc index 65dd35364..eed701ee0 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.cc @@ -32,6 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -39,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -61,19 +63,25 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->enum_type()); + (*variables)["kt_type"] = (*variables)["type"]; (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->enum_type()); (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); (*variables)["default_number"] = StrCat(descriptor->default_value_enum()->number()); (*variables)["tag"] = StrCat( - static_cast(internal::WireFormat::MakeTag(descriptor))); + static_cast(internal::WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( internal::WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["on_changed"] = "onChanged();"; // Use deprecated valueOf() method to be compatible with old generated code // for v2.5.0/v2.6.1. @@ -81,7 +89,7 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, // with v2.5.0/v2.6.1, and remove the @SuppressWarnings annotations. (*variables)["for_number"] = "valueOf"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); @@ -105,18 +113,11 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, ".getNumber()"; } - // For repated builders, one bit is used for whether the array is immutable. + // For repeated builders, one bit is used for whether the array is immutable. (*variables)["get_mutable_bit_builder"] = GenerateGetBit(builderBitIndex); (*variables)["set_mutable_bit_builder"] = GenerateSetBit(builderBitIndex); (*variables)["clear_mutable_bit_builder"] = GenerateClearBit(builderBitIndex); - // For repeated fields, one bit is used for whether the array is immutable - // in the parsing constructor. - (*variables)["get_mutable_bit_parser"] = - GenerateGetBitMutableLocal(builderBitIndex); - (*variables)["set_mutable_bit_parser"] = - GenerateSetBitMutableLocal(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -145,7 +146,7 @@ ImmutableEnumFieldGenerator::ImmutableEnumFieldGenerator( ImmutableEnumFieldGenerator::~ImmutableEnumFieldGenerator() {} int ImmutableEnumFieldGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } int ImmutableEnumFieldGenerator::GetNumBitsForBuilder() const { @@ -154,7 +155,7 @@ int ImmutableEnumFieldGenerator::GetNumBitsForBuilder() const { void ImmutableEnumFieldGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -171,27 +172,28 @@ void ImmutableEnumFieldGenerator::GenerateInterfaceMembers( void ImmutableEnumFieldGenerator::GenerateMembers(io::Printer* printer) const { printer->Print(variables_, "private int $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" - "}\n"); + printer->Print(variables_, + "@java.lang.Override $deprecation$public boolean " + "${$has$capitalized_name$$}$() {\n" + " return $get_has_field_bit_message$;\n" + "}\n"); printer->Annotate("{", "}", descriptor_); } if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" - " return $name$_;\n" - "}\n"); + printer->Print(variables_, + "@java.lang.Override $deprecation$public int " + "${$get$capitalized_name$Value$}$() {\n" + " return $name$_;\n" + "}\n"); printer->Annotate("{", "}", descriptor_); } WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" + "@java.lang.Override $deprecation$public $type$ " + "${$get$capitalized_name$$}$() {\n" " @SuppressWarnings(\"deprecation\")\n" " $type$ result = $type$.$for_number$($name$_);\n" " return result == null ? $unknown$ : result;\n" @@ -202,28 +204,29 @@ void ImmutableEnumFieldGenerator::GenerateMembers(io::Printer* printer) const { void ImmutableEnumFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { printer->Print(variables_, "private int $name$_ = $default_number$;\n"); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_builder$;\n" - "}\n"); + printer->Print(variables_, + "@java.lang.Override $deprecation$public boolean " + "${$has$capitalized_name$$}$() {\n" + " return $get_has_field_bit_builder$;\n" + "}\n"); printer->Annotate("{", "}", descriptor_); } if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); - printer->Print( - variables_, - "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" - " return $name$_;\n" - "}\n"); + printer->Print(variables_, + "@java.lang.Override $deprecation$public int " + "${$get$capitalized_name$Value$}$() {\n" + " return $name$_;\n" + "}\n"); printer->Annotate("{", "}", descriptor_); WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER, /* builder */ true); printer->Print(variables_, "$deprecation$public Builder " "${$set$capitalized_name$Value$}$(int value) {\n" + " $set_has_field_bit_builder$\n" " $name$_ = value;\n" " $on_changed$\n" " return this;\n" @@ -232,6 +235,7 @@ void ImmutableEnumFieldGenerator::GenerateBuilderMembers( } WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " @SuppressWarnings(\"deprecation\")\n" " $type$ result = $type$.$for_number$($name$_);\n" @@ -265,6 +269,35 @@ void ImmutableEnumFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutableEnumFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for enums @@ -284,7 +317,7 @@ void ImmutableEnumFieldGenerator::GenerateBuilderClearCode( void ImmutableEnumFieldGenerator::GenerateMergingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { printer->Print(variables_, "if (other.has$capitalized_name$()) {\n" " set$capitalized_name$(other.get$capitalized_name$());\n" @@ -302,7 +335,7 @@ void ImmutableEnumFieldGenerator::GenerateMergingCode( void ImmutableEnumFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { printer->Print(variables_, "if ($get_has_field_bit_from_local$) {\n" " $set_has_field_bit_to_local$;\n" @@ -311,32 +344,26 @@ void ImmutableEnumFieldGenerator::GenerateBuildingCode( printer->Print(variables_, "result.$name$_ = $name$_;\n"); } -void ImmutableEnumFieldGenerator::GenerateParsingCode( +void ImmutableEnumFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { if (SupportUnknownEnumValue(descriptor_->file())) { printer->Print(variables_, - "int rawValue = input.readEnum();\n" - "$set_has_field_bit_message$\n" - "$name$_ = rawValue;\n"); + "$name$_ = input.readEnum();\n" + "$set_has_field_bit_builder$\n"); } else { printer->Print(variables_, - "int rawValue = input.readEnum();\n" - " @SuppressWarnings(\"deprecation\")\n" - "$type$ value = $type$.$for_number$(rawValue);\n" - "if (value == null) {\n" - " unknownFields.mergeVarintField($number$, rawValue);\n" + "int tmpRaw = input.readEnum();\n" + "$type$ tmpValue =\n" + " $type$.forNumber(tmpRaw);\n" + "if (tmpValue == null) {\n" + " mergeUnknownVarintField($number$, tmpRaw);\n" "} else {\n" - " $set_has_field_bit_message$\n" - " $name$_ = rawValue;\n" + " $name$_ = tmpRaw;\n" + " $set_has_field_bit_builder$\n" "}\n"); } } -void ImmutableEnumFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - // noop for enums -} - void ImmutableEnumFieldGenerator::GenerateSerializationCode( io::Printer* printer) const { printer->Print(variables_, @@ -386,15 +413,14 @@ ImmutableEnumOneofFieldGenerator::~ImmutableEnumOneofFieldGenerator() {} void ImmutableEnumOneofFieldGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -423,19 +449,20 @@ void ImmutableEnumOneofFieldGenerator::GenerateMembers( void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public int ${$get$capitalized_name$Value$}$() {\n" " if ($has_oneof_case_message$) {\n" " return ((java.lang.Integer) $oneof_name$_).intValue();\n" @@ -457,6 +484,7 @@ void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers( } WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " if ($has_oneof_case_message$) {\n" " @SuppressWarnings(\"deprecation\")\n" @@ -496,6 +524,11 @@ void ImmutableEnumOneofFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableEnumOneofFieldGenerator::GenerateBuilderClearCode( + io::Printer* printer) const { + // No-op: Enum fields in oneofs are correctly cleared by clearing the oneof +} + void ImmutableEnumOneofFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { printer->Print(variables_, @@ -516,7 +549,7 @@ void ImmutableEnumOneofFieldGenerator::GenerateMergingCode( } } -void ImmutableEnumOneofFieldGenerator::GenerateParsingCode( +void ImmutableEnumOneofFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { if (SupportUnknownEnumValue(descriptor_->file())) { printer->Print(variables_, @@ -526,10 +559,10 @@ void ImmutableEnumOneofFieldGenerator::GenerateParsingCode( } else { printer->Print(variables_, "int rawValue = input.readEnum();\n" - "@SuppressWarnings(\"deprecation\")\n" - "$type$ value = $type$.$for_number$(rawValue);\n" + "$type$ value =\n" + " $type$.forNumber(rawValue);\n" "if (value == null) {\n" - " unknownFields.mergeVarintField($number$, rawValue);\n" + " mergeUnknownVarintField($number$, rawValue);\n" "} else {\n" " $set_oneof_case_message$;\n" " $oneof_name$_ = rawValue;\n" @@ -650,6 +683,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public java.util.List<$type$> " "${$get$capitalized_name$List$}$() {\n" " return new com.google.protobuf.Internal.ListAdapter<\n" @@ -659,6 +693,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, LIST_COUNT); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" " return $name$_.size();\n" "}\n"); @@ -666,6 +701,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" " return $name$_converter_.convert($name$_.get(index));\n" "}\n"); @@ -673,6 +709,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateMembers( if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public java.util.List\n" "${$get$capitalized_name$ValueList$}$() {\n" " return $name$_;\n" @@ -681,6 +718,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateMembers( WriteFieldEnumValueAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public int " "${$get$capitalized_name$Value$}$(int index) {\n" " return $name$_.get(index);\n" @@ -701,7 +739,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateBuilderMembers( // list is immutable. If it's immutable, the invariant is that it must // either an instance of Collections.emptyList() or it's an ArrayList // wrapped in a Collections.unmodifiableList() wrapper and nobody else has - // a refererence to the underlying ArrayList. This invariant allows us to + // a reference to the underlying ArrayList. This invariant allows us to // share instances of lists between protocol buffers avoiding expensive // memory allocations. Note, immutable is a strong guarantee here -- not // just that the list cannot be modified via the reference but that the @@ -903,36 +941,29 @@ void RepeatedImmutableEnumFieldGenerator::GenerateBuildingCode( "result.$name$_ = $name$_;\n"); } -void RepeatedImmutableEnumFieldGenerator::GenerateParsingCode( +void RepeatedImmutableEnumFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { // Read and store the enum if (SupportUnknownEnumValue(descriptor_->file())) { printer->Print(variables_, - "int rawValue = input.readEnum();\n" - "if (!$get_mutable_bit_parser$) {\n" - " $name$_ = new java.util.ArrayList();\n" - " $set_mutable_bit_parser$;\n" - "}\n" - "$name$_.add(rawValue);\n"); + "int tmpRaw = input.readEnum();\n" + "ensure$capitalized_name$IsMutable();\n" + "$name$_.add(tmpRaw);\n"); } else { - printer->Print( - variables_, - "int rawValue = input.readEnum();\n" - "@SuppressWarnings(\"deprecation\")\n" - "$type$ value = $type$.$for_number$(rawValue);\n" - "if (value == null) {\n" - " unknownFields.mergeVarintField($number$, rawValue);\n" - "} else {\n" - " if (!$get_mutable_bit_parser$) {\n" - " $name$_ = new java.util.ArrayList();\n" - " $set_mutable_bit_parser$;\n" - " }\n" - " $name$_.add(rawValue);\n" - "}\n"); + printer->Print(variables_, + "int tmpRaw = input.readEnum();\n" + "$type$ tmpValue =\n" + " $type$.forNumber(tmpRaw);\n" + "if (tmpValue == null) {\n" + " mergeUnknownVarintField($number$, tmpRaw);\n" + "} else {\n" + " ensure$capitalized_name$IsMutable();\n" + " $name$_.add(tmpRaw);\n" + "}\n"); } } -void RepeatedImmutableEnumFieldGenerator::GenerateParsingCodeFromPacked( +void RepeatedImmutableEnumFieldGenerator::GenerateBuilderParsingCodeFromPacked( io::Printer* printer) const { // Wrap GenerateParsingCode's contents with a while loop. @@ -942,7 +973,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateParsingCodeFromPacked( "while(input.getBytesUntilLimit() > 0) {\n"); printer->Indent(); - GenerateParsingCode(printer); + GenerateBuilderParsingCode(printer); printer->Outdent(); printer->Print(variables_, @@ -950,15 +981,6 @@ void RepeatedImmutableEnumFieldGenerator::GenerateParsingCodeFromPacked( "input.popLimit(oldLimit);\n"); } -void RepeatedImmutableEnumFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($get_mutable_bit_parser$) {\n" - " $name$_ = java.util.Collections.unmodifiableList($name$_);\n" - "}\n"); -} - void RepeatedImmutableEnumFieldGenerator::GenerateSerializationCode( io::Printer* printer) const { if (descriptor_->is_packed()) { @@ -1026,6 +1048,100 @@ void RepeatedImmutableEnumFieldGenerator::GenerateHashCode( "}\n"); } +void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + std::string RepeatedImmutableEnumFieldGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.h similarity index 56% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.h index 95c7db578..aafc26ced 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field.h @@ -60,28 +60,29 @@ class ImmutableEnumFieldGenerator : public ImmutableFieldGenerator { explicit ImmutableEnumFieldGenerator(const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - ~ImmutableEnumFieldGenerator(); + ~ImmutableEnumFieldGenerator() override; // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -99,15 +100,16 @@ class ImmutableEnumOneofFieldGenerator : public ImmutableEnumFieldGenerator { Context* context); ~ImmutableEnumOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldGenerator); @@ -118,28 +120,30 @@ class RepeatedImmutableEnumFieldGenerator : public ImmutableFieldGenerator { explicit RepeatedImmutableEnumFieldGenerator( const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - ~RepeatedImmutableEnumFieldGenerator(); + ~RepeatedImmutableEnumFieldGenerator() override; // implements ImmutableFieldGenerator --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingCodeFromPacked(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCodeFromPacked( + io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.cc similarity index 80% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.cc index 5c137ca50..ca3a2e880 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.cc @@ -32,6 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -39,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -68,22 +70,28 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->enum_type()); + (*variables)["kt_type"] = (*variables)["type"]; (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->enum_type()); (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); (*variables)["default_number"] = StrCat(descriptor->default_value_enum()->number()); (*variables)["tag"] = StrCat( - static_cast(internal::WireFormat::MakeTag(descriptor))); + static_cast(internal::WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( internal::WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["required"] = descriptor->is_required() ? "true" : "false"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); @@ -103,9 +111,6 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, ".getNumber()"; } - // For repeated builders, the underlying list tracks mutability state. - (*variables)["is_mutable"] = (*variables)["name"] + "_.isModifiable()"; - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -140,12 +145,12 @@ ImmutableEnumFieldLiteGenerator::ImmutableEnumFieldLiteGenerator( ImmutableEnumFieldLiteGenerator::~ImmutableEnumFieldLiteGenerator() {} int ImmutableEnumFieldLiteGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } void ImmutableEnumFieldLiteGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -163,7 +168,7 @@ void ImmutableEnumFieldLiteGenerator::GenerateMembers( io::Printer* printer) const { printer->Print(variables_, "private int $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -217,7 +222,7 @@ void ImmutableEnumFieldLiteGenerator::GenerateMembers( void ImmutableEnumFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -276,6 +281,35 @@ void ImmutableEnumFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutableEnumFieldLiteGenerator::GenerateInitializationCode( io::Printer* printer) const { if (!IsDefaultValueJavaDefault(descriptor_)) { @@ -284,15 +318,15 @@ void ImmutableEnumFieldLiteGenerator::GenerateInitializationCode( } void ImmutableEnumFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteIntToUtf16CharSequence(messageBitIndex_, output); } printer->Print(variables_, "\"$name$_\",\n"); - if (SupportFieldPresence(descriptor_->file())) { + if (!SupportUnknownEnumValue((descriptor_))) { PrintEnumVerifierLogic(printer, descriptor_, variables_, /*var_name=*/"$type$", /*terminating_string=*/",\n", @@ -319,16 +353,15 @@ ImmutableEnumOneofFieldLiteGenerator::~ImmutableEnumOneofFieldLiteGenerator() {} void ImmutableEnumOneofFieldLiteGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -381,12 +414,12 @@ void ImmutableEnumOneofFieldLiteGenerator::GenerateMembers( } void ImmutableEnumOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); WriteIntToUtf16CharSequence(descriptor_->containing_oneof()->index(), output); - if (SupportFieldPresence(descriptor_->file())) { + if (!SupportUnknownEnumValue(descriptor_)) { PrintEnumVerifierLogic(printer, descriptor_, variables_, /*var_name=*/"$type$", /*terminating_string=*/",\n", @@ -396,16 +429,15 @@ void ImmutableEnumOneofFieldLiteGenerator::GenerateFieldInfo( void ImmutableEnumOneofFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return instance.has$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return instance.has$capitalized_name$();\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + if (SupportUnknownEnumValue(descriptor_->file())) { WriteFieldEnumValueAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -538,9 +570,14 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); printer->Print( variables_, + // NB: Do not use the "$name$_converter_" field; the usage of generics + // (and requisite upcasts to Object) prevent optimizations. Even + // without any optimizations, the below code is cheaper because it + // avoids boxing an int and a checkcast from the generics. "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $name$_converter_.convert($name$_.getInt(index));\n" + " $type$ result = $type$.forNumber($name$_.getInt(index));\n" + " return result == null ? $unknown$ : result;\n" "}\n"); printer->Annotate("{", "}", descriptor_); if (SupportUnknownEnumValue(descriptor_->file())) { @@ -572,9 +609,11 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateMembers( printer->Print( variables_, "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$is_mutable$) {\n" + // Use a temporary to avoid a redundant iget-object. + " com.google.protobuf.Internal.IntList tmp = $name$_;\n" + " if (!tmp.isModifiable()) {\n" " $name$_ =\n" - " com.google.protobuf.GeneratedMessageLite.mutableCopy($name$_);\n" + " com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);\n" " }\n" "}\n"); WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER); @@ -635,12 +674,12 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateMembers( } void RepeatedImmutableEnumFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); printer->Print(variables_, "\"$name$_\",\n"); - if (SupportFieldPresence(descriptor_->file())) { + if (!SupportUnknownEnumValue(descriptor_->file())) { PrintEnumVerifierLogic(printer, descriptor_, variables_, /*var_name=*/"$type$", /*terminating_string=*/",\n", @@ -775,6 +814,100 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateInitializationCode( printer->Print(variables_, "$name$_ = emptyIntList();\n"); } +void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + std::string RepeatedImmutableEnumFieldLiteGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.h similarity index 75% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.h index b5e980772..6ed11c9ef 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_field_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_field_lite.h @@ -35,8 +35,10 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_LITE_H__ +#include #include #include + #include namespace google { @@ -60,19 +62,20 @@ class ImmutableEnumFieldLiteGenerator : public ImmutableFieldLiteGenerator { explicit ImmutableEnumFieldLiteGenerator(const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutableEnumFieldLiteGenerator(); + ~ImmutableEnumFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator // ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -90,12 +93,12 @@ class ImmutableEnumOneofFieldLiteGenerator public: ImmutableEnumOneofFieldLiteGenerator(const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutableEnumOneofFieldLiteGenerator(); + ~ImmutableEnumOneofFieldLiteGenerator() override; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldLiteGenerator); @@ -106,18 +109,19 @@ class RepeatedImmutableEnumFieldLiteGenerator public: explicit RepeatedImmutableEnumFieldLiteGenerator( const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableEnumFieldLiteGenerator(); + ~RepeatedImmutableEnumFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_lite.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_lite.cc index 69bd26c3f..aa64c9712 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_lite.cc @@ -78,9 +78,10 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { WriteEnumDocComment(printer, descriptor_); MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_); printer->Print( - "public enum $classname$\n" + "$deprecation$public enum $classname$\n" " implements com.google.protobuf.Internal.EnumLite {\n", - "classname", descriptor_->name()); + "classname", descriptor_->name(), "deprecation", + descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""); printer->Annotate("classname", descriptor_); printer->Indent(); @@ -124,9 +125,13 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { vars["number"] = StrCat(descriptor_->value(i)->number()); vars["{"] = ""; vars["}"] = ""; + vars["deprecation"] = descriptor_->value(i)->options().deprecated() + ? "@java.lang.Deprecated " + : ""; WriteEnumValueDocComment(printer, descriptor_->value(i)); printer->Print(vars, - "public static final int ${$$name$_VALUE$}$ = $number$;\n"); + "$deprecation$public static final int ${$$name$_VALUE$}$ = " + "$number$;\n"); printer->Annotate("{", "}", descriptor_->value(i)); } printer->Print("\n"); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_lite.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_enum_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_enum_lite.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension.h index ab8789077..f928a7837 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension.h @@ -94,9 +94,9 @@ class ImmutableExtensionGenerator : public ExtensionGenerator { Context* context); virtual ~ImmutableExtensionGenerator(); - virtual void Generate(io::Printer* printer); - virtual int GenerateNonNestedInitializationCode(io::Printer* printer); - virtual int GenerateRegistrationCode(io::Printer* printer); + void Generate(io::Printer* printer) override; + int GenerateNonNestedInitializationCode(io::Printer* printer) override; + int GenerateRegistrationCode(io::Printer* printer) override; protected: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension_lite.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension_lite.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension_lite.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension_lite.h index 410781dd3..76961563a 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_extension_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_extension_lite.h @@ -51,13 +51,13 @@ class ImmutableExtensionLiteGenerator : public ExtensionGenerator { Context* context); virtual ~ImmutableExtensionLiteGenerator(); - virtual void Generate(io::Printer* printer); + void Generate(io::Printer* printer) override; // Returns an estimate of the number of bytes the printed code will compile to - virtual int GenerateNonNestedInitializationCode(io::Printer* printer); + int GenerateNonNestedInitializationCode(io::Printer* printer) override; // Returns an estimate of the number of bytes the printed code will compile to - virtual int GenerateRegistrationCode(io::Printer* printer); + int GenerateRegistrationCode(io::Printer* printer) override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.cc similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.cc index 96ed23401..0c69a53bf 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.cc @@ -87,7 +87,7 @@ ImmutableFieldGenerator* MakeImmutableGenerator(const FieldDescriptor* field, field, messageBitIndex, builderBitIndex, context); } } else { - if (field->containing_oneof()) { + if (IsRealOneof(field)) { switch (GetJavaType(field)) { case JAVATYPE_MESSAGE: return new ImmutableMessageOneofFieldGenerator( @@ -144,7 +144,7 @@ ImmutableFieldLiteGenerator* MakeImmutableLiteGenerator( field, messageBitIndex, context); } } else { - if (field->containing_oneof()) { + if (IsRealOneof(field)) { switch (GetJavaType(field)) { case JAVATYPE_MESSAGE: return new ImmutableMessageOneofFieldLiteGenerator( @@ -185,7 +185,7 @@ static inline void ReportUnexpectedPackedFieldsCall(io::Printer* printer) { // but this method should be overridden. // - This FieldGenerator doesn't support packing, and this method // should never have been called. - GOOGLE_LOG(FATAL) << "GenerateParsingCodeFromPacked() " + GOOGLE_LOG(FATAL) << "GenerateBuilderParsingCodeFromPacked() " << "called on field generator that does not support packing."; } @@ -193,7 +193,7 @@ static inline void ReportUnexpectedPackedFieldsCall(io::Printer* printer) { ImmutableFieldGenerator::~ImmutableFieldGenerator() {} -void ImmutableFieldGenerator::GenerateParsingCodeFromPacked( +void ImmutableFieldGenerator::GenerateBuilderParsingCodeFromPacked( io::Printer* printer) const { ReportUnexpectedPackedFieldsCall(printer); } @@ -251,12 +251,32 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, (*variables)["disambiguated_reason"] = info->disambiguated_reason; (*variables)["constant_name"] = FieldConstantName(descriptor); (*variables)["number"] = StrCat(descriptor->number()); + (*variables)["kt_dsl_builder"] = "_builder"; // These variables are placeholders to pick out the beginning and ends of // identifiers for annotations (when doing so with existing variables would // be ambiguous or impossible). They should never be set to anything but the // empty string. (*variables)["{"] = ""; (*variables)["}"] = ""; + (*variables)["kt_name"] = + IsForbiddenKotlin(info->name) ? info->name + "_" : info->name; + (*variables)["kt_capitalized_name"] = IsForbiddenKotlin(info->name) + ? info->capitalized_name + "_" + : info->capitalized_name; + if (!descriptor->is_repeated()) { + (*variables)["annotation_field_type"] = FieldTypeName(descriptor->type()); + } else if (GetJavaType(descriptor) == JAVATYPE_MESSAGE && + IsMapEntry(descriptor->message_type())) { + (*variables)["annotation_field_type"] = + std::string(FieldTypeName(descriptor->type())) + "MAP"; + } else { + (*variables)["annotation_field_type"] = + std::string(FieldTypeName(descriptor->type())) + "_LIST"; + if (descriptor->is_packed()) { + (*variables)["annotation_field_type"] = + (*variables)["annotation_field_type"] + "_PACKED"; + } + } } void SetCommonOneofVariables(const FieldDescriptor* descriptor, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.h index 9d04dc845..a570cd61b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_field.h @@ -35,6 +35,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ +#include #include #include #include @@ -76,13 +77,13 @@ class ImmutableFieldGenerator { virtual void GenerateBuilderClearCode(io::Printer* printer) const = 0; virtual void GenerateMergingCode(io::Printer* printer) const = 0; virtual void GenerateBuildingCode(io::Printer* printer) const = 0; - virtual void GenerateParsingCode(io::Printer* printer) const = 0; - virtual void GenerateParsingCodeFromPacked(io::Printer* printer) const; - virtual void GenerateParsingDoneCode(io::Printer* printer) const = 0; + virtual void GenerateBuilderParsingCode(io::Printer* printer) const = 0; + virtual void GenerateBuilderParsingCodeFromPacked(io::Printer* printer) const; virtual void GenerateSerializationCode(io::Printer* printer) const = 0; virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0; virtual void GenerateFieldBuilderInitializationCode( io::Printer* printer) const = 0; + virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0; virtual void GenerateEqualsCode(io::Printer* printer) const = 0; virtual void GenerateHashCode(io::Printer* printer) const = 0; @@ -104,7 +105,8 @@ class ImmutableFieldLiteGenerator { virtual void GenerateBuilderMembers(io::Printer* printer) const = 0; virtual void GenerateInitializationCode(io::Printer* printer) const = 0; virtual void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const = 0; + std::vector* output) const = 0; + virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0; virtual std::string GetBoxedType() const = 0; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.cc similarity index 93% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.cc index 4a96a365d..9dbf81814 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.cc @@ -91,7 +91,9 @@ bool CollectExtensions(const Message& message, FieldDescriptorSet* extensions) { reflection->ListFields(message, &fields); for (int i = 0; i < fields.size(); i++) { - if (fields[i]->is_extension()) extensions->insert(fields[i]); + if (fields[i]->is_extension()) { + extensions->insert(fields[i]); + } if (GetJavaType(fields[i]) == JAVATYPE_MESSAGE) { if (fields[i]->is_repeated()) { @@ -673,6 +675,54 @@ void FileGenerator::GenerateSiblings( } } +std::string FileGenerator::GetKotlinClassname() { + return name_resolver_->GetFileClassName(file_, immutable_api_, true); +} + +void FileGenerator::GenerateKotlinSiblings( + const std::string& package_dir, GeneratorContext* context, + std::vector* file_list, + std::vector* annotation_list) { + for (int i = 0; i < file_->message_type_count(); i++) { + const Descriptor* descriptor = file_->message_type(i); + MessageGenerator* generator = message_generators_[i].get(); + auto open_file = [context](const std::string& filename) { + return std::unique_ptr(context->Open(filename)); + }; + std::string filename = package_dir + descriptor->name() + "Kt.kt"; + file_list->push_back(filename); + std::string info_full_path = filename + ".pb.meta"; + GeneratedCodeInfo annotations; + io::AnnotationProtoCollector annotation_collector( + &annotations); + auto output = open_file(filename); + io::Printer printer( + output.get(), '$', + options_.annotate_code ? &annotation_collector : nullptr); + + printer.Print( + "//Generated by the protocol buffer compiler. DO NOT EDIT!\n" + "// source: $filename$\n" + "\n", + "filename", descriptor->file()->name()); + if (!java_package_.empty()) { + printer.Print( + "package $package$;\n" + "\n", + "package", java_package_); + } + + generator->GenerateKotlinMembers(&printer); + generator->GenerateTopLevelKotlinMembers(&printer); + + if (options_.annotate_code) { + auto info_output = open_file(info_full_path); + annotations.SerializeToZeroCopyStream(info_output.get()); + annotation_list->push_back(info_full_path); + } + } +} + bool FileGenerator::ShouldIncludeDependency(const FileDescriptor* descriptor, bool immutable_api) { return true; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.h similarity index 93% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.h index bb3e4a576..71ee3e855 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_file.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_file.h @@ -78,6 +78,12 @@ class FileGenerator { void Generate(io::Printer* printer); + std::string GetKotlinClassname(); + void GenerateKotlinSiblings(const std::string& package_dir, + GeneratorContext* generator_context, + std::vector* file_list, + std::vector* annotation_list); + // If we aren't putting everything into one file, this will write all the // files other than the outer file (i.e. one for each message, enum, and // service type). diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.cc index 5045cfdc6..29ae2cf9f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.cc @@ -58,6 +58,10 @@ namespace java { JavaGenerator::JavaGenerator() {} JavaGenerator::~JavaGenerator() {} +uint64_t JavaGenerator::GetSupportedFeatures() const { + return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL; +} + bool JavaGenerator::Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* context, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.h similarity index 97% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.h index be63ac49e..6315e7c3f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator.h @@ -58,7 +58,9 @@ class PROTOC_EXPORT JavaGenerator : public CodeGenerator { // implements CodeGenerator ---------------------------------------- bool Generate(const FileDescriptor* file, const std::string& parameter, - GeneratorContext* context, std::string* error) const; + GeneratorContext* context, std::string* error) const override; + + uint64_t GetSupportedFeatures() const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator_factory.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator_factory.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator_factory.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator_factory.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator_factory.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator_factory.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator_factory.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator_factory.h index 16688a56d..831d9dd85 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_generator_factory.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_generator_factory.h @@ -80,14 +80,14 @@ class ImmutableGeneratorFactory : public GeneratorFactory { ImmutableGeneratorFactory(Context* context); virtual ~ImmutableGeneratorFactory(); - virtual MessageGenerator* NewMessageGenerator( - const Descriptor* descriptor) const; + MessageGenerator* NewMessageGenerator( + const Descriptor* descriptor) const override; - virtual ExtensionGenerator* NewExtensionGenerator( - const FieldDescriptor* descriptor) const; + ExtensionGenerator* NewExtensionGenerator( + const FieldDescriptor* descriptor) const override; - virtual ServiceGenerator* NewServiceGenerator( - const ServiceDescriptor* descriptor) const; + ServiceGenerator* NewServiceGenerator( + const ServiceDescriptor* descriptor) const override; private: Context* context_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.cc similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.cc index 41cd52402..f37ecde78 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.cc @@ -35,12 +35,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -75,8 +77,8 @@ const char* kForbiddenWordList[] = { "class", }; -const std::unordered_set* kReservedNames = - new std::unordered_set({ +const std::unordered_set* kReservedNames = + new std::unordered_set({ "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", @@ -191,6 +193,38 @@ std::string UnderscoresToCamelCase(const std::string& input, return result; } +std::string ToCamelCase(const std::string& input, bool lower_first) { + bool capitalize_next = !lower_first; + std::string result; + result.reserve(input.size()); + + for (char i : input) { + if (i == '_') { + capitalize_next = true; + } else if (capitalize_next) { + result.push_back(ToUpperCh(i)); + capitalize_next = false; + } else { + result.push_back(i); + } + } + + // Lower-case the first letter. + if (lower_first && !result.empty()) { + result[0] = ToLowerCh(result[0]); + } + + return result; +} + +char ToUpperCh(char ch) { + return (ch >= 'a' && ch <= 'z') ? (ch - 'a' + 'A') : ch; +} + +char ToLowerCh(char ch) { + return (ch >= 'A' && ch <= 'Z') ? (ch - 'A' + 'a') : ch; +} + std::string UnderscoresToCamelCase(const FieldDescriptor* field) { return UnderscoresToCamelCase(FieldName(field), false); } @@ -215,6 +249,22 @@ std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field) { return name; } +bool IsForbiddenKotlin(const std::string& field_name) { + // Names that should be avoided as field names in Kotlin. + // All Kotlin hard keywords are in this list. + const std::unordered_set* kKotlinForbiddenNames = + new std::unordered_set({ + "as", "as?", "break", "class", "continue", "do", + "else", "false", "for", "fun", "if", "in", + "!in", "interface", "is", "!is", "null", "object", + "package", "return", "super", "this", "throw", "true", + "try", "typealias", "typeof", "val", "var", "when", + "while", + }); + return kKotlinForbiddenNames->find(field_name) != + kKotlinForbiddenNames->end(); +} + std::string UniqueFileScopeIdentifier(const Descriptor* descriptor) { return "static_" + StringReplace(descriptor->full_name(), ".", "_", true); } @@ -227,14 +277,6 @@ std::string CamelCaseFieldName(const FieldDescriptor* field) { return fieldName; } -std::string StripProto(const std::string& filename) { - if (HasSuffixString(filename, ".protodevel")) { - return StripSuffixString(filename, ".protodevel"); - } else { - return StripSuffixString(filename, ".proto"); - } -} - std::string FileClassName(const FileDescriptor* file, bool immutable) { ClassNameResolver name_resolver; return name_resolver.GetFileClassName(file, immutable); @@ -308,7 +350,7 @@ std::string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor) { std::string FieldConstantName(const FieldDescriptor* field) { std::string name = field->name() + "_FIELD_NUMBER"; - UpperString(&name); + ToUpper(&name); return name; } @@ -428,6 +470,35 @@ const char* BoxedPrimitiveTypeName(const FieldDescriptor* descriptor) { return BoxedPrimitiveTypeName(GetJavaType(descriptor)); } +const char* KotlinTypeName(JavaType type) { + switch (type) { + case JAVATYPE_INT: + return "kotlin.Int"; + case JAVATYPE_LONG: + return "kotlin.Long"; + case JAVATYPE_FLOAT: + return "kotlin.Float"; + case JAVATYPE_DOUBLE: + return "kotlin.Double"; + case JAVATYPE_BOOLEAN: + return "kotlin.Boolean"; + case JAVATYPE_STRING: + return "kotlin.String"; + case JAVATYPE_BYTES: + return "com.google.protobuf.ByteString"; + case JAVATYPE_ENUM: + return NULL; + case JAVATYPE_MESSAGE: + return NULL; + + // No default because we want the compiler to complain if any new + // JavaTypes are added. + } + + GOOGLE_LOG(FATAL) << "Can't get here."; + return NULL; +} + std::string GetOneofStoredType(const FieldDescriptor* field) { const JavaType javaType = GetJavaType(field); switch (javaType) { @@ -505,11 +576,11 @@ std::string DefaultValue(const FieldDescriptor* field, bool immutable, return StrCat(field->default_value_int32()); case FieldDescriptor::CPPTYPE_UINT32: // Need to print as a signed int since Java has no unsigned. - return StrCat(static_cast(field->default_value_uint32())); + return StrCat(static_cast(field->default_value_uint32())); case FieldDescriptor::CPPTYPE_INT64: return StrCat(field->default_value_int64()) + "L"; case FieldDescriptor::CPPTYPE_UINT64: - return StrCat(static_cast(field->default_value_uint64())) + + return StrCat(static_cast(field->default_value_uint64())) + "L"; case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field->default_value_double(); @@ -901,11 +972,11 @@ bool HasRepeatedFields(const Descriptor* descriptor) { // // Note that we only use code points in [0x0000, 0xD7FF] and [0xE000, 0xFFFF]. // There will be no surrogate pairs in the encoded character sequence. -void WriteUInt32ToUtf16CharSequence(uint32 number, - std::vector* output) { +void WriteUInt32ToUtf16CharSequence(uint32_t number, + std::vector* output) { // For values in [0x0000, 0xD7FF], only use one char to encode it. if (number < 0xD800) { - output->push_back(static_cast(number)); + output->push_back(static_cast(number)); return; } // Encode into multiple chars. All except the last char will be in the range @@ -915,10 +986,10 @@ void WriteUInt32ToUtf16CharSequence(uint32 number, // them. while (number >= 0xD800) { // [0xE000, 0xFFFF] can represent 13 bits of info. - output->push_back(static_cast(0xE000 | (number & 0x1FFF))); + output->push_back(static_cast(0xE000 | (number & 0x1FFF))); number >>= 13; } - output->push_back(static_cast(number)); + output->push_back(static_cast(number)); } int GetExperimentalJavaFieldTypeForSingular(const FieldDescriptor* field) { @@ -963,6 +1034,7 @@ int GetExperimentalJavaFieldType(const FieldDescriptor* field) { static const int kUtf8CheckBit = 0x200; static const int kCheckInitialized = 0x400; static const int kMapWithProto2EnumValue = 0x800; + static const int kHasHasBit = 0x1000; int extra_bits = field->is_required() ? kRequiredBit : 0; if (field->type() == FieldDescriptor::TYPE_STRING && CheckUtf8(field)) { extra_bits |= kUtf8CheckBit; @@ -971,9 +1043,12 @@ int GetExperimentalJavaFieldType(const FieldDescriptor* field) { HasRequiredFields(field->message_type()))) { extra_bits |= kCheckInitialized; } + if (HasHasbit(field)) { + extra_bits |= kHasHasBit; + } if (field->is_map()) { - if (SupportFieldPresence(field->file())) { + if (!SupportUnknownEnumValue(field)) { const FieldDescriptor* value = field->message_type()->FindFieldByName("value"); if (GetJavaType(value) == JAVATYPE_ENUM) { @@ -985,7 +1060,7 @@ int GetExperimentalJavaFieldType(const FieldDescriptor* field) { return GetExperimentalJavaFieldTypeForPacked(field); } else if (field->is_repeated()) { return GetExperimentalJavaFieldTypeForRepeated(field) | extra_bits; - } else if (field->containing_oneof() != NULL) { + } else if (IsRealOneof(field)) { return (GetExperimentalJavaFieldTypeForSingular(field) + kOneofFieldTypeOffset) | extra_bits; @@ -995,7 +1070,7 @@ int GetExperimentalJavaFieldType(const FieldDescriptor* field) { } // Escape a UTF-16 character to be embedded in a Java string. -void EscapeUtf16ToString(uint16 code, std::string* output) { +void EscapeUtf16ToString(uint16_t code, std::string* output) { if (code == '\t') { output->append("\\t"); } else if (code == '\b') { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.h similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.h index 1193cec97..28cac6af9 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_helpers.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_helpers.h @@ -35,7 +35,9 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_HELPERS_H__ +#include #include + #include #include #include @@ -51,6 +53,8 @@ namespace java { extern const char kThickSeparator[]; extern const char kThinSeparator[]; +bool IsForbiddenKotlin(const std::string& field_name); + // If annotation_file is non-empty, prints a javax.annotation.Generated // annotation to the given Printer. annotation_file will be referenced in the // annotation's comments field. delimiter should be the Printer's delimiter @@ -70,6 +74,13 @@ void PrintEnumVerifierLogic(io::Printer* printer, const char* var_name, const char* terminating_string, bool enforce_lite); +// Converts a name to camel-case. If cap_first_letter is true, capitalize the +// first letter. +std::string ToCamelCase(const std::string& input, bool lower_first); + +char ToUpperCh(char ch); +char ToLowerCh(char ch); + // Converts a name to camel-case. If cap_first_letter is true, capitalize the // first letter. std::string UnderscoresToCamelCase(const std::string& name, @@ -86,7 +97,7 @@ std::string UnderscoresToCamelCase(const MethodDescriptor* method); // Same as UnderscoresToCamelCase, but checks for reserved keywords std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field); -// Similar to UnderscoresToCamelCase, but guarentees that the result is a +// Similar to UnderscoresToCamelCase, but guarantees that the result is a // complete Java identifier by adding a _ if needed. std::string CamelCaseFieldName(const FieldDescriptor* field); @@ -95,9 +106,6 @@ std::string CamelCaseFieldName(const FieldDescriptor* field); // outermost file scope. std::string UniqueFileScopeIdentifier(const Descriptor* descriptor); -// Strips ".proto" or ".protodevel" from the end of a filename. -std::string StripProto(const std::string& filename); - // Gets the unqualified class name for the file. For each .proto file, there // will be one Java class containing all the immutable messages and another // Java class containing all the mutable messages. @@ -105,21 +113,11 @@ std::string StripProto(const std::string& filename); std::string FileClassName(const FileDescriptor* file, bool immutable = true); // Returns the file's Java package name. -std::string FileJavaPackage(const FileDescriptor* file); std::string FileJavaPackage(const FileDescriptor* file, bool immutable); // Returns output directory for the given package name. std::string JavaPackageToDir(std::string package_name); -// TODO(xiaofeng): the following methods are kept for they are exposed -// publicly in //net/proto2/compiler/java/public/names.h. They return -// immutable names only and should be removed after mutable API is -// integrated into google3. -std::string ClassName(const Descriptor* descriptor); -std::string ClassName(const EnumDescriptor* descriptor); -std::string ClassName(const ServiceDescriptor* descriptor); -std::string ClassName(const FileDescriptor* descriptor); - // Comma-separate list of option-specified interfaces implemented by the // Message, to follow the "implements" declaration of the Message definition. std::string ExtraMessageInterfaces(const Descriptor* descriptor); @@ -157,6 +155,7 @@ std::string GetOneofStoredType(const FieldDescriptor* field); // Whether we should generate multiple java files for messages. inline bool MultipleJavaFiles(const FileDescriptor* descriptor, bool immutable) { + (void)immutable; return descriptor->options().java_multiple_files(); } @@ -188,9 +187,11 @@ template void MaybePrintGeneratedAnnotation(Context* context, io::Printer* printer, Descriptor* descriptor, bool immutable, const std::string& suffix = "") { - if (context->options().annotate_code && IsOwnFile(descriptor, immutable)) { + if (IsOwnFile(descriptor, immutable)) { PrintGeneratedAnnotation(printer, '$', - AnnotationFileName(descriptor, suffix)); + context->options().annotate_code + ? AnnotationFileName(descriptor, suffix) + : ""); } } @@ -224,6 +225,10 @@ const char* PrimitiveTypeName(JavaType type); // types. const char* BoxedPrimitiveTypeName(JavaType type); +// Kotlin source does not distinguish between primitives and non-primitives, +// but does use Kotlin-specific qualified types for them. +const char* KotlinTypeName(JavaType type); + // Get the name of the java enum constant representing this type. E.g., // "INT32" for FieldDescriptor::TYPE_INT32. The enum constant's full // name is "com.google.protobuf.WireFormat.FieldType.INT32". @@ -240,15 +245,15 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field); bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field); // Does this message class have descriptor and reflection methods? -inline bool HasDescriptorMethods(const Descriptor* descriptor, +inline bool HasDescriptorMethods(const Descriptor* /* descriptor */, bool enforce_lite) { return !enforce_lite; } -inline bool HasDescriptorMethods(const EnumDescriptor* descriptor, +inline bool HasDescriptorMethods(const EnumDescriptor* /* descriptor */, bool enforce_lite) { return !enforce_lite; } -inline bool HasDescriptorMethods(const FileDescriptor* descriptor, +inline bool HasDescriptorMethods(const FileDescriptor* /* descriptor */, bool enforce_lite) { return !enforce_lite; } @@ -352,9 +357,28 @@ inline bool HasPackedFields(const Descriptor* descriptor) { // them has a required field. Return true if a required field is found. bool HasRequiredFields(const Descriptor* descriptor); -// Whether a .proto file supports field presence test for non-message types. -inline bool SupportFieldPresence(const FileDescriptor* descriptor) { - return descriptor->syntax() != FileDescriptor::SYNTAX_PROTO3; +inline bool IsProto2(const FileDescriptor* descriptor) { + return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO2; +} + +inline bool IsRealOneof(const FieldDescriptor* descriptor) { + return descriptor->containing_oneof() && + !descriptor->containing_oneof()->is_synthetic(); +} + +inline bool HasHazzer(const FieldDescriptor* descriptor) { + return !descriptor->is_repeated() && + (descriptor->message_type() || descriptor->has_optional_keyword() || + IsProto2(descriptor->file()) || IsRealOneof(descriptor)); +} + +inline bool HasHasbit(const FieldDescriptor* descriptor) { + // Note that currently message fields inside oneofs have hasbits. This is + // surprising, as the oneof case should avoid any need for a hasbit. But if + // you change this method to remove hasbits for oneofs, a few tests fail. + // TODO(b/124347790): remove hasbits for oneofs + return !descriptor->is_repeated() && + (descriptor->has_optional_keyword() || IsProto2(descriptor->file())); } // Whether generate classes expose public PARSER instances. @@ -370,6 +394,10 @@ inline bool SupportUnknownEnumValue(const FileDescriptor* descriptor) { return descriptor->syntax() == FileDescriptor::SYNTAX_PROTO3; } +inline bool SupportUnknownEnumValue(const FieldDescriptor* field) { + return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3; +} + // Check whether a message has repeated fields. bool HasRepeatedFields(const Descriptor* descriptor); @@ -398,15 +426,16 @@ inline std::string GeneratedCodeVersionSuffix() { return "V3"; } -void WriteUInt32ToUtf16CharSequence(uint32 number, std::vector* output); +void WriteUInt32ToUtf16CharSequence(uint32_t number, + std::vector* output); inline void WriteIntToUtf16CharSequence(int value, - std::vector* output) { - WriteUInt32ToUtf16CharSequence(static_cast(value), output); + std::vector* output) { + WriteUInt32ToUtf16CharSequence(static_cast(value), output); } // Escape a UTF-16 character so it can be embedded in a Java string literal. -void EscapeUtf16ToString(uint16 code, std::string* output); +void EscapeUtf16ToString(uint16_t code, std::string* output); // Only the lowest two bytes of the return value are used. The lowest byte // is the integer value of a j/c/g/protobuf/FieldType enum. For the other diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.cc new file mode 100644 index 000000000..8d262a018 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.cc @@ -0,0 +1,162 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace java { + +KotlinGenerator::KotlinGenerator() {} +KotlinGenerator::~KotlinGenerator() {} + +uint64_t KotlinGenerator::GetSupportedFeatures() const { + return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL; +} + +bool KotlinGenerator::Generate(const FileDescriptor* file, + const std::string& parameter, + GeneratorContext* context, + std::string* error) const { + // ----------------------------------------------------------------- + // parse generator options + + std::vector > options; + ParseGeneratorParameter(parameter, &options); + Options file_options; + + for (auto& option : options) { + if (option.first == "output_list_file") { + file_options.output_list_file = option.second; + } else if (option.first == "immutable") { + file_options.generate_immutable_code = true; + } else if (option.first == "mutable") { + *error = "Mutable not supported by Kotlin generator"; + return false; + } else if (option.first == "shared") { + file_options.generate_shared_code = true; + } else if (option.first == "lite") { + file_options.enforce_lite = true; + } else if (option.first == "annotate_code") { + file_options.annotate_code = true; + } else if (option.first == "annotation_list_file") { + file_options.annotation_list_file = option.second; + } else { + *error = "Unknown generator option: " + option.first; + return false; + } + } + + // By default we generate immutable code and shared code for immutable API. + if (!file_options.generate_immutable_code && + !file_options.generate_shared_code) { + file_options.generate_immutable_code = true; + file_options.generate_shared_code = true; + } + + std::vector all_files; + std::vector all_annotations; + + std::unique_ptr file_generator; + if (file_options.generate_immutable_code) { + file_generator.reset( + new FileGenerator(file, file_options, /* immutable_api = */ true)); + } + + if (!file_generator->Validate(error)) { + return false; + } + + auto open_file = [context](const std::string& filename) { + return std::unique_ptr(context->Open(filename)); + }; + std::string package_dir = JavaPackageToDir(file_generator->java_package()); + std::string kotlin_filename = package_dir; + kotlin_filename += file_generator->GetKotlinClassname(); + kotlin_filename += ".kt"; + all_files.push_back(kotlin_filename); + std::string info_full_path = kotlin_filename + ".pb.meta"; + if (file_options.annotate_code) { + all_annotations.push_back(info_full_path); + } + + // Generate main kotlin file. + auto output = open_file(kotlin_filename); + GeneratedCodeInfo annotations; + io::AnnotationProtoCollector annotation_collector( + &annotations); + io::Printer printer( + output.get(), '$', + file_options.annotate_code ? &annotation_collector : nullptr); + + file_generator->GenerateKotlinSiblings(package_dir, context, &all_files, + &all_annotations); + + if (file_options.annotate_code) { + auto info_output = open_file(info_full_path); + annotations.SerializeToZeroCopyStream(info_output.get()); + } + + // Generate output list if requested. + if (!file_options.output_list_file.empty()) { + // Generate output list. This is just a simple text file placed in a + // deterministic location which lists the .kt files being generated. + auto srclist_raw_output = open_file(file_options.output_list_file); + io::Printer srclist_printer(srclist_raw_output.get(), '$'); + for (auto& all_file : all_files) { + srclist_printer.Print("$filename$\n", "filename", all_file); + } + } + + if (!file_options.annotation_list_file.empty()) { + // Generate output list. This is just a simple text file placed in a + // deterministic location which lists the .kt files being generated. + auto annotation_list_raw_output = + open_file(file_options.annotation_list_file); + io::Printer annotation_list_printer(annotation_list_raw_output.get(), '$'); + for (auto& all_annotation : all_annotations) { + annotation_list_printer.Print("$filename$\n", "filename", all_annotation); + } + } + + return true; +} + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.h new file mode 100644 index 000000000..66e32b9e0 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_kotlin_generator.h @@ -0,0 +1,72 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Generates Kotlin code for a given .proto file. + +#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace java { + +// CodeGenerator implementation which generates Kotlin code. If you create your +// own protocol compiler binary and you want it to support Kotlin output, you +// can do so by registering an instance of this CodeGenerator with the +// CommandLineInterface in your main() function. +class PROTOC_EXPORT KotlinGenerator : public CodeGenerator { + public: + KotlinGenerator(); + ~KotlinGenerator() override; + + // implements CodeGenerator ---------------------------------------- + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* context, std::string* error) const override; + + uint64_t GetSupportedFeatures() const override; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(KotlinGenerator); +}; + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google + +#include + +#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H__ diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.cc similarity index 86% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.cc index 535374587..d5c76f161 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.cc @@ -69,6 +69,17 @@ std::string TypeName(const FieldDescriptor* field, } } +std::string KotlinTypeName(const FieldDescriptor* field, + ClassNameResolver* name_resolver) { + if (GetJavaType(field) == JAVATYPE_MESSAGE) { + return name_resolver->GetImmutableClassName(field->message_type()); + } else if (GetJavaType(field) == JAVATYPE_ENUM) { + return name_resolver->GetImmutableClassName(field->enum_type()); + } else { + return KotlinTypeName(GetJavaType(field)); + } +} + std::string WireType(const FieldDescriptor* field) { return "com.google.protobuf.WireFormat.FieldType." + std::string(FieldTypeName(field->type())); @@ -91,6 +102,8 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["key_type"] = TypeName(key, name_resolver, false); std::string boxed_key_type = TypeName(key, name_resolver, true); (*variables)["boxed_key_type"] = boxed_key_type; + (*variables)["kt_key_type"] = KotlinTypeName(key, name_resolver); + (*variables)["kt_value_type"] = KotlinTypeName(value, name_resolver); // Used for calling the serialization function. (*variables)["short_key_type"] = boxed_key_type.substr(boxed_key_type.rfind('.') + 1); @@ -98,11 +111,13 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver); (*variables)["key_null_check"] = IsReferenceType(keyJavaType) - ? "if (key == null) { throw new java.lang.NullPointerException(); }" + ? "if (key == null) { throw new NullPointerException(\"map key\"); }" : ""; (*variables)["value_null_check"] = - IsReferenceType(valueJavaType) - ? "if (value == null) { throw new java.lang.NullPointerException(); }" + valueJavaType != JAVATYPE_ENUM && IsReferenceType(valueJavaType) + ? "if (value == null) {\n" + " throw new NullPointerException(\"map value\");\n" + "}\n" : ""; if (valueJavaType == JAVATYPE_ENUM) { // We store enums as Integers internally. @@ -136,15 +151,13 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["on_changed"] = "onChanged();"; - // For repeated fields, one bit is used for whether the array is immutable - // in the parsing constructor. - (*variables)["get_mutable_bit_parser"] = - GenerateGetBitMutableLocal(builderBitIndex); - (*variables)["set_mutable_bit_parser"] = - GenerateSetBitMutableLocal(builderBitIndex); - (*variables)["default_entry"] = (*variables)["capitalized_name"] + "DefaultEntryHolder.defaultEntry"; (*variables)["map_field_parameter"] = (*variables)["default_entry"]; @@ -417,6 +430,7 @@ void ImmutableMapFieldGenerator::GenerateBuilderMembers( " $key_type$ key,\n" " $value_type$ value) {\n" " $key_null_check$\n" + " $value_null_check$\n" " internalGetMutable$capitalized_name$().getMutableMap()\n" " .put(key, value);\n" " return this;\n" @@ -483,6 +497,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( printer->Print( variables_, "$deprecation$\n" + "@java.lang.Override\n" "public boolean ${$contains$capitalized_name$$}$(\n" " $key_type$ key) {\n" " $key_null_check$\n" @@ -494,6 +509,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( "/**\n" " * Use {@link #get$capitalized_name$Map()} instead.\n" " */\n" + "@java.lang.Override\n" "@java.lang.Deprecated\n" "public java.util.Map<$boxed_key_type$, $value_enum_type$>\n" "${$get$capitalized_name$$}$() {\n" @@ -502,6 +518,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( printer->Annotate("{", "}", descriptor_); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$\n" "public java.util.Map<$boxed_key_type$, $value_enum_type$>\n" "${$get$capitalized_name$Map$}$() {\n" @@ -512,6 +529,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_enum_type$ ${$get$capitalized_name$OrDefault$}$(\n" " $key_type$ key,\n" @@ -527,6 +545,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_enum_type$ ${$get$capitalized_name$OrThrow$}$(\n" " $key_type$ key) {\n" @@ -545,6 +564,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( "/**\n" " * Use {@link #get$capitalized_name$ValueMap()} instead.\n" " */\n" + "@java.lang.Override\n" "@java.lang.Deprecated\n" "public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n" "${$get$capitalized_name$Value$}$() {\n" @@ -554,6 +574,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public java.util.Map<$boxed_key_type$, $boxed_value_type$>\n" "${$get$capitalized_name$ValueMap$}$() {\n" @@ -563,6 +584,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_type$ ${$get$capitalized_name$ValueOrDefault$}$(\n" " $key_type$ key,\n" @@ -576,6 +598,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_type$ ${$get$capitalized_name$ValueOrThrow$}$(\n" " $key_type$ key) {\n" @@ -594,6 +617,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( "/**\n" " * Use {@link #get$capitalized_name$Map()} instead.\n" " */\n" + "@java.lang.Override\n" "@java.lang.Deprecated\n" "public java.util.Map<$type_parameters$> " "${$get$capitalized_name$$}$() {\n" @@ -602,6 +626,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( printer->Annotate("{", "}", descriptor_); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$\n" "public java.util.Map<$type_parameters$> " "${$get$capitalized_name$Map$}$() {\n" @@ -611,6 +636,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_type$ ${$get$capitalized_name$OrDefault$}$(\n" " $key_type$ key,\n" @@ -623,6 +649,7 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( printer->Annotate("{", "}", descriptor_); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$\n" "public $value_type$ ${$get$capitalized_name$OrThrow$}$(\n" " $key_type$ key) {\n" @@ -638,6 +665,88 @@ void ImmutableMapFieldGenerator::GenerateMapGetters( } } +void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " @JvmName(\"get$kt_capitalized_name$Map\")\n" + " get() = com.google.protobuf.kotlin.DslMap(\n" + " $kt_dsl_builder$.${$get$capitalized_name$Map$}$()\n" + " )\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@JvmName(\"put$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .put(key: $kt_key_type$, value: $kt_value_type$) {\n" + " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"set$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .set(key: $kt_key_type$, value: $kt_value_type$) {\n" + " put(key, value)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"remove$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .remove(key: $kt_key_type$) {\n" + " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"putAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) " + "{\n" + " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + " }\n"); +} + void ImmutableMapFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // Nothing to initialize. @@ -668,27 +777,19 @@ void ImmutableMapFieldGenerator::GenerateBuildingCode( "result.$name$_.makeImmutable();\n"); } -void ImmutableMapFieldGenerator::GenerateParsingCode( +void ImmutableMapFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { - printer->Print(variables_, - "if (!$get_mutable_bit_parser$) {\n" - " $name$_ = com.google.protobuf.MapField.newMapField(\n" - " $map_field_parameter$);\n" - " $set_mutable_bit_parser$;\n" - "}\n"); if (!SupportUnknownEnumValue(descriptor_->file()) && GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { printer->Print( variables_, "com.google.protobuf.ByteString bytes = input.readBytes();\n" "com.google.protobuf.MapEntry<$type_parameters$>\n" - "$name$__ = $default_entry$.getParserForType().parseFrom(bytes);\n"); - printer->Print( - variables_, + "$name$__ = $default_entry$.getParserForType().parseFrom(bytes);\n" "if ($value_enum_type$.forNumber($name$__.getValue()) == null) {\n" - " unknownFields.mergeLengthDelimitedField($number$, bytes);\n" + " mergeUnknownLengthDelimitedField($number$, bytes);\n" "} else {\n" - " $name$_.getMutableMap().put(\n" + " internalGetMutable$capitalized_name$().getMutableMap().put(\n" " $name$__.getKey(), $name$__.getValue());\n" "}\n"); } else { @@ -697,16 +798,11 @@ void ImmutableMapFieldGenerator::GenerateParsingCode( "com.google.protobuf.MapEntry<$type_parameters$>\n" "$name$__ = input.readMessage(\n" " $default_entry$.getParserForType(), extensionRegistry);\n" - "$name$_.getMutableMap().put(\n" + "internalGetMutable$capitalized_name$().getMutableMap().put(\n" " $name$__.getKey(), $name$__.getValue());\n"); } } -void ImmutableMapFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - // Nothing to do here. -} - void ImmutableMapFieldGenerator::GenerateSerializationCode( io::Printer* printer) const { printer->Print(variables_, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.h similarity index 69% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.h index 2ff1f7673..7262edf22 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field.h @@ -43,27 +43,28 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator { explicit ImmutableMapFieldGenerator(const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - ~ImmutableMapFieldGenerator(); + ~ImmutableMapFieldGenerator() override; // implements ImmutableFieldGenerator --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.cc similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.cc index 8236f3a45..e71116866 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.cc @@ -30,6 +30,8 @@ #include +#include + #include #include #include @@ -69,6 +71,17 @@ std::string TypeName(const FieldDescriptor* field, } } +std::string KotlinTypeName(const FieldDescriptor* field, + ClassNameResolver* name_resolver) { + if (GetJavaType(field) == JAVATYPE_MESSAGE) { + return name_resolver->GetImmutableClassName(field->message_type()); + } else if (GetJavaType(field) == JAVATYPE_ENUM) { + return name_resolver->GetImmutableClassName(field->enum_type()); + } else { + return KotlinTypeName(GetJavaType(field)); + } +} + std::string WireType(const FieldDescriptor* field) { return "com.google.protobuf.WireFormat.FieldType." + std::string(FieldTypeName(field->type())); @@ -90,14 +103,20 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["key_type"] = TypeName(key, name_resolver, false); (*variables)["boxed_key_type"] = TypeName(key, name_resolver, true); + (*variables)["kt_key_type"] = KotlinTypeName(key, name_resolver); + (*variables)["kt_value_type"] = KotlinTypeName(value, name_resolver); (*variables)["key_wire_type"] = WireType(key); (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver); // We use `x.getClass()` as a null check because it generates less bytecode // than an `if (x == null) { throw ... }` statement. (*variables)["key_null_check"] = - IsReferenceType(keyJavaType) ? "key.getClass();" : ""; + IsReferenceType(keyJavaType) + ? "java.lang.Class keyClass = key.getClass();" + : ""; (*variables)["value_null_check"] = - IsReferenceType(valueJavaType) ? "value.getClass();" : ""; + IsReferenceType(valueJavaType) + ? "java.lang.Class valueClass = value.getClass();" + : ""; if (GetJavaType(value) == JAVATYPE_ENUM) { // We store enums as Integers internally. @@ -131,6 +150,11 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["default_entry"] = (*variables)["capitalized_name"] + "DefaultEntryHolder.defaultEntry"; @@ -501,14 +525,14 @@ void ImmutableMapFieldLiteGenerator::GenerateMembers( } void ImmutableMapFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); printer->Print(variables_, "\"$name$_\",\n" "$default_entry$,\n"); - if (SupportFieldPresence(descriptor_->file()) && + if (!SupportUnknownEnumValue(descriptor_) && GetJavaType(ValueField(descriptor_)) == JAVATYPE_ENUM) { PrintEnumVerifierLogic(printer, ValueField(descriptor_), variables_, /*var_name=*/"$value_enum_type$", @@ -788,6 +812,88 @@ void ImmutableMapFieldLiteGenerator::GenerateBuilderMembers( } } +void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " @JvmName(\"get$kt_capitalized_name$Map\")\n" + " get() = com.google.protobuf.kotlin.DslMap(\n" + " $kt_dsl_builder$.${$get$capitalized_name$Map$}$()\n" + " )\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@JvmName(\"put$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .put(key: $kt_key_type$, value: $kt_value_type$) {\n" + " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"set$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .set(key: $kt_key_type$, value: $kt_value_type$) {\n" + " put(key, value)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"remove$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .remove(key: $kt_key_type$) {\n" + " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"putAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) " + "{\n" + " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " .clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + " }\n"); +} + void ImmutableMapFieldLiteGenerator::GenerateInitializationCode( io::Printer* printer) const { // Nothing to initialize. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.h similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.h index 49cbf6cca..da046b219 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_map_field_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_map_field_lite.h @@ -31,6 +31,8 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_LITE_H__ +#include + #include namespace google { @@ -43,18 +45,19 @@ class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator { explicit ImmutableMapFieldLiteGenerator(const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutableMapFieldLiteGenerator(); + ~ImmutableMapFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.cc similarity index 77% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.cc index dbf62e58f..d8c09ae44 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -51,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -75,7 +77,13 @@ std::string MapValueImmutableClassdName(const Descriptor* descriptor, // =================================================================== MessageGenerator::MessageGenerator(const Descriptor* descriptor) - : descriptor_(descriptor) {} + : descriptor_(descriptor) { + for (int i = 0; i < descriptor_->field_count(); i++) { + if (IsRealOneof(descriptor_->field(i))) { + oneofs_.insert(descriptor_->field(i)->containing_oneof()); + } + } +} MessageGenerator::~MessageGenerator() {} @@ -204,6 +212,11 @@ void ImmutableMessageGenerator::GenerateFieldAccessorTable( " com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n" " internal_$identifier$_fieldAccessorTable;\n"); + // The following bytecode_estimate calculation logic must stay in sync with + // the similar logic in the GenerateFieldAccessorTableInitializer method below + // to make sure that the generated static final fields are initialized in the + // static initialization block directly. + // // 6 bytes per field and oneof *bytecode_estimate += 10 + 6 * descriptor_->field_count() + 6 * descriptor_->oneof_decl_count(); @@ -219,12 +232,17 @@ int ImmutableMessageGenerator::GenerateFieldAccessorTableInitializer( " new java.lang.String[] { ", "identifier", UniqueFileScopeIdentifier(descriptor_), "ver", GeneratedCodeVersionSuffix()); + // All the bytecode_estimate calculation logic in this method must stay in + // sync with the similar logic in the GenerateFieldAccessorTable method + // above. See the corresponding comment in GenerateFieldAccessorTable for + // details. for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); bytecode_estimate += 6; printer->Print("\"$field_name$\", ", "field_name", info->capitalized_name); } + // We reproduce synthetic oneofs here since proto reflection needs these. for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { const OneofDescriptor* oneof = descriptor_->oneof_decl(i); const OneofGeneratorInfo* info = context_->GetOneofGeneratorInfo(oneof); @@ -269,15 +287,13 @@ void ImmutableMessageGenerator::GenerateInterface(io::Printer* printer) { field_generators_.get(descriptor_->field(i)) .GenerateInterfaceMembers(printer); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (auto oneof : oneofs_) { printer->Print( "\n" "public $classname$.$oneof_capitalized_name$Case " "get$oneof_capitalized_name$Case();\n", "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name, - "classname", + context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "classname", context_->GetNameResolver()->GetImmutableClassName(descriptor_)); } printer->Outdent(); @@ -291,7 +307,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { bool is_own_file = IsOwnFile(descriptor_, /* immutable = */ true); std::map variables; - variables["static"] = is_own_file ? " " : " static "; + variables["static"] = is_own_file ? "" : "static "; variables["classname"] = descriptor_->name(); variables["extra_interfaces"] = ExtraMessageInterfaces(descriptor_); variables["ver"] = GeneratedCodeVersionSuffix(); @@ -301,7 +317,6 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { WriteMessageDocComment(printer, descriptor_); MaybePrintGeneratedAnnotation(context_, printer, descriptor_, /* immutable = */ true); - // The builder_type stores the super type name of the nested Builder class. std::string builder_type; if (descriptor_->extension_range_count() > 0) { @@ -330,7 +345,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { " $classname$OrBuilder {\n"); builder_type = strings::Substitute("com.google.protobuf.GeneratedMessage$0.Builder", - GeneratedCodeVersionSuffix()); + GeneratedCodeVersionSuffix()); } printer->Print("private static final long serialVersionUID = 0L;\n"); @@ -362,6 +377,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "}\n" "\n"); + // TODO(b/248149118): Remove this superfluous override. printer->Print( "@java.lang.Override\n" "public final com.google.protobuf.UnknownFieldSet\n" @@ -369,10 +385,6 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { " return this.unknownFields;\n" "}\n"); - if (context_->HasGeneratedMethods(descriptor_)) { - GenerateParsingConstructor(printer); - } - GenerateDescriptorMethods(printer); // Nested types @@ -403,13 +415,11 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { // oneof std::map vars; - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - vars["oneof_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name; + for (auto oneof : oneofs_) { + vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name; vars["oneof_capitalized_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name; - vars["oneof_index"] = StrCat(descriptor_->oneof_decl(i)->index()); + context_->GetOneofGeneratorInfo(oneof)->capitalized_name; + vars["oneof_index"] = StrCat((oneof)->index()); // oneofCase_ and oneof_ printer->Print(vars, "private int $oneof_name$Case_ = 0;\n" @@ -423,8 +433,8 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { " implements com.google.protobuf.Internal.EnumLite,\n" " com.google.protobuf.AbstractMessage.InternalOneOfEnum {\n"); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print( "$deprecation$$field_name$($field_number$),\n", "deprecation", field->options().deprecated() ? "@java.lang.Deprecated " : "", @@ -452,8 +462,8 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { "\n" "public static $oneof_capitalized_name$Case forNumber(int value) {\n" " switch (value) {\n"); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print(" case $field_number$: return $field_name$;\n", "field_number", StrCat(field->number()), "field_name", ToUpper(field->name())); @@ -488,6 +498,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { printer->Print("public static final int $constant_name$ = $number$;\n", "constant_name", FieldConstantName(descriptor_->field(i)), "number", StrCat(descriptor_->field(i)->number())); + printer->Annotate("constant_name", descriptor_->field(i)); field_generators_.get(descriptor_->field(i)).GenerateMembers(printer); printer->Print("\n"); } @@ -567,6 +578,7 @@ void ImmutableMessageGenerator::GenerateMessageSerializationMethods( SortFieldsByNumber(descriptor_)); std::vector sorted_extensions; + sorted_extensions.reserve(descriptor_->extension_range_count()); for (int i = 0; i < descriptor_->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor_->extension_range(i)); } @@ -621,9 +633,9 @@ void ImmutableMessageGenerator::GenerateMessageSerializationMethods( } if (descriptor_->options().message_set_wire_format()) { - printer->Print("unknownFields.writeAsMessageSetTo(output);\n"); + printer->Print("getUnknownFields().writeAsMessageSetTo(output);\n"); } else { - printer->Print("unknownFields.writeTo(output);\n"); + printer->Print("getUnknownFields().writeTo(output);\n"); } printer->Outdent(); @@ -652,9 +664,10 @@ void ImmutableMessageGenerator::GenerateMessageSerializationMethods( } if (descriptor_->options().message_set_wire_format()) { - printer->Print("size += unknownFields.getSerializedSizeAsMessageSet();\n"); + printer->Print( + "size += getUnknownFields().getSerializedSizeAsMessageSet();\n"); } else { - printer->Print("size += unknownFields.getSerializedSize();\n"); + printer->Print("size += getUnknownFields().getSerializedSize();\n"); } printer->Print( @@ -912,19 +925,8 @@ void ImmutableMessageGenerator::GenerateIsInitialized(io::Printer* printer) { "name", info->capitalized_name); break; case FieldDescriptor::LABEL_OPTIONAL: - if (!SupportFieldPresence(descriptor_->file()) && - field->containing_oneof() != NULL) { - const OneofDescriptor* oneof = field->containing_oneof(); - const OneofGeneratorInfo* oneof_info = - context_->GetOneofGeneratorInfo(oneof); - printer->Print("if ($oneof_name$Case_ == $field_number$) {\n", - "oneof_name", oneof_info->name, "field_number", - StrCat(field->number())); - } else { - printer->Print("if (has$name$()) {\n", "name", - info->capitalized_name); - } printer->Print( + "if (has$name$()) {\n" " if (!get$name$().isInitialized()) {\n" " memoizedIsInitialized = 0;\n" " return false;\n" @@ -987,11 +989,10 @@ bool CheckHasBitsForEqualsAndHashCode(const FieldDescriptor* field) { if (field->is_repeated()) { return false; } - if (SupportFieldPresence(field->file())) { + if (HasHasbit(field)) { return true; } - return GetJavaType(field) == JAVATYPE_MESSAGE && - field->containing_oneof() == NULL; + return GetJavaType(field) == JAVATYPE_MESSAGE && !IsRealOneof(field); } } // namespace @@ -1015,7 +1016,7 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); - if (field->containing_oneof() == NULL) { + if (!IsRealOneof(field)) { const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); bool check_has_bits = CheckHasBitsForEqualsAndHashCode(field); if (check_has_bits) { @@ -1034,19 +1035,17 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( } // Compare oneofs. - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (auto oneof : oneofs_) { printer->Print( "if (!get$oneof_capitalized_name$Case().equals(" "other.get$oneof_capitalized_name$Case())) return false;\n", "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name); - printer->Print( - "switch ($oneof_name$Case_) {\n", "oneof_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name); + context_->GetOneofGeneratorInfo(oneof)->capitalized_name); + printer->Print("switch ($oneof_name$Case_) {\n", "oneof_name", + context_->GetOneofGeneratorInfo(oneof)->name); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print("case $field_number$:\n", "field_number", StrCat(field->number())); printer->Indent(); @@ -1065,7 +1064,8 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( // false for non-canonical ordering when running in LITE_RUNTIME but it's // the best we can do. printer->Print( - "if (!unknownFields.equals(other.unknownFields)) return false;\n"); + "if (!getUnknownFields().equals(other.getUnknownFields())) return " + "false;\n"); if (descriptor_->extension_range_count() > 0) { printer->Print( "if (!getExtensionFields().equals(other.getExtensionFields()))\n" @@ -1099,7 +1099,7 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( // hashCode non-oneofs. for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); - if (field->containing_oneof() == NULL) { + if (!IsRealOneof(field)) { const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); bool check_has_bits = CheckHasBitsForEqualsAndHashCode(field); if (check_has_bits) { @@ -1115,13 +1115,12 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( } // hashCode oneofs. - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - printer->Print( - "switch ($oneof_name$Case_) {\n", "oneof_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name); + for (auto oneof : oneofs_) { + printer->Print("switch ($oneof_name$Case_) {\n", "oneof_name", + context_->GetOneofGeneratorInfo(oneof)->name); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print("case $field_number$:\n", "field_number", StrCat(field->number())); printer->Indent(); @@ -1140,7 +1139,7 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( printer->Print("hash = hashFields(hash, getExtensionFields());\n"); } - printer->Print("hash = (29 * hash) + unknownFields.hashCode();\n"); + printer->Print("hash = (29 * hash) + getUnknownFields().hashCode();\n"); printer->Print( "memoizedHashCode = hash;\n" "return hash;\n"); @@ -1166,207 +1165,339 @@ void ImmutableMessageGenerator::GenerateExtensionRegistrationCode( } // =================================================================== -void ImmutableMessageGenerator::GenerateParsingConstructor( - io::Printer* printer) { - std::unique_ptr sorted_fields( - SortFieldsByNumber(descriptor_)); - +void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) { printer->Print( - "private $classname$(\n" - " com.google.protobuf.CodedInputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n", + "$visibility$ static final com.google.protobuf.Parser<$classname$>\n" + " PARSER = new com.google.protobuf.AbstractParser<$classname$>() {\n" + " @java.lang.Override\n" + " public $classname$ parsePartialFrom(\n" + " com.google.protobuf.CodedInputStream input,\n" + " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" + " throws com.google.protobuf.InvalidProtocolBufferException {\n" + " Builder builder = newBuilder();\n" + " try {\n" + " builder.mergeFrom(input, extensionRegistry);\n" + " } catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" + " throw e.setUnfinishedMessage(builder.buildPartial());\n" + " } catch (com.google.protobuf.UninitializedMessageException e) {\n" + " throw " + "e.asInvalidProtocolBufferException().setUnfinishedMessage(builder." + "buildPartial());\n" + " } catch (java.io.IOException e) {\n" + " throw new com.google.protobuf.InvalidProtocolBufferException(e)\n" + " .setUnfinishedMessage(builder.buildPartial());\n" + " }\n" + " return builder.buildPartial();\n" + " }\n" + "};\n" + "\n" + "public static com.google.protobuf.Parser<$classname$> parser() {\n" + " return PARSER;\n" + "}\n" + "\n" + "@java.lang.Override\n" + "public com.google.protobuf.Parser<$classname$> getParserForType() {\n" + " return PARSER;\n" + "}\n" + "\n", + "visibility", + ExposePublicParser(descriptor_->file()) ? "@java.lang.Deprecated public" + : "private", "classname", descriptor_->name()); - printer->Indent(); - - // Initialize all fields to default. - printer->Print( - "this();\n" - "if (extensionRegistry == null) {\n" - " throw new java.lang.NullPointerException();\n" - "}\n"); +} - // Use builder bits to track mutable repeated fields. - int totalBuilderBits = 0; +// =================================================================== +void ImmutableMessageGenerator::GenerateInitializers(io::Printer* printer) { for (int i = 0; i < descriptor_->field_count(); i++) { - const ImmutableFieldGenerator& field = - field_generators_.get(descriptor_->field(i)); - totalBuilderBits += field.GetNumBitsForBuilder(); - } - int totalBuilderInts = (totalBuilderBits + 31) / 32; - for (int i = 0; i < totalBuilderInts; i++) { - printer->Print("int mutable_$bit_field_name$ = 0;\n", "bit_field_name", - GetBitFieldName(i)); + if (!IsRealOneof(descriptor_->field(i))) { + field_generators_.get(descriptor_->field(i)) + .GenerateInitializationCode(printer); + } } +} +// =================================================================== +void ImmutableMessageGenerator::GenerateMutableCopy(io::Printer* printer) { printer->Print( - "com.google.protobuf.UnknownFieldSet.Builder unknownFields =\n" - " com.google.protobuf.UnknownFieldSet.newBuilder();\n"); - - printer->Print("try {\n"); - printer->Indent(); + "protected com.google.protobuf.MutableMessage\n" + " internalMutableDefault() {\n" + " return MutableDefaultLoader.get();\n" + "}\n" + "\n" + "private static final class MutableDefaultLoader {\n" + " private static final java.lang.Object defaultOrRuntimeException;\n" + " static {\n" + " java.lang.Object local;\n" + " try {\n" + " local = internalMutableDefault(\"$mutable_name$\");\n" + " } catch (java.lang.RuntimeException e) {\n" + " local = e;\n" + " }\n" + " defaultOrRuntimeException = local;\n" + " }\n" + "\n" + " private MutableDefaultLoader() {}\n" + "\n" + " public static com.google.protobuf.MutableMessage get() {\n" + " if (defaultOrRuntimeException\n" + " instanceof java.lang.RuntimeException) {\n" + " throw (java.lang.RuntimeException) defaultOrRuntimeException;\n" + " }\n" + " return\n" + " (com.google.protobuf.MutableMessage) " + "defaultOrRuntimeException;\n" + " }\n" + "}\n", + "mutable_name", name_resolver_->GetJavaMutableClassName(descriptor_)); +} +void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const { printer->Print( - "boolean done = false;\n" - "while (!done) {\n"); - printer->Indent(); - + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "@com.google.protobuf.kotlin.ProtoDslMarker\n"); printer->Print( - "int tag = input.readTag();\n" - "switch (tag) {\n"); - printer->Indent(); + "public class Dsl private constructor(\n" + " private val _builder: $message$.Builder\n" + ") {\n" + " public companion object {\n" + " @kotlin.jvm.JvmSynthetic\n" + " @kotlin.PublishedApi\n" + " internal fun _create(builder: $message$.Builder): Dsl = " + "Dsl(builder)\n" + " }\n" + "\n" + " @kotlin.jvm.JvmSynthetic\n" + " @kotlin.PublishedApi\n" + " internal fun _build(): $message$ = _builder.build()\n", + "message", name_resolver_->GetClassName(descriptor_, true)); - printer->Print( - "case 0:\n" // zero signals EOF / limit reached - " done = true;\n" - " break;\n"); + printer->Indent(); for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = sorted_fields[i]; - uint32 tag = WireFormatLite::MakeTag( - field->number(), WireFormat::WireTypeForFieldType(field->type())); + printer->Print("\n"); + field_generators_.get(descriptor_->field(i)) + .GenerateKotlinDslMembers(printer); + } - printer->Print("case $tag$: {\n", "tag", - StrCat(static_cast(tag))); - printer->Indent(); + for (auto oneof : oneofs_) { + printer->Print( + "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" + " @JvmName(\"get$oneof_capitalized_name$Case\")\n" + " get() = _builder.get$oneof_capitalized_name$Case()\n\n" + "public fun clear$oneof_capitalized_name$() {\n" + " _builder.clear$oneof_capitalized_name$()\n" + "}\n", + "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name, + "oneof_capitalized_name", + context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "message", + name_resolver_->GetClassName(descriptor_, true)); + } - field_generators_.get(field).GenerateParsingCode(printer); + if (descriptor_->extension_range_count() > 0) { + GenerateKotlinExtensions(printer); + } - printer->Outdent(); - printer->Print( - " break;\n" - "}\n"); + printer->Outdent(); + printer->Print("}\n"); +} - if (field->is_packable()) { - // To make packed = true wire compatible, we generate parsing code from a - // packed version of this field regardless of field->options().packed(). - uint32 packed_tag = WireFormatLite::MakeTag( - field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - printer->Print("case $tag$: {\n", "tag", - StrCat(static_cast(packed_tag))); - printer->Indent(); +void ImmutableMessageGenerator::GenerateKotlinMembers( + io::Printer* printer) const { + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " + "$message$ " + "=\n" + " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " + "}._build()\n", + "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_), + "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_), + "message", name_resolver_->GetClassName(descriptor_, true)); + + printer->Print("public object $name$Kt {\n", "name", descriptor_->name()); + printer->Indent(); + GenerateKotlinDsl(printer); + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + if (IsMapEntry(descriptor_->nested_type(i))) continue; + ImmutableMessageGenerator(descriptor_->nested_type(i), context_) + .GenerateKotlinMembers(printer); + } + printer->Outdent(); + printer->Print("}\n"); +} - field_generators_.get(field).GenerateParsingCodeFromPacked(printer); +void ImmutableMessageGenerator::GenerateTopLevelKotlinMembers( + io::Printer* printer) const { + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " + "$message$ =\n" + " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " + "}._build()\n", + "message", name_resolver_->GetClassName(descriptor_, true), "message_kt", + name_resolver_->GetKotlinExtensionsClassName(descriptor_)); - printer->Outdent(); - printer->Print( - " break;\n" - "}\n"); - } + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + if (IsMapEntry(descriptor_->nested_type(i))) continue; + ImmutableMessageGenerator(descriptor_->nested_type(i), context_) + .GenerateTopLevelKotlinMembers(printer); } +} + +void ImmutableMessageGenerator::GenerateKotlinExtensions( + io::Printer* printer) const { + std::string message_name = name_resolver_->GetClassName(descriptor_, true); printer->Print( - "default: {\n" - " if (!parseUnknownField(\n" - " input, unknownFields, extensionRegistry, tag)) {\n" - " done = true;\n" // it's an endgroup tag + "@Suppress(\"UNCHECKED_CAST\")\n" + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun get(extension: " + "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" + " return if (extension.isRepeated) {\n" + " get(extension as com.google.protobuf.ExtensionLite<$message$, " + "List<*>>) as T\n" + " } else {\n" + " _builder.getExtension(extension)\n" " }\n" - " break;\n" - "}\n"); + "}\n\n", + "message", message_name); - printer->Outdent(); - printer->Outdent(); printer->Print( - " }\n" // switch (tag) - "}\n"); // while (!done) + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" + "public operator fun get(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, List>\n" + "): com.google.protobuf.kotlin.ExtensionList {\n" + " return com.google.protobuf.kotlin.ExtensionList(extension, " + "_builder.getExtension(extension))\n" + "}\n\n", + "message", message_name); - printer->Outdent(); printer->Print( - "} catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" - " throw e.setUnfinishedMessage(this);\n" - "} catch (java.io.IOException e) {\n" - " throw new com.google.protobuf.InvalidProtocolBufferException(\n" - " e).setUnfinishedMessage(this);\n" - "} finally {\n"); - printer->Indent(); + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun contains(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>): " + "Boolean {\n" + " return _builder.hasExtension(extension)\n" + "}\n\n", + "message", message_name); - // Make repeated field list immutable. - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = sorted_fields[i]; - field_generators_.get(field).GenerateParsingDoneCode(printer); - } + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public fun clear(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>) " + "{\n" + " _builder.clearExtension(extension)\n" + "}\n\n", + "message", message_name); - // Make unknown fields immutable. - printer->Print("this.unknownFields = unknownFields.build();\n"); + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.PublishedApi\n" + "internal fun setExtension(extension: " + "com.google.protobuf.ExtensionLite<$message$, T>, " + "value: T) {\n" + " _builder.setExtension(extension, value)\n" + "}\n\n", + "message", message_name); - // Make extensions immutable. - printer->Print("makeExtensionsImmutable();\n"); + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun > set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" + " value: T\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); - printer->Outdent(); - printer->Outdent(); printer->Print( - " }\n" // finally - "}\n"); -} + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, " + "com.google.protobuf.ByteString>,\n" + " value: com.google.protobuf.ByteString\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); -// =================================================================== -void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) { printer->Print( - "$visibility$ static final com.google.protobuf.Parser<$classname$>\n" - " PARSER = new com.google.protobuf.AbstractParser<$classname$>() {\n", - "visibility", - ExposePublicParser(descriptor_->file()) ? "@java.lang.Deprecated public" - : "private", - "classname", descriptor_->name()); - printer->Indent(); + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" + " value: T\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); + printer->Print( - "@java.lang.Override\n" - "public $classname$ parsePartialFrom(\n" - " com.google.protobuf.CodedInputStream input,\n" - " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" - " throws com.google.protobuf.InvalidProtocolBufferException {\n", - "classname", descriptor_->name()); - if (context_->HasGeneratedMethods(descriptor_)) { - printer->Print(" return new $classname$(input, extensionRegistry);\n", - "classname", descriptor_->name()); - } else { - // When parsing constructor isn't generated, use builder to parse - // messages. Note, will fallback to use reflection based mergeFieldFrom() - // in AbstractMessage.Builder. - printer->Indent(); - printer->Print( - "Builder builder = newBuilder();\n" - "try {\n" - " builder.mergeFrom(input, extensionRegistry);\n" - "} catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" - " throw e.setUnfinishedMessage(builder.buildPartial());\n" - "} catch (java.io.IOException e) {\n" - " throw new com.google.protobuf.InvalidProtocolBufferException(\n" - " e.getMessage()).setUnfinishedMessage(\n" - " builder.buildPartial());\n" - "}\n" - "return builder.buildPartial();\n"); - printer->Outdent(); - } - printer->Print("}\n"); - printer->Outdent(); + "@kotlin.jvm.JvmSynthetic\n" + "public fun com.google.protobuf.kotlin.ExtensionList.add(value: E) {\n" + " _builder.addExtension(this.extension, value)\n" + "}\n\n", + "message", message_name); + printer->Print( - "};\n" - "\n"); + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun " + "com.google.protobuf.kotlin.ExtensionList.plusAssign" + "(value: E) {\n" + " add(value)\n" + "}\n\n", + "message", message_name); printer->Print( - "public static com.google.protobuf.Parser<$classname$> parser() {\n" - " return PARSER;\n" - "}\n" - "\n" - "@java.lang.Override\n" - "public com.google.protobuf.Parser<$classname$> getParserForType() {\n" - " return PARSER;\n" - "}\n" - "\n", - "classname", descriptor_->name()); -} + "@kotlin.jvm.JvmSynthetic\n" + "public fun com.google.protobuf.kotlin.ExtensionList.addAll(values: Iterable) {\n" + " for (value in values) {\n" + " add(value)\n" + " }\n" + "}\n\n", + "message", message_name); -// =================================================================== -void ImmutableMessageGenerator::GenerateInitializers(io::Printer* printer) { - for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { - field_generators_.get(descriptor_->field(i)) - .GenerateInitializationCode(printer); - } - } -} + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun " + "com.google.protobuf.kotlin.ExtensionList.plusAssign(values: " + "Iterable) {\n" + " addAll(values)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun com.google.protobuf.kotlin.ExtensionList.set(index: Int, value: " + "E) {\n" + " _builder.setExtension(this.extension, index, value)\n" + "}\n\n", + "message", message_name); + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline fun com.google.protobuf.kotlin.ExtensionList<*, " + "$message$>.clear() {\n" + " clear(extension)\n" + "}\n\n", + "message", message_name); +} void ImmutableMessageGenerator::GenerateAnyMethods(io::Printer* printer) { printer->Print( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.h similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.h index de2f359a4..cafc91e68 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message.h @@ -85,9 +85,13 @@ class MessageGenerator { // Generate code to register all contained extensions with an // ExtensionRegistry. virtual void GenerateExtensionRegistrationCode(io::Printer* printer) = 0; + virtual void GenerateKotlinDsl(io::Printer* printer) const = 0; + virtual void GenerateKotlinMembers(io::Printer* printer) const = 0; + virtual void GenerateTopLevelKotlinMembers(io::Printer* printer) const = 0; protected: const Descriptor* descriptor_; + std::set oneofs_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); @@ -98,14 +102,17 @@ class ImmutableMessageGenerator : public MessageGenerator { ImmutableMessageGenerator(const Descriptor* descriptor, Context* context); virtual ~ImmutableMessageGenerator(); - virtual void Generate(io::Printer* printer); - virtual void GenerateInterface(io::Printer* printer); - virtual void GenerateExtensionRegistrationCode(io::Printer* printer); - virtual void GenerateStaticVariables(io::Printer* printer, - int* bytecode_estimate); + void Generate(io::Printer* printer) override; + void GenerateInterface(io::Printer* printer) override; + void GenerateExtensionRegistrationCode(io::Printer* printer) override; + void GenerateStaticVariables(io::Printer* printer, + int* bytecode_estimate) override; // Returns an estimate of the number of bytes the printed code will compile to - virtual int GenerateStaticVariableInitializers(io::Printer* printer); + int GenerateStaticVariableInitializers(io::Printer* printer) override; + void GenerateKotlinDsl(io::Printer* printer) const override; + void GenerateKotlinMembers(io::Printer* printer) const override; + void GenerateTopLevelKotlinMembers(io::Printer* printer) const override; private: void GenerateFieldAccessorTable(io::Printer* printer, int* bytecode_estimate); @@ -127,6 +134,8 @@ class ImmutableMessageGenerator : public MessageGenerator { void GenerateEqualsAndHashCode(io::Printer* printer); void GenerateParser(io::Printer* printer); void GenerateParsingConstructor(io::Printer* printer); + void GenerateMutableCopy(io::Printer* printer); + void GenerateKotlinExtensions(io::Printer* printer) const; void GenerateAnyMethods(io::Printer* printer); Context* context_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.cc similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.cc index 16e63afc6..24ea648c7 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.cc @@ -58,6 +58,9 @@ namespace protobuf { namespace compiler { namespace java { +using internal::WireFormat; +using internal::WireFormatLite; + namespace { std::string MapValueImmutableClassdName(const Descriptor* descriptor, ClassNameResolver* name_resolver) { @@ -76,6 +79,11 @@ MessageBuilderGenerator::MessageBuilderGenerator(const Descriptor* descriptor, GOOGLE_CHECK(HasDescriptorMethods(descriptor->file(), context->EnforceLite())) << "Generator factory error: A non-lite message generator is used to " "generate lite messages."; + for (int i = 0; i < descriptor_->field_count(); i++) { + if (IsRealOneof(descriptor_->field(i))) { + oneofs_.insert(descriptor_->field(i)->containing_oneof()); + } + } } MessageBuilderGenerator::~MessageBuilderGenerator() {} @@ -115,13 +123,11 @@ void MessageBuilderGenerator::Generate(io::Printer* printer) { // oneof std::map vars; - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - vars["oneof_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name; + for (auto oneof : oneofs_) { + vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name; vars["oneof_capitalized_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name; - vars["oneof_index"] = StrCat(descriptor_->oneof_decl(i)->index()); + context_->GetOneofGeneratorInfo(oneof)->capitalized_name; + vars["oneof_index"] = StrCat(oneof->index()); // oneofCase_ and oneof_ printer->Print(vars, "private int $oneof_name$Case_ = 0;\n" @@ -282,43 +288,63 @@ void MessageBuilderGenerator::GenerateDescriptorMethods(io::Printer* printer) { void MessageBuilderGenerator::GenerateCommonBuilderMethods( io::Printer* printer) { + // Decide if we really need to have the "maybeForceBuilderInitialization()" + // method. + // TODO(b/249158148): Remove the need for this entirely + bool need_maybe_force_builder_init = false; + for (int i = 0; i < descriptor_->field_count(); i++) { + if (descriptor_->field(i)->message_type() != nullptr && + !IsRealOneof(descriptor_->field(i)) && + HasHasbit(descriptor_->field(i))) { + need_maybe_force_builder_init = true; + break; + } + } + + const char* force_builder_init = need_maybe_force_builder_init + ? " maybeForceBuilderInitialization();" + : ""; + printer->Print( "// Construct using $classname$.newBuilder()\n" "private Builder() {\n" - " maybeForceBuilderInitialization();\n" + "$force_builder_init$\n" "}\n" "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); + "classname", name_resolver_->GetImmutableClassName(descriptor_), + "force_builder_init", force_builder_init); printer->Print( "private Builder(\n" " com.google.protobuf.GeneratedMessage$ver$.BuilderParent parent) {\n" " super(parent);\n" - " maybeForceBuilderInitialization();\n" + "$force_builder_init$\n" "}\n", "classname", name_resolver_->GetImmutableClassName(descriptor_), "ver", - GeneratedCodeVersionSuffix()); + GeneratedCodeVersionSuffix(), "force_builder_init", force_builder_init); - printer->Print( - "private void maybeForceBuilderInitialization() {\n" - " if (com.google.protobuf.GeneratedMessage$ver$\n" - " .alwaysUseFieldBuilders) {\n", - "ver", GeneratedCodeVersionSuffix()); + if (need_maybe_force_builder_init) { + printer->Print( + "private void maybeForceBuilderInitialization() {\n" + " if (com.google.protobuf.GeneratedMessage$ver$\n" + " .alwaysUseFieldBuilders) {\n", + "ver", GeneratedCodeVersionSuffix()); - printer->Indent(); - printer->Indent(); - for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { - field_generators_.get(descriptor_->field(i)) - .GenerateFieldBuilderInitializationCode(printer); + printer->Indent(); + printer->Indent(); + for (int i = 0; i < descriptor_->field_count(); i++) { + if (!IsRealOneof(descriptor_->field(i))) { + field_generators_.get(descriptor_->field(i)) + .GenerateFieldBuilderInitializationCode(printer); + } } - } - printer->Outdent(); - printer->Outdent(); + printer->Outdent(); + printer->Outdent(); - printer->Print( - " }\n" - "}\n"); + printer->Print( + " }\n" + "}\n"); + } printer->Print( "@java.lang.Override\n" @@ -328,18 +354,15 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( printer->Indent(); for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { - field_generators_.get(descriptor_->field(i)) - .GenerateBuilderClearCode(printer); - } + field_generators_.get(descriptor_->field(i)) + .GenerateBuilderClearCode(printer); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (auto oneof : oneofs_) { printer->Print( "$oneof_name$Case_ = 0;\n" "$oneof_name$_ = null;\n", - "oneof_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name); + "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); } printer->Outdent(); @@ -423,10 +446,9 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( "bit_field_name", GetBitFieldName(i)); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - printer->Print( - "result.$oneof_name$Case_ = $oneof_name$Case_;\n", "oneof_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name); + for (auto oneof : oneofs_) { + printer->Print("result.$oneof_name$Case_ = $oneof_name$Case_;\n", + "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); } printer->Outdent(); @@ -535,21 +557,20 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( printer->Indent(); for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { + if (!IsRealOneof(descriptor_->field(i))) { field_generators_.get(descriptor_->field(i)) .GenerateMergingCode(printer); } } // Merge oneof fields. - for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) { + for (auto oneof : oneofs_) { printer->Print("switch (other.get$oneof_capitalized_name$Case()) {\n", "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name); + context_->GetOneofGeneratorInfo(oneof)->capitalized_name); printer->Indent(); - for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { - const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); + for (int j = 0; j < oneof->field_count(); j++) { + const FieldDescriptor* field = oneof->field(j); printer->Print("case $field_name$: {\n", "field_name", ToUpper(field->name())); printer->Indent(); @@ -563,9 +584,7 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( " break;\n" "}\n", "cap_oneof_name", - ToUpper( - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->name)); + ToUpper(context_->GetOneofGeneratorInfo(oneof)->name)); printer->Outdent(); printer->Print("}\n"); } @@ -577,7 +596,7 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( printer->Print(" this.mergeExtensionFields(other);\n"); } - printer->Print(" this.mergeUnknownFields(other.unknownFields);\n"); + printer->Print(" this.mergeUnknownFields(other.getUnknownFields());\n"); printer->Print(" onChanged();\n"); @@ -598,20 +617,92 @@ void MessageBuilderGenerator::GenerateBuilderParsingMethods( " com.google.protobuf.CodedInputStream input,\n" " com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n" " throws java.io.IOException {\n" - " $classname$ parsedMessage = null;\n" + " if (extensionRegistry == null) {\n" + " throw new java.lang.NullPointerException();\n" + " }\n" " try {\n" - " parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);\n" + " boolean done = false;\n" + " while (!done) {\n" + " int tag = input.readTag();\n" + " switch (tag) {\n" + " case 0:\n" // zero signals EOF / limit reached + " done = true;\n" + " break;\n"); + printer->Indent(); // method + printer->Indent(); // try + printer->Indent(); // while + printer->Indent(); // switch + GenerateBuilderFieldParsingCases(printer); + printer->Outdent(); // switch + printer->Outdent(); // while + printer->Outdent(); // try + printer->Outdent(); // method + printer->Print( + " default: {\n" + " if (!super.parseUnknownField(input, extensionRegistry, tag)) " + "{\n" + " done = true; // was an endgroup tag\n" + " }\n" + " break;\n" + " } // default:\n" + " } // switch (tag)\n" + " } // while (!done)\n" " } catch (com.google.protobuf.InvalidProtocolBufferException e) {\n" - " parsedMessage = ($classname$) e.getUnfinishedMessage();\n" " throw e.unwrapIOException();\n" " } finally {\n" - " if (parsedMessage != null) {\n" - " mergeFrom(parsedMessage);\n" - " }\n" - " }\n" + " onChanged();\n" + " } // finally\n" " return this;\n" - "}\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); + "}\n"); +} + +void MessageBuilderGenerator::GenerateBuilderFieldParsingCases( + io::Printer* printer) { + std::unique_ptr sorted_fields( + SortFieldsByNumber(descriptor_)); + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = sorted_fields[i]; + GenerateBuilderFieldParsingCase(printer, field); + if (field->is_packable()) { + GenerateBuilderPackedFieldParsingCase(printer, field); + } + } +} + +void MessageBuilderGenerator::GenerateBuilderFieldParsingCase( + io::Printer* printer, const FieldDescriptor* field) { + uint32_t tag = WireFormatLite::MakeTag( + field->number(), WireFormat::WireTypeForFieldType(field->type())); + std::string tagString = StrCat(static_cast(tag)); + printer->Print("case $tag$: {\n", "tag", tagString); + printer->Indent(); + + field_generators_.get(field).GenerateBuilderParsingCode(printer); + + printer->Outdent(); + printer->Print( + " break;\n" + "} // case $tag$\n", + "tag", tagString); +} + +void MessageBuilderGenerator::GenerateBuilderPackedFieldParsingCase( + io::Printer* printer, const FieldDescriptor* field) { + // To make packed = true wire compatible, we generate parsing code from a + // packed version of this field regardless of field->options().packed(). + uint32_t tag = WireFormatLite::MakeTag( + field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + std::string tagString = StrCat(static_cast(tag)); + printer->Print("case $tag$: {\n", "tag", tagString); + printer->Indent(); + + field_generators_.get(field).GenerateBuilderParsingCodeFromPacked(printer); + + printer->Outdent(); + printer->Print( + " break;\n" + "} // case $tag$\n", + "tag", tagString); } // =================================================================== @@ -655,19 +746,8 @@ void MessageBuilderGenerator::GenerateIsInitialized(io::Printer* printer) { "name", info->capitalized_name); break; case FieldDescriptor::LABEL_OPTIONAL: - if (!SupportFieldPresence(descriptor_->file()) && - field->containing_oneof() != NULL) { - const OneofDescriptor* oneof = field->containing_oneof(); - const OneofGeneratorInfo* oneof_info = - context_->GetOneofGeneratorInfo(oneof); - printer->Print("if ($oneof_name$Case_ == $field_number$) {\n", - "oneof_name", oneof_info->name, "field_number", - StrCat(field->number())); - } else { - printer->Print("if (has$name$()) {\n", "name", - info->capitalized_name); - } printer->Print( + "if (has$name$()) {\n" " if (!get$name$().isInitialized()) {\n" " return false;\n" " }\n" diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.h similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.h index a31d0badf..96f289a83 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder.h @@ -70,12 +70,18 @@ class MessageBuilderGenerator { void GenerateCommonBuilderMethods(io::Printer* printer); void GenerateDescriptorMethods(io::Printer* printer); void GenerateBuilderParsingMethods(io::Printer* printer); + void GenerateBuilderFieldParsingCases(io::Printer* printer); + void GenerateBuilderFieldParsingCase(io::Printer* printer, + const FieldDescriptor* field); + void GenerateBuilderPackedFieldParsingCase(io::Printer* printer, + const FieldDescriptor* field); void GenerateIsInitialized(io::Printer* printer); const Descriptor* descriptor_; Context* context_; ClassNameResolver* name_resolver_; FieldGeneratorMap field_generators_; + std::set oneofs_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageBuilderGenerator); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.cc similarity index 93% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.cc index 6e78fb737..7b69a9ab3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.cc @@ -67,6 +67,11 @@ MessageBuilderLiteGenerator::MessageBuilderLiteGenerator( GOOGLE_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite())) << "Generator factory error: A lite message generator is used to " "generate non-lite messages."; + for (int i = 0; i < descriptor_->field_count(); i++) { + if (IsRealOneof(descriptor_->field(i))) { + oneofs_.insert(descriptor_->field(i)->containing_oneof()); + } + } } MessageBuilderLiteGenerator::~MessageBuilderLiteGenerator() {} @@ -88,13 +93,11 @@ void MessageBuilderLiteGenerator::Generate(io::Printer* printer) { // oneof std::map vars; - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - vars["oneof_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i))->name; + for (auto oneof : oneofs_) { + vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name; vars["oneof_capitalized_name"] = - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name; - vars["oneof_index"] = StrCat(descriptor_->oneof_decl(i)->index()); + context_->GetOneofGeneratorInfo(oneof)->capitalized_name; + vars["oneof_index"] = StrCat(oneof->index()); // oneofCase() and clearOneof() printer->Print(vars, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.h similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.h index e0a48dc1f..3402adf33 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_builder_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_builder_lite.h @@ -73,6 +73,7 @@ class MessageBuilderLiteGenerator { Context* context_; ClassNameResolver* name_resolver_; FieldGeneratorMap field_generators_; + std::set oneofs_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageBuilderLiteGenerator); }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.cc similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.cc index 273faeced..24592082f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.cc @@ -49,6 +49,7 @@ namespace protobuf { namespace compiler { namespace java { + namespace { void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, @@ -59,6 +60,7 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->message_type()); + (*variables)["kt_type"] = (*variables)["type"]; (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->message_type()); (*variables)["group_or_message"] = @@ -68,13 +70,18 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["on_changed"] = "onChanged();"; (*variables)["ver"] = GeneratedCodeVersionSuffix(); (*variables)["get_parser"] = ExposePublicParser(descriptor->message_type()->file()) ? "PARSER" : "parser()"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); @@ -97,18 +104,11 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["name"] + "_ != null"; } - // For repated builders, one bit is used for whether the array is immutable. + // For repeated builders, one bit is used for whether the array is immutable. (*variables)["get_mutable_bit_builder"] = GenerateGetBit(builderBitIndex); (*variables)["set_mutable_bit_builder"] = GenerateSetBit(builderBitIndex); (*variables)["clear_mutable_bit_builder"] = GenerateClearBit(builderBitIndex); - // For repeated fields, one bit is used for whether the array is immutable - // in the parsing constructor. - (*variables)["get_mutable_bit_parser"] = - GenerateGetBitMutableLocal(builderBitIndex); - (*variables)["set_mutable_bit_parser"] = - GenerateSetBitMutableLocal(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -131,7 +131,7 @@ ImmutableMessageFieldGenerator::ImmutableMessageFieldGenerator( ImmutableMessageFieldGenerator::~ImmutableMessageFieldGenerator() {} int ImmutableMessageFieldGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } int ImmutableMessageFieldGenerator::GetNumBitsForBuilder() const { @@ -160,10 +160,11 @@ void ImmutableMessageFieldGenerator::GenerateMembers( printer->Print(variables_, "private $type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $get_has_field_bit_message$;\n" "}\n"); @@ -171,6 +172,7 @@ void ImmutableMessageFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" "}\n"); @@ -179,6 +181,7 @@ void ImmutableMessageFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$OrBuilder " "${$get$capitalized_name$OrBuilder$}$() {\n" " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" @@ -188,6 +191,7 @@ void ImmutableMessageFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $name$_ != null;\n" "}\n"); @@ -195,6 +199,7 @@ void ImmutableMessageFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" "}\n"); @@ -202,6 +207,7 @@ void ImmutableMessageFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$OrBuilder " "${$get$capitalized_name$OrBuilder$}$() {\n" " return get$capitalized_name$();\n" @@ -246,7 +252,7 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( // non-nested builder case. It only creates a nested builder lazily on // demand and then forever delegates to it after creation. - bool support_field_presence = SupportFieldPresence(descriptor_->file()); + bool has_hasbit = HasHasbit(descriptor_); printer->Print(variables_, "private $type$ $name$_;\n"); @@ -262,7 +268,7 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( // boolean hasField() WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - if (support_field_presence) { + if (has_hasbit) { printer->Print( variables_, "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" @@ -323,7 +329,7 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( printer, "$deprecation$public Builder ${$merge$capitalized_name$$}$($type$ value)", - support_field_presence + has_hasbit ? "if ($get_has_field_bit_builder$ &&\n" " $name$_ != null &&\n" " $name$_ != $type$.getDefaultInstance()) {\n" @@ -354,9 +360,9 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( "$name$_ = null;\n" "$on_changed$\n", - support_field_presence ? "$name$Builder_.clear();\n" - : "$name$_ = null;\n" - "$name$Builder_ = null;\n", + has_hasbit ? "$name$Builder_.clear();\n" + : "$name$_ = null;\n" + "$name$Builder_ = null;\n", "$clear_has_field_bit_builder$\n" "return this;\n"); @@ -400,9 +406,36 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( "}\n"); } +void ImmutableMessageFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); +} + void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { printer->Print(variables_, "get$capitalized_name$FieldBuilder();\n"); } } @@ -412,7 +445,7 @@ void ImmutableMessageFieldGenerator::GenerateInitializationCode( void ImmutableMessageFieldGenerator::GenerateBuilderClearCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { PrintNestedBuilderCondition(printer, "$name$_ = null;\n", "$name$Builder_.clear();\n"); @@ -435,7 +468,7 @@ void ImmutableMessageFieldGenerator::GenerateMergingCode( void ImmutableMessageFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { printer->Print(variables_, "if ($get_has_field_bit_from_local$) {\n"); printer->Indent(); PrintNestedBuilderCondition(printer, "result.$name$_ = $name$_;\n", @@ -450,35 +483,21 @@ void ImmutableMessageFieldGenerator::GenerateBuildingCode( } } -void ImmutableMessageFieldGenerator::GenerateParsingCode( +void ImmutableMessageFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { - printer->Print(variables_, - "$type$.Builder subBuilder = null;\n" - "if ($is_field_present_message$) {\n" - " subBuilder = $name$_.toBuilder();\n" - "}\n"); - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { printer->Print(variables_, - "$name$_ = input.readGroup($number$, $type$.$get_parser$,\n" - " extensionRegistry);\n"); + "input.readGroup($number$,\n" + " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " extensionRegistry);\n" + "$set_has_field_bit_builder$\n"); } else { printer->Print(variables_, - "$name$_ = input.readMessage($type$.$get_parser$, " - "extensionRegistry);\n"); + "input.readMessage(\n" + " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " extensionRegistry);\n" + "$set_has_field_bit_builder$\n"); } - - printer->Print(variables_, - "if (subBuilder != null) {\n" - " subBuilder.mergeFrom($name$_);\n" - " $name$_ = subBuilder.buildPartial();\n" - "}\n" - "$set_has_field_bit_message$\n"); -} - -void ImmutableMessageFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - // noop for messages. } void ImmutableMessageFieldGenerator::GenerateSerializationCode( @@ -537,12 +556,14 @@ void ImmutableMessageOneofFieldGenerator::GenerateMembers( PrintExtraFieldInfo(variables_, printer); WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $has_oneof_case_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " if ($has_oneof_case_message$) {\n" " return ($type$) $oneof_name$_;\n" @@ -553,6 +574,7 @@ void ImmutableMessageOneofFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$OrBuilder " "${$get$capitalized_name$OrBuilder$}$() {\n" " if ($has_oneof_case_message$) {\n" @@ -581,6 +603,7 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( // boolean hasField() WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $has_oneof_case_message$;\n" "}\n"); @@ -589,7 +612,9 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( // Field getField() WriteFieldAccessorDocComment(printer, descriptor_, GETTER); PrintNestedBuilderFunction( - printer, "$deprecation$public $type$ ${$get$capitalized_name$$}$()", + printer, + "@java.lang.Override\n" + "$deprecation$public $type$ ${$get$capitalized_name$$}$()", "if ($has_oneof_case_message$) {\n" " return ($type$) $oneof_name$_;\n" @@ -687,6 +712,7 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$OrBuilder " "${$get$capitalized_name$OrBuilder$}$() {\n" " if (($has_oneof_case_message$) && ($name$Builder_ != null)) {\n" @@ -723,6 +749,15 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableMessageOneofFieldGenerator::GenerateBuilderClearCode( + io::Printer* printer) const { + // Make sure the builder gets cleared. + printer->Print(variables_, + "if ($name$Builder_ != null) {\n" + " $name$Builder_.clear();\n" + "}\n"); +} + void ImmutableMessageOneofFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { printer->Print(variables_, "if ($has_oneof_case_message$) {\n"); @@ -743,32 +778,21 @@ void ImmutableMessageOneofFieldGenerator::GenerateMergingCode( "merge$capitalized_name$(other.get$capitalized_name$());\n"); } -void ImmutableMessageOneofFieldGenerator::GenerateParsingCode( +void ImmutableMessageOneofFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { - printer->Print(variables_, - "$type$.Builder subBuilder = null;\n" - "if ($has_oneof_case_message$) {\n" - " subBuilder = (($type$) $oneof_name$_).toBuilder();\n" - "}\n"); - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { - printer->Print( - variables_, - "$oneof_name$_ = input.readGroup($number$, $type$.$get_parser$,\n" - " extensionRegistry);\n"); + printer->Print(variables_, + "input.readGroup($number$,\n" + " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " extensionRegistry);\n" + "$set_oneof_case_message$;\n"); } else { - printer->Print( - variables_, - "$oneof_name$_ =\n" - " input.readMessage($type$.$get_parser$, extensionRegistry);\n"); + printer->Print(variables_, + "input.readMessage(\n" + " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " extensionRegistry);\n" + "$set_oneof_case_message$;\n"); } - - printer->Print(variables_, - "if (subBuilder != null) {\n" - " subBuilder.mergeFrom(($type$) $oneof_name$_);\n" - " $oneof_name$_ = subBuilder.buildPartial();\n" - "}\n"); - printer->Print(variables_, "$set_oneof_case_message$;\n"); } void ImmutableMessageOneofFieldGenerator::GenerateSerializationCode( @@ -846,6 +870,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateMembers( PrintExtraFieldInfo(variables_, printer); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public java.util.List<$type$> " "${$get$capitalized_name$List$}$() {\n" " return $name$_;\n" // note: unmodifiable list @@ -854,6 +879,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public java.util.List \n" " ${$get$capitalized_name$OrBuilderList$}$() {\n" " return $name$_;\n" @@ -862,6 +888,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n" " return $name$_.size();\n" "}\n"); @@ -869,12 +896,14 @@ void RepeatedImmutableMessageFieldGenerator::GenerateMembers( WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" " return $name$_.get(index);\n" "}\n"); printer->Annotate("{", "}", descriptor_); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$OrBuilder " "${$get$capitalized_name$OrBuilder$}$(\n" " int index) {\n" @@ -926,7 +955,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateBuilderMembers( // list is immutable. If it's immutable, the invariant is that it must // either an instance of Collections.emptyList() or it's an ArrayList // wrapped in a Collections.unmodifiableList() wrapper and nobody else has - // a refererence to the underlying ArrayList. This invariant allows us to + // a reference to the underlying ArrayList. This invariant allows us to // share instances of lists between protocol buffers avoiding expensive // memory allocations. Note, immutable is a strong guarantee here -- not // just that the list cannot be modified via the reference but that the @@ -1214,10 +1243,12 @@ void RepeatedImmutableMessageFieldGenerator::GenerateInitializationCode( void RepeatedImmutableMessageFieldGenerator::GenerateBuilderClearCode( io::Printer* printer) const { PrintNestedBuilderCondition(printer, - "$name$_ = java.util.Collections.emptyList();\n" - "$clear_mutable_bit_builder$;\n", + "$name$_ = java.util.Collections.emptyList();\n", + "$name$_ = null;\n" "$name$Builder_.clear();\n"); + + printer->Print(variables_, "$clear_mutable_bit_builder$;\n"); } void RepeatedImmutableMessageFieldGenerator::GenerateMergingCode( @@ -1272,34 +1303,25 @@ void RepeatedImmutableMessageFieldGenerator::GenerateBuildingCode( "result.$name$_ = $name$Builder_.build();\n"); } -void RepeatedImmutableMessageFieldGenerator::GenerateParsingCode( +void RepeatedImmutableMessageFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { - printer->Print(variables_, - "if (!$get_mutable_bit_parser$) {\n" - " $name$_ = new java.util.ArrayList<$type$>();\n" - " $set_mutable_bit_parser$;\n" - "}\n"); - if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { - printer->Print( - variables_, - "$name$_.add(input.readGroup($number$, $type$.$get_parser$,\n" - " extensionRegistry));\n"); + printer->Print(variables_, + "$type$ m =\n" + " input.readGroup($number$,\n" + " $type$.$get_parser$,\n" + " extensionRegistry);\n"); } else { - printer->Print( - variables_, - "$name$_.add(\n" - " input.readMessage($type$.$get_parser$, extensionRegistry));\n"); + printer->Print(variables_, + "$type$ m =\n" + " input.readMessage(\n" + " $type$.$get_parser$,\n" + " extensionRegistry);\n"); } -} - -void RepeatedImmutableMessageFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - printer->Print( - variables_, - "if ($get_mutable_bit_parser$) {\n" - " $name$_ = java.util.Collections.unmodifiableList($name$_);\n" - "}\n"); + PrintNestedBuilderCondition(printer, + "ensure$capitalized_name$IsMutable();\n" + "$name$_.add(m);\n", + "$name$Builder_.addMessage(m);\n"); } void RepeatedImmutableMessageFieldGenerator::GenerateSerializationCode( @@ -1342,6 +1364,100 @@ std::string RepeatedImmutableMessageFieldGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->message_type()); } +void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + } // namespace java } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.h similarity index 64% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.h index 36fa49208..172a45210 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field.h @@ -65,24 +65,25 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -110,13 +111,14 @@ class ImmutableMessageOneofFieldGenerator Context* context); ~ImmutableMessageOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldGenerator); @@ -127,27 +129,28 @@ class RepeatedImmutableMessageFieldGenerator : public ImmutableFieldGenerator { explicit RepeatedImmutableMessageFieldGenerator( const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - ~RepeatedImmutableMessageFieldGenerator(); + ~RepeatedImmutableMessageFieldGenerator() override; // implements ImmutableFieldGenerator --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.cc similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.cc index cb5f3c0e0..1c4d016d3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.cc @@ -32,13 +32,15 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include #include #include #include -#include #include #include #include @@ -59,6 +61,7 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->message_type()); + (*variables)["kt_type"] = (*variables)["type"]; (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->message_type()); (*variables)["group_or_message"] = @@ -68,9 +71,14 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["required"] = descriptor->is_required() ? "true" : "false"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); @@ -89,9 +97,6 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["name"] + "_ != null"; } - // For repeated builders, the underlying list tracks mutability state. - (*variables)["is_mutable"] = (*variables)["name"] + "_.isModifiable()"; - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -119,7 +124,11 @@ ImmutableMessageFieldLiteGenerator::ImmutableMessageFieldLiteGenerator( ImmutableMessageFieldLiteGenerator::~ImmutableMessageFieldLiteGenerator() {} int ImmutableMessageFieldLiteGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + // TODO(dweis): We don't need a has bit for messages as they have null + // sentinels and no user should be reflecting on this. We could save some + // bits by setting to 0 and updating the runtimes but this might come at a + // runtime performance cost since we can't memoize has-bit reads. + return HasHasbit(descriptor_) ? 1 : 0; } void ImmutableMessageFieldLiteGenerator::GenerateInterfaceMembers( @@ -136,7 +145,7 @@ void ImmutableMessageFieldLiteGenerator::GenerateMembers( printer->Print(variables_, "private $type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, @@ -274,12 +283,39 @@ void ImmutableMessageFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); +} + void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteIntToUtf16CharSequence(messageBitIndex_, output); } printer->Print(variables_, "\"$name$_\",\n"); @@ -365,7 +401,7 @@ void ImmutableMessageOneofFieldLiteGenerator::GenerateMembers( } void ImmutableMessageOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); @@ -528,9 +564,11 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateMembers( printer->Print( variables_, "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$is_mutable$) {\n" + // Use a temporary to avoid a redundant iget-object. + " com.google.protobuf.Internal.ProtobufList<$type$> tmp = $name$_;\n" + " if (!tmp.isModifiable()) {\n" " $name$_ =\n" - " com.google.protobuf.GeneratedMessageLite.mutableCopy($name$_);\n" + " com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);\n" " }\n" "}\n" "\n"); @@ -728,7 +766,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateBuilderMembers( } void RepeatedImmutableMessageFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); @@ -746,6 +784,100 @@ std::string RepeatedImmutableMessageFieldLiteGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->message_type()); } +void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + } // namespace java } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.h similarity index 77% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.h index c0a9b37f4..8f81f60df 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_field_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_field_lite.h @@ -35,8 +35,10 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_LITE_H__ +#include #include #include + #include namespace google { @@ -64,15 +66,16 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator { // implements ImmutableFieldLiteGenerator // ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -92,10 +95,10 @@ class ImmutableMessageOneofFieldLiteGenerator Context* context); ~ImmutableMessageOneofFieldLiteGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldLiteGenerator); @@ -106,18 +109,19 @@ class RepeatedImmutableMessageFieldLiteGenerator public: explicit RepeatedImmutableMessageFieldLiteGenerator( const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableMessageFieldLiteGenerator(); + ~RepeatedImmutableMessageFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.cc similarity index 74% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.cc index c2233110b..c2c278890 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -73,6 +74,11 @@ ImmutableMessageLiteGenerator::ImmutableMessageLiteGenerator( GOOGLE_CHECK(!HasDescriptorMethods(descriptor->file(), context->EnforceLite())) << "Generator factory error: A lite message generator is used to " "generate non-lite messages."; + for (int i = 0; i < descriptor_->field_count(); i++) { + if (IsRealOneof(descriptor_->field(i))) { + oneofs_.insert(descriptor_->field(i)->containing_oneof()); + } + } } ImmutableMessageLiteGenerator::~ImmutableMessageLiteGenerator() {} @@ -134,15 +140,13 @@ void ImmutableMessageLiteGenerator::GenerateInterface(io::Printer* printer) { field_generators_.get(descriptor_->field(i)) .GenerateInterfaceMembers(printer); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (auto oneof : oneofs_) { printer->Print( "\n" "public $classname$.$oneof_capitalized_name$Case " "get$oneof_capitalized_name$Case();\n", "oneof_capitalized_name", - context_->GetOneofGeneratorInfo(descriptor_->oneof_decl(i)) - ->capitalized_name, - "classname", + context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "classname", context_->GetNameResolver()->GetImmutableClassName(descriptor_)); } printer->Outdent(); @@ -224,12 +228,11 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { // oneof std::map vars; - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + for (auto oneof : oneofs_) { vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name; vars["oneof_capitalized_name"] = context_->GetOneofGeneratorInfo(oneof)->capitalized_name; - vars["oneof_index"] = StrCat(oneof->index()); + vars["oneof_index"] = StrCat((oneof)->index()); // oneofCase_ and oneof_ printer->Print(vars, "private int $oneof_name$Case_ = 0;\n" @@ -237,8 +240,8 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { // OneofCase enum printer->Print(vars, "public enum $oneof_capitalized_name$Case {\n"); printer->Indent(); - for (int j = 0; j < oneof->field_count(); j++) { - const FieldDescriptor* field = oneof->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print("$field_name$($field_number$),\n", "field_name", ToUpper(field->name()), "field_number", StrCat(field->number())); @@ -262,8 +265,8 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { "\n" "public static $oneof_capitalized_name$Case forNumber(int value) {\n" " switch (value) {\n"); - for (int j = 0; j < oneof->field_count(); j++) { - const FieldDescriptor* field = oneof->field(j); + for (int j = 0; j < (oneof)->field_count(); j++) { + const FieldDescriptor* field = (oneof)->field(j); printer->Print(" case $field_number$: return $field_name$;\n", "field_number", StrCat(field->number()), "field_name", ToUpper(field->name())); @@ -469,10 +472,10 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo( // Collect field info into a sequence of UTF-16 chars. It will be embedded // as a Java string in the generated code. - std::vector chars; + std::vector chars; int flags = 0; - if (SupportFieldPresence(descriptor_->file())) { + if (IsProto2(descriptor_->file())) { flags |= 0x1; } if (descriptor_->options().message_set_wire_format()) { @@ -489,9 +492,8 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo( printer->Indent(); // Record the number of oneofs. - WriteIntToUtf16CharSequence(descriptor_->oneof_decl_count(), &chars); - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + WriteIntToUtf16CharSequence(oneofs_.size(), &chars); + for (auto oneof : oneofs_) { printer->Print( "\"$oneof_name$_\",\n" "\"$oneof_name$Case_\",\n", @@ -552,7 +554,7 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo( printer->Print("java.lang.String info =\n"); std::string line; for (size_t i = 0; i < chars.size(); i++) { - uint16 code = chars[i]; + uint16_t code = chars[i]; EscapeUtf16ToString(code, &line); if (line.size() >= 80) { printer->Print(" \"$string$\" +\n", "string", line); @@ -715,13 +717,260 @@ void ImmutableMessageLiteGenerator::GenerateParser(io::Printer* printer) { // =================================================================== void ImmutableMessageLiteGenerator::GenerateInitializers(io::Printer* printer) { for (int i = 0; i < descriptor_->field_count(); i++) { - if (!descriptor_->field(i)->containing_oneof()) { + if (!IsRealOneof(descriptor_->field(i))) { field_generators_.get(descriptor_->field(i)) .GenerateInitializationCode(printer); } } } +void ImmutableMessageLiteGenerator::GenerateKotlinDsl( + io::Printer* printer) const { + printer->Print( + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "@com.google.protobuf.kotlin.ProtoDslMarker\n"); + printer->Print( + "public class Dsl private constructor(\n" + " private val _builder: $message$.Builder\n" + ") {\n" + " public companion object {\n" + " @kotlin.jvm.JvmSynthetic\n" + " @kotlin.PublishedApi\n" + " internal fun _create(builder: $message$.Builder): Dsl = " + "Dsl(builder)\n" + " }\n" + "\n" + " @kotlin.jvm.JvmSynthetic\n" + " @kotlin.PublishedApi\n" + " internal fun _build(): $message$ = _builder.build()\n", + "message", name_resolver_->GetClassName(descriptor_, true)); + + printer->Indent(); + + for (int i = 0; i < descriptor_->field_count(); i++) { + printer->Print("\n"); + field_generators_.get(descriptor_->field(i)) + .GenerateKotlinDslMembers(printer); + } + + for (auto oneof : oneofs_) { + printer->Print( + "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" + " @JvmName(\"get$oneof_capitalized_name$Case\")\n" + " get() = _builder.get$oneof_capitalized_name$Case()\n\n" + "public fun clear$oneof_capitalized_name$() {\n" + " _builder.clear$oneof_capitalized_name$()\n" + "}\n", + "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name, + "oneof_capitalized_name", + context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "message", + name_resolver_->GetClassName(descriptor_, true)); + } + + if (descriptor_->extension_range_count() > 0) { + GenerateKotlinExtensions(printer); + } + + printer->Outdent(); + printer->Print("}\n"); +} + +void ImmutableMessageLiteGenerator::GenerateKotlinMembers( + io::Printer* printer) const { + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " + "$message$ =\n" + " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " + "}._build()\n", + "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_), + "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_), + "message", name_resolver_->GetClassName(descriptor_, true)); + + printer->Print("public object $name$Kt {\n", "name", descriptor_->name()); + printer->Indent(); + GenerateKotlinDsl(printer); + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + if (IsMapEntry(descriptor_->nested_type(i))) continue; + ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_) + .GenerateKotlinMembers(printer); + } + printer->Outdent(); + printer->Print("}\n"); +} + +void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers( + io::Printer* printer) const { + printer->Print( + "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " + "$message$ =\n" + " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " + "}._build()\n", + "message", name_resolver_->GetClassName(descriptor_, true), "message_kt", + name_resolver_->GetKotlinExtensionsClassName(descriptor_)); + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + if (IsMapEntry(descriptor_->nested_type(i))) continue; + ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_) + .GenerateTopLevelKotlinMembers(printer); + } +} + +void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( + io::Printer* printer) const { + std::string message_name = name_resolver_->GetClassName(descriptor_, true); + + printer->Print( + "@Suppress(\"UNCHECKED_CAST\")\n" + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun get(extension: " + "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" + " return if (extension.isRepeated) {\n" + " get(extension as com.google.protobuf.ExtensionLite<$message$, " + "List<*>>) as T\n" + " } else {\n" + " _builder.getExtension(extension)\n" + " }\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" + "public operator fun get(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, List>\n" + "): com.google.protobuf.kotlin.ExtensionList {\n" + " return com.google.protobuf.kotlin.ExtensionList(extension, " + "_builder.getExtension(extension))\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun contains(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>): " + "Boolean {\n" + " return _builder.hasExtension(extension)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public fun clear(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>) " + "{\n" + " _builder.clearExtension(extension)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.PublishedApi\n" + "internal fun setExtension(extension: " + "com.google.protobuf.ExtensionLite<$message$, T>, " + "value: T) {\n" + " _builder.setExtension(extension, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun > set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" + " value: T\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, " + "com.google.protobuf.ByteString>,\n" + " value: com.google.protobuf.ByteString\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" + " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" + " value: T\n" + ") {\n" + " setExtension(extension, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public fun com.google.protobuf.kotlin.ExtensionList.add(value: E) {\n" + " _builder.addExtension(this.extension, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun " + "com.google.protobuf.kotlin.ExtensionList.plusAssign" + "(value: E) {\n" + " add(value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public fun com.google.protobuf.kotlin.ExtensionList.addAll(values: Iterable) {\n" + " for (value in values) {\n" + " add(value)\n" + " }\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun " + "com.google.protobuf.kotlin.ExtensionList.plusAssign(values: " + "Iterable) {\n" + " addAll(values)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "public operator fun com.google.protobuf.kotlin.ExtensionList.set(index: Int, value: " + "E) {\n" + " _builder.setExtension(this.extension, index, value)\n" + "}\n\n", + "message", message_name); + + printer->Print( + "@kotlin.jvm.JvmSynthetic\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline fun com.google.protobuf.kotlin.ExtensionList<*, " + "$message$>.clear() {\n" + " clear(extension)\n" + "}\n\n", + "message", message_name); +} + } // namespace java } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.h similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.h index 5290b1e64..adb0df7cc 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_message_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_message_lite.h @@ -50,12 +50,15 @@ class ImmutableMessageLiteGenerator : public MessageGenerator { ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context); virtual ~ImmutableMessageLiteGenerator(); - virtual void Generate(io::Printer* printer); - virtual void GenerateInterface(io::Printer* printer); - virtual void GenerateExtensionRegistrationCode(io::Printer* printer); - virtual void GenerateStaticVariables(io::Printer* printer, - int* bytecode_estimate); - virtual int GenerateStaticVariableInitializers(io::Printer* printer); + void Generate(io::Printer* printer) override; + void GenerateInterface(io::Printer* printer) override; + void GenerateExtensionRegistrationCode(io::Printer* printer) override; + void GenerateStaticVariables(io::Printer* printer, + int* bytecode_estimate) override; + int GenerateStaticVariableInitializers(io::Printer* printer) override; + void GenerateKotlinDsl(io::Printer* printer) const override; + void GenerateKotlinMembers(io::Printer* printer) const override; + void GenerateTopLevelKotlinMembers(io::Printer* printer) const override; private: void GenerateParseFromMethods(io::Printer* printer); @@ -66,6 +69,7 @@ class ImmutableMessageLiteGenerator : public MessageGenerator { void GenerateParser(io::Printer* printer); void GenerateConstructor(io::Printer* printer); void GenerateDynamicMethodNewBuildMessageInfo(io::Printer* printer); + void GenerateKotlinExtensions(io::Printer* printer) const; Context* context_; ClassNameResolver* name_resolver_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.cc similarity index 68% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.cc index 361cfa986..39bf3e278 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.cc @@ -34,6 +34,8 @@ #include #include +#include +#include #include namespace google { @@ -67,6 +69,17 @@ std::string ClassNameWithoutPackage(const Descriptor* descriptor, return StripPackageName(descriptor->full_name(), descriptor->file()); } +std::string ClassNameWithoutPackageKotlin(const Descriptor* descriptor) { + std::string result = descriptor->name(); + const Descriptor* temp = descriptor->containing_type(); + + while (temp) { + result = temp->name() + "Kt." + result; + temp = temp->containing_type(); + } + return result; +} + // Get the name of an enum's Java class without package name prefix. std::string ClassNameWithoutPackage(const EnumDescriptor* descriptor, bool immutable) { @@ -91,7 +104,7 @@ std::string ClassNameWithoutPackage(const ServiceDescriptor* descriptor, } // Return true if a and b are equals (case insensitive). -NameEquality CheckNameEquality(const string& a, const string& b) { +NameEquality CheckNameEquality(const std::string& a, const std::string& b) { if (ToUpper(a) == ToUpper(b)) { if (a == b) { return NameEquality::EXACT_EQUAL; @@ -160,7 +173,14 @@ std::string ClassNameResolver::GetFileImmutableClassName( std::string ClassNameResolver::GetFileClassName(const FileDescriptor* file, bool immutable) { - if (immutable) { + return GetFileClassName(file, immutable, false); +} + +std::string ClassNameResolver::GetFileClassName(const FileDescriptor* file, + bool immutable, bool kotlin) { + if (kotlin) { + return GetFileImmutableClassName(file) + "Kt"; + } else if (immutable) { return GetFileImmutableClassName(file); } else { return "Mutable" + GetFileImmutableClassName(file); @@ -200,9 +220,14 @@ std::string ClassNameResolver::GetDescriptorClassName( std::string ClassNameResolver::GetClassName(const FileDescriptor* descriptor, bool immutable) { + return GetClassName(descriptor, immutable, false); +} + +std::string ClassNameResolver::GetClassName(const FileDescriptor* descriptor, + bool immutable, bool kotlin) { std::string result = FileJavaPackage(descriptor, immutable); if (!result.empty()) result += '.'; - result += GetFileClassName(descriptor, immutable); + result += GetFileClassName(descriptor, immutable, kotlin); return result; } @@ -211,50 +236,79 @@ std::string ClassNameResolver::GetClassName(const FileDescriptor* descriptor, std::string ClassNameResolver::GetClassFullName( const std::string& name_without_package, const FileDescriptor* file, bool immutable, bool is_own_file) { + return GetClassFullName(name_without_package, file, immutable, is_own_file, + false); +} + +std::string ClassNameResolver::GetClassFullName( + const std::string& name_without_package, const FileDescriptor* file, + bool immutable, bool is_own_file, bool kotlin) { std::string result; if (is_own_file) { result = FileJavaPackage(file, immutable); } else { - result = GetClassName(file, immutable); + result = GetClassName(file, immutable, kotlin); } if (!result.empty()) { result += '.'; } result += name_without_package; + if (kotlin) result += "Kt"; return result; } std::string ClassNameResolver::GetClassName(const Descriptor* descriptor, bool immutable) { - return GetClassFullName(ClassNameWithoutPackage(descriptor, immutable), - descriptor->file(), immutable, - MultipleJavaFiles(descriptor->file(), immutable)); + return GetClassName(descriptor, immutable, false); +} + +std::string ClassNameResolver::GetClassName(const Descriptor* descriptor, + bool immutable, bool kotlin) { + return GetClassFullName( + ClassNameWithoutPackage(descriptor, immutable), descriptor->file(), + immutable, MultipleJavaFiles(descriptor->file(), immutable), kotlin); } std::string ClassNameResolver::GetClassName(const EnumDescriptor* descriptor, bool immutable) { - return GetClassFullName(ClassNameWithoutPackage(descriptor, immutable), - descriptor->file(), immutable, - MultipleJavaFiles(descriptor->file(), immutable)); + return GetClassName(descriptor, immutable, false); +} + +std::string ClassNameResolver::GetClassName(const EnumDescriptor* descriptor, + bool immutable, bool kotlin) { + return GetClassFullName( + ClassNameWithoutPackage(descriptor, immutable), descriptor->file(), + immutable, MultipleJavaFiles(descriptor->file(), immutable), kotlin); } std::string ClassNameResolver::GetClassName(const ServiceDescriptor* descriptor, bool immutable) { + return GetClassName(descriptor, immutable, false); +} + +std::string ClassNameResolver::GetClassName(const ServiceDescriptor* descriptor, + bool immutable, bool kotlin) { return GetClassFullName(ClassNameWithoutPackage(descriptor, immutable), descriptor->file(), immutable, - IsOwnFile(descriptor, immutable)); + IsOwnFile(descriptor, immutable), kotlin); } // Get the Java Class style full name of a message. std::string ClassNameResolver::GetJavaClassFullName( const std::string& name_without_package, const FileDescriptor* file, bool immutable) { + return GetJavaClassFullName(name_without_package, file, immutable, false); +} + +std::string ClassNameResolver::GetJavaClassFullName( + const std::string& name_without_package, const FileDescriptor* file, + bool immutable, bool kotlin) { std::string result; if (MultipleJavaFiles(file, immutable)) { result = FileJavaPackage(file, immutable); if (!result.empty()) result += '.'; } else { - result = GetClassName(file, immutable); + result = GetClassName(file, immutable, kotlin); if (!result.empty()) result += '$'; } result += StringReplace(name_without_package, ".", "$", true); @@ -263,10 +317,21 @@ std::string ClassNameResolver::GetJavaClassFullName( std::string ClassNameResolver::GetExtensionIdentifierName( const FieldDescriptor* descriptor, bool immutable) { - return GetClassName(descriptor->containing_type(), immutable) + "." + + return GetExtensionIdentifierName(descriptor, immutable, false); +} + +std::string ClassNameResolver::GetExtensionIdentifierName( + const FieldDescriptor* descriptor, bool immutable, bool kotlin) { + return GetClassName(descriptor->containing_type(), immutable, kotlin) + "." + descriptor->name(); } +std::string ClassNameResolver::GetKotlinFactoryName( + const Descriptor* descriptor) { + std::string name = ToCamelCase(descriptor->name(), /* lower_first = */ true); + return IsForbiddenKotlin(name) ? name + "_" : name; +} + std::string ClassNameResolver::GetJavaImmutableClassName( const Descriptor* descriptor) { return GetJavaClassFullName(ClassNameWithoutPackage(descriptor, true), @@ -279,6 +344,35 @@ std::string ClassNameResolver::GetJavaImmutableClassName( descriptor->file(), true); } +std::string ClassNameResolver::GetKotlinExtensionsClassName( + const Descriptor* descriptor) { + return GetClassFullName(ClassNameWithoutPackageKotlin(descriptor), + descriptor->file(), true, true, true); +} + +std::string ClassNameResolver::GetJavaMutableClassName( + const Descriptor* descriptor) { + return GetJavaClassFullName(ClassNameWithoutPackage(descriptor, false), + descriptor->file(), false); +} + +std::string ClassNameResolver::GetJavaMutableClassName( + const EnumDescriptor* descriptor) { + return GetJavaClassFullName(ClassNameWithoutPackage(descriptor, false), + descriptor->file(), false); +} + +std::string ClassNameResolver::GetDowngradedFileClassName( + const FileDescriptor* file) { + return "Downgraded" + GetFileClassName(file, false); +} + +std::string ClassNameResolver::GetDowngradedClassName( + const Descriptor* descriptor) { + return FileJavaPackage(descriptor->file()) + "." + + GetDowngradedFileClassName(descriptor->file()) + "." + + ClassNameWithoutPackage(descriptor, false); +} } // namespace java } // namespace compiler diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.h similarity index 77% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.h index b92570c60..a688d49a4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_name_resolver.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_name_resolver.h @@ -60,6 +60,8 @@ class ClassNameResolver { // Gets the unqualified outer class name for the file. std::string GetFileClassName(const FileDescriptor* file, bool immutable); + std::string GetFileClassName(const FileDescriptor* file, bool immutable, + bool kotlin); // Gets the unqualified immutable outer class name of a file. std::string GetFileImmutableClassName(const FileDescriptor* file); // Gets the unqualified default immutable outer class name of a file @@ -80,9 +82,17 @@ class ClassNameResolver { // Gets the fully-qualified class name corresponding to the given descriptor. std::string GetClassName(const Descriptor* descriptor, bool immutable); + std::string GetClassName(const Descriptor* descriptor, bool immutable, + bool kotlin); std::string GetClassName(const EnumDescriptor* descriptor, bool immutable); + std::string GetClassName(const EnumDescriptor* descriptor, bool immutable, + bool kotlin); std::string GetClassName(const ServiceDescriptor* descriptor, bool immutable); + std::string GetClassName(const ServiceDescriptor* descriptor, bool immutable, + bool kotlin); std::string GetClassName(const FileDescriptor* descriptor, bool immutable); + std::string GetClassName(const FileDescriptor* descriptor, bool immutable, + bool kotlin); template std::string GetImmutableClassName(const DescriptorType* descriptor) { @@ -96,6 +106,8 @@ class ClassNameResolver { // Gets the fully qualified name of an extension identifier. std::string GetExtensionIdentifierName(const FieldDescriptor* descriptor, bool immutable); + std::string GetExtensionIdentifierName(const FieldDescriptor* descriptor, + bool immutable, bool kotlin); // Gets the fully qualified name for generated classes in Java convention. // Nested classes will be separated using '$' instead of '.' @@ -103,15 +115,29 @@ class ClassNameResolver { // com.package.OuterClass$OuterMessage$InnerMessage std::string GetJavaImmutableClassName(const Descriptor* descriptor); std::string GetJavaImmutableClassName(const EnumDescriptor* descriptor); + std::string GetKotlinFactoryName(const Descriptor* descriptor); + std::string GetKotlinExtensionsClassName(const Descriptor* descriptor); + std::string GetJavaMutableClassName(const Descriptor* descriptor); + std::string GetJavaMutableClassName(const EnumDescriptor* descriptor); + // Gets the outer class and the actual class for downgraded mutable messages. + std::string GetDowngradedFileClassName(const FileDescriptor* file); + std::string GetDowngradedClassName(const Descriptor* descriptor); + private: // Get the full name of a Java class by prepending the Java package name // or outer class name. std::string GetClassFullName(const std::string& name_without_package, const FileDescriptor* file, bool immutable, bool is_own_file); + std::string GetClassFullName(const std::string& name_without_package, + const FileDescriptor* file, bool immutable, + bool is_own_file, bool kotlin); // Get the Java Class style full name of a message. std::string GetJavaClassFullName(const std::string& name_without_package, const FileDescriptor* file, bool immutable); + std::string GetJavaClassFullName(const std::string& name_without_package, + const FileDescriptor* file, bool immutable, + bool kotlin); // Caches the result to provide better performance. std::map file_immutable_outer_class_names_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_names.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_names.h similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_names.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_names.h index a8efbb49b..313ace4fe 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_names.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_names.h @@ -90,21 +90,9 @@ std::string FileJavaPackage(const FileDescriptor* descriptor); // Requires: // descriptor != NULL // Returns: -// Captialized camel case name field name. +// Capitalized camel case name field name. std::string CapitalizedFieldName(const FieldDescriptor* descriptor); -// Requires: -// descriptor != NULL -// Returns: -// Primitive Java type name for the field. -const char* PrimitiveTypeName(const FieldDescriptor* descriptor); - -// Requires: -// descriptor != NULL -// Returns: -// Boes primitive Java type name for the field. -const char* BoxedPrimitiveTypeName(const FieldDescriptor* descriptor); - } // namespace java } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_options.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_options.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_options.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_options.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_plugin_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_plugin_unittest.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_plugin_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_plugin_unittest.cc index 744b2c8be..3bdd53bff 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_plugin_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_plugin_unittest.cc @@ -36,13 +36,12 @@ #include +#include +#include #include #include #include #include - -#include -#include #include #include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.cc index d06b534bf..ec040047f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.cc @@ -32,6 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -41,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +54,6 @@ namespace compiler { namespace java { using internal::WireFormat; -using internal::WireFormatLite; namespace { @@ -66,6 +67,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["type"] = PrimitiveTypeName(javaType); (*variables)["boxed_type"] = BoxedPrimitiveTypeName(javaType); + (*variables)["kt_type"] = KotlinTypeName(javaType); (*variables)["field_type"] = (*variables)["type"]; if (javaType == JAVATYPE_BOOLEAN || javaType == JAVATYPE_DOUBLE || @@ -112,7 +114,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["capitalized_type"] = GetCapitalizedType(descriptor, /* immutable = */ true); (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); + StrCat(static_cast(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); if (IsReferenceType(GetJavaType(descriptor))) { @@ -127,13 +129,18 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; int fixed_size = FixedSize(GetType(descriptor)); if (fixed_size != -1) { (*variables)["fixed_size"] = StrCat(fixed_size); } (*variables)["on_changed"] = "onChanged();"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); @@ -152,27 +159,33 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["set_has_field_bit_builder"] = ""; (*variables)["clear_has_field_bit_builder"] = ""; - if (descriptor->type() == FieldDescriptor::TYPE_BYTES) { - (*variables)["is_field_present_message"] = - "!" + (*variables)["name"] + "_.isEmpty()"; - } else { - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != " + (*variables)["default"]; + switch (descriptor->type()) { + case FieldDescriptor::TYPE_BYTES: + (*variables)["is_field_present_message"] = + "!" + (*variables)["name"] + "_.isEmpty()"; + break; + case FieldDescriptor::TYPE_FLOAT: + (*variables)["is_field_present_message"] = + "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] + + "_) != 0"; + break; + case FieldDescriptor::TYPE_DOUBLE: + (*variables)["is_field_present_message"] = + "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] + + "_) != 0"; + break; + default: + (*variables)["is_field_present_message"] = + (*variables)["name"] + "_ != " + (*variables)["default"]; + break; } } - // For repated builders, one bit is used for whether the array is immutable. + // For repeated builders, one bit is used for whether the array is immutable. (*variables)["get_mutable_bit_builder"] = GenerateGetBit(builderBitIndex); (*variables)["set_mutable_bit_builder"] = GenerateSetBit(builderBitIndex); (*variables)["clear_mutable_bit_builder"] = GenerateClearBit(builderBitIndex); - // For repeated fields, one bit is used for whether the array is immutable - // in the parsing constructor. - (*variables)["get_mutable_bit_parser"] = - GenerateGetBitMutableLocal(builderBitIndex); - (*variables)["set_mutable_bit_parser"] = - GenerateSetBitMutableLocal(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -195,7 +208,7 @@ ImmutablePrimitiveFieldGenerator::ImmutablePrimitiveFieldGenerator( ImmutablePrimitiveFieldGenerator::~ImmutablePrimitiveFieldGenerator() {} int ImmutablePrimitiveFieldGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } int ImmutablePrimitiveFieldGenerator::GetNumBitsForBuilder() const { @@ -204,7 +217,7 @@ int ImmutablePrimitiveFieldGenerator::GetNumBitsForBuilder() const { void ImmutablePrimitiveFieldGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -217,10 +230,11 @@ void ImmutablePrimitiveFieldGenerator::GenerateMembers( io::Printer* printer) const { printer->Print(variables_, "private $field_type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $get_has_field_bit_message$;\n" "}\n"); @@ -229,6 +243,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " return $name$_;\n" "}\n"); @@ -239,10 +254,11 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { printer->Print(variables_, "private $field_type$ $name$_ $default_init$;\n"); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $get_has_field_bit_builder$;\n" "}\n"); @@ -251,6 +267,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " return $name$_;\n" "}\n"); @@ -292,6 +309,35 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( "}\n"); } +void ImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutablePrimitiveFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for primitives @@ -313,7 +359,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderClearCode( void ImmutablePrimitiveFieldGenerator::GenerateMergingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { printer->Print(variables_, "if (other.has$capitalized_name$()) {\n" " set$capitalized_name$(other.get$capitalized_name$());\n" @@ -328,7 +374,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateMergingCode( void ImmutablePrimitiveFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { if (IsDefaultValueJavaDefault(descriptor_)) { printer->Print(variables_, "if ($get_has_field_bit_from_local$) {\n" @@ -347,16 +393,11 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuildingCode( } } -void ImmutablePrimitiveFieldGenerator::GenerateParsingCode( +void ImmutablePrimitiveFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { printer->Print(variables_, - "$set_has_field_bit_message$\n" - "$name$_ = input.read$capitalized_type$();\n"); -} - -void ImmutablePrimitiveFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - // noop for primitives. + "$name$_ = input.read$capitalized_type$();\n" + "$set_has_field_bit_builder$\n"); } void ImmutablePrimitiveFieldGenerator::GenerateSerializationCode( @@ -492,18 +533,18 @@ ImmutablePrimitiveOneofFieldGenerator:: void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" " if ($has_oneof_case_message$) {\n" " return ($boxed_type$) $oneof_name$_;\n" @@ -515,15 +556,13 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateMembers( void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, @@ -563,6 +602,12 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderClearCode( + io::Printer* printer) const { + // No-Op: When a primitive field is in a oneof, clearing the oneof clears that + // field. +} + void ImmutablePrimitiveOneofFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { printer->Print(variables_, @@ -577,11 +622,11 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateMergingCode( "set$capitalized_name$(other.get$capitalized_name$());\n"); } -void ImmutablePrimitiveOneofFieldGenerator::GenerateParsingCode( +void ImmutablePrimitiveOneofFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { printer->Print(variables_, - "$set_oneof_case_message$;\n" - "$oneof_name$_ = input.read$capitalized_type$();\n"); + "$oneof_name$_ = input.read$capitalized_type$();\n" + "$set_oneof_case_message$;\n"); } void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializationCode( @@ -663,6 +708,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateMembers( PrintExtraFieldInfo(variables_, printer); WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public java.util.List<$boxed_type$>\n" " ${$get$capitalized_name$List$}$() {\n" " return $name$_;\n" // note: unmodifiable list @@ -695,7 +741,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( // list is immutable. If it's immutable, the invariant is that it must // either an instance of Collections.emptyList() or it's an ArrayList // wrapped in a Collections.unmodifiableList() wrapper and nobody else has - // a refererence to the underlying ArrayList. This invariant allows us to + // a reference to the underlying ArrayList. This invariant allows us to // share instances of lists between protocol buffers avoiding expensive // memory allocations. Note, immutable is a strong guarantee here -- not // just that the list cannot be modified via the reference but that the @@ -787,6 +833,100 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + void RepeatedImmutablePrimitiveFieldGenerator:: GenerateFieldBuilderInitializationCode(io::Printer* printer) const { // noop for primitives @@ -836,38 +976,24 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuildingCode( "result.$name$_ = $name$_;\n"); } -void RepeatedImmutablePrimitiveFieldGenerator::GenerateParsingCode( +void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { printer->Print(variables_, - "if (!$get_mutable_bit_parser$) {\n" - " $name$_ = $create_list$;\n" - " $set_mutable_bit_parser$;\n" - "}\n" - "$repeated_add$(input.read$capitalized_type$());\n"); -} - -void RepeatedImmutablePrimitiveFieldGenerator::GenerateParsingCodeFromPacked( - io::Printer* printer) const { - printer->Print( - variables_, - "int length = input.readRawVarint32();\n" - "int limit = input.pushLimit(length);\n" - "if (!$get_mutable_bit_parser$ && input.getBytesUntilLimit() > 0) {\n" - " $name$_ = $create_list$;\n" - " $set_mutable_bit_parser$;\n" - "}\n" - "while (input.getBytesUntilLimit() > 0) {\n" - " $repeated_add$(input.read$capitalized_type$());\n" - "}\n" - "input.popLimit(limit);\n"); + "$type$ v = input.read$capitalized_type$();\n" + "ensure$capitalized_name$IsMutable();\n" + "$repeated_add$(v);\n"); } -void RepeatedImmutablePrimitiveFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { +void RepeatedImmutablePrimitiveFieldGenerator:: + GenerateBuilderParsingCodeFromPacked(io::Printer* printer) const { printer->Print(variables_, - "if ($get_mutable_bit_parser$) {\n" - " $name_make_immutable$; // C\n" - "}\n"); + "int length = input.readRawVarint32();\n" + "int limit = input.pushLimit(length);\n" + "ensure$capitalized_name$IsMutable();\n" + "while (input.getBytesUntilLimit() > 0) {\n" + " $repeated_add$(input.read$capitalized_type$());\n" + "}\n" + "input.popLimit(limit);\n"); } void RepeatedImmutablePrimitiveFieldGenerator::GenerateSerializationCode( diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.h similarity index 58% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.h index db20750e2..1f1aa0c41 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field.h @@ -61,28 +61,29 @@ class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator { int messageBitIndex, int builderBitIndex, Context* context); - ~ImmutablePrimitiveFieldGenerator(); + ~ImmutablePrimitiveFieldGenerator() override; // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -101,13 +102,14 @@ class ImmutablePrimitiveOneofFieldGenerator int builderBitIndex, Context* context); ~ImmutablePrimitiveOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldGenerator); @@ -119,28 +121,30 @@ class RepeatedImmutablePrimitiveFieldGenerator explicit RepeatedImmutablePrimitiveFieldGenerator( const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - virtual ~RepeatedImmutablePrimitiveFieldGenerator(); + ~RepeatedImmutablePrimitiveFieldGenerator() override; // implements ImmutableFieldGenerator --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingCodeFromPacked(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCodeFromPacked( + io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.cc similarity index 75% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.cc index f038412bd..5441d01a5 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.cc @@ -32,6 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -41,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -72,12 +74,13 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, JavaType javaType = GetJavaType(descriptor); (*variables)["type"] = PrimitiveTypeName(javaType); (*variables)["boxed_type"] = BoxedPrimitiveTypeName(javaType); + (*variables)["kt_type"] = KotlinTypeName(javaType); (*variables)["field_type"] = (*variables)["type"]; (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); (*variables)["capitalized_type"] = GetCapitalizedType(descriptor, /* immutable = */ true); (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); + StrCat(static_cast(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); (*variables)["required"] = descriptor->is_required() ? "true" : "false"; @@ -126,7 +129,8 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, if (IsReferenceType(javaType)) { // We use `x.getClass()` as a null check because it generates less bytecode // than an `if (x == null) { throw ... }` statement. - (*variables)["null_check"] = " value.getClass();\n"; + (*variables)["null_check"] = + " java.lang.Class valueClass = value.getClass();\n"; } else { (*variables)["null_check"] = ""; } @@ -134,12 +138,17 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; int fixed_size = FixedSize(GetType(descriptor)); if (fixed_size != -1) { (*variables)["fixed_size"] = StrCat(fixed_size); } - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); @@ -155,18 +164,28 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["set_has_field_bit_message"] = ""; (*variables)["clear_has_field_bit_message"] = ""; - if (descriptor->type() == FieldDescriptor::TYPE_BYTES) { - (*variables)["is_field_present_message"] = - "!" + (*variables)["name"] + "_.isEmpty()"; - } else { - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != " + (*variables)["default"]; + switch (descriptor->type()) { + case FieldDescriptor::TYPE_BYTES: + (*variables)["is_field_present_message"] = + "!" + (*variables)["name"] + "_.isEmpty()"; + break; + case FieldDescriptor::TYPE_FLOAT: + (*variables)["is_field_present_message"] = + "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] + + "_) != 0"; + break; + case FieldDescriptor::TYPE_DOUBLE: + (*variables)["is_field_present_message"] = + "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] + + "_) != 0"; + break; + default: + (*variables)["is_field_present_message"] = + (*variables)["name"] + "_ != " + (*variables)["default"]; + break; } } - // For repeated builders, the underlying list tracks mutability state. - (*variables)["is_mutable"] = (*variables)["name"] + "_.isModifiable()"; - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -190,12 +209,12 @@ ImmutablePrimitiveFieldLiteGenerator::ImmutablePrimitiveFieldLiteGenerator( ImmutablePrimitiveFieldLiteGenerator::~ImmutablePrimitiveFieldLiteGenerator() {} int ImmutablePrimitiveFieldLiteGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } void ImmutablePrimitiveFieldLiteGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -215,7 +234,7 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateMembers( } printer->Print(variables_, "private $field_type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -261,7 +280,7 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateMembers( void ImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -303,12 +322,41 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteIntToUtf16CharSequence(messageBitIndex_, output); } printer->Print(variables_, "\"$name$_\",\n"); @@ -346,16 +394,14 @@ ImmutablePrimitiveOneofFieldLiteGenerator:: void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, @@ -387,7 +433,7 @@ void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateMembers( } void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); @@ -396,16 +442,14 @@ void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateFieldInfo( void ImmutablePrimitiveOneofFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return instance.has$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return instance.has$capitalized_name$();\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, @@ -511,9 +555,11 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateMembers( printer->Print( variables_, "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$is_mutable$) {\n" + // Use a temporary to avoid a redundant iget-object. + " $field_list_type$ tmp = $name$_;\n" + " if (!tmp.isModifiable()) {\n" " $name$_ =\n" - " com.google.protobuf.GeneratedMessageLite.mutableCopy($name$_);\n" + " com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);\n" " }\n" "}\n"); @@ -616,8 +662,102 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "add(value: $kt_type$) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(value: $kt_type$) {\n" + " add(value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" + " addAll(values)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "set(index: kotlin.Int, value: $kt_type$) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.h similarity index 76% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.h index 5867cee74..dfafae392 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_primitive_field_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_primitive_field_lite.h @@ -35,8 +35,10 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_LITE_H__ +#include #include #include + #include namespace google { @@ -60,19 +62,20 @@ class ImmutablePrimitiveFieldLiteGenerator public: explicit ImmutablePrimitiveFieldLiteGenerator( const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutablePrimitiveFieldLiteGenerator(); + ~ImmutablePrimitiveFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator // ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -92,11 +95,11 @@ class ImmutablePrimitiveOneofFieldLiteGenerator Context* context); ~ImmutablePrimitiveOneofFieldLiteGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldLiteGenerator); @@ -107,18 +110,19 @@ class RepeatedImmutablePrimitiveFieldLiteGenerator public: explicit RepeatedImmutablePrimitiveFieldLiteGenerator( const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - virtual ~RepeatedImmutablePrimitiveFieldLiteGenerator(); + ~RepeatedImmutablePrimitiveFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_service.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_service.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_service.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_service.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_service.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_service.h similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_service.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_service.h index 1c82c16c1..81db51948 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_service.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_service.h @@ -80,7 +80,7 @@ class ImmutableServiceGenerator : public ServiceGenerator { Context* context); virtual ~ImmutableServiceGenerator(); - virtual void Generate(io::Printer* printer); + void Generate(io::Printer* printer) override; private: // Generate the getDescriptorForType() method. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_shared_code_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_shared_code_generator.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_shared_code_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_shared_code_generator.cc index f673e6830..45943d762 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_shared_code_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_shared_code_generator.cc @@ -36,6 +36,7 @@ #include #include +#include #include #include #include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_shared_code_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_shared_code_generator.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_shared_code_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_shared_code_generator.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.cc similarity index 83% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.cc index 4dec3940c..7a3b458e9 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.cc @@ -33,6 +33,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -42,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -71,13 +73,16 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, "= " + ImmutableDefaultValue(descriptor, name_resolver); (*variables)["capitalized_type"] = "String"; (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); + StrCat(static_cast(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); (*variables)["null_check"] = " if (value == null) {\n" " throw new NullPointerException();\n" " }\n"; + (*variables)["isStringEmpty"] = "com.google.protobuf.GeneratedMessage" + + GeneratedCodeVersionSuffix() + + ".isStringEmpty"; (*variables)["writeString"] = "com.google.protobuf.GeneratedMessage" + GeneratedCodeVersionSuffix() + ".writeString"; (*variables)["computeStringSize"] = "com.google.protobuf.GeneratedMessage" + @@ -88,9 +93,14 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["on_changed"] = "onChanged();"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); @@ -110,7 +120,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["clear_has_field_bit_builder"] = ""; (*variables)["is_field_present_message"] = - "!get" + (*variables)["capitalized_name"] + "Bytes().isEmpty()"; + "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)"; } // For repeated builders, one bit is used for whether the array is immutable. @@ -118,13 +128,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["set_mutable_bit_builder"] = GenerateSetBit(builderBitIndex); (*variables)["clear_mutable_bit_builder"] = GenerateClearBit(builderBitIndex); - // For repeated fields, one bit is used for whether the array is immutable - // in the parsing constructor. - (*variables)["get_mutable_bit_parser"] = - GenerateGetBitMutableLocal(builderBitIndex); - (*variables)["set_mutable_bit_parser"] = - GenerateSetBitMutableLocal(builderBitIndex); - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -147,7 +150,7 @@ ImmutableStringFieldGenerator::ImmutableStringFieldGenerator( ImmutableStringFieldGenerator::~ImmutableStringFieldGenerator() {} int ImmutableStringFieldGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } int ImmutableStringFieldGenerator::GetNumBitsForBuilder() const { @@ -157,7 +160,7 @@ int ImmutableStringFieldGenerator::GetNumBitsForBuilder() const { // A note about how strings are handled. This code used to just store a String // in the Message. This had two issues: // -// 1. It wouldn't roundtrip byte arrays that were not vaid UTF-8 encoded +// 1. It wouldn't roundtrip byte arrays that were not valid UTF-8 encoded // strings, but rather fields that were raw bytes incorrectly marked // as strings in the proto file. This is common because in the proto1 // syntax, string was the way to indicate bytes and C++ engineers can @@ -188,7 +191,7 @@ int ImmutableStringFieldGenerator::GetNumBitsForBuilder() const { // UnmodifiableLazyStringList. void ImmutableStringFieldGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -207,10 +210,11 @@ void ImmutableStringFieldGenerator::GenerateMembers( printer->Print(variables_, "private volatile java.lang.Object $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" " return $get_has_field_bit_message$;\n" "}\n"); @@ -220,6 +224,7 @@ void ImmutableStringFieldGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" " java.lang.Object ref = $name$_;\n" " if (ref instanceof java.lang.String) {\n" @@ -243,6 +248,7 @@ void ImmutableStringFieldGenerator::GenerateMembers( "}\n"); WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public com.google.protobuf.ByteString\n" " ${$get$capitalized_name$Bytes$}$() {\n" " java.lang.Object ref = $name$_;\n" @@ -263,7 +269,7 @@ void ImmutableStringFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { printer->Print(variables_, "private java.lang.Object $name$_ $default_init$;\n"); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -362,6 +368,35 @@ void ImmutableStringFieldGenerator::GenerateBuilderMembers( "}\n"); } +void ImmutableStringFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: kotlin.String\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutableStringFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for primitives @@ -381,7 +416,7 @@ void ImmutableStringFieldGenerator::GenerateBuilderClearCode( void ImmutableStringFieldGenerator::GenerateMergingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { // Allow a slight breach of abstraction here in order to avoid forcing // all string fields to Strings when copying fields from a Message. printer->Print(variables_, @@ -401,7 +436,7 @@ void ImmutableStringFieldGenerator::GenerateMergingCode( void ImmutableStringFieldGenerator::GenerateBuildingCode( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { printer->Print(variables_, "if ($get_has_field_bit_from_local$) {\n" " $set_has_field_bit_to_local$;\n" @@ -410,26 +445,19 @@ void ImmutableStringFieldGenerator::GenerateBuildingCode( printer->Print(variables_, "result.$name$_ = $name$_;\n"); } -void ImmutableStringFieldGenerator::GenerateParsingCode( +void ImmutableStringFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { if (CheckUtf8(descriptor_)) { printer->Print(variables_, - "java.lang.String s = input.readStringRequireUtf8();\n" - "$set_has_field_bit_message$\n" - "$name$_ = s;\n"); + "$name$_ = input.readStringRequireUtf8();\n" + "$set_has_field_bit_builder$\n"); } else { printer->Print(variables_, - "com.google.protobuf.ByteString bs = input.readBytes();\n" - "$set_has_field_bit_message$\n" - "$name$_ = bs;\n"); + "$name$_ = input.readBytes();\n" + "$set_has_field_bit_builder$\n"); } } -void ImmutableStringFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - // noop for strings. -} - void ImmutableStringFieldGenerator::GenerateSerializationCode( io::Printer* printer) const { printer->Print(variables_, @@ -481,16 +509,13 @@ ImmutableStringOneofFieldGenerator::~ImmutableStringOneofFieldGenerator() {} void ImmutableStringOneofFieldGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -548,19 +573,19 @@ void ImmutableStringOneofFieldGenerator::GenerateMembers( void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( variables_, + "@java.lang.Override\n" "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n" " java.lang.Object ref $default_init$;\n" " if ($has_oneof_case_message$) {\n" @@ -590,6 +615,7 @@ void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers( WriteFieldStringBytesAccessorDocComment(printer, descriptor_, GETTER); printer->Print(variables_, + "@java.lang.Override\n" "$deprecation$public com.google.protobuf.ByteString\n" " ${$get$capitalized_name$Bytes$}$() {\n" " java.lang.Object ref $default_init$;\n" @@ -655,6 +681,11 @@ void ImmutableStringOneofFieldGenerator::GenerateBuilderMembers( "}\n"); } +void ImmutableStringOneofFieldGenerator::GenerateBuilderClearCode( + io::Printer* printer) const { + // No-Op: String fields in oneofs are correctly cleared by clearing the oneof +} + void ImmutableStringOneofFieldGenerator::GenerateMergingCode( io::Printer* printer) const { // Allow a slight breach of abstraction here in order to avoid forcing @@ -673,7 +704,7 @@ void ImmutableStringOneofFieldGenerator::GenerateBuildingCode( "}\n"); } -void ImmutableStringOneofFieldGenerator::GenerateParsingCode( +void ImmutableStringOneofFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { if (CheckUtf8(descriptor_)) { printer->Print(variables_, @@ -795,7 +826,7 @@ void RepeatedImmutableStringFieldGenerator::GenerateBuilderMembers( // list is immutable. If it's immutable, the invariant is that it must // either an instance of Collections.emptyList() or it's an ArrayList // wrapped in a Collections.unmodifiableList() wrapper and nobody else has - // a refererence to the underlying ArrayList. This invariant allows us to + // a reference to the underlying ArrayList. This invariant allows us to // share instances of lists between protocol buffers avoiding expensive // memory allocations. Note, immutable is a strong guarantee here -- not // just that the list cannot be modified via the reference but that the @@ -913,6 +944,107 @@ void RepeatedImmutableStringFieldGenerator::GenerateBuilderMembers( "}\n"); } +void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + // property for List + WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); + printer->Print(variables_, + "$kt_deprecation$public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + // List.add(String) + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "add(value: kotlin.String) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}\n"); + + // List += String + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "." + "plusAssign(value: kotlin.String) {\n" + " add(value)\n" + "}\n"); + + // List.addAll(Iterable) + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "addAll(values: kotlin.collections.Iterable) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}\n"); + + // List += Iterable + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "." + "plusAssign(values: kotlin.collections.Iterable) {\n" + " addAll(values)\n" + "}\n"); + + // List[Int] = String + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "." + "set(index: kotlin.Int, value: kotlin.String) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + void RepeatedImmutableStringFieldGenerator:: GenerateFieldBuilderInitializationCode(io::Printer* printer) const { // noop for primitives @@ -963,35 +1095,21 @@ void RepeatedImmutableStringFieldGenerator::GenerateBuildingCode( "result.$name$_ = $name$_;\n"); } -void RepeatedImmutableStringFieldGenerator::GenerateParsingCode( +void RepeatedImmutableStringFieldGenerator::GenerateBuilderParsingCode( io::Printer* printer) const { if (CheckUtf8(descriptor_)) { printer->Print(variables_, - "java.lang.String s = input.readStringRequireUtf8();\n"); + "java.lang.String s = input.readStringRequireUtf8();\n" + "ensure$capitalized_name$IsMutable();\n" + "$name$_.add(s);\n"); } else { printer->Print(variables_, - "com.google.protobuf.ByteString bs = input.readBytes();\n"); - } - printer->Print(variables_, - "if (!$get_mutable_bit_parser$) {\n" - " $name$_ = new com.google.protobuf.LazyStringArrayList();\n" - " $set_mutable_bit_parser$;\n" - "}\n"); - if (CheckUtf8(descriptor_)) { - printer->Print(variables_, "$name$_.add(s);\n"); - } else { - printer->Print(variables_, "$name$_.add(bs);\n"); + "com.google.protobuf.ByteString bs = input.readBytes();\n" + "ensure$capitalized_name$IsMutable();\n" + "$name$_.add(bs);\n"); } } -void RepeatedImmutableStringFieldGenerator::GenerateParsingDoneCode( - io::Printer* printer) const { - printer->Print(variables_, - "if ($get_mutable_bit_parser$) {\n" - " $name$_ = $name$_.getUnmodifiableView();\n" - "}\n"); -} - void RepeatedImmutableStringFieldGenerator::GenerateSerializationCode( io::Printer* printer) const { printer->Print(variables_, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.h similarity index 59% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.h index 1c00ae81c..47517649e 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field.h @@ -65,24 +65,25 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator { // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -102,13 +103,14 @@ class ImmutableStringOneofFieldGenerator ~ImmutableStringOneofFieldGenerator(); private: - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldGenerator); }; @@ -118,27 +120,28 @@ class RepeatedImmutableStringFieldGenerator : public ImmutableFieldGenerator { explicit RepeatedImmutableStringFieldGenerator( const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, Context* context); - ~RepeatedImmutableStringFieldGenerator(); + ~RepeatedImmutableStringFieldGenerator() override; // implements ImmutableFieldGenerator --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - - std::string GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateBuilderParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode( + io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.cc index b2f22a5ff..183390331 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.cc @@ -33,6 +33,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. +#include + +#include #include #include @@ -42,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -72,20 +74,26 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, "= " + ImmutableDefaultValue(descriptor, name_resolver); (*variables)["capitalized_type"] = "java.lang.String"; (*variables)["tag"] = - StrCat(static_cast(WireFormat::MakeTag(descriptor))); + StrCat(static_cast(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // We use `x.getClass()` as a null check because it generates less bytecode // than an `if (x == null) { throw ... }` statement. - (*variables)["null_check"] = " value.getClass();\n"; + (*variables)["null_check"] = + " java.lang.Class valueClass = value.getClass();\n"; // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; + (*variables)["kt_deprecation"] = + descriptor->options().deprecated() + ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] + + " is deprecated\") " + : ""; (*variables)["required"] = descriptor->is_required() ? "true" : "false"; - if (SupportFieldPresence(descriptor->file())) { + if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); @@ -104,9 +112,6 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, "!" + (*variables)["name"] + "_.isEmpty()"; } - // For repeated builders, the underlying list tracks mutability state. - (*variables)["is_mutable"] = (*variables)["name"] + "_.isModifiable()"; - (*variables)["get_has_field_bit_from_local"] = GenerateGetBitFromLocal(builderBitIndex); (*variables)["set_has_field_bit_to_local"] = @@ -130,14 +135,14 @@ ImmutableStringFieldLiteGenerator::ImmutableStringFieldLiteGenerator( ImmutableStringFieldLiteGenerator::~ImmutableStringFieldLiteGenerator() {} int ImmutableStringFieldLiteGenerator::GetNumBitsForMessage() const { - return SupportFieldPresence(descriptor_->file()) ? 1 : 0; + return HasHasbit(descriptor_) ? 1 : 0; } // A note about how strings are handled. In the SPEED and CODE_SIZE runtimes, // strings are not stored as java.lang.String in the Message because of two // issues: // -// 1. It wouldn't roundtrip byte arrays that were not vaid UTF-8 encoded +// 1. It wouldn't roundtrip byte arrays that were not valid UTF-8 encoded // strings, but rather fields that were raw bytes incorrectly marked // as strings in the proto file. This is common because in the proto1 // syntax, string was the way to indicate bytes and C++ engineers can @@ -160,7 +165,7 @@ int ImmutableStringFieldLiteGenerator::GetNumBitsForMessage() const { // shouldn't be necessary or used on devices. void ImmutableStringFieldLiteGenerator::GenerateInterfaceMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print(variables_, "$deprecation$boolean has$capitalized_name$();\n"); @@ -179,7 +184,7 @@ void ImmutableStringFieldLiteGenerator::GenerateMembers( printer->Print(variables_, "private java.lang.String $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -241,7 +246,7 @@ void ImmutableStringFieldLiteGenerator::GenerateMembers( void ImmutableStringFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { + if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); printer->Print( variables_, @@ -304,12 +309,41 @@ void ImmutableStringFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void ImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + WriteFieldDocComment(printer, descriptor_); + printer->Print(variables_, + "$kt_deprecation$public var $kt_name$: kotlin.String\n" + " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" + " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" + " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" + " set(value) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (HasHazzer(descriptor_)) { + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + void ImmutableStringFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); - if (SupportFieldPresence(descriptor_->file())) { + if (HasHasbit(descriptor_)) { WriteIntToUtf16CharSequence(messageBitIndex_, output); } printer->Print(variables_, "\"$name$_\",\n"); @@ -340,17 +374,14 @@ ImmutableStringOneofFieldLiteGenerator:: void ImmutableStringOneofFieldLiteGenerator::GenerateMembers( io::Printer* printer) const { PrintExtraFieldInfo(variables_, printer); - - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $has_oneof_case_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $has_oneof_case_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -412,7 +443,7 @@ void ImmutableStringOneofFieldLiteGenerator::GenerateMembers( } void ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); @@ -421,16 +452,14 @@ void ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo( void ImmutableStringOneofFieldLiteGenerator::GenerateBuilderMembers( io::Printer* printer) const { - if (SupportFieldPresence(descriptor_->file())) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return instance.has$capitalized_name$();\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + GOOGLE_DCHECK(HasHazzer(descriptor_)); + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return instance.has$capitalized_name$();\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); WriteFieldAccessorDocComment(printer, descriptor_, GETTER); printer->Print( @@ -567,9 +596,12 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateMembers( printer->Print( variables_, "private void ensure$capitalized_name$IsMutable() {\n" - " if (!$is_mutable$) {\n" + // Use a temporary to avoid a redundant iget-object. + " com.google.protobuf.Internal.ProtobufList tmp =\n" + " $name$_;" + " if (!tmp.isModifiable()) {\n" " $name$_ =\n" - " com.google.protobuf.GeneratedMessageLite.mutableCopy($name$_);\n" + " com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);\n" " }\n" "}\n"); @@ -706,8 +738,111 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_); } +void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( + io::Printer* printer) const { + printer->Print( + variables_, + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + // property for List + WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); + printer->Print( + variables_, + "$kt_deprecation$public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "\n" + " @kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); + + // List.add(String) + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "add(value: kotlin.String) {\n" + " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + "}\n"); + + // List += String + WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "." + "plusAssign(value: kotlin.String) {\n" + " add(value)\n" + "}\n"); + + // List.addAll(Iterable) + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "addAll(values: kotlin.collections.Iterable) {\n" + " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + "}\n"); + + // List += Iterable + WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" + "." + "plusAssign(values: kotlin.collections.Iterable) {\n" + " addAll(values)\n" + "}\n"); + + // List[Int] = String + WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, + /* builder */ false); + printer->Print( + variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" + "public operator fun com.google.protobuf.kotlin.DslList" + "." + "set(index: kotlin.Int, value: kotlin.String) {\n" + " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, + /* builder */ false); + printer->Print(variables_, + "@kotlin.jvm.JvmSynthetic\n" + "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" + "public fun com.google.protobuf.kotlin.DslList" + "." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + void RepeatedImmutableStringFieldLiteGenerator::GenerateFieldInfo( - io::Printer* printer, std::vector* output) const { + io::Printer* printer, std::vector* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); WriteIntToUtf16CharSequence(GetExperimentalJavaFieldType(descriptor_), output); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.h similarity index 75% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.h index b67135cd8..85ec60277 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/java/java_string_field_lite.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/java/java_string_field_lite.h @@ -36,8 +36,10 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_LITE_H__ +#include #include #include + #include namespace google { @@ -61,19 +63,20 @@ class ImmutableStringFieldLiteGenerator : public ImmutableFieldLiteGenerator { explicit ImmutableStringFieldLiteGenerator(const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutableStringFieldLiteGenerator(); + ~ImmutableStringFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator // ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -90,13 +93,13 @@ class ImmutableStringOneofFieldLiteGenerator public: ImmutableStringOneofFieldLiteGenerator(const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~ImmutableStringOneofFieldLiteGenerator(); + ~ImmutableStringOneofFieldLiteGenerator() override; private: - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldLiteGenerator); }; @@ -106,18 +109,19 @@ class RepeatedImmutableStringFieldLiteGenerator public: explicit RepeatedImmutableStringFieldLiteGenerator( const FieldDescriptor* descriptor, int messageBitIndex, Context* context); - ~RepeatedImmutableStringFieldLiteGenerator(); + ~RepeatedImmutableStringFieldLiteGenerator() override; // implements ImmutableFieldLiteGenerator ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector* output) const; + std::vector* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - std::string GetBoxedType() const; + std::string GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.cc similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.cc index e85343684..d2dac2f60 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.cc @@ -28,9 +28,19 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include #include #include #include @@ -39,17 +49,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - namespace google { namespace protobuf { namespace compiler { @@ -95,19 +94,6 @@ bool IsReserved(const std::string& ident) { return false; } -bool StrEndsWith(StringPiece sp, StringPiece x) { - return sp.size() >= x.size() && sp.substr(sp.size() - x.size()) == x; -} - -// Returns a copy of |filename| with any trailing ".protodevel" or ".proto -// suffix stripped. -// TODO(haberman): Unify with copy in compiler/cpp/internal/helpers.cc. -std::string StripProto(const std::string& filename) { - const char* suffix = - StrEndsWith(filename, ".protodevel") ? ".protodevel" : ".proto"; - return StripSuffixString(filename, suffix); -} - std::string GetSnakeFilename(const std::string& filename) { std::string snake_name = filename; ReplaceCharacters(&snake_name, "/", '_'); @@ -182,8 +168,8 @@ std::string GetNestedMessageName(const Descriptor* descriptor) { if (descriptor == NULL) { return ""; } - std::string result = StripPrefixString( - descriptor->full_name(), descriptor->file()->package()); + std::string result = + StripPrefixString(descriptor->full_name(), descriptor->file()->package()); // Add a leading dot if one is not already present. if (!result.empty() && result[0] != '.') { result = "." + result; @@ -420,7 +406,7 @@ std::string GetMessagesFileName(const GeneratorOptions& options, const SCC* scc, GetSnakeFilename(scc->GetRepresentative()->file()->name())); (*long_name_dict)[scc->GetRepresentative()] = StrCat(snake_name, "_long_sccs_", - static_cast((*long_name_dict).size())); + static_cast((*long_name_dict).size())); } filename_base = (*long_name_dict)[scc->GetRepresentative()]; } @@ -440,9 +426,7 @@ std::string GetEnumFileName(const GeneratorOptions& options, } // Returns the message/response ID, if set. -std::string GetMessageId(const Descriptor* desc) { - return std::string(); -} +std::string GetMessageId(const Descriptor* desc) { return std::string(); } bool IgnoreExtensionField(const FieldDescriptor* field) { // Exclude descriptor extensions from output "to avoid clutter" (from original @@ -453,7 +437,6 @@ bool IgnoreExtensionField(const FieldDescriptor* field) { file->name() == "google/protobuf/descriptor.proto"; } - // Used inside Google only -- do not remove. bool IsResponse(const Descriptor* desc) { return false; } @@ -461,12 +444,12 @@ bool IgnoreField(const FieldDescriptor* field) { return IgnoreExtensionField(field); } - // Do we ignore this message type? bool IgnoreMessage(const Descriptor* d) { return d->options().map_entry(); } // Does JSPB ignore this entire oneof? True only if all fields are ignored. bool IgnoreOneof(const OneofDescriptor* oneof) { + if (oneof->is_synthetic()) return true; for (int i = 0; i < oneof->field_count(); i++) { if (!IgnoreField(oneof->field(i))) { return false; @@ -545,7 +528,6 @@ std::string JSGetterName(const GeneratorOptions& options, return name; } - std::string JSOneofName(const OneofDescriptor* oneof) { return ToUpperCamel(ParseLowerUnderscore(oneof->name())); } @@ -576,6 +558,7 @@ std::string JSOneofIndex(const OneofDescriptor* oneof) { int index = -1; for (int i = 0; i < oneof->containing_type()->oneof_decl_count(); i++) { const OneofDescriptor* o = oneof->containing_type()->oneof_decl(i); + if (o->is_synthetic()) continue; // If at least one field in this oneof is not JSPB-ignored, count the oneof. for (int j = 0; j < o->field_count(); j++) { const FieldDescriptor* f = o->field(j); @@ -794,6 +777,11 @@ std::string DoubleToString(double value) { return PostProcessFloat(result); } +bool InRealOneof(const FieldDescriptor* field) { + return field->containing_oneof() && + !field->containing_oneof()->is_synthetic(); +} + // Return true if this is an integral field that should be represented as string // in JS. bool IsIntegralFieldWithStringJSType(const FieldDescriptor* field) { @@ -820,23 +808,19 @@ std::string JSFieldDefault(const FieldDescriptor* field) { switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - return MaybeNumberString(field, - StrCat(field->default_value_int32())); + return MaybeNumberString(field, StrCat(field->default_value_int32())); case FieldDescriptor::CPPTYPE_UINT32: // The original codegen is in Java, and Java protobufs store unsigned // integer values as signed integer values. In order to exactly match the // output, we need to reinterpret as base-2 signed. Ugh. return MaybeNumberString( - field, - StrCat(static_cast(field->default_value_uint32()))); + field, StrCat(static_cast(field->default_value_uint32()))); case FieldDescriptor::CPPTYPE_INT64: - return MaybeNumberString(field, - StrCat(field->default_value_int64())); + return MaybeNumberString(field, StrCat(field->default_value_int64())); case FieldDescriptor::CPPTYPE_UINT64: // See above note for uint32 -- reinterpreting as signed. return MaybeNumberString( - field, - StrCat(static_cast(field->default_value_uint64()))); + field, StrCat(static_cast(field->default_value_uint64()))); case FieldDescriptor::CPPTYPE_ENUM: return StrCat(field->default_value_enum()->number()); case FieldDescriptor::CPPTYPE_BOOL: @@ -851,9 +835,10 @@ std::string JSFieldDefault(const FieldDescriptor* field) { bool is_valid = EscapeJSString(field->default_value_string(), &out); if (!is_valid) { // TODO(b/115551870): Decide whether this should be a hard error. - GOOGLE_LOG(WARNING) << "The default value for field " << field->full_name() - << " was truncated since it contained invalid UTF-8 or" - " codepoints outside the basic multilingual plane."; + GOOGLE_LOG(WARNING) + << "The default value for field " << field->full_name() + << " was truncated since it contained invalid UTF-8 or" + " codepoints outside the basic multilingual plane."; } return "\"" + out + "\""; } else { // Bytes @@ -1116,7 +1101,6 @@ std::string JSBinaryWriterMethodName(const GeneratorOptions& options, JSBinaryReadWriteMethodName(field, /* is_writer = */ true); } - std::string JSTypeTag(const FieldDescriptor* desc) { switch (desc->type()) { case FieldDescriptor::TYPE_DOUBLE: @@ -1151,7 +1135,6 @@ std::string JSTypeTag(const FieldDescriptor* desc) { return ""; } - bool HasRepeatedFields(const GeneratorOptions& options, const Descriptor* desc) { for (int i = 0; i < desc->field_count(); i++) { @@ -1173,7 +1156,7 @@ std::string RepeatedFieldsArrayName(const GeneratorOptions& options, bool HasOneofFields(const Descriptor* desc) { for (int i = 0; i < desc->field_count(); i++) { - if (desc->field(i)->containing_oneof()) { + if (InRealOneof(desc->field(i))) { return true; } } @@ -1411,15 +1394,9 @@ std::string GetPivot(const Descriptor* desc) { // generate extra methods (clearFoo() and hasFoo()) for this field. bool HasFieldPresence(const GeneratorOptions& options, const FieldDescriptor* field) { - if (field->is_repeated() || field->is_map()) { - // We say repeated fields and maps don't have presence, but we still do - // generate clearFoo() methods for them through a special case elsewhere. - return false; - } - - return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - field->containing_oneof() != NULL || - field->file()->syntax() == FileDescriptor::SYNTAX_PROTO2; + // This returns false for repeated fields and maps, but we still do + // generate clearFoo() methods for these through a special case elsewhere. + return field->has_presence(); } // We use this to implement the semantics that same file can be generated @@ -1431,24 +1408,17 @@ bool HasFieldPresence(const GeneratorOptions& options, // were the final one for a given filename. class FileDeduplicator { public: - explicit FileDeduplicator(const GeneratorOptions& options) - : error_on_conflict_(options.error_on_name_conflict) {} + explicit FileDeduplicator(const GeneratorOptions& options) {} // params: // filenames: a pair of {short filename, full filename} // (short filename don't have extra information, full filename // contains extra information) // desc: The Descriptor or SCC pointer or EnumDescriptor. - // error: The returned error information. bool AddFile(const std::pair filenames, - const void* desc, std::string* error) { + const void* desc) { if (descs_by_shortname_.find(filenames.first) != descs_by_shortname_.end()) { - if (error_on_conflict_) { - *error = "Name conflict: file name " + filenames.first + - " would be generated by two descriptors"; - return false; - } // Change old pointer's actual name to full name. auto short_name_desc = descs_by_shortname_[filenames.first]; allowed_descs_actual_name_[short_name_desc] = @@ -1466,7 +1436,6 @@ class FileDeduplicator { } private: - bool error_on_conflict_; // The map that restores all the descs that are using short name as filename. std::map descs_by_shortname_; // The final actual filename map. @@ -1529,8 +1498,6 @@ void GenerateJspbFileOrder(const std::vector& input, ordered->end()); } -} // namespace - // If we're generating code in file-per-type mode, avoid overwriting files // by choosing the last descriptor that writes each filename and permitting // only those to generate code. @@ -1559,13 +1526,10 @@ struct DepsGenerator { } }; -namespace { - bool GenerateJspbAllowedMap(const GeneratorOptions& options, const std::vector& files, std::map* allowed_set, - SCCAnalyzer* analyzer, - std::string* error) { + SCCAnalyzer* analyzer) { std::vector files_ordered; GenerateJspbFileOrder(files, &files_ordered); @@ -1580,7 +1544,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, std::make_pair( GetMessagesFileName(options, analyzer->GetSCC(desc), false), GetMessagesFileName(options, analyzer->GetSCC(desc), true)), - analyzer->GetSCC(desc), error)) { + analyzer->GetSCC(desc))) { return false; } } @@ -1588,7 +1552,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, const EnumDescriptor* desc = files_ordered[i]->enum_type(j); if (!dedup.AddFile(std::make_pair(GetEnumFileName(options, desc, false), GetEnumFileName(options, desc, true)), - desc, error)) { + desc)) { return false; } } @@ -1607,7 +1571,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, std::make_pair( GetExtensionFileName(options, files_ordered[i], false), GetExtensionFileName(options, files_ordered[i], true)), - files_ordered[i], error)) { + files_ordered[i])) { return false; } } @@ -1650,6 +1614,8 @@ void Generator::GenerateHeader(const GeneratorOptions& options, "/**\n" " * @fileoverview\n" " * @enhanceable\n" + // TODO(b/152440355): requireType/requires diverged from internal version. + " * @suppress {missingRequire} reports error on implicit type usages.\n" " * @suppress {messageConventions} JS Compiler reports an " "error if a variable or\n" " * field starts with 'MSG_' and isn't a translatable " @@ -1657,6 +1623,8 @@ void Generator::GenerateHeader(const GeneratorOptions& options, " * @public\n" " */\n" "// GENERATED CODE -- DO NOT EDIT!\n" + "/* eslint-disable */\n" + "// @ts-nocheck\n" "\n"); } @@ -1912,16 +1880,13 @@ void Generator::GenerateRequiresImpl(const GeneratorOptions& options, } } -bool NamespaceOnly(const Descriptor* desc) { - return false; -} +bool NamespaceOnly(const Descriptor* desc) { return false; } void Generator::FindRequiresForMessage(const GeneratorOptions& options, const Descriptor* desc, std::set* required, std::set* forwards, bool* have_message) const { - if (!NamespaceOnly(desc)) { *have_message = true; for (int i = 0; i < desc->field_count(); i++) { @@ -1970,7 +1935,8 @@ void Generator::FindRequiresForField(const GeneratorOptions& options, void Generator::FindRequiresForExtension( const GeneratorOptions& options, const FieldDescriptor* field, std::set* required, std::set* forwards) const { - if (field->containing_type()->full_name() != "google.protobuf.bridge.MessageSet") { + if (field->containing_type()->full_name() != + "google.protobuf.bridge.MessageSet") { required->insert(GetMessagePath(options, field->containing_type())); } FindRequiresForField(options, field, required, forwards); @@ -2010,7 +1976,6 @@ void Generator::GenerateClass(const GeneratorOptions& options, printer->Print("\n"); GenerateClassFieldInfo(options, printer, desc); - GenerateClassToObject(options, printer, desc); // These must come *before* the extension-field info generation in // GenerateClassRegistration so that references to the binary @@ -2094,7 +2059,8 @@ void Generator::GenerateClassConstructorAndDeclareExtensionFieldInfo( const Descriptor* desc) const { if (!NamespaceOnly(desc)) { GenerateClassConstructor(options, printer, desc); - if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { + if (IsExtendable(desc) && + desc->full_name() != "google.protobuf.bridge.MessageSet") { GenerateClassExtensionFieldInfo(options, printer, desc); } } @@ -2534,7 +2500,6 @@ void Generator::GenerateClassRegistration(const GeneratorOptions& options, GenerateExtension(options, printer, extension); } } - } void Generator::GenerateClassFields(const GeneratorOptions& options, @@ -2680,7 +2645,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* singular_if_not_packed = */ false), "class", GetMessagePath(options, field->containing_type()), "settername", "set" + JSGetterName(options, field), "oneoftag", - (field->containing_oneof() ? "Oneof" : ""), "repeatedtag", + (InRealOneof(field) ? "Oneof" : ""), "repeatedtag", (field->is_repeated() ? "Repeated" : "")); printer->Annotate("settername", field); @@ -2690,16 +2655,14 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "\n" "\n", "index", JSFieldIndex(field), "oneofgroup", - (field->containing_oneof() ? (", " + JSOneofArray(options, field)) - : "")); + (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : "")); if (field->is_repeated()) { GenerateRepeatedMessageHelperMethods(options, printer, field); } } else { - bool untyped = - false; + bool untyped = false; // Simple (primitive) field, either singular or repeated. @@ -2815,8 +2778,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " return jspb.Message.set$oneoftag$Field(this, $index$", "class", GetMessagePath(options, field->containing_type()), "settername", "set" + JSGetterName(options, field), "oneoftag", - (field->containing_oneof() ? "Oneof" : ""), "index", - JSFieldIndex(field)); + (InRealOneof(field) ? "Oneof" : ""), "index", JSFieldIndex(field)); printer->Annotate("settername", field); printer->Print( "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);\n" @@ -2826,8 +2788,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "type", untyped ? "/** @type{string|number|boolean|Array|undefined} */(" : "", "typeclose", untyped ? ")" : "", "oneofgroup", - (field->containing_oneof() ? (", " + JSOneofArray(options, field)) - : ""), + (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "rptvalueinit", (field->is_repeated() ? " || []" : "")); } @@ -2903,8 +2864,8 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "$index$$maybeoneofgroup$, ", "class", GetMessagePath(options, field->containing_type()), "clearername", "clear" + JSGetterName(options, field), - "maybeoneof", (field->containing_oneof() ? "Oneof" : ""), - "maybeoneofgroup", (field->containing_oneof() + "maybeoneof", (InRealOneof(field) ? "Oneof" : ""), + "maybeoneofgroup", (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "index", JSFieldIndex(field)); @@ -2969,7 +2930,7 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( "\n", "type", untyped ? "/** @type{string|number|boolean|!Uint8Array} */(" : "", "typeclose", untyped ? ")" : "", "oneofgroup", - (field->containing_oneof() ? (", " + JSOneofArray(options, field)) : ""), + (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "rptvalueinit", ""); // clang-format on } @@ -2998,8 +2959,8 @@ void Generator::GenerateRepeatedMessageHelperMethods( "\n" "\n", "index", JSFieldIndex(field), "oneofgroup", - (field->containing_oneof() ? (", " + JSOneofArray(options, field)) : ""), - "ctor", GetMessagePath(options, field->message_type())); + (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "ctor", + GetMessagePath(options, field->message_type())); } void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, @@ -3050,7 +3011,6 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, } } - void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { @@ -3080,36 +3040,36 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, "$class$.deserializeBinaryFromReader = function(msg, reader) {\n" " while (reader.nextField()) {\n", "class", GetMessagePath(options, desc)); - printer->Print( - " if (reader.isEndGroup()) {\n" - " break;\n" - " }\n" - " var field = reader.getFieldNumber();\n" - " switch (field) {\n"); + printer->Print( + " if (reader.isEndGroup()) {\n" + " break;\n" + " }\n" + " var field = reader.getFieldNumber();\n" + " switch (field) {\n"); - for (int i = 0; i < desc->field_count(); i++) { - if (!IgnoreField(desc->field(i))) { - GenerateClassDeserializeBinaryField(options, printer, desc->field(i)); - } + for (int i = 0; i < desc->field_count(); i++) { + if (!IgnoreField(desc->field(i))) { + GenerateClassDeserializeBinaryField(options, printer, desc->field(i)); } + } - printer->Print(" default:\n"); - if (IsExtendable(desc)) { - printer->Print( - " jspb.Message.readBinaryExtension(msg, reader,\n" - " $extobj$Binary,\n" - " $class$.prototype.getExtension,\n" - " $class$.prototype.setExtension);\n" - " break;\n" - " }\n", - "extobj", JSExtensionsObjectName(options, desc->file(), desc), - "class", GetMessagePath(options, desc)); - } else { - printer->Print( - " reader.skipField();\n" - " break;\n" - " }\n"); - } + printer->Print(" default:\n"); + if (IsExtendable(desc)) { + printer->Print( + " jspb.Message.readBinaryExtension(msg, reader,\n" + " $extobj$Binary,\n" + " $class$.prototype.getExtension,\n" + " $class$.prototype.setExtension);\n" + " break;\n" + " }\n", + "extobj", JSExtensionsObjectName(options, desc->file(), desc), "class", + GetMessagePath(options, desc)); + } else { + printer->Print( + " reader.skipField();\n" + " break;\n" + " }\n"); + } printer->Print( " }\n" @@ -3167,6 +3127,15 @@ void Generator::GenerateClassDeserializeBinaryField( (field->type() == FieldDescriptor::TYPE_GROUP) ? (StrCat(field->number()) + ", ") : ""); + } else if (field->is_packable()) { + printer->Print( + " var values = /** @type {$fieldtype$} */ " + "(reader.isDelimited() " + "? reader.readPacked$reader$() : [reader.read$reader$()]);\n", + "fieldtype", + JSFieldTypeAnnotation(options, field, false, true, + /* singular_if_not_packed */ false, BYTES_U8), + "reader", JSBinaryReaderMethodType(field)); } else { printer->Print( " var value = /** @type {$fieldtype$} */ " @@ -3178,7 +3147,14 @@ void Generator::GenerateClassDeserializeBinaryField( JSBinaryReadWriteMethodName(field, /* is_writer = */ false)); } - if (field->is_repeated() && !field->is_packed()) { + if (field->is_packable()) { + printer->Print( + " for (var i = 0; i < values.length; i++) {\n" + " msg.add$name$(values[i]);\n" + " }\n", + "name", + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true)); + } else if (field->is_repeated()) { printer->Print( " msg.add$name$(value);\n", "name", JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true)); @@ -3378,9 +3354,8 @@ void Generator::GenerateEnum(const GeneratorOptions& options, for (auto i : valid_index) { const EnumValueDescriptor* value = enumdesc->value(i); printer->Print(" $name$: $value$$comma$\n", "name", - ToEnumCase(value->name()), "value", - StrCat(value->number()), "comma", - (i == valid_index.back()) ? "" : ","); + ToEnumCase(value->name()), "value", StrCat(value->number()), + "comma", (i == valid_index.back()) ? "" : ","); printer->Annotate("name", value); } @@ -3421,8 +3396,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options, "!Object} */ (\n" " $toObject$),\n" " $repeated$);\n", - "index", StrCat(field->number()), "name", extension_object_name, - "ctor", + "index", StrCat(field->number()), "name", extension_object_name, "ctor", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ? SubmessageTypeRef(options, field) : std::string("null")), @@ -3490,12 +3464,10 @@ bool GeneratorOptions::ParseFromOptions( return false; } testonly = true; + } else if (options[i].first == "error_on_name_conflict") { - if (options[i].second != "") { - *error = "Unexpected option value for error_on_name_conflict"; - return false; - } - error_on_name_conflict = true; + GOOGLE_LOG(WARNING) << "Ignoring error_on_name_conflict option, this " + "will be removed in a future release"; } else if (options[i].first == "output_dir") { output_dir = options[i].second; } else if (options[i].first == "namespace_prefix") { @@ -3544,11 +3516,10 @@ bool GeneratorOptions::ParseFromOptions( if (import_style != kImportClosure && (add_require_for_enums || testonly || !library.empty() || - error_on_name_conflict || extension != ".js" || - one_output_file_per_input_file)) { + extension != ".js" || one_output_file_per_input_file)) { *error = - "The add_require_for_enums, testonly, library, error_on_name_conflict, " - "extension, and one_output_file_per_input_file options should only be " + "The add_require_for_enums, testonly, library, extension, and " + "one_output_file_per_input_file options should only be " "used for import_style=closure"; return false; } @@ -3654,7 +3625,23 @@ void Generator::GenerateFile(const GeneratorOptions& options, if (options.import_style == GeneratorOptions::kImportCommonJsStrict) { printer->Print("var proto = {};\n\n"); } else { - printer->Print("var global = Function('return this')();\n\n"); + // To get the global object we call a function with .call(null), this will set "this" inside the + // function to the global object. + // This does not work if we are running in strict mode ("use strict"), + // so we fallback to the following things (in order from first to last): + // - window: defined in browsers + // - global: defined in most server side environments like NodeJS + // - self: defined inside Web Workers (WorkerGlobalScope) + // - Function('return this')(): this will work on most platforms, but it may be blocked by things like CSP. + // Function('') is almost the same as eval('') + printer->Print( + "var global = (function() {\n" + " if (this) { return this; }\n" + " if (typeof window !== 'undefined') { return window; }\n" + " if (typeof global !== 'undefined') { return global; }\n" + " if (typeof self !== 'undefined') { return self; }\n" + " return Function('return this')();\n" + "}.call(null));\n\n"); } for (int i = 0; i < file->dependency_count(); i++) { @@ -3729,7 +3716,6 @@ bool Generator::GenerateAll(const std::vector& files, return false; } - if (options.output_mode() == GeneratorOptions::kEverythingInOneFile) { // All output should go in a single file. std::string filename = options.output_dir + "/" + options.library + @@ -3784,8 +3770,7 @@ bool Generator::GenerateAll(const std::vector& files, std::set have_printed; SCCAnalyzer analyzer; std::map allowed_map; - if (!GenerateJspbAllowedMap(options, files, &allowed_map, &analyzer, - error)) { + if (!GenerateJspbAllowedMap(options, files, &allowed_map, &analyzer)) { return false; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.h index 49f19f6eb..cd9631afb 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/js_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/js_generator.h @@ -83,7 +83,6 @@ struct GeneratorOptions { add_require_for_enums(false), testonly(false), library(""), - error_on_name_conflict(false), extension(".js"), one_output_file_per_input_file(false), annotate_code(false) {} @@ -119,16 +118,14 @@ struct GeneratorOptions { // Create a library with name _lib.js rather than a separate .js file // per type? std::string library; - // Error if there are two types that would generate the same output file? - bool error_on_name_conflict; // The extension to use for output file names. std::string extension; // Create a separate output file for each input file? bool one_output_file_per_input_file; - // If true, we should append annotations as commen on the last line for + // If true, we should append annotations as comments on the last line for // generated .js file. Annotations used by tools like https://kythe.io // to provide cross-references between .js and .proto files. Annotations - // are enced as base64 proto of GeneratedCodeInfo message (see + // are encoded as base64 proto of GeneratedCodeInfo message (see // descriptor.proto). bool annotate_code; }; @@ -142,18 +139,21 @@ class PROTOC_EXPORT Generator : public CodeGenerator { Generator() {} virtual ~Generator() {} - virtual bool Generate(const FileDescriptor* file, - const std::string& parameter, GeneratorContext* context, - std::string* error) const { + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* context, std::string* error) const override { *error = "Unimplemented Generate() method. Call GenerateAll() instead."; return false; } - virtual bool HasGenerateAll() const { return true; } + bool HasGenerateAll() const override { return true; } - virtual bool GenerateAll(const std::vector& files, - const std::string& parameter, - GeneratorContext* context, std::string* error) const; + bool GenerateAll(const std::vector& files, + const std::string& parameter, GeneratorContext* context, + std::string* error) const override; + + uint64 GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL; + } private: void GenerateHeader(const GeneratorOptions& options, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/well_known_types_embed.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/well_known_types_embed.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/well_known_types_embed.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/well_known_types_embed.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/well_known_types_embed.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/well_known_types_embed.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/js/well_known_types_embed.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/js/well_known_types_embed.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/main.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/main.cc similarity index 77% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/main.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/main.cc index 8a14e8f84..7cb7a6375 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/main.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/main.cc @@ -28,20 +28,16 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Author: kenton@google.com (Kenton Varda) - -// 2021-06-16: rafal.somla@oracle.com -// Disabled all generators other than C++ - #include -//#include -//#include +#include +#include +#include #include -//#include -//#include -//#include -//#include -//#include +#include +#include +#include +#include +#include #include @@ -64,27 +60,30 @@ int ProtobufMain(int argc, char* argv[]) { cpp_generator.set_runtime_include_base(GOOGLE_PROTOBUF_RUNTIME_INCLUDE_BASE); #endif -#if 0 - // Proto2 Java java::JavaGenerator java_generator; cli.RegisterGenerator("--java_out", "--java_opt", &java_generator, "Generate Java source file."); + // Proto2 Kotlin + java::KotlinGenerator kt_generator; + cli.RegisterGenerator("--kotlin_out", "--kotlin_opt", &kt_generator, + "Generate Kotlin file."); + // Proto2 Python python::Generator py_generator; - cli.RegisterGenerator("--python_out", &py_generator, + cli.RegisterGenerator("--python_out", "--python_opt", &py_generator, "Generate Python source file."); // PHP php::Generator php_generator; - cli.RegisterGenerator("--php_out", &php_generator, + cli.RegisterGenerator("--php_out", "--php_opt", &php_generator, "Generate PHP source file."); // Ruby ruby::Generator rb_generator; - cli.RegisterGenerator("--ruby_out", &rb_generator, + cli.RegisterGenerator("--ruby_out", "--ruby_opt", &rb_generator, "Generate Ruby source file."); // CSharp @@ -92,18 +91,16 @@ int ProtobufMain(int argc, char* argv[]) { cli.RegisterGenerator("--csharp_out", "--csharp_opt", &csharp_generator, "Generate C# source file."); - // Objective C + // Objective-C objectivec::ObjectiveCGenerator objc_generator; cli.RegisterGenerator("--objc_out", "--objc_opt", &objc_generator, - "Generate Objective C header and source."); + "Generate Objective-C header and source."); // JavaScript js::Generator js_generator; - cli.RegisterGenerator("--js_out", &js_generator, + cli.RegisterGenerator("--js_out", "--js_opt", &js_generator, "Generate JavaScript source."); -#endif // 0 - return cli.Run(argc, argv); } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.cc similarity index 77% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.cc index e88b18bea..1fce10609 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.cc @@ -34,6 +34,7 @@ #include +#include #include #include #include @@ -87,6 +88,15 @@ MockCodeGenerator::MockCodeGenerator(const std::string& name) : name_(name) {} MockCodeGenerator::~MockCodeGenerator() {} +uint64_t MockCodeGenerator::GetSupportedFeatures() const { + uint64_t all_features = CodeGenerator::FEATURE_PROTO3_OPTIONAL; + return all_features & ~suppressed_features_; +} + +void MockCodeGenerator::SuppressFeatures(uint64_t features) { + suppressed_features_ = features; +} + void MockCodeGenerator::ExpectGenerated( const std::string& name, const std::string& parameter, const std::string& insertions, const std::string& file, @@ -110,7 +120,7 @@ void MockCodeGenerator::ExpectGenerated( std::vector insertion_list; if (!insertions.empty()) { - SplitStringUsing(insertions, ",", &insertion_list); + insertion_list = Split(insertions, ",", true); } EXPECT_EQ(lines.size(), 3 + insertion_list.size() * 2); @@ -157,17 +167,36 @@ void MockCodeGenerator::CheckGeneratedAnnotations( &file_content, true)); std::string meta_content; GOOGLE_CHECK_OK(File::GetContents( - output_directory + "/" + GetOutputFileName(name, file) + ".meta", + output_directory + "/" + GetOutputFileName(name, file) + ".pb.meta", &meta_content, true)); GeneratedCodeInfo annotations; GOOGLE_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); - ASSERT_EQ(3, annotations.annotation_size()); + ASSERT_EQ(7, annotations.annotation_size()); + CheckSingleAnnotation("first_annotation", "first", file_content, annotations.annotation(0)); + CheckSingleAnnotation("first_path", + "test_generator: first_insert,\n foo.proto,\n " + "MockCodeGenerator_Annotate,\n foo.proto\n", + file_content, annotations.annotation(1)); + CheckSingleAnnotation("first_path", + "test_plugin: first_insert,\n foo.proto,\n " + "MockCodeGenerator_Annotate,\n foo.proto\n", + file_content, annotations.annotation(2)); CheckSingleAnnotation("second_annotation", "second", file_content, - annotations.annotation(1)); + annotations.annotation(3)); + // This annotated text has changed because it was inserted at an indented + // insertion point. + CheckSingleAnnotation("second_path", + "test_generator: second_insert,\n foo.proto,\n " + "MockCodeGenerator_Annotate,\n foo.proto\n", + file_content, annotations.annotation(4)); + CheckSingleAnnotation("second_path", + "test_plugin: second_insert,\n foo.proto,\n " + "MockCodeGenerator_Annotate,\n foo.proto\n", + file_content, annotations.annotation(5)); CheckSingleAnnotation("third_annotation", "third", file_content, - annotations.annotation(2)); + annotations.annotation(6)); } bool MockCodeGenerator::Generate(const FileDescriptor* file, @@ -220,18 +249,33 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, } } - if (HasPrefixString(parameter, "insert=")) { - std::vector insert_into; - SplitStringUsing(StripPrefixString(parameter, "insert="), ",", - &insert_into); + bool insert_endlines = HasPrefixString(parameter, "insert_endlines="); + if (insert_endlines || HasPrefixString(parameter, "insert=")) { + std::vector insert_into = Split( + StripPrefixString( + parameter, insert_endlines ? "insert_endlines=" : "insert="), + ",", true); for (size_t i = 0; i < insert_into.size(); i++) { { - std::unique_ptr output(context->OpenForInsert( - GetOutputFileName(insert_into[i], file), kFirstInsertionPointName)); + google::protobuf::GeneratedCodeInfo info; + std::string content = + GetOutputFileContent(name_, "first_insert", file, context); + if (insert_endlines) { + GlobalReplaceSubstring(",", ",\n", &content); + } + if (annotate) { + auto* annotation = info.add_annotation(); + annotation->set_begin(0); + annotation->set_end(content.size()); + annotation->set_source_file("first_path"); + } + std::unique_ptr output( + context->OpenForInsertWithGeneratedCodeInfo( + GetOutputFileName(insert_into[i], file), + kFirstInsertionPointName, info)); io::Printer printer(output.get(), '$'); - printer.PrintRaw( - GetOutputFileContent(name_, "first_insert", file, context)); + printer.PrintRaw(content); if (printer.failed()) { *error = "MockCodeGenerator detected write error."; return false; @@ -239,12 +283,24 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, } { + google::protobuf::GeneratedCodeInfo info; + std::string content = + GetOutputFileContent(name_, "second_insert", file, context); + if (insert_endlines) { + GlobalReplaceSubstring(",", ",\n", &content); + } + if (annotate) { + auto* annotation = info.add_annotation(); + annotation->set_begin(0); + annotation->set_end(content.size()); + annotation->set_source_file("second_path"); + } std::unique_ptr output( - context->OpenForInsert(GetOutputFileName(insert_into[i], file), - kSecondInsertionPointName)); + context->OpenForInsertWithGeneratedCodeInfo( + GetOutputFileName(insert_into[i], file), + kSecondInsertionPointName, info)); io::Printer printer(output.get(), '$'); - printer.PrintRaw( - GetOutputFileContent(name_, "second_insert", file, context)); + printer.PrintRaw(content); if (printer.failed()) { *error = "MockCodeGenerator detected write error."; return false; @@ -263,17 +319,17 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, printer.PrintRaw(GetOutputFileContent(name_, parameter, file, context)); std::string annotate_suffix = "_annotation"; if (annotate) { - printer.Print("$p$", "p", "first"); + printer.Print("$p$\n", "p", "first"); printer.Annotate("p", "first" + annotate_suffix); } printer.PrintRaw(kFirstInsertionPoint); if (annotate) { - printer.Print("$p$", "p", "second"); + printer.Print("$p$\n", "p", "second"); printer.Annotate("p", "second" + annotate_suffix); } printer.PrintRaw(kSecondInsertionPoint); if (annotate) { - printer.Print("$p$", "p", "third"); + printer.Print("$p$\n", "p", "third"); printer.Annotate("p", "third" + annotate_suffix); } @@ -283,9 +339,9 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, } if (annotate) { std::unique_ptr meta_output( - context->Open(GetOutputFileName(name_, file) + ".meta")); + context->Open(GetOutputFileName(name_, file) + ".pb.meta")); if (!TextFormat::Print(annotations, meta_output.get())) { - *error = "MockCodeGenerator couldn't write .meta"; + *error = "MockCodeGenerator couldn't write .pb.meta"; return false; } } @@ -320,7 +376,7 @@ std::string MockCodeGenerator::GetOutputFileContent( const std::string& file, const std::string& parsed_file_list, const std::string& first_message_name) { return strings::Substitute("$0: $1, $2, $3, $4\n", generator_name, parameter, - file, first_message_name, parsed_file_list); + file, first_message_name, parsed_file_list); } } // namespace compiler diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.h similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.h index 082ba18d4..6e101055d 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/mock_code_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/mock_code_generator.h @@ -33,6 +33,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_MOCK_CODE_GENERATOR_H__ #define GOOGLE_PROTOBUF_COMPILER_MOCK_CODE_GENERATOR_H__ +#include #include #include @@ -56,7 +57,9 @@ namespace compiler { // If the parameter is "insert=NAMES", the MockCodeGenerator will insert lines // into the files generated by other MockCodeGenerators instead of creating // its own file. NAMES is a comma-separated list of the names of those other -// MockCodeGenerators. +// MockCodeGenerators. If the parameter is "insert_endlines=NAMES", the +// MockCodeGenerator will insert data guaranteed to contain more than one +// endline into the files generated by NAMES. // // MockCodeGenerator will also modify its behavior slightly if the input file // contains a message type with one of the following names: @@ -106,12 +109,15 @@ class MockCodeGenerator : public CodeGenerator { // implements CodeGenerator ---------------------------------------- - virtual bool Generate(const FileDescriptor* file, - const std::string& parameter, GeneratorContext* context, - std::string* error) const; + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* context, std::string* error) const override; + + uint64_t GetSupportedFeatures() const override; + void SuppressFeatures(uint64_t features); private: std::string name_; + uint64_t suppressed_features_ = 0; static std::string GetOutputFileContent(const std::string& generator_name, const std::string& parameter, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.cc similarity index 97% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.cc index f2967683e..ea8f394eb 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.cc @@ -65,7 +65,7 @@ EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor) base_values_.push_back(value); value_names.insert(EnumValueName(value)); } else { - string value_name(EnumValueName(value)); + std::string value_name(EnumValueName(value)); if (value_names.find(value_name) != value_names.end()) { alias_values_to_skip_.insert(value); } else { @@ -79,7 +79,7 @@ EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor) EnumGenerator::~EnumGenerator() {} void EnumGenerator::GenerateHeader(io::Printer* printer) { - string enum_comments; + std::string enum_comments; SourceLocation location; if (descriptor_->GetSourceLocation(&location)) { enum_comments = BuildCommentsString(location, true); @@ -127,9 +127,8 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) { if (alias_values_to_skip_.find(all_values_[i]) != alias_values_to_skip_.end()) { continue; } - SourceLocation location; if (all_values_[i]->GetSourceLocation(&location)) { - string comments = BuildCommentsString(location, true).c_str(); + std::string comments = BuildCommentsString(location, true).c_str(); if (comments.length() > 0) { if (i > 0) { printer->Print("\n"); @@ -172,11 +171,11 @@ void EnumGenerator::GenerateSource(io::Printer* printer) { // will be zero. TextFormatDecodeData text_format_decode_data; int enum_value_description_key = -1; - string text_blob; + std::string text_blob; for (int i = 0; i < all_values_.size(); i++) { ++enum_value_description_key; - string short_name(EnumValueShortName(all_values_[i])); + std::string short_name(EnumValueShortName(all_values_[i])); text_blob += short_name + '\0'; if (UnCamelCaseEnumShortName(short_name) != all_values_[i]->name()) { text_format_decode_data.AddString(enum_value_description_key, short_name, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.h similarity index 97% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.h index 50a656447..1d5741a53 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum.h @@ -53,14 +53,14 @@ class EnumGenerator { void GenerateHeader(io::Printer* printer); void GenerateSource(io::Printer* printer); - const string& name() const { return name_; } + const std::string& name() const { return name_; } private: const EnumDescriptor* descriptor_; std::vector base_values_; std::vector all_values_; std::set alias_values_to_skip_; - const string name_; + const std::string name_; }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc index 9890d0a14..ff69f39f4 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc @@ -44,8 +44,8 @@ namespace objectivec { namespace { void SetEnumVariables(const FieldDescriptor* descriptor, - std::map* variables) { - string type = EnumName(descriptor->enum_type()); + std::map* variables) { + std::string type = EnumName(descriptor->enum_type()); (*variables)["storage_type"] = type; // For non repeated fields, if it was defined in a different file, the // property decls need to use "enum NAME" rather than just "NAME" to support @@ -104,26 +104,26 @@ void EnumFieldGenerator::GenerateCFunctionImplementations( "int32_t $owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message) {\n" " GPBDescriptor *descriptor = [$owning_message_class$ descriptor];\n" " GPBFieldDescriptor *field = [descriptor fieldWithNumber:$field_number_name$];\n" - " return GPBGetMessageInt32Field(message, field);\n" + " return GPBGetMessageRawEnumField(message, field);\n" "}\n" "\n" "void Set$owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message, int32_t value) {\n" " GPBDescriptor *descriptor = [$owning_message_class$ descriptor];\n" " GPBFieldDescriptor *field = [descriptor fieldWithNumber:$field_number_name$];\n" - " GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);\n" + " GPBSetMessageRawEnumField(message, field, value);\n" "}\n" "\n"); } void EnumFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls) const { + std::set* fwd_decls) const { SingleFieldGenerator::DetermineForwardDeclarations(fwd_decls); // If it is an enum defined in a different file, then we'll need a forward // declaration for it. When it is in our file, all the enums are output // before the message, so it will be declared before it is needed. if (descriptor_->file() != descriptor_->enum_type()->file()) { // Enum name is already in "storage_type". - const string& name = variable("storage_type"); + const std::string& name = variable("storage_type"); fwd_decls->insert("GPB_ENUM_FWD_DECLARE(" + name + ")"); } } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h index 5a69c9786..3fb0a9fd1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h @@ -48,9 +48,12 @@ class EnumFieldGenerator : public SingleFieldGenerator { EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; public: - virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; - virtual void GenerateCFunctionImplementations(io::Printer* printer) const; - virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; + virtual void GenerateCFunctionDeclarations( + io::Printer* printer) const override; + virtual void GenerateCFunctionImplementations( + io::Printer* printer) const override; + virtual void DetermineForwardDeclarations( + std::set* fwd_decls) const override; protected: EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); @@ -62,7 +65,7 @@ class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { const Options& options); public: - virtual void FinishInitialization(); + virtual void FinishInitialization() override; protected: RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.cc similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.cc index bf65de3be..9cebcb22a 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -41,7 +41,7 @@ namespace protobuf { namespace compiler { namespace objectivec { -ExtensionGenerator::ExtensionGenerator(const string& root_class_name, +ExtensionGenerator::ExtensionGenerator(const std::string& root_class_name, const FieldDescriptor* descriptor) : method_name_(ExtensionMethodName(descriptor)), root_class_and_method_name_(root_class_name + "_" + method_name_), @@ -59,7 +59,7 @@ ExtensionGenerator::ExtensionGenerator(const string& root_class_name, ExtensionGenerator::~ExtensionGenerator() {} void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { - std::map vars; + std::map vars; vars["method_name"] = method_name_; if (IsRetainedName(method_name_)) { vars["storage_attribute"] = " NS_RETURNS_NOT_RETAINED"; @@ -82,26 +82,26 @@ void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) { void ExtensionGenerator::GenerateStaticVariablesInitialization( io::Printer* printer) { - std::map vars; + std::map vars; vars["root_class_and_method_name"] = root_class_and_method_name_; - vars["extended_type"] = ClassName(descriptor_->containing_type()); + const std::string containing_type = ClassName(descriptor_->containing_type()); + vars["extended_type"] = ObjCClass(containing_type); vars["number"] = StrCat(descriptor_->number()); - std::vector options; + std::vector options; if (descriptor_->is_repeated()) options.push_back("GPBExtensionRepeated"); if (descriptor_->is_packed()) options.push_back("GPBExtensionPacked"); - if (descriptor_->containing_type()->options().message_set_wire_format()) + if (descriptor_->containing_type()->options().message_set_wire_format()) { options.push_back("GPBExtensionSetWireFormat"); - + } vars["options"] = BuildFlagsString(FLAGTYPE_EXTENSION, options); ObjectiveCType objc_type = GetObjectiveCType(descriptor_); - string singular_type; if (objc_type == OBJECTIVECTYPE_MESSAGE) { - vars["type"] = string("GPBStringifySymbol(") + - ClassName(descriptor_->message_type()) + ")"; + std::string message_type = ClassName(descriptor_->message_type()); + vars["type"] = ObjCClass(message_type); } else { - vars["type"] = "NULL"; + vars["type"] = "Nil"; } vars["default_name"] = GPBGenericValueFieldName(descriptor_); @@ -110,8 +110,8 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization( } else { vars["default"] = DefaultValue(descriptor_); } - string type = GetCapitalizedType(descriptor_); - vars["extension_type"] = string("GPBDataType") + type; + std::string type = GetCapitalizedType(descriptor_); + vars["extension_type"] = std::string("GPBDataType") + type; if (objc_type == OBJECTIVECTYPE_ENUM) { vars["enum_desc_func_name"] = @@ -124,8 +124,8 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization( "{\n" " .defaultValue.$default_name$ = $default$,\n" " .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n" - " .extendedClass = GPBStringifySymbol($extended_type$),\n" - " .messageOrGroupClassName = $type$,\n" + " .extendedClass.clazz = $extended_type$,\n" + " .messageOrGroupClass.clazz = $type$,\n" " .enumDescriptorFunc = $enum_desc_func_name$,\n" " .fieldNumber = $number$,\n" " .dataType = $extension_type$,\n" @@ -133,11 +133,23 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization( "},\n"); } +void ExtensionGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) { + std::string extended_type = ClassName(descriptor_->containing_type()); + fwd_decls->insert(ObjCClassDeclaration(extended_type)); + ObjectiveCType objc_type = GetObjectiveCType(descriptor_); + if (objc_type == OBJECTIVECTYPE_MESSAGE) { + std::string message_type = ClassName(descriptor_->message_type()); + fwd_decls->insert(ObjCClassDeclaration(message_type)); + } +} + void ExtensionGenerator::GenerateRegistrationSource(io::Printer* printer) { printer->Print( "[registry addExtension:$root_class_and_method_name$];\n", "root_class_and_method_name", root_class_and_method_name_); } + } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.h similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.h index d49a4f1cc..d412f4a9f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_extension.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_extension.h @@ -41,7 +41,7 @@ namespace objectivec { class ExtensionGenerator { public: - ExtensionGenerator(const string& root_class_name, + ExtensionGenerator(const std::string& root_class_name, const FieldDescriptor* descriptor); ~ExtensionGenerator(); @@ -51,10 +51,11 @@ class ExtensionGenerator { void GenerateMembersHeader(io::Printer* printer); void GenerateStaticVariablesInitialization(io::Printer* printer); void GenerateRegistrationSource(io::Printer* printer); + void DetermineObjectiveCClassDefinitions(std::set* fwd_decls); private: - string method_name_; - string root_class_and_method_name_; + std::string method_name_; + std::string root_class_and_method_name_; const FieldDescriptor* descriptor_; }; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.cc similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.cc index f585941ea..eb23fee19 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -48,16 +48,16 @@ namespace objectivec { namespace { void SetCommonFieldVariables(const FieldDescriptor* descriptor, - std::map* variables) { - string camel_case_name = FieldName(descriptor); - string raw_field_name; + std::map* variables) { + std::string camel_case_name = FieldName(descriptor); + std::string raw_field_name; if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { raw_field_name = descriptor->message_type()->name(); } else { raw_field_name = descriptor->name(); } // The logic here has to match -[GGPBFieldDescriptor textFormatName]. - const string un_camel_case_name( + const std::string un_camel_case_name( UnCamelCaseFieldName(camel_case_name, descriptor)); const bool needs_custom_name = (raw_field_name != un_camel_case_name); @@ -67,10 +67,10 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, } else { (*variables)["comments"] = "\n"; } - const string& classname = ClassName(descriptor->containing_type()); + const std::string& classname = ClassName(descriptor->containing_type()); (*variables)["classname"] = classname; (*variables)["name"] = camel_case_name; - const string& capitalized_name = FieldNameCapitalized(descriptor); + const std::string& capitalized_name = FieldNameCapitalized(descriptor); (*variables)["capitalized_name"] = capitalized_name; (*variables)["raw_field_name"] = raw_field_name; (*variables)["field_number_name"] = @@ -78,7 +78,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, (*variables)["field_number"] = StrCat(descriptor->number()); (*variables)["field_type"] = GetCapitalizedType(descriptor); (*variables)["deprecated_attribute"] = GetOptionalDeprecatedAttribute(descriptor); - std::vector field_flags; + std::vector field_flags; if (descriptor->is_repeated()) field_flags.push_back("GPBFieldRepeated"); if (descriptor->is_required()) field_flags.push_back("GPBFieldRequired"); if (descriptor->is_optional()) field_flags.push_back("GPBFieldOptional"); @@ -91,14 +91,22 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor, if (descriptor->type() == FieldDescriptor::TYPE_ENUM) { field_flags.push_back("GPBFieldHasEnumDescriptor"); } + // It will clear on a zero value if... + // - not repeated/map + // - doesn't have presence + bool clear_on_zero = + (!descriptor->is_repeated() && !descriptor->has_presence()); + if (clear_on_zero) { + field_flags.push_back("GPBFieldClearHasIvarOnZero"); + } (*variables)["fieldflags"] = BuildFlagsString(FLAGTYPE_FIELD, field_flags); (*variables)["default"] = DefaultValue(descriptor); (*variables)["default_name"] = GPBGenericValueFieldName(descriptor); - (*variables)["dataTypeSpecific_name"] = "className"; - (*variables)["dataTypeSpecific_value"] = "NULL"; + (*variables)["dataTypeSpecific_name"] = "clazz"; + (*variables)["dataTypeSpecific_value"] = "Nil"; (*variables)["storage_offset_value"] = "(uint32_t)offsetof(" + classname + "__storage_, " + camel_case_name + ")"; @@ -177,7 +185,12 @@ void FieldGenerator::GenerateCFunctionImplementations( } void FieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls) const { + std::set* fwd_decls) const { + // Nothing +} + +void FieldGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const { // Nothing } @@ -233,13 +246,18 @@ void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) { } void FieldGenerator::SetOneofIndexBase(int index_base) { - if (descriptor_->containing_oneof() != NULL) { - int index = descriptor_->containing_oneof()->index() + index_base; + const OneofDescriptor* oneof = descriptor_->real_containing_oneof(); + if (oneof != NULL) { + int index = oneof->index() + index_base; // Flip the sign to mark it as a oneof. variables_["has_index"] = StrCat(-index); } } +bool FieldGenerator::WantsHasProperty(void) const { + return descriptor_->has_presence() && !descriptor_->real_containing_oneof(); +} + void FieldGenerator::FinishInitialization(void) { // If "property_type" wasn't set, make it "storage_type". if ((variables_.find("property_type") == variables_.end()) && @@ -284,20 +302,8 @@ void SingleFieldGenerator::GeneratePropertyImplementation( } } -bool SingleFieldGenerator::WantsHasProperty(void) const { - if (descriptor_->containing_oneof() != NULL) { - // If in a oneof, it uses the oneofcase instead of a has bit. - return false; - } - if (HasFieldPresence(descriptor_->file())) { - // In proto1/proto2, every field has a has_$name$() method. - return true; - } - return false; -} - bool SingleFieldGenerator::RuntimeUsesHasBit(void) const { - if (descriptor_->containing_oneof() != NULL) { + if (descriptor_->real_containing_oneof()) { // The oneof tracks what is set instead. return false; } @@ -397,13 +403,8 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration( printer->Print("\n"); } -bool RepeatedFieldGenerator::WantsHasProperty(void) const { - // Consumer check the array size/existance rather than a has bit. - return false; -} - bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const { - return false; // The array having anything is what is used. + return false; // The array (or map/dict) having anything is what is used. } FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.h similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.h index 24465d0a3..ad8e55aeb 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -65,7 +65,10 @@ class FieldGenerator { virtual void GenerateCFunctionImplementations(io::Printer* printer) const; // Exposed for subclasses, should always call it on the parent class also. - virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; + virtual void DetermineForwardDeclarations( + std::set* fwd_decls) const; + virtual void DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const; // Used during generation, not intended to be extended by subclasses. void GenerateFieldDescription( @@ -80,25 +83,26 @@ class FieldGenerator { virtual void SetExtraRuntimeHasBitsBase(int index_base); void SetOneofIndexBase(int index_base); - string variable(const char* key) const { + std::string variable(const char* key) const { return variables_.find(key)->second; } bool needs_textformat_name_support() const { - const string& field_flags = variable("fieldflags"); - return field_flags.find("GPBFieldTextFormatNameCustom") != string::npos; + const std::string& field_flags = variable("fieldflags"); + return field_flags.find("GPBFieldTextFormatNameCustom") != + std::string::npos; } - string generated_objc_name() const { return variable("name"); } - string raw_field_name() const { return variable("raw_field_name"); } + std::string generated_objc_name() const { return variable("name"); } + std::string raw_field_name() const { return variable("raw_field_name"); } protected: FieldGenerator(const FieldDescriptor* descriptor, const Options& options); virtual void FinishInitialization(void); - virtual bool WantsHasProperty(void) const = 0; + bool WantsHasProperty(void) const; const FieldDescriptor* descriptor_; - std::map variables_; + std::map variables_; }; class SingleFieldGenerator : public FieldGenerator { @@ -108,17 +112,16 @@ class SingleFieldGenerator : public FieldGenerator { SingleFieldGenerator(const SingleFieldGenerator&) = delete; SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyImplementation(io::Printer* printer) const; + virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - virtual bool RuntimeUsesHasBit(void) const; + virtual bool RuntimeUsesHasBit(void) const override; protected: SingleFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - virtual bool WantsHasProperty(void) const; }; // Subclass with common support for when the field ends up as an ObjC Object. @@ -129,8 +132,8 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator { ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete; ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; protected: ObjCObjFieldGenerator(const FieldDescriptor* descriptor, @@ -144,18 +147,17 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator { RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete; RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyImplementation(io::Printer* printer) const; + virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - virtual bool RuntimeUsesHasBit(void) const; + virtual bool RuntimeUsesHasBit(void) const override; protected: RepeatedFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - virtual void FinishInitialization(void); - virtual bool WantsHasProperty(void) const; + virtual void FinishInitialization(void) override; }; // Convenience class which constructs FieldGenerators for a Descriptor. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.cc similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 7bc585e9b..d9f43a55c 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -52,7 +52,7 @@ namespace objectivec { namespace { // This is also found in GPBBootstrap.h, and needs to be kept in sync. -const int32 GOOGLE_PROTOBUF_OBJC_VERSION = 30002; +const int32_t GOOGLE_PROTOBUF_OBJC_VERSION = 30004; const char* kHeaderExtension = ".pbobjc.h"; @@ -185,22 +185,22 @@ bool IsDirectDependency(const FileDescriptor* dep, const FileDescriptor* file) { } // namespace -FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options) +FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) : file_(file), root_class_name_(FileClassName(file)), is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)), options_(options) { for (int i = 0; i < file_->enum_type_count(); i++) { - EnumGenerator *generator = new EnumGenerator(file_->enum_type(i)); + EnumGenerator* generator = new EnumGenerator(file_->enum_type(i)); enum_generators_.emplace_back(generator); } for (int i = 0; i < file_->message_type_count(); i++) { - MessageGenerator *generator = + MessageGenerator* generator = new MessageGenerator(root_class_name_, file_->message_type(i), options_); message_generators_.emplace_back(generator); } for (int i = 0; i < file_->extension_count(); i++) { - ExtensionGenerator *generator = + ExtensionGenerator* generator = new ExtensionGenerator(root_class_name_, file_->extension(i)); extension_generators_.emplace_back(generator); } @@ -208,16 +208,16 @@ FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options) FileGenerator::~FileGenerator() {} -void FileGenerator::GenerateHeader(io::Printer *printer) { - std::set headers; +void FileGenerator::GenerateHeader(io::Printer* printer) { + std::vector headers; // Generated files bundled with the library get minimal imports, everything // else gets the wrapper so everything is usable. if (is_bundled_proto_) { - headers.insert("GPBRootObject.h"); - headers.insert("GPBMessage.h"); - headers.insert("GPBDescriptor.h"); + headers.push_back("GPBDescriptor.h"); + headers.push_back("GPBMessage.h"); + headers.push_back("GPBRootObject.h"); } else { - headers.insert("GPBProtocolBuffers.h"); + headers.push_back("GPBProtocolBuffers.h"); } PrintFileRuntimePreamble(printer, headers); @@ -242,8 +242,9 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { ImportWriter import_writer( options_.generate_for_named_framework, options_.named_framework_to_proto_path_mappings_path, + options_.runtime_import_prefix, is_bundled_proto_); - const string header_extension(kHeaderExtension); + const std::string header_extension(kHeaderExtension); for (int i = 0; i < file_->public_dependency_count(); i++) { import_writer.AddFile(file_->public_dependency(i), header_extension); } @@ -263,11 +264,11 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { "CF_EXTERN_C_BEGIN\n" "\n"); - std::set fwd_decls; + std::set fwd_decls; for (const auto& generator : message_generators_) { generator->DetermineForwardDeclarations(&fwd_decls); } - for (std::set::const_iterator i(fwd_decls.begin()); + for (std::set::const_iterator i(fwd_decls.begin()); i != fwd_decls.end(); ++i) { printer->Print("$value$;\n", "value", *i); } @@ -303,12 +304,12 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { " * which is a @c GPBExtensionRegistry that includes all the extensions defined by\n" " * this file and all files that it depends on.\n" " **/\n" - "@interface $root_class_name$ : GPBRootObject\n" + "GPB_FINAL @interface $root_class_name$ : GPBRootObject\n" "@end\n" "\n", "root_class_name", root_class_name_); - if (extension_generators_.size() > 0) { + if (!extension_generators_.empty()) { // The dynamic methods block is only needed if there are extensions. printer->Print( "@interface $root_class_name$ (DynamicMethods)\n", @@ -319,7 +320,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { } printer->Print("@end\n\n"); - } // extension_generators_.size() > 0 + } // !extension_generators_.empty() for (const auto& generator : message_generators_) { generator->GenerateMessageHeader(printer); @@ -335,10 +336,10 @@ void FileGenerator::GenerateHeader(io::Printer *printer) { "// @@protoc_insertion_point(global_scope)\n"); } -void FileGenerator::GenerateSource(io::Printer *printer) { +void FileGenerator::GenerateSource(io::Printer* printer) { // #import the runtime support. - std::set headers; - headers.insert("GPBProtocolBuffers_RuntimeSupport.h"); + std::vector headers; + headers.push_back("GPBProtocolBuffers_RuntimeSupport.h"); PrintFileRuntimePreamble(printer, headers); // Enums use atomic in the generated code, so add the system import as needed. @@ -355,15 +356,16 @@ void FileGenerator::GenerateSource(io::Printer *printer) { ImportWriter import_writer( options_.generate_for_named_framework, options_.named_framework_to_proto_path_mappings_path, + options_.runtime_import_prefix, is_bundled_proto_); - const string header_extension(kHeaderExtension); + const std::string header_extension(kHeaderExtension); // #import the header for this proto file. import_writer.AddFile(file_, header_extension); // #import the headers for anything that a plain dependency of this proto // file (that means they were just an include, not a "public" include). - std::set public_import_names; + std::set public_import_names; for (int i = 0; i < file_->public_dependency_count(); i++) { public_import_names.insert(file_->public_dependency(i)->name()); } @@ -379,7 +381,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // imported so it can get merged into the root's extensions registry. // See the Note by CollectMinimalFileDepsContainingExtensions before // changing this. - for (std::vector::iterator iter = + for (std::vector::iterator iter = deps_with_extensions.begin(); iter != deps_with_extensions.end(); ++iter) { if (!IsDirectDependency(*iter, file_)) { @@ -398,10 +400,20 @@ void FileGenerator::GenerateSource(io::Printer *printer) { } } + std::set fwd_decls; + for (const auto& generator : message_generators_) { + generator->DetermineObjectiveCClassDefinitions(&fwd_decls); + } + for (const auto& generator : extension_generators_) { + generator->DetermineObjectiveCClassDefinitions(&fwd_decls); + } + // Note: // deprecated-declarations suppression is only needed if some place in this // proto file is something deprecated or if it references something from // another file that is deprecated. + // dollar-in-identifier-extension is needed because we use references to + // objc class names that have $ in identifiers. printer->Print( "// @@protoc_insertion_point(imports)\n" "\n" @@ -409,14 +421,31 @@ void FileGenerator::GenerateSource(io::Printer *printer) { "#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n"); if (includes_oneof) { // The generated code for oneof's uses direct ivar access, suppress the - // warning incase developer turn that on in the context they compile the + // warning in case developer turn that on in the context they compile the // generated code. printer->Print( "#pragma clang diagnostic ignored \"-Wdirect-ivar-access\"\n"); } - + if (!fwd_decls.empty()) { + printer->Print( + "#pragma clang diagnostic ignored \"-Wdollar-in-identifier-extension\"\n"); + } + printer->Print( + "\n"); + if (!fwd_decls.empty()) { + printer->Print( + "#pragma mark - Objective C Class declarations\n" + "// Forward declarations of Objective C classes that we can use as\n" + "// static values in struct initializers.\n" + "// We don't use [Foo class] because it is not a static value.\n"); + } + for (const auto& i : fwd_decls) { + printer->Print("$value$\n", "value", i); + } + if (!fwd_decls.empty()) { + printer->Print("\n"); + } printer->Print( - "\n" "#pragma mark - $root_class_name$\n" "\n" "@implementation $root_class_name$\n\n", @@ -454,7 +483,8 @@ void FileGenerator::GenerateSource(io::Printer *printer) { "};\n" "for (size_t i = 0; i < sizeof(descriptions) / sizeof(descriptions[0]); ++i) {\n" " GPBExtensionDescriptor *extension =\n" - " [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i]];\n" + " [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i]\n" + " usesClassRefs:YES];\n" " [registry addExtension:extension];\n" " [self globallyRegisterExtension:extension];\n" " [extension release];\n" @@ -468,10 +498,10 @@ void FileGenerator::GenerateSource(io::Printer *printer) { } else { printer->Print( "// Merge in the imports (direct or indirect) that defined extensions.\n"); - for (std::vector::iterator iter = + for (std::vector::iterator iter = deps_with_extensions.begin(); iter != deps_with_extensions.end(); ++iter) { - const string root_class_name(FileClassName((*iter))); + const std::string root_class_name(FileClassName((*iter))); printer->Print( "[registry addExtensions:[$dependency$ extensionRegistry]];\n", "dependency", root_class_name); @@ -500,8 +530,8 @@ void FileGenerator::GenerateSource(io::Printer *printer) { printer->Print("\n@end\n\n"); // File descriptor only needed if there are messages to use it. - if (message_generators_.size() > 0) { - std::map vars; + if (!message_generators_.empty()) { + std::map vars; vars["root_class_name"] = root_class_name_; vars["package"] = file_->package(); vars["objc_prefix"] = FileClassPrefix(file_); @@ -525,7 +555,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) { " static GPBFileDescriptor *descriptor = NULL;\n" " if (!descriptor) {\n" " GPB_DEBUG_CHECK_RUNTIME_VERSIONS();\n"); - if (vars["objc_prefix"].size() > 0) { + if (!vars["objc_prefix"].empty()) { printer->Print( vars, " descriptor = [[GPBFileDescriptor alloc] initWithPackage:@\"$package$\"\n" @@ -562,48 +592,16 @@ void FileGenerator::GenerateSource(io::Printer *printer) { // files. This currently only supports the runtime coming from a framework // as defined by the official CocoaPod. void FileGenerator::PrintFileRuntimePreamble( - io::Printer* printer, const std::set& headers_to_import) const { + io::Printer* printer, + const std::vector& headers_to_import) const { printer->Print( "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" "// source: $filename$\n" "\n", "filename", file_->name()); - - const string framework_name(ProtobufLibraryFrameworkName); - const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name)); - - printer->Print( - "// This CPP symbol can be defined to use imports that match up to the framework\n" - "// imports needed when using CocoaPods.\n" - "#if !defined($cpp_symbol$)\n" - " #define $cpp_symbol$ 0\n" - "#endif\n" - "\n" - "#if $cpp_symbol$\n", - "cpp_symbol", cpp_symbol); - - - for (std::set::const_iterator iter = headers_to_import.begin(); - iter != headers_to_import.end(); ++iter) { - printer->Print( - " #import <$framework_name$/$header$>\n", - "header", *iter, - "framework_name", framework_name); - } - - printer->Print( - "#else\n"); - - for (std::set::const_iterator iter = headers_to_import.begin(); - iter != headers_to_import.end(); ++iter) { - printer->Print( - " #import \"$header$\"\n", - "header", *iter); - } - - printer->Print( - "#endif\n" - "\n"); + ImportWriter::PrintRuntimeImports( + printer, headers_to_import, options_.runtime_import_prefix, true); + printer->Print("\n"); } } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.h similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.h index fd5726348..87258a39f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_file.h @@ -58,11 +58,9 @@ class FileGenerator { void GenerateSource(io::Printer* printer); void GenerateHeader(io::Printer* printer); - const string& RootClassName() const { return root_class_name_; } - private: const FileDescriptor* file_; - string root_class_name_; + std::string root_class_name_; bool is_bundled_proto_; std::vector> enum_generators_; @@ -72,7 +70,8 @@ class FileGenerator { const Options options_; void PrintFileRuntimePreamble( - io::Printer* printer, const std::set& headers_to_import) const; + io::Printer* printer, + const std::vector& headers_to_import) const; }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.cc similarity index 58% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.cc index 25338ad93..a03b8604f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.cc @@ -28,7 +28,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include #include +#include +#include #include #include #include @@ -41,6 +44,28 @@ namespace protobuf { namespace compiler { namespace objectivec { +namespace { + +// Convert a string with "yes"/"no" (case insensitive) to a boolean, returning +// true/false for if the input string was a valid value. If the input string is +// invalid, `result` is unchanged. +bool StringToBool(const std::string& value, bool* result) { + std::string upper_value(value); + UpperString(&upper_value); + if (upper_value == "NO") { + *result = false; + return true; + } + if (upper_value == "YES") { + *result = true; + return true; + } + + return false; +} + +} // namespace + ObjectiveCGenerator::ObjectiveCGenerator() {} ObjectiveCGenerator::~ObjectiveCGenerator() {} @@ -50,17 +75,17 @@ bool ObjectiveCGenerator::HasGenerateAll() const { } bool ObjectiveCGenerator::Generate(const FileDescriptor* file, - const string& parameter, + const std::string& parameter, GeneratorContext* context, - string* error) const { + std::string* error) const { *error = "Unimplemented Generate() method. Call GenerateAll() instead."; return false; } -bool ObjectiveCGenerator::GenerateAll(const std::vector& files, - const string& parameter, - GeneratorContext* context, - string* error) const { +bool ObjectiveCGenerator::GenerateAll( + const std::vector& files, + const std::string& parameter, GeneratorContext* context, + std::string* error) const { // ----------------------------------------------------------------- // Parse generator options. These options are passed to the compiler using the // --objc_opt flag. The options are passed as a comma separated list of @@ -71,7 +96,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& Options generation_options; - std::vector > options; + std::vector > options; ParseGeneratorParameter(parameter, &options); for (int i = 0; i < options.size(); i++) { if (options[i].first == "expected_prefixes_path") { @@ -93,8 +118,36 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& // A semicolon delimited string that lists the paths of .proto files to // exclude from the package prefix validations (expected_prefixes_path). // This is provided as an "out", to skip some files being checked. - SplitStringUsing(options[i].second, ";", - &generation_options.expected_prefixes_suppressions); + for (StringPiece split_piece : Split( + options[i].second, ";", true)) { + generation_options.expected_prefixes_suppressions.push_back( + std::string(split_piece)); + } + } else if (options[i].first == "prefixes_must_be_registered") { + // If objc prefix file option value must be registered to be used. This + // option has no meaning if an "expected_prefixes_path" isn't set. The + // available options are: + // "no": They don't have to be registered. + // "yes": They must be registered and an error will be raised if a files + // tried to use a prefix that isn't registered. + // Default is "no". + if (!StringToBool(options[i].second, + &generation_options.prefixes_must_be_registered)) { + *error = "error: Unknown value for prefixes_must_be_registered: " + options[i].second; + return false; + } + } else if (options[i].first == "require_prefixes") { + // If every file must have an objc prefix file option to be used. The + // available options are: + // "no": Files can be generated without the prefix option. + // "yes": Files must have the objc prefix option, and an error will be + // raised if a files doesn't have one. + // Default is "no". + if (!StringToBool(options[i].second, + &generation_options.require_prefixes)) { + *error = "error: Unknown value for require_prefixes: " + options[i].second; + return false; + } } else if (options[i].first == "generate_for_named_framework") { // The name of the framework that protos are being generated for. This // will cause the #import statements to be framework based using this @@ -120,13 +173,45 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& // Any number of files can be listed for a framework, just separate them // with commas. // - // There can be multiple lines listing the same frameworkName incase it + // There can be multiple lines listing the same frameworkName in case it // has a lot of proto files included in it; having multiple lines makes // things easier to read. If a proto file is not configured in the // mappings file, it will use the default framework name if one was passed // with generate_for_named_framework, or the relative path to it's include // path otherwise. generation_options.named_framework_to_proto_path_mappings_path = options[i].second; + } else if (options[i].first == "runtime_import_prefix") { + // Path to use as a prefix on #imports of runtime provided headers in the + // generated files. When integrating ObjC protos into a build system, + // this can be used to avoid having to add the runtime directory to the + // header search path since the generate #import will be more complete. + generation_options.runtime_import_prefix = + StripSuffixString(options[i].second, "/"); + } else if (options[i].first == "use_package_as_prefix") { + // Controls how the symbols should be prefixed to avoid symbols + // collisions. The objc_class_prefix file option is always honored, this + // is just what to do if that isn't set. The available options are: + // "no": Not prefixed (the existing mode). + // "yes": Make a prefix out of the proto package. + bool value = false; + if (StringToBool(options[i].second, &value)) { + SetUseProtoPackageAsDefaultPrefix(value); + } else { + *error = "error: Unknown use_package_as_prefix: " + options[i].second; + return false; + } + } else if (options[i].first == "proto_package_prefix_exceptions_path") { + // Path to find a file containing the list of proto package names that are + // exceptions when use_package_as_prefix is enabled. This can be used to + // migrate packages one at a time to use_package_as_prefix since there + // are likely code updates needed with each one. + // + // The format of the file is: + // - An entry is a line of "proto.package.name". + // - Comments start with "#". + // - A comment can go on a line after a expected package/prefix pair. + // (i.e. - "some.proto.package # comment") + SetProtoPackagePrefixExceptionList(options[i].second); } else { *error = "error: Unknown generator option: " + options[i].first; return false; @@ -135,6 +220,25 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& // ----------------------------------------------------------------- + // These are not official generation options and could be removed/changed in + // the future and doing that won't count as a breaking change. + bool headers_only = getenv("GPB_OBJC_HEADERS_ONLY") != NULL; + std::unordered_set skip_impls; + if (getenv("GPB_OBJC_SKIP_IMPLS_FILE") != NULL) { + std::ifstream skip_file(getenv("GPB_OBJC_SKIP_IMPLS_FILE")); + if (skip_file.is_open()) { + std::string line; + while (std::getline(skip_file, line)) { + skip_impls.insert(line); + } + } else { + *error = "error: Failed to open GPB_OBJC_SKIP_IMPLS_FILE file"; + return false; + } + } + + // ----------------------------------------------------------------- + // Validate the objc prefix/package pairings. if (!ValidateObjCClassPrefixes(files, generation_options, error)) { // *error will have been filled in. @@ -144,7 +248,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& for (int i = 0; i < files.size(); i++) { const FileDescriptor* file = files[i]; FileGenerator file_generator(file, generation_options); - string filepath = FilePath(file); + std::string filepath = FilePath(file); // Generate header. { @@ -155,7 +259,7 @@ bool ObjectiveCGenerator::GenerateAll(const std::vector& } // Generate m file. - { + if (!headers_only && skip_impls.count(file->name()) == 0) { std::unique_ptr output( context->Open(filepath + ".pbobjc.m")); io::Printer printer(output.get(), '$'); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.h similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.h index d10efc20e..1dbc666af 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_generator.h @@ -57,15 +57,16 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { ObjectiveCGenerator& operator=(const ObjectiveCGenerator&) = delete; // implements CodeGenerator ---------------------------------------- - bool HasGenerateAll() const; - bool Generate(const FileDescriptor* file, - const string& parameter, - GeneratorContext* context, - string* error) const; + bool HasGenerateAll() const override; + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* context, std::string* error) const override; bool GenerateAll(const std::vector& files, - const string& parameter, - GeneratorContext* context, - string* error) const; + const std::string& parameter, GeneratorContext* context, + std::string* error) const override; + + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL; + } }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc similarity index 66% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 09a808bf4..5f4b7f60f 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,102 @@ using ::open; #endif } // namespace port +namespace { + +class SimpleLineCollector : public LineConsumer { + public: + SimpleLineCollector(std::unordered_set* inout_set) + : set_(inout_set) {} + + virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override { + set_->insert(std::string(line)); + return true; + } + + private: + std::unordered_set* set_; +}; + +class PrefixModeStorage { + public: + 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_; } + void set_exception_path(const std::string& path) { + exception_path_ = path; + exceptions_.clear(); + } + + bool is_package_exempted(const std::string& package); + + private: + bool use_package_name_; + std::string exception_path_; + std::unordered_set exceptions_; +}; + +PrefixModeStorage::PrefixModeStorage() { + // Even thought there are generation options, have an env back door since some + // of these helpers could be used in other plugins. + + const char* use_package_cstr = getenv("GPB_OBJC_USE_PACKAGE_AS_PREFIX"); + use_package_name_ = + (use_package_cstr && (std::string("YES") == ToUpper(use_package_cstr))); + + const char* exception_path = getenv("GPB_OBJC_PACKAGE_PREFIX_EXCEPTIONS_PATH"); + if (exception_path) { + exception_path_ = exception_path; + } +} + +bool PrefixModeStorage::is_package_exempted(const std::string& package) { + if (exceptions_.empty() && !exception_path_.empty()) { + std::string error_str; + SimpleLineCollector collector(&exceptions_); + if (!ParseSimpleFile(exception_path_, &collector, &error_str)) { + if (error_str.empty()) { + error_str = std::string("protoc:0: warning: Failed to parse") + + std::string(" package prefix exceptions file: ") + + exception_path_; + } + std::cerr << error_str << std::endl; + std::cerr.flush(); + exceptions_.clear(); + } + + // If the file was empty put something in it so it doesn't get reloaded over + // and over. + if (exceptions_.empty()) { + exceptions_.insert(""); + } + } + + return exceptions_.count(package) != 0; +} + +PrefixModeStorage g_prefix_mode; + +} // namespace + +bool UseProtoPackageAsDefaultPrefix() { + return g_prefix_mode.use_package_name(); +} + +void SetUseProtoPackageAsDefaultPrefix(bool on_or_off) { + g_prefix_mode.set_use_package_name(on_or_off); +} + +std::string GetProtoPackagePrefixExceptionList() { + return g_prefix_mode.exception_path(); +} + +void SetProtoPackagePrefixExceptionList(const std::string& file_path) { + g_prefix_mode.set_exception_path(file_path); +} + Options::Options() { // Default is the value of the env for the package prefixes. const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); @@ -78,14 +175,18 @@ Options::Options() { } const char* suppressions = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES_SUPPRESSIONS"); if (suppressions) { - SplitStringUsing(suppressions, ";", &expected_prefixes_suppressions); + expected_prefixes_suppressions = + Split(suppressions, ";", true); } + prefixes_must_be_registered = false; + require_prefixes = false; } namespace { -std::unordered_set MakeWordsMap(const char* const words[], size_t num_words) { - std::unordered_set result; +std::unordered_set MakeWordsMap(const char* const words[], + size_t num_words) { + std::unordered_set result; for (int i = 0; i < num_words; i++) { result.insert(words[i]); } @@ -94,7 +195,7 @@ std::unordered_set MakeWordsMap(const char* const words[], size_t num_wo const char* const kUpperSegmentsList[] = {"url", "http", "https"}; -std::unordered_set kUpperSegments = +std::unordered_set kUpperSegments = MakeWordsMap(kUpperSegmentsList, GOOGLE_ARRAYSIZE(kUpperSegmentsList)); bool ascii_isnewline(char c) { @@ -104,9 +205,10 @@ bool ascii_isnewline(char c) { // Internal helper for name handing. // Do not expose this outside of helpers, stick to having functions for specific // cases (ClassName(), FieldName()), so there is always consistent suffix rules. -string UnderscoresToCamelCase(const string& input, bool first_capitalized) { - std::vector values; - string current; +std::string UnderscoresToCamelCase(const std::string& input, + bool first_capitalized) { + std::vector values; + std::string current; bool last_char_was_number = false; bool last_char_was_lower = false; @@ -144,10 +246,11 @@ string UnderscoresToCamelCase(const string& input, bool first_capitalized) { } values.push_back(current); - string result; + std::string result; bool first_segment_forces_upper = false; - for (std::vector::iterator i = values.begin(); i != values.end(); ++i) { - string value = *i; + for (std::vector::iterator i = values.begin(); i != values.end(); + ++i) { + std::string value = *i; bool all_upper = (kUpperSegments.count(value) > 0); if (all_upper && (result.length() == 0)) { first_segment_forces_upper = true; @@ -208,6 +311,10 @@ const char* const kReservedWordList[] = { // Not a keyword, but will break you "NULL", + // C88+ specs call for these to be macros, so depending on what they are + // defined to be it can lead to odd errors for some Xcode/SDK versions. + "stdin", "stdout", "stderr", + // Objective-C Runtime typedefs // From "Category", "Ivar", "Method", "Protocol", @@ -233,7 +340,7 @@ const char* const kReservedWordList[] = { // but this verifies and allows for future expansion if we decide to redefine what a // reserved C identifier is (for example the GNU list // https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html ) -bool IsReservedCIdentifier(const string& input) { +bool IsReservedCIdentifier(const std::string& input) { if (input.length() > 2) { if (input.at(0) == '_') { if (isupper(input.at(1)) || input.at(1) == '_') { @@ -244,15 +351,15 @@ bool IsReservedCIdentifier(const string& input) { return false; } -string SanitizeNameForObjC(const string& prefix, - const string& input, - const string& extension, - string* out_suffix_added) { - static const std::unordered_set kReservedWords = +std::string SanitizeNameForObjC(const std::string& prefix, + const std::string& input, + const std::string& extension, + std::string* out_suffix_added) { + static const std::unordered_set kReservedWords = MakeWordsMap(kReservedWordList, GOOGLE_ARRAYSIZE(kReservedWordList)); - static const std::unordered_set kNSObjectMethods = + static const std::unordered_set kNSObjectMethods = MakeWordsMap(kNSObjectMethodsList, GOOGLE_ARRAYSIZE(kNSObjectMethodsList)); - string sanitized; + std::string sanitized; // We add the prefix in the cases where the string is missing a prefix. // We define "missing a prefix" as where 'input': // a) Doesn't start with the prefix or @@ -277,7 +384,7 @@ string SanitizeNameForObjC(const string& prefix, return sanitized; } -string NameFromFieldDescriptor(const FieldDescriptor* field) { +std::string NameFromFieldDescriptor(const FieldDescriptor* field) { if (field->type() == FieldDescriptor::TYPE_GROUP) { return field->message_type()->name(); } else { @@ -285,9 +392,10 @@ string NameFromFieldDescriptor(const FieldDescriptor* field) { } } -void PathSplit(const string& path, string* directory, string* basename) { - string::size_type last_slash = path.rfind('/'); - if (last_slash == string::npos) { +void PathSplit(const std::string& path, std::string* directory, + std::string* basename) { + std::string::size_type last_slash = path.rfind('/'); + if (last_slash == std::string::npos) { if (directory) { *directory = ""; } @@ -304,7 +412,7 @@ void PathSplit(const string& path, string* directory, string* basename) { } } -bool IsSpecialName(const string& name, const string* special_names, +bool IsSpecialName(const std::string& name, const std::string* special_names, size_t count) { for (size_t i = 0; i < count; ++i) { size_t length = special_names[i].length(); @@ -322,7 +430,7 @@ bool IsSpecialName(const string& name, const string* special_names, return false; } -string GetZeroEnumNameForFlagType(const FlagType flag_type) { +std::string GetZeroEnumNameForFlagType(const FlagType flag_type) { switch(flag_type) { case FLAGTYPE_DESCRIPTOR_INITIALIZATION: return "GPBDescriptorInitializationFlag_None"; @@ -336,7 +444,7 @@ string GetZeroEnumNameForFlagType(const FlagType flag_type) { } } -string GetEnumNameForFlagType(const FlagType flag_type) { +std::string GetEnumNameForFlagType(const FlagType flag_type) { switch(flag_type) { case FLAGTYPE_DESCRIPTOR_INITIALIZATION: return "GPBDescriptorInitializationFlags"; @@ -346,25 +454,26 @@ string GetEnumNameForFlagType(const FlagType flag_type) { return "GPBFieldFlags"; default: GOOGLE_LOG(FATAL) << "Can't get here."; - return string(); + return std::string(); + } +} + +void MaybeUnQuote(StringPiece* input) { + if ((input->length() >= 2) && + ((*input->data() == '\'' || *input->data() == '"')) && + ((*input)[input->length() - 1] == *input->data())) { + input->remove_prefix(1); + input->remove_suffix(1); } } } // namespace // Escape C++ trigraphs by escaping question marks to \? -string EscapeTrigraphs(const string& to_escape) { +std::string EscapeTrigraphs(const std::string& to_escape) { return StringReplace(to_escape, "?", "\\?", true); } -string StripProto(const string& filename) { - if (HasSuffixString(filename, ".protodevel")) { - return StripSuffixString(filename, ".protodevel"); - } else { - return StripSuffixString(filename, ".proto"); - } -} - void TrimWhitespace(StringPiece* input) { while (!input->empty() && ascii_isspace(*input->data())) { input->remove_prefix(1); @@ -374,38 +483,68 @@ void TrimWhitespace(StringPiece* input) { } } - -bool IsRetainedName(const string& name) { +bool IsRetainedName(const std::string& name) { // List of prefixes from // http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html - static const string retained_names[] = {"new", "alloc", "copy", - "mutableCopy"}; + static const std::string retained_names[] = {"new", "alloc", "copy", + "mutableCopy"}; return IsSpecialName(name, retained_names, sizeof(retained_names) / sizeof(retained_names[0])); } -bool IsInitName(const string& name) { - static const string init_names[] = {"init"}; +bool IsInitName(const std::string& name) { + static const std::string init_names[] = {"init"}; return IsSpecialName(name, init_names, sizeof(init_names) / sizeof(init_names[0])); } -string BaseFileName(const FileDescriptor* file) { - string basename; +std::string BaseFileName(const FileDescriptor* file) { + std::string basename; PathSplit(file->name(), NULL, &basename); return basename; } -string FileClassPrefix(const FileDescriptor* file) { - // Default is empty string, no need to check has_objc_class_prefix. - string result = file->options().objc_class_prefix(); +std::string FileClassPrefix(const FileDescriptor* file) { + // Always honor the file option. + if (file->options().has_objc_class_prefix()) { + return file->options().objc_class_prefix(); + } + + // If package prefix isn't enabled or no package, done. + if (!g_prefix_mode.use_package_name() || file->package().empty()) { + return ""; + } + + // If the package is in the exceptions list, done. + if (g_prefix_mode.is_package_exempted(file->package())) { + return ""; + } + + // Transform the package into a prefix: use the dot segments as part, + // camelcase each one and then join them with underscores, and add an + // underscore at the end. + std::string result; + const std::vector segments = Split(file->package(), ".", true); + for (const auto& segment : segments) { + const std::string part = UnderscoresToCamelCase(segment, true); + if (part.empty()) { + continue; + } + if (!result.empty()) { + result.append("_"); + } + result.append(part); + } + if (!result.empty()) { + result.append("_"); + } return result; } -string FilePath(const FileDescriptor* file) { - string output; - string basename; - string directory; +std::string FilePath(const FileDescriptor* file) { + std::string output; + std::string basename; + std::string directory; PathSplit(file->name(), &directory, &basename); if (directory.length() > 0) { output = directory + "/"; @@ -419,10 +558,10 @@ string FilePath(const FileDescriptor* file) { return output; } -string FilePathBasename(const FileDescriptor* file) { - string output; - string basename; - string directory; +std::string FilePathBasename(const FileDescriptor* file) { + std::string output; + std::string basename; + std::string directory; PathSplit(file->name(), &directory, &basename); basename = StripProto(basename); @@ -432,16 +571,17 @@ string FilePathBasename(const FileDescriptor* file) { return output; } -string FileClassName(const FileDescriptor* file) { - const string prefix = FileClassPrefix(file); - const string name = UnderscoresToCamelCase(StripProto(BaseFileName(file)), true) + "Root"; +std::string FileClassName(const FileDescriptor* file) { + const std::string prefix = FileClassPrefix(file); + const std::string name = + UnderscoresToCamelCase(StripProto(BaseFileName(file)), true) + "Root"; // There aren't really any reserved words that end in "Root", but playing // it safe and checking. return SanitizeNameForObjC(prefix, name, "_RootClass", NULL); } -string ClassNameWorker(const Descriptor* descriptor) { - string name; +std::string ClassNameWorker(const Descriptor* descriptor) { + std::string name; if (descriptor->containing_type() != NULL) { name = ClassNameWorker(descriptor->containing_type()); name += "_"; @@ -449,8 +589,8 @@ string ClassNameWorker(const Descriptor* descriptor) { return name + descriptor->name(); } -string ClassNameWorker(const EnumDescriptor* descriptor) { - string name; +std::string ClassNameWorker(const EnumDescriptor* descriptor) { + std::string name; if (descriptor->containing_type() != NULL) { name = ClassNameWorker(descriptor->containing_type()); name += "_"; @@ -458,19 +598,20 @@ string ClassNameWorker(const EnumDescriptor* descriptor) { return name + descriptor->name(); } -string ClassName(const Descriptor* descriptor) { +std::string ClassName(const Descriptor* descriptor) { return ClassName(descriptor, NULL); } -string ClassName(const Descriptor* descriptor, string* out_suffix_added) { +std::string ClassName(const Descriptor* descriptor, + std::string* out_suffix_added) { // 1. Message names are used as is (style calls for CamelCase, trust it). // 2. Check for reserved word at the very end and then suffix things. - const string prefix = FileClassPrefix(descriptor->file()); - const string name = ClassNameWorker(descriptor); + const std::string prefix = FileClassPrefix(descriptor->file()); + const std::string name = ClassNameWorker(descriptor); return SanitizeNameForObjC(prefix, name, "_Class", out_suffix_added); } -string EnumName(const EnumDescriptor* descriptor) { +std::string EnumName(const EnumDescriptor* descriptor) { // 1. Enum names are used as is (style calls for CamelCase, trust it). // 2. Check for reserved word at the every end and then suffix things. // message Fixed { @@ -479,27 +620,28 @@ string EnumName(const EnumDescriptor* descriptor) { // ... // } // yields Fixed_Class, Fixed_Size. - const string prefix = FileClassPrefix(descriptor->file()); - const string name = ClassNameWorker(descriptor); + const std::string prefix = FileClassPrefix(descriptor->file()); + const std::string name = ClassNameWorker(descriptor); return SanitizeNameForObjC(prefix, name, "_Enum", NULL); } -string EnumValueName(const EnumValueDescriptor* descriptor) { +std::string EnumValueName(const EnumValueDescriptor* descriptor) { // Because of the Switch enum compatibility, the name on the enum has to have // the suffix handing, so it slightly diverges from how nested classes work. // enum Fixed { // FOO = 1 // } // yields Fixed_Enum and Fixed_Enum_Foo (not Fixed_Foo). - const string class_name = EnumName(descriptor->type()); - const string value_str = UnderscoresToCamelCase(descriptor->name(), true); - const string name = class_name + "_" + value_str; + const std::string class_name = EnumName(descriptor->type()); + const std::string value_str = + UnderscoresToCamelCase(descriptor->name(), true); + const std::string name = class_name + "_" + value_str; // There aren't really any reserved words with an underscore and a leading // capital letter, but playing it safe and checking. return SanitizeNameForObjC("", name, "_Value", NULL); } -string EnumValueShortName(const EnumValueDescriptor* descriptor) { +std::string EnumValueShortName(const EnumValueDescriptor* descriptor) { // Enum value names (EnumValueName above) are the enum name turned into // a class name and then the value name is CamelCased and concatenated; the // whole thing then gets sanitized for reserved words. @@ -512,14 +654,14 @@ string EnumValueShortName(const EnumValueDescriptor* descriptor) { // So the right way to get the short name is to take the full enum name // and then strip off the enum name (leaving the value name and anything // done by sanitize). - const string class_name = EnumName(descriptor->type()); - const string long_name_prefix = class_name + "_"; - const string long_name = EnumValueName(descriptor); + const std::string class_name = EnumName(descriptor->type()); + const std::string long_name_prefix = class_name + "_"; + const std::string long_name = EnumValueName(descriptor); return StripPrefixString(long_name, long_name_prefix); } -string UnCamelCaseEnumShortName(const string& name) { - string result; +std::string UnCamelCaseEnumShortName(const std::string& name) { + std::string result; for (int i = 0; i < name.size(); i++) { char c = name[i]; if (i > 0 && ascii_isupper(c)) { @@ -530,15 +672,15 @@ string UnCamelCaseEnumShortName(const string& name) { return result; } -string ExtensionMethodName(const FieldDescriptor* descriptor) { - const string name = NameFromFieldDescriptor(descriptor); - const string result = UnderscoresToCamelCase(name, false); +std::string ExtensionMethodName(const FieldDescriptor* descriptor) { + const std::string name = NameFromFieldDescriptor(descriptor); + const std::string result = UnderscoresToCamelCase(name, false); return SanitizeNameForObjC("", result, "_Extension", NULL); } -string FieldName(const FieldDescriptor* field) { - const string name = NameFromFieldDescriptor(field); - string result = UnderscoresToCamelCase(name, false); +std::string FieldName(const FieldDescriptor* field) { + const std::string name = NameFromFieldDescriptor(field); + std::string result = UnderscoresToCamelCase(name, false); if (field->is_repeated() && !field->is_map()) { // Add "Array" before do check for reserved worlds. result += "Array"; @@ -551,42 +693,50 @@ string FieldName(const FieldDescriptor* field) { return SanitizeNameForObjC("", result, "_p", NULL); } -string FieldNameCapitalized(const FieldDescriptor* field) { +std::string FieldNameCapitalized(const FieldDescriptor* field) { // Want the same suffix handling, so upcase the first letter of the other // name. - string result = FieldName(field); + std::string result = FieldName(field); if (result.length() > 0) { result[0] = ascii_toupper(result[0]); } return result; } -string OneofEnumName(const OneofDescriptor* descriptor) { +std::string OneofEnumName(const OneofDescriptor* descriptor) { const Descriptor* fieldDescriptor = descriptor->containing_type(); - string name = ClassName(fieldDescriptor); + std::string name = ClassName(fieldDescriptor); name += "_" + UnderscoresToCamelCase(descriptor->name(), true) + "_OneOfCase"; // No sanitize needed because the OS never has names that end in _OneOfCase. return name; } -string OneofName(const OneofDescriptor* descriptor) { - string name = UnderscoresToCamelCase(descriptor->name(), false); +std::string OneofName(const OneofDescriptor* descriptor) { + std::string name = UnderscoresToCamelCase(descriptor->name(), false); // No sanitize needed because it gets OneOfCase added and that shouldn't // ever conflict. return name; } -string OneofNameCapitalized(const OneofDescriptor* descriptor) { +std::string OneofNameCapitalized(const OneofDescriptor* descriptor) { // Use the common handling and then up-case the first letter. - string result = OneofName(descriptor); + std::string result = OneofName(descriptor); if (result.length() > 0) { result[0] = ascii_toupper(result[0]); } return result; } -string UnCamelCaseFieldName(const string& name, const FieldDescriptor* field) { - string worker(name); +std::string ObjCClass(const std::string& class_name) { + return std::string("GPBObjCClass(") + class_name + ")"; +} + +std::string ObjCClassDeclaration(const std::string& class_name) { + return std::string("GPBObjCClassDeclaration(") + class_name + ");"; +} + +std::string UnCamelCaseFieldName(const std::string& name, const FieldDescriptor* field) { + std::string worker(name); if (HasSuffixString(worker, "_p")) { worker = StripSuffixString(worker, "_p"); } @@ -601,7 +751,7 @@ string UnCamelCaseFieldName(const string& name, const FieldDescriptor* field) { } return worker; } else { - string result; + std::string result; for (int i = 0; i < worker.size(); i++) { char c = worker[i]; if (ascii_isupper(c)) { @@ -617,7 +767,7 @@ string UnCamelCaseFieldName(const string& name, const FieldDescriptor* field) { } } -string GetCapitalizedType(const FieldDescriptor* field) { +std::string GetCapitalizedType(const FieldDescriptor* field) { switch (field->type()) { case FieldDescriptor::TYPE_INT32: return "Int32"; @@ -660,7 +810,7 @@ string GetCapitalizedType(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. GOOGLE_LOG(FATAL) << "Can't get here."; - return string(); + return std::string(); } ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) { @@ -734,7 +884,8 @@ bool IsReferenceType(const FieldDescriptor* field) { return !IsPrimitiveType(field); } -static string HandleExtremeFloatingPoint(string val, bool add_float_suffix) { +static std::string HandleExtremeFloatingPoint(std::string val, + bool add_float_suffix) { if (val == "nan") { return "NAN"; } else if (val == "inf") { @@ -743,16 +894,16 @@ static string HandleExtremeFloatingPoint(string val, bool add_float_suffix) { return "-INFINITY"; } else { // float strings with ., e or E need to have f appended - if (add_float_suffix && - (val.find(".") != string::npos || val.find("e") != string::npos || - val.find("E") != string::npos)) { + if (add_float_suffix && (val.find(".") != std::string::npos || + val.find("e") != std::string::npos || + val.find("E") != std::string::npos)) { val += "f"; } return val; } } -string GPBGenericValueFieldName(const FieldDescriptor* field) { +std::string GPBGenericValueFieldName(const FieldDescriptor* field) { // Returns the field within the GPBGenericValue union to use for the given // field. if (field->is_repeated()) { @@ -788,11 +939,11 @@ string GPBGenericValueFieldName(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. GOOGLE_LOG(FATAL) << "Can't get here."; - return string(); + return std::string(); } -string DefaultValue(const FieldDescriptor* field) { +std::string DefaultValue(const FieldDescriptor* field) { // Repeated fields don't have defaults. if (field->is_repeated()) { return "nil"; @@ -827,7 +978,7 @@ string DefaultValue(const FieldDescriptor* field) { return field->default_value_bool() ? "YES" : "NO"; case FieldDescriptor::CPPTYPE_STRING: { const bool has_default_value = field->has_default_value(); - const string& default_string = field->default_value_string(); + const std::string& default_string = field->default_value_string(); if (!has_default_value || default_string.length() == 0) { // If the field is defined as being the empty string, // then we will just assign to nil, as the empty string is the @@ -843,8 +994,8 @@ string DefaultValue(const FieldDescriptor* field) { // Must convert to a standard byte order for packing length into // a cstring. - uint32 length = ghtonl(default_string.length()); - string bytes((const char*)&length, sizeof(length)); + uint32_t length = ghtonl(default_string.length()); + std::string bytes((const char*)&length, sizeof(length)); bytes.append(default_string); return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\""; } else { @@ -860,7 +1011,7 @@ string DefaultValue(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. GOOGLE_LOG(FATAL) << "Can't get here."; - return string(); + return std::string(); } bool HasNonZeroDefaultValue(const FieldDescriptor* field) { @@ -893,7 +1044,7 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) { case FieldDescriptor::CPPTYPE_BOOL: return field->default_value_bool(); case FieldDescriptor::CPPTYPE_STRING: { - const string& default_string = field->default_value_string(); + const std::string& default_string = field->default_value_string(); return default_string.length() != 0; } case FieldDescriptor::CPPTYPE_ENUM: @@ -908,14 +1059,14 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) { return false; } -string BuildFlagsString(const FlagType flag_type, - const std::vector& strings) { - if (strings.size() == 0) { +std::string BuildFlagsString(const FlagType flag_type, + const std::vector& strings) { + if (strings.empty()) { return GetZeroEnumNameForFlagType(flag_type); } else if (strings.size() == 1) { return strings[0]; } - string string("(" + GetEnumNameForFlagType(flag_type) + ")("); + std::string string("(" + GetEnumNameForFlagType(flag_type) + ")("); for (size_t i = 0; i != strings.size(); ++i) { if (i > 0) { string.append(" | "); @@ -926,25 +1077,25 @@ string BuildFlagsString(const FlagType flag_type, return string; } -string BuildCommentsString(const SourceLocation& location, +std::string BuildCommentsString(const SourceLocation& location, bool prefer_single_line) { - const string& comments = location.leading_comments.empty() + const std::string& comments = location.leading_comments.empty() ? location.trailing_comments : location.leading_comments; - std::vector lines; + std::vector lines; lines = Split(comments, "\n", false); while (!lines.empty() && lines.back().empty()) { lines.pop_back(); } // If there are no comments, just return an empty string. - if (lines.size() == 0) { + if (lines.empty()) { return ""; } - string prefix; - string suffix; - string final_comments; - string epilogue; + std::string prefix; + std::string suffix; + std::string final_comments; + std::string epilogue; bool add_leading_space = false; @@ -960,7 +1111,7 @@ string BuildCommentsString(const SourceLocation& location, } for (int i = 0; i < lines.size(); i++) { - string line = StripPrefixString(lines[i], " "); + std::string line = StripPrefixString(lines[i], " "); // HeaderDoc and appledoc use '\' and '@' for markers; escape them. line = StringReplace(line, "\\", "\\\\", true); line = StringReplace(line, "@", "\\@", true); @@ -982,11 +1133,11 @@ string BuildCommentsString(const SourceLocation& location, // want to put the library in a framework is an interesting question. The // problem is it means changing sources shipped with the library to actually // use a different value; so it isn't as simple as a option. -const char* const ProtobufLibraryFrameworkName = "protobuf"; +const char* const ProtobufLibraryFrameworkName = "Protobuf"; -string ProtobufFrameworkImportSymbol(const string& framework_name) { +std::string ProtobufFrameworkImportSymbol(const std::string& framework_name) { // GPB_USE_[framework_name]_FRAMEWORK_IMPORTS - string result = string("GPB_USE_"); + std::string result = std::string("GPB_USE_"); result += ToUpper(framework_name); result += "_FRAMEWORK_IMPORTS"; return result; @@ -996,7 +1147,7 @@ bool IsProtobufLibraryBundledProtoFile(const FileDescriptor* file) { // We don't check the name prefix or proto package because some files // (descriptor.proto), aren't shipped generated by the library, so this // seems to be the safest way to only catch the ones shipped. - const string name = file->name(); + const std::string name = file->name(); if (name == "google/protobuf/any.proto" || name == "google/protobuf/api.proto" || name == "google/protobuf/duration.proto" || @@ -1035,36 +1186,37 @@ namespace { class ExpectedPrefixesCollector : public LineConsumer { public: - ExpectedPrefixesCollector(std::map* inout_package_to_prefix_map) + ExpectedPrefixesCollector(std::map* inout_package_to_prefix_map) : prefix_map_(inout_package_to_prefix_map) {} - virtual bool ConsumeLine(const StringPiece& line, string* out_error); + virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override; private: - std::map* prefix_map_; + std::map* prefix_map_; }; bool ExpectedPrefixesCollector::ConsumeLine( - const StringPiece& line, string* out_error) { + const StringPiece& line, std::string* out_error) { int offset = line.find('='); if (offset == StringPiece::npos) { - *out_error = string("Expected prefixes file line without equal sign: '") + - string(line) + "'."; + *out_error = std::string("Expected prefixes file line without equal sign: '") + + std::string(line) + "'."; return false; } StringPiece package = line.substr(0, offset); StringPiece prefix = line.substr(offset + 1); TrimWhitespace(&package); TrimWhitespace(&prefix); + MaybeUnQuote(&prefix); // Don't really worry about error checking the package/prefix for // being valid. Assume the file is validated when it is created/edited. - (*prefix_map_)[string(package)] = string(prefix); + (*prefix_map_)[std::string(package)] = std::string(prefix); return true; } -bool LoadExpectedPackagePrefixes(const Options &generation_options, - std::map* prefix_map, - string* out_error) { +bool LoadExpectedPackagePrefixes(const Options& generation_options, + std::map* prefix_map, + std::string* out_error) { if (generation_options.expected_prefixes_path.empty()) { return true; } @@ -1075,23 +1227,30 @@ bool LoadExpectedPackagePrefixes(const Options &generation_options, } bool ValidateObjCClassPrefix( - const FileDescriptor* file, - const string& expected_prefixes_path, - const std::map& expected_package_prefixes, - string* out_error) { - const string prefix = file->options().objc_class_prefix(); - const string package = file->package(); + const FileDescriptor* file, const std::string& expected_prefixes_path, + const std::map& expected_package_prefixes, + bool prefixes_must_be_registered, bool require_prefixes, + std::string* out_error) { + // Reminder: An explicit prefix option of "" is valid in case the default + // prefixing is set to use the proto package and a file needs to be generated + // without any prefix at all (for legacy reasons). + + bool has_prefix = file->options().has_objc_class_prefix(); + bool have_expected_prefix_file = !expected_prefixes_path.empty(); + + const std::string prefix = file->options().objc_class_prefix(); + const std::string package = file->package(); // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some // error cases, so it seems to be ok to use as a back door for warnings. // Check: Error - See if there was an expected prefix for the package and // report if it doesn't match (wrong or missing). - std::map::const_iterator package_match = + std::map::const_iterator package_match = expected_package_prefixes.find(package); if (package_match != expected_package_prefixes.end()) { // There was an entry, and... - if (package_match->second == prefix) { + if (has_prefix && package_match->second == prefix) { // ...it matches. All good, out of here! return true; } else { @@ -1099,7 +1258,7 @@ bool ValidateObjCClassPrefix( *out_error = "error: Expected 'option objc_class_prefix = \"" + package_match->second + "\";' for package '" + package + "' in '" + file->name() + "'"; - if (prefix.length()) { + if (has_prefix) { *out_error += "; but found '" + prefix + "' instead"; } *out_error += "."; @@ -1108,25 +1267,85 @@ bool ValidateObjCClassPrefix( } // If there was no prefix option, we're done at this point. - if (prefix.empty()) { - // No prefix, nothing left to check. + if (!has_prefix) { + if (require_prefixes) { + *out_error = + "error: '" + file->name() + "' does not have a required 'option" + + " objc_class_prefix'."; + return false; + } return true; } + // When the prefix is non empty, check it against the expected entries. + if (!prefix.empty() && have_expected_prefix_file) { + // For a non empty prefix, look for any other package that uses the prefix. + std::string other_package_for_prefix; + for (std::map::const_iterator i = + expected_package_prefixes.begin(); + i != expected_package_prefixes.end(); ++i) { + if (i->second == prefix) { + other_package_for_prefix = i->first; + break; + } + } + + // Check: Warning - If the file does not have a package, check whether the + // prefix was declared is being used by another package or not. This is + // a special case for empty packages. + if (package.empty()) { + // The file does not have a package and ... + if (other_package_for_prefix.empty()) { + // ... no other package has declared that prefix. + std::cerr + << "protoc:0: warning: File '" << file->name() << "' has no " + << "package. Consider adding a new package to the proto and adding '" + << "new.package = " << prefix << "' to the expected prefixes file (" + << expected_prefixes_path << ")." << std::endl; + std::cerr.flush(); + } else { + // ... another package has declared the same prefix. + std::cerr + << "protoc:0: warning: File '" << file->name() << "' has no package " + << "and package '" << other_package_for_prefix << "' already uses '" + << prefix << "' as its prefix. Consider either adding a new package " + << "to the proto, or reusing one of the packages already using this " + << "prefix in the expected prefixes file (" + << expected_prefixes_path << ")." << std::endl; + std::cerr.flush(); + } + return true; + } + + // Check: Error - Make sure the prefix wasn't expected for a different + // package (overlap is allowed, but it has to be listed as an expected + // overlap). + if (!other_package_for_prefix.empty()) { + *out_error = + "error: Found 'option objc_class_prefix = \"" + prefix + + "\";' in '" + file->name() + + "'; that prefix is already used for 'package " + + other_package_for_prefix + ";'. It can only be reused by listing " + + "it in the expected file (" + + expected_prefixes_path + ")."; + return false; // Only report first usage of the prefix. + } + } // !prefix.empty() + // Check: Warning - Make sure the prefix is is a reasonable value according // to Apple's rules (the checks above implicitly whitelist anything that // doesn't meet these rules). - if (!ascii_isupper(prefix[0])) { - std::cerr << std::endl + if (!prefix.empty() && !ascii_isupper(prefix[0])) { + std::cerr << "protoc:0: warning: Invalid 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" << " it should start with a capital letter." << std::endl; std::cerr.flush(); } - if (prefix.length() < 3) { + if (!prefix.empty() && prefix.length() < 3) { // Apple reserves 2 character prefixes for themselves. They do use some // 3 character prefixes, but they haven't updated the rules/docs. - std::cerr << std::endl + std::cerr << "protoc:0: warning: Invalid 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" << " Apple recommends they should be at least 3 characters long." @@ -1134,60 +1353,19 @@ bool ValidateObjCClassPrefix( std::cerr.flush(); } - // Look for any other package that uses the same prefix. - string other_package_for_prefix; - for (std::map::const_iterator i = expected_package_prefixes.begin(); - i != expected_package_prefixes.end(); ++i) { - if (i->second == prefix) { - other_package_for_prefix = i->first; - break; - } - } - - // Check: Warning - If the file does not have a package, check whether - // the prefix declared is being used by another package or not. - if (package.empty()) { - // The file does not have a package and ... - if (other_package_for_prefix.empty()) { - // ... no other package has declared that prefix. - std::cerr << std::endl - << "protoc:0: warning: File '" << file->name() << "' has no " - << "package. Consider adding a new package to the proto and adding '" - << "new.package = " << prefix << "' to the expected prefixes file (" - << expected_prefixes_path << ")." << std::endl; - std::cerr.flush(); - } else { - // ... another package has declared the same prefix. - std::cerr << std::endl - << "protoc:0: warning: File '" << file->name() << "' has no package " - << "and package '" << other_package_for_prefix << "' already uses '" - << prefix << "' as its prefix. Consider either adding a new package " - << "to the proto, or reusing one of the packages already using this " - << "prefix in the expected prefixes file (" - << expected_prefixes_path << ")." << std::endl; - std::cerr.flush(); + // Check: Error/Warning - If the given package/prefix pair wasn't expected, + // issue a error/warning to added to the file. + if (have_expected_prefix_file) { + if (prefixes_must_be_registered) { + *out_error = + "error: '" + file->name() + "' has 'option objc_class_prefix = \"" + + prefix + "\";', but it is not registered; add it to the expected " + + "prefixes file (" + expected_prefixes_path + ") for the package '" + + package + "'."; + return false; } - return true; - } - // Check: Error - Make sure the prefix wasn't expected for a different - // package (overlap is allowed, but it has to be listed as an expected - // overlap). - if (!other_package_for_prefix.empty()) { - *out_error = - "error: Found 'option objc_class_prefix = \"" + prefix + - "\";' in '" + file->name() + - "'; that prefix is already used for 'package " + - other_package_for_prefix + ";'. It can only be reused by listing " + - "it in the expected file (" + - expected_prefixes_path + ")."; - return false; // Only report first usage of the prefix. - } - - // Check: Warning - If the given package/prefix pair wasn't expected, issue a - // warning issue a warning suggesting it gets added to the file. - if (!expected_package_prefixes.empty()) { - std::cerr << std::endl + std::cerr << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" << " consider adding it to the expected prefixes file (" @@ -1202,9 +1380,15 @@ bool ValidateObjCClassPrefix( bool ValidateObjCClassPrefixes(const std::vector& files, const Options& generation_options, - string* out_error) { + std::string* out_error) { + // Allow a '-' as the path for the expected prefixes to completely disable + // even the most basic of checks. + if (generation_options.expected_prefixes_path == "-") { + return true; + } + // Load the expected package prefixes, if available, to validate against. - std::map expected_package_prefixes; + std::map expected_package_prefixes; if (!LoadExpectedPackagePrefixes(generation_options, &expected_package_prefixes, out_error)) { @@ -1225,6 +1409,8 @@ bool ValidateObjCClassPrefixes(const std::vector& files, ValidateObjCClassPrefix(files[i], generation_options.expected_prefixes_path, expected_package_prefixes, + generation_options.prefixes_must_be_registered, + generation_options.require_prefixes, out_error); if (!is_valid) { return false; @@ -1237,9 +1423,9 @@ TextFormatDecodeData::TextFormatDecodeData() { } TextFormatDecodeData::~TextFormatDecodeData() { } -void TextFormatDecodeData::AddString(int32 key, - const string& input_for_decode, - const string& desired_output) { +void TextFormatDecodeData::AddString(int32_t key, + const std::string& input_for_decode, + const std::string& desired_output) { for (std::vector::const_iterator i = entries_.begin(); i != entries_.end(); ++i) { if (i->first == key) { @@ -1251,12 +1437,12 @@ void TextFormatDecodeData::AddString(int32 key, } } - const string& data = TextFormatDecodeData::DecodeDataForString( + const std::string& data = TextFormatDecodeData::DecodeDataForString( input_for_decode, desired_output); entries_.push_back(DataEntry(key, data)); } -string TextFormatDecodeData::Data() const { +std::string TextFormatDecodeData::Data() const { std::ostringstream data_stringstream; if (num_entries() > 0) { @@ -1287,20 +1473,20 @@ class DecodeDataBuilder { Push(); need_underscore_ = true; } - string Finish() { + std::string Finish() { Push(); return decode_data_; } private: - static const uint8 kAddUnderscore = 0x80; + static constexpr uint8_t kAddUnderscore = 0x80; - static const uint8 kOpAsIs = 0x00; - static const uint8 kOpFirstUpper = 0x40; - static const uint8 kOpFirstLower = 0x20; - static const uint8 kOpAllUpper = 0x60; + static constexpr uint8_t kOpAsIs = 0x00; + static constexpr uint8_t kOpFirstUpper = 0x40; + static constexpr uint8_t kOpFirstLower = 0x20; + static constexpr uint8_t kOpAllUpper = 0x60; - static const int kMaxSegmentLen = 0x1f; + static constexpr int kMaxSegmentLen = 0x1f; void AddChar(const char desired) { ++segment_len_; @@ -1308,7 +1494,7 @@ class DecodeDataBuilder { } void Push() { - uint8 op = (op_ | segment_len_); + uint8_t op = (op_ | segment_len_); if (need_underscore_) op |= kAddUnderscore; if (op != 0) { decode_data_ += (char)op; @@ -1340,10 +1526,10 @@ class DecodeDataBuilder { bool need_underscore_; bool is_all_upper_; - uint8 op_; + uint8_t op_; int segment_len_; - string decode_data_; + std::string decode_data_; }; bool DecodeDataBuilder::AddCharacter(const char desired, const char input) { @@ -1384,8 +1570,8 @@ bool DecodeDataBuilder::AddCharacter(const char desired, const char input) { // If decode data can't be generated, a directive for the raw string // is used instead. -string DirectDecodeString(const string& str) { - string result; +std::string DirectDecodeString(const std::string& str) { + std::string result; result += (char)'\0'; // Marker for full string. result += str; result += (char)'\0'; // End of string. @@ -1395,17 +1581,17 @@ string DirectDecodeString(const string& str) { } // namespace // static -string TextFormatDecodeData::DecodeDataForString(const string& input_for_decode, - const string& desired_output) { - if ((input_for_decode.size() == 0) || (desired_output.size() == 0)) { +std::string TextFormatDecodeData::DecodeDataForString( + const std::string& input_for_decode, const std::string& desired_output) { + if (input_for_decode.empty() || desired_output.empty()) { std::cerr << "error: got empty string for making TextFormat data, input: \"" << input_for_decode << "\", desired: \"" << desired_output << "\"." << std::endl; std::cerr.flush(); abort(); } - if ((input_for_decode.find('\0') != string::npos) || - (desired_output.find('\0') != string::npos)) { + if ((input_for_decode.find('\0') != std::string::npos) || + (desired_output.find('\0') != std::string::npos)) { std::cerr << "error: got a null char in a string for making TextFormat data," << " input: \"" << CEscape(input_for_decode) << "\", desired: \"" << CEscape(desired_output) << "\"." << std::endl; @@ -1452,69 +1638,69 @@ class Parser { Parser(LineConsumer* line_consumer) : line_consumer_(line_consumer), line_(0) {} - // Parses a check of input, returning success/failure. - bool ParseChunk(StringPiece chunk); + // Feeds in some input, parse what it can, returning success/failure. Calling + // again after an error is undefined. + bool ParseChunk(StringPiece chunk, std::string* out_error); // Should be called to finish parsing (after all input has been provided via - // ParseChunk()). Returns success/failure. - bool Finish(); + // successful calls to ParseChunk(), calling after a ParseChunk() failure is + // undefined). Returns success/failure. + bool Finish(std::string* out_error); int last_line() const { return line_; } - string error_str() const { return error_str_; } private: - bool ParseLoop(); - LineConsumer* line_consumer_; int line_; - string error_str_; - StringPiece p_; - string leftover_; + std::string leftover_; }; -bool Parser::ParseChunk(StringPiece chunk) { +bool Parser::ParseChunk(StringPiece chunk, std::string* out_error) { + StringPiece full_chunk; if (!leftover_.empty()) { - leftover_ += string(chunk); - p_ = StringPiece(leftover_); + leftover_ += std::string(chunk); + full_chunk = StringPiece(leftover_); } else { - p_ = chunk; + full_chunk = chunk; } - bool result = ParseLoop(); - if (p_.empty()) { + + StringPiece line; + while (ReadLine(&full_chunk, &line)) { + ++line_; + RemoveComment(&line); + TrimWhitespace(&line); + if (!line.empty() && !line_consumer_->ConsumeLine(line, out_error)) { + if (out_error->empty()) { + *out_error = "ConsumeLine failed without setting an error."; + } + leftover_.clear(); + return false; + } + } + + if (full_chunk.empty()) { leftover_.clear(); } else { - leftover_ = string(p_); + leftover_ = std::string(full_chunk); } - return result; + return true; } -bool Parser::Finish() { - if (leftover_.empty()) { - return true; +bool Parser::Finish(std::string* out_error) { + // If there is still something to go, flush it with a newline. + if (!leftover_.empty() && !ParseChunk("\n", out_error)) { + return false; } - // Force a newline onto the end to finish parsing. - leftover_ += "\n"; - p_ = StringPiece(leftover_); - if (!ParseLoop()) { + // This really should never fail if ParseChunk succeeded, but check to be sure. + if (!leftover_.empty()) { + *out_error = "ParseSimple Internal error: finished with pending data."; return false; } - return p_.empty(); // Everything used? + return true; } -bool Parser::ParseLoop() { - StringPiece line; - while (ReadLine(&p_, &line)) { - ++line_; - RemoveComment(&line); - TrimWhitespace(&line); - if (line.size() == 0) { - continue; // Blank line. - } - if (!line_consumer_->ConsumeLine(line, &error_str_)) { - return false; - } - } - return true; +std::string FullErrorString(const std::string& name, int line_num, const std::string& msg) { + return std::string("error: ") + name + " Line " + StrCat(line_num) + ", " + msg; } } // namespace @@ -1523,63 +1709,72 @@ LineConsumer::LineConsumer() {} LineConsumer::~LineConsumer() {} -bool ParseSimpleFile( - const string& path, LineConsumer* line_consumer, string* out_error) { +bool ParseSimpleFile(const std::string& path, LineConsumer* line_consumer, + std::string* out_error) { int fd; do { fd = posix::open(path.c_str(), O_RDONLY); } while (fd < 0 && errno == EINTR); if (fd < 0) { - *out_error = - string("error: Unable to open \"") + path + "\", " + strerror(errno); + *out_error = std::string("error: Unable to open \"") + path + "\", " + + strerror(errno); return false; } io::FileInputStream file_stream(fd); file_stream.SetCloseOnDelete(true); + return ParseSimpleStream(file_stream, path, line_consumer, out_error); +} + +bool ParseSimpleStream(io::ZeroCopyInputStream& input_stream, + const std::string& stream_name, + LineConsumer* line_consumer, + std::string* out_error) { + std::string local_error; Parser parser(line_consumer); const void* buf; int buf_len; - while (file_stream.Next(&buf, &buf_len)) { + while (input_stream.Next(&buf, &buf_len)) { if (buf_len == 0) { continue; } - if (!parser.ParseChunk(StringPiece(static_cast(buf), buf_len))) { - *out_error = - string("error: ") + path + - " Line " + StrCat(parser.last_line()) + ", " + parser.error_str(); + if (!parser.ParseChunk(StringPiece(static_cast(buf), buf_len), + &local_error)) { + *out_error = FullErrorString(stream_name, parser.last_line(), local_error); return false; } } - return parser.Finish(); + if (!parser.Finish(&local_error)) { + *out_error = FullErrorString(stream_name, parser.last_line(), local_error); + return false; + } + return true; } ImportWriter::ImportWriter( - const string& generate_for_named_framework, - const string& named_framework_to_proto_path_mappings_path, - bool include_wkt_imports) + const std::string& generate_for_named_framework, + const std::string& named_framework_to_proto_path_mappings_path, + const std::string& runtime_import_prefix, bool include_wkt_imports) : generate_for_named_framework_(generate_for_named_framework), named_framework_to_proto_path_mappings_path_( named_framework_to_proto_path_mappings_path), + runtime_import_prefix_(runtime_import_prefix), include_wkt_imports_(include_wkt_imports), - need_to_parse_mapping_file_(true) { -} + need_to_parse_mapping_file_(true) {} ImportWriter::~ImportWriter() {} void ImportWriter::AddFile(const FileDescriptor* file, - const string& header_extension) { - const string file_path(FilePath(file)); - + const std::string& header_extension) { if (IsProtobufLibraryBundledProtoFile(file)) { // The imports of the WKTs are only needed within the library itself, // in other cases, they get skipped because the generated code already // import GPBProtocolBuffers.h and hence proves them. if (include_wkt_imports_) { - protobuf_framework_imports_.push_back( - FilePathBasename(file) + header_extension); - protobuf_non_framework_imports_.push_back(file_path + header_extension); + const std::string header_name = + "GPB" + FilePathBasename(file) + header_extension; + protobuf_imports_.push_back(header_name); } return; } @@ -1589,7 +1784,7 @@ void ImportWriter::AddFile(const FileDescriptor* file, ParseFrameworkMappings(); } - std::map::iterator proto_lookup = + std::map::iterator proto_lookup = proto_file_to_framework_name_.find(file->name()); if (proto_lookup != proto_file_to_framework_name_.end()) { other_framework_imports_.push_back( @@ -1605,49 +1800,24 @@ void ImportWriter::AddFile(const FileDescriptor* file, return; } - other_imports_.push_back(file_path + header_extension); + other_imports_.push_back(FilePath(file) + header_extension); } void ImportWriter::Print(io::Printer* printer) const { - assert(protobuf_non_framework_imports_.size() == - protobuf_framework_imports_.size()); - bool add_blank_line = false; - if (protobuf_framework_imports_.size() > 0) { - const string framework_name(ProtobufLibraryFrameworkName); - const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name)); - - printer->Print( - "#if $cpp_symbol$\n", - "cpp_symbol", cpp_symbol); - for (std::vector::const_iterator iter = protobuf_framework_imports_.begin(); - iter != protobuf_framework_imports_.end(); ++iter) { - printer->Print( - " #import <$framework_name$/$header$>\n", - "framework_name", framework_name, - "header", *iter); - } - printer->Print( - "#else\n"); - for (std::vector::const_iterator iter = protobuf_non_framework_imports_.begin(); - iter != protobuf_non_framework_imports_.end(); ++iter) { - printer->Print( - " #import \"$header$\"\n", - "header", *iter); - } - printer->Print( - "#endif\n"); - + if (!protobuf_imports_.empty()) { + PrintRuntimeImports(printer, protobuf_imports_, runtime_import_prefix_); add_blank_line = true; } - if (other_framework_imports_.size() > 0) { + if (!other_framework_imports_.empty()) { if (add_blank_line) { printer->Print("\n"); } - for (std::vector::const_iterator iter = other_framework_imports_.begin(); + for (std::vector::const_iterator iter = + other_framework_imports_.begin(); iter != other_framework_imports_.end(); ++iter) { printer->Print( "#import <$header$>\n", @@ -1657,12 +1827,12 @@ void ImportWriter::Print(io::Printer* printer) const { add_blank_line = true; } - if (other_imports_.size() > 0) { + if (!other_imports_.empty()) { if (add_blank_line) { printer->Print("\n"); } - for (std::vector::const_iterator iter = other_imports_.begin(); + for (std::vector::const_iterator iter = other_imports_.begin(); iter != other_imports_.end(); ++iter) { printer->Print( "#import \"$header$\"\n", @@ -1671,6 +1841,54 @@ void ImportWriter::Print(io::Printer* printer) const { } } +void ImportWriter::PrintRuntimeImports( + io::Printer* printer, const std::vector& header_to_import, + const std::string& runtime_import_prefix, bool default_cpp_symbol) { + // Given an override, use that. + if (!runtime_import_prefix.empty()) { + for (const auto& header : header_to_import) { + printer->Print( + " #import \"$import_prefix$/$header$\"\n", + "import_prefix", runtime_import_prefix, + "header", header); + } + return; + } + + const std::string framework_name(ProtobufLibraryFrameworkName); + const std::string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name)); + + if (default_cpp_symbol) { + printer->Print( + "// This CPP symbol can be defined to use imports that match up to the framework\n" + "// imports needed when using CocoaPods.\n" + "#if !defined($cpp_symbol$)\n" + " #define $cpp_symbol$ 0\n" + "#endif\n" + "\n", + "cpp_symbol", cpp_symbol); + } + + printer->Print( + "#if $cpp_symbol$\n", + "cpp_symbol", cpp_symbol); + for (const auto& header : header_to_import) { + printer->Print( + " #import <$framework_name$/$header$>\n", + "framework_name", framework_name, + "header", header); + } + printer->Print( + "#else\n"); + for (const auto& header : header_to_import) { + printer->Print( + " #import \"$header$\"\n", + "header", header); + } + printer->Print( + "#endif\n"); +} + void ImportWriter::ParseFrameworkMappings() { need_to_parse_mapping_file_ = false; if (named_framework_to_proto_path_mappings_path_.empty()) { @@ -1678,7 +1896,7 @@ void ImportWriter::ParseFrameworkMappings() { } ProtoFrameworkCollector collector(&proto_file_to_framework_name_); - string parse_error; + std::string parse_error; if (!ParseSimpleFile(named_framework_to_proto_path_mappings_path_, &collector, &parse_error)) { std::cerr << "error parsing " << named_framework_to_proto_path_mappings_path_ @@ -1688,12 +1906,12 @@ void ImportWriter::ParseFrameworkMappings() { } bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( - const StringPiece& line, string* out_error) { + const StringPiece& line, std::string* out_error) { int offset = line.find(':'); if (offset == StringPiece::npos) { *out_error = - string("Framework/proto file mapping line without colon sign: '") + - string(line) + "'."; + std::string("Framework/proto file mapping line without colon sign: '") + + std::string(line) + "'."; return false; } StringPiece framework_name = line.substr(0, offset); @@ -1709,13 +1927,13 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( StringPiece proto_file = proto_file_list.substr(start, offset - start); TrimWhitespace(&proto_file); - if (proto_file.size() != 0) { - std::map::iterator existing_entry = - map_->find(string(proto_file)); + if (!proto_file.empty()) { + std::map::iterator existing_entry = + map_->find(std::string(proto_file)); if (existing_entry != map_->end()) { std::cerr << "warning: duplicate proto file reference, replacing " "framework entry for '" - << string(proto_file) << "' with '" << string(framework_name) + << std::string(proto_file) << "' with '" << std::string(framework_name) << "' (was '" << existing_entry->second << "')." << std::endl; std::cerr.flush(); } @@ -1723,11 +1941,11 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( if (proto_file.find(' ') != StringPiece::npos) { std::cerr << "note: framework mapping file had a proto file with a " "space in, hopefully that isn't a missing comma: '" - << string(proto_file) << "'" << std::endl; + << std::string(proto_file) << "'" << std::endl; std::cerr.flush(); } - (*map_)[string(proto_file)] = string(framework_name); + (*map_)[std::string(proto_file)] = std::string(framework_name); } start = offset + 1; @@ -1736,7 +1954,6 @@ bool ImportWriter::ProtoFrameworkCollector::ConsumeLine( return true; } - } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.h similarity index 54% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 98ec7db8f..13a105240 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -38,6 +38,7 @@ #include #include +#include #include @@ -46,81 +47,98 @@ namespace protobuf { namespace compiler { namespace objectivec { +// Get/Set if the proto package should be used to make the default prefix for +// symbols. This will then impact most of the type naming apis below. It is done +// as a global to not break any other generator reusing the methods since they +// are exported. +bool PROTOC_EXPORT UseProtoPackageAsDefaultPrefix(); +void PROTOC_EXPORT SetUseProtoPackageAsDefaultPrefix(bool on_or_off); +// Get/Set the path to a file to load as exceptions when +// `UseProtoPackageAsDefaultPrefixUseProtoPackageAsDefaultPrefix()` is `true`. +// And empty string means there should be no exceptions loaded. +std::string PROTOC_EXPORT GetProtoPackagePrefixExceptionList(); +void PROTOC_EXPORT SetProtoPackagePrefixExceptionList( + const std::string& file_path); + // Generator options (see objectivec_generator.cc for a description of each): struct Options { Options(); - string expected_prefixes_path; - std::vector expected_prefixes_suppressions; - string generate_for_named_framework; - string named_framework_to_proto_path_mappings_path; + std::string expected_prefixes_path; + std::vector expected_prefixes_suppressions; + std::string generate_for_named_framework; + std::string named_framework_to_proto_path_mappings_path; + std::string runtime_import_prefix; + bool prefixes_must_be_registered; + bool require_prefixes; }; // Escape C++ trigraphs by escaping question marks to "\?". -string PROTOC_EXPORT EscapeTrigraphs(const string& to_escape); - -// Strips ".proto" or ".protodevel" from the end of a filename. -string PROTOC_EXPORT StripProto(const string& filename); +std::string PROTOC_EXPORT EscapeTrigraphs(const std::string& to_escape); // Remove white space from either end of a StringPiece. void PROTOC_EXPORT TrimWhitespace(StringPiece* input); // Returns true if the name requires a ns_returns_not_retained attribute applied // to it. -bool PROTOC_EXPORT IsRetainedName(const string& name); +bool PROTOC_EXPORT IsRetainedName(const std::string& name); // Returns true if the name starts with "init" and will need to have special // handling under ARC. -bool PROTOC_EXPORT IsInitName(const string& name); +bool PROTOC_EXPORT IsInitName(const std::string& name); -// Gets the objc_class_prefix. -string PROTOC_EXPORT FileClassPrefix(const FileDescriptor* file); +// Gets the objc_class_prefix or the prefix made from the proto package. +std::string PROTOC_EXPORT FileClassPrefix(const FileDescriptor* file); // Gets the path of the file we're going to generate (sans the .pb.h // extension). The path will be dependent on the objectivec package // declared in the proto package. -string PROTOC_EXPORT FilePath(const FileDescriptor* file); +std::string PROTOC_EXPORT FilePath(const FileDescriptor* file); // Just like FilePath(), but without the directory part. -string PROTOC_EXPORT FilePathBasename(const FileDescriptor* file); +std::string PROTOC_EXPORT FilePathBasename(const FileDescriptor* file); // Gets the name of the root class we'll generate in the file. This class // is not meant for external consumption, but instead contains helpers that // the rest of the classes need -string PROTOC_EXPORT FileClassName(const FileDescriptor* file); +std::string PROTOC_EXPORT FileClassName(const FileDescriptor* file); // These return the fully-qualified class name corresponding to the given // descriptor. -string PROTOC_EXPORT ClassName(const Descriptor* descriptor); -string PROTOC_EXPORT ClassName(const Descriptor* descriptor, - string* out_suffix_added); -string PROTOC_EXPORT EnumName(const EnumDescriptor* descriptor); +std::string PROTOC_EXPORT ClassName(const Descriptor* descriptor); +std::string PROTOC_EXPORT ClassName(const Descriptor* descriptor, + std::string* out_suffix_added); +std::string PROTOC_EXPORT EnumName(const EnumDescriptor* descriptor); // Returns the fully-qualified name of the enum value corresponding to the // the descriptor. -string PROTOC_EXPORT EnumValueName(const EnumValueDescriptor* descriptor); +std::string PROTOC_EXPORT EnumValueName(const EnumValueDescriptor* descriptor); // Returns the name of the enum value corresponding to the descriptor. -string PROTOC_EXPORT EnumValueShortName(const EnumValueDescriptor* descriptor); +std::string PROTOC_EXPORT EnumValueShortName(const EnumValueDescriptor* descriptor); // Reverse what an enum does. -string PROTOC_EXPORT UnCamelCaseEnumShortName(const string& name); +std::string PROTOC_EXPORT UnCamelCaseEnumShortName(const std::string& name); // Returns the name to use for the extension (used as the method off the file's // Root class). -string PROTOC_EXPORT ExtensionMethodName(const FieldDescriptor* descriptor); +std::string PROTOC_EXPORT ExtensionMethodName(const FieldDescriptor* descriptor); // Returns the transformed field name. -string PROTOC_EXPORT FieldName(const FieldDescriptor* field); -string PROTOC_EXPORT FieldNameCapitalized(const FieldDescriptor* field); +std::string PROTOC_EXPORT FieldName(const FieldDescriptor* field); +std::string PROTOC_EXPORT FieldNameCapitalized(const FieldDescriptor* field); // Returns the transformed oneof name. -string PROTOC_EXPORT OneofEnumName(const OneofDescriptor* descriptor); -string PROTOC_EXPORT OneofName(const OneofDescriptor* descriptor); -string PROTOC_EXPORT OneofNameCapitalized(const OneofDescriptor* descriptor); +std::string PROTOC_EXPORT OneofEnumName(const OneofDescriptor* descriptor); +std::string PROTOC_EXPORT OneofName(const OneofDescriptor* descriptor); +std::string PROTOC_EXPORT OneofNameCapitalized(const OneofDescriptor* descriptor); -inline bool HasFieldPresence(const FileDescriptor* file) { - return file->syntax() != FileDescriptor::SYNTAX_PROTO3; -} +// Returns a symbol that can be used in C code to refer to an Objective C +// class without initializing the class. +std::string PROTOC_EXPORT ObjCClass(const std::string& class_name); + +// Declares an Objective C class without initializing the class so that it can +// be refrerred to by ObjCClass. +std::string PROTOC_EXPORT ObjCClassDeclaration(const std::string& class_name); inline bool HasPreservingUnknownEnumSemantics(const FileDescriptor* file) { return file->syntax() == FileDescriptor::SYNTAX_PROTO3; @@ -131,8 +149,8 @@ inline bool IsMapEntryMessage(const Descriptor* descriptor) { } // Reverse of the above. -string PROTOC_EXPORT UnCamelCaseFieldName(const string& name, - const FieldDescriptor* field); +std::string PROTOC_EXPORT UnCamelCaseFieldName(const std::string& name, + const FieldDescriptor* field); enum ObjectiveCType { OBJECTIVECTYPE_INT32, @@ -154,11 +172,11 @@ enum FlagType { FLAGTYPE_FIELD }; -template -string GetOptionalDeprecatedAttribute( - const TDescriptor* descriptor, - const FileDescriptor* file = NULL, - bool preSpace = true, bool postNewline = false) { +template +std::string GetOptionalDeprecatedAttribute(const TDescriptor* descriptor, + const FileDescriptor* file = NULL, + bool preSpace = true, + bool postNewline = false) { bool isDeprecated = descriptor->options().deprecated(); // The file is only passed when checking Messages & Enums, so those types // get tagged. At the moment, it doesn't seem to make sense to tag every @@ -169,7 +187,7 @@ string GetOptionalDeprecatedAttribute( isDeprecated = isFileLevelDeprecation; } if (isDeprecated) { - string message; + std::string message; const FileDescriptor* sourceFile = descriptor->file(); if (isFileLevelDeprecation) { message = sourceFile->name() + " is deprecated."; @@ -178,7 +196,7 @@ string GetOptionalDeprecatedAttribute( sourceFile->name() + ")."; } - string result = string("GPB_DEPRECATED_MSG(\"") + message + "\")"; + std::string result = std::string("GPB_DEPRECATED_MSG(\"") + message + "\")"; if (preSpace) { result.insert(0, " "); } @@ -191,7 +209,7 @@ string GetOptionalDeprecatedAttribute( } } -string PROTOC_EXPORT GetCapitalizedType(const FieldDescriptor* field); +std::string PROTOC_EXPORT GetCapitalizedType(const FieldDescriptor* field); ObjectiveCType PROTOC_EXPORT GetObjectiveCType(FieldDescriptor::Type field_type); @@ -203,25 +221,26 @@ inline ObjectiveCType GetObjectiveCType(const FieldDescriptor* field) { bool PROTOC_EXPORT IsPrimitiveType(const FieldDescriptor* field); bool PROTOC_EXPORT IsReferenceType(const FieldDescriptor* field); -string PROTOC_EXPORT GPBGenericValueFieldName(const FieldDescriptor* field); -string PROTOC_EXPORT DefaultValue(const FieldDescriptor* field); +std::string PROTOC_EXPORT +GPBGenericValueFieldName(const FieldDescriptor* field); +std::string PROTOC_EXPORT DefaultValue(const FieldDescriptor* field); bool PROTOC_EXPORT HasNonZeroDefaultValue(const FieldDescriptor* field); -string PROTOC_EXPORT BuildFlagsString(const FlagType type, - const std::vector& strings); +std::string PROTOC_EXPORT +BuildFlagsString(const FlagType type, const std::vector& strings); // Builds HeaderDoc/appledoc style comments out of the comments in the .proto // file. -string PROTOC_EXPORT BuildCommentsString(const SourceLocation& location, - bool prefer_single_line); +std::string PROTOC_EXPORT BuildCommentsString(const SourceLocation& location, + bool prefer_single_line); // The name the commonly used by the library when built as a framework. // This lines up to the name used in the CocoaPod. extern PROTOC_EXPORT const char* const ProtobufLibraryFrameworkName; // Returns the CPP symbol name to use as the gate for framework style imports // for the given framework name to use. -string PROTOC_EXPORT -ProtobufFrameworkImportSymbol(const string& framework_name); +std::string PROTOC_EXPORT +ProtobufFrameworkImportSymbol(const std::string& framework_name); // Checks if the file is one of the proto's bundled with the library. bool PROTOC_EXPORT @@ -230,9 +249,9 @@ IsProtobufLibraryBundledProtoFile(const FileDescriptor* file); // Checks the prefix for the given files and outputs any warnings as needed. If // there are flat out errors, then out_error is filled in with the first error // and the result is false. -bool PROTOC_EXPORT -ValidateObjCClassPrefixes(const std::vector& files, - const Options& generation_options, string* out_error); +bool PROTOC_EXPORT ValidateObjCClassPrefixes( + const std::vector& files, + const Options& generation_options, std::string* out_error); // Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform // the input into the expected output. @@ -244,16 +263,16 @@ class PROTOC_EXPORT TextFormatDecodeData { TextFormatDecodeData(const TextFormatDecodeData&) = delete; TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete; - void AddString(int32 key, const string& input_for_decode, - const string& desired_output); + void AddString(int32_t key, const std::string& input_for_decode, + const std::string& desired_output); size_t num_entries() const { return entries_.size(); } - string Data() const; + std::string Data() const; - static string DecodeDataForString(const string& input_for_decode, - const string& desired_output); + static std::string DecodeDataForString(const std::string& input_for_decode, + const std::string& desired_output); private: - typedef std::pair DataEntry; + typedef std::pair DataEntry; std::vector entries_; }; @@ -262,49 +281,60 @@ class PROTOC_EXPORT LineConsumer { public: LineConsumer(); virtual ~LineConsumer(); - virtual bool ConsumeLine(const StringPiece& line, string* out_error) = 0; + virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) = 0; }; -bool PROTOC_EXPORT ParseSimpleFile(const string& path, +bool PROTOC_EXPORT ParseSimpleFile(const std::string& path, LineConsumer* line_consumer, - string* out_error); + std::string* out_error); + +bool PROTOC_EXPORT ParseSimpleStream(io::ZeroCopyInputStream& input_stream, + const std::string& stream_name, + LineConsumer* line_consumer, + std::string* out_error); // Helper class for parsing framework import mappings and generating // import statements. class PROTOC_EXPORT ImportWriter { public: - ImportWriter(const string& generate_for_named_framework, - const string& named_framework_to_proto_path_mappings_path, + ImportWriter(const std::string& generate_for_named_framework, + const std::string& named_framework_to_proto_path_mappings_path, + const std::string& runtime_import_prefix, bool include_wkt_imports); ~ImportWriter(); - void AddFile(const FileDescriptor* file, const string& header_extension); - void Print(io::Printer *printer) const; + void AddFile(const FileDescriptor* file, const std::string& header_extension); + void Print(io::Printer* printer) const; + + static void PrintRuntimeImports(io::Printer* printer, + const std::vector& header_to_import, + const std::string& runtime_import_prefix, + bool default_cpp_symbol = false); private: class ProtoFrameworkCollector : public LineConsumer { public: - ProtoFrameworkCollector(std::map* inout_proto_file_to_framework_name) + ProtoFrameworkCollector(std::map* inout_proto_file_to_framework_name) : map_(inout_proto_file_to_framework_name) {} - virtual bool ConsumeLine(const StringPiece& line, string* out_error); + virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override; private: - std::map* map_; + std::map* map_; }; void ParseFrameworkMappings(); - const string generate_for_named_framework_; - const string named_framework_to_proto_path_mappings_path_; + const std::string generate_for_named_framework_; + const std::string named_framework_to_proto_path_mappings_path_; + const std::string runtime_import_prefix_; const bool include_wkt_imports_; - std::map proto_file_to_framework_name_; + std::map proto_file_to_framework_name_; bool need_to_parse_mapping_file_; - std::vector protobuf_framework_imports_; - std::vector protobuf_non_framework_imports_; - std::vector other_framework_imports_; - std::vector other_imports_; + std::vector protobuf_imports_; + std::vector other_framework_imports_; + std::vector other_imports_; }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc similarity index 65% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc index dc1cef556..3c5eda226 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc @@ -29,6 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#include #include #include @@ -39,21 +40,21 @@ namespace objectivec { namespace { TEST(ObjCHelper, TextFormatDecodeData_DecodeDataForString_RawStrings) { - string input_for_decode("abcdefghIJ"); - string desired_output_for_decode; - string expected; - string result; + std::string input_for_decode("abcdefghIJ"); + std::string desired_output_for_decode; + std::string expected; + std::string result; // Different data, can't transform. desired_output_for_decode = "zbcdefghIJ"; - expected = string("\0zbcdefghIJ\0", 12); + expected = std::string("\0zbcdefghIJ\0", 12); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); desired_output_for_decode = "abcdezghIJ"; - expected = string("\0abcdezghIJ\0", 12); + expected = std::string("\0abcdezghIJ\0", 12); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); @@ -61,7 +62,7 @@ TEST(ObjCHelper, TextFormatDecodeData_DecodeDataForString_RawStrings) { // Shortened data, can't transform. desired_output_for_decode = "abcdefghI"; - expected = string("\0abcdefghI\0", 11); + expected = std::string("\0abcdefghI\0", 11); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); @@ -69,32 +70,32 @@ TEST(ObjCHelper, TextFormatDecodeData_DecodeDataForString_RawStrings) { // Extra data, can't transform. desired_output_for_decode = "abcdefghIJz"; - expected = string("\0abcdefghIJz\0", 13); + expected = std::string("\0abcdefghIJz\0", 13); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); } TEST(ObjCHelper, TextFormatDecodeData_DecodeDataForString_ByteCodes) { - string input_for_decode("abcdefghIJ"); - string desired_output_for_decode; - string expected; - string result; + std::string input_for_decode("abcdefghIJ"); + std::string desired_output_for_decode; + std::string expected; + std::string result; desired_output_for_decode = "abcdefghIJ"; - expected = string("\x0A\x0", 2); + expected = std::string("\x0A\x0", 2); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); desired_output_for_decode = "_AbcdefghIJ"; - expected = string("\xCA\x0", 2); + expected = std::string("\xCA\x0", 2); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); desired_output_for_decode = "ABCD__EfghI_j"; - expected = string("\x64\x80\xC5\xA1\x0", 5); + expected = std::string("\x64\x80\xC5\xA1\x0", 5); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); @@ -105,7 +106,7 @@ TEST(ObjCHelper, TextFormatDecodeData_DecodeDataForString_ByteCodes) { "longFieldNameIsLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1000"; desired_output_for_decode = "long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000"; - expected = string("\x04\xA5\xA4\xA2\xBF\x1F\x0E\x84\x0", 9); + expected = std::string("\x04\xA5\xA4\xA2\xBF\x1F\x0E\x84\x0", 9); result = TextFormatDecodeData::DecodeDataForString(input_for_decode, desired_output_for_decode); EXPECT_EQ(expected, result); @@ -128,7 +129,7 @@ TEST(ObjCHelperDeathTest, TextFormatDecodeData_DecodeDataForString_Failures) { // Null char in the string. - string str_with_null_char("ab\0c", 4); + std::string str_with_null_char("ab\0c", 4); EXPECT_EXIT( TextFormatDecodeData::DecodeDataForString(str_with_null_char, "def"), ::testing::KilledBySignal(SIGABRT), @@ -160,7 +161,7 @@ TEST(ObjCHelper, TextFormatDecodeData_RawStrings) { 0x2, 0x0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'I', 0x0, 0x4, 0x0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'I', 'J', 'z', 0x0, }; - string expected((const char*)expected_data, sizeof(expected_data)); + std::string expected((const char*)expected_data, sizeof(expected_data)); EXPECT_EQ(expected, decode_data.Data()); } @@ -196,7 +197,7 @@ TEST(ObjCHelper, TextFormatDecodeData_ByteCodes) { // underscore, as is + 3 (00 op) 0xE8, 0x07, 0x04, 0xA5, 0xA4, 0xA2, 0xBF, 0x1F, 0x0E, 0x84, 0x0, }; - string expected((const char*)expected_data, sizeof(expected_data)); + std::string expected((const char*)expected_data, sizeof(expected_data)); EXPECT_EQ(expected, decode_data.Data()); } @@ -221,7 +222,7 @@ TEST(ObjCHelperDeathTest, TextFormatDecodeData_Failures) { // Null char in the string. - string str_with_null_char("ab\0c", 4); + std::string str_with_null_char("ab\0c", 4); EXPECT_EXIT( decode_data.AddString(1, str_with_null_char, "def"), ::testing::KilledBySignal(SIGABRT), @@ -242,6 +243,133 @@ TEST(ObjCHelperDeathTest, TextFormatDecodeData_Failures) { } #endif // PROTOBUF_HAS_DEATH_TEST +class TestLineCollector : public LineConsumer { + public: + TestLineCollector(std::vector* inout_lines, + const std::string* reject_line = nullptr, + bool skip_msg = false) + : lines_(inout_lines), reject_(reject_line), skip_msg_(skip_msg) {} + + bool ConsumeLine(const StringPiece& line, std::string* out_error) override { + if (reject_ && *reject_ == line) { + if (!skip_msg_) { + *out_error = std::string("Rejected '") + *reject_ + "'"; + } + return false; + } + if (lines_) { + lines_->emplace_back(line); + } + return true; + } + + private: + std::vector* lines_; + const std::string* reject_; + bool skip_msg_; +}; + +const int kBlockSizes[] = {-1, 1, 2, 5, 64}; +const int kBlockSizeCount = GOOGLE_ARRAYSIZE(kBlockSizes); + +TEST(ObjCHelper, ParseSimple_BasicsSuccess) { + const std::vector>> tests = { + {"", {}}, + {"a", {"a"}}, + {"a c", {"a c"}}, + {" a c ", {"a c"}}, + {"\ta c ", {"a c"}}, + {"abc\n", {"abc"}}, + {"abc\nd f", {"abc", "d f"}}, + {"\n abc \n def \n\n", {"abc", "def"}}, + }; + + for (const auto& test : tests) { + for (int i = 0; i < kBlockSizeCount; i++) { + io::ArrayInputStream input(test.first.data(), test.first.size(), kBlockSizes[i]); + std::string err_str; + std::vector lines; + TestLineCollector collector(&lines); + EXPECT_TRUE(ParseSimpleStream(input, "dummy", &collector, &err_str)); + EXPECT_EQ(lines, test.second); + EXPECT_TRUE(err_str.empty()); + } + } +} + +TEST(ObjCHelper, ParseSimple_DropsComments) { + const std::vector>> tests = { + {"# nothing", {}}, + {"#", {}}, + {"##", {}}, + {"\n# nothing\n", {}}, + {"a # same line", {"a"}}, + {"a # same line\n", {"a"}}, + {"a\n# line\nc", {"a", "c"}}, + {"# n o t # h i n g #", {}}, + {"## n o # t h i n g #", {}}, + {"a# n o t # h i n g #", {"a"}}, + {"a\n## n o # t h i n g #", {"a"}}, + }; + + for (const auto& test : tests) { + for (int i = 0; i < kBlockSizeCount; i++) { + io::ArrayInputStream input(test.first.data(), test.first.size(), kBlockSizes[i]); + std::string err_str; + std::vector lines; + TestLineCollector collector(&lines); + EXPECT_TRUE(ParseSimpleStream(input, "dummy", &collector, &err_str)); + EXPECT_EQ(lines, test.second); + EXPECT_TRUE(err_str.empty()); + } + } +} + +TEST(ObjCHelper, ParseSimple_RejectLines) { + const std::vector> tests = { + std::make_tuple("a\nb\nc", "a", 1), + std::make_tuple("a\nb\nc", "b", 2), + std::make_tuple("a\nb\nc", "c", 3), + std::make_tuple("a\nb\nc\n", "c", 3), + }; + + for (const auto& test : tests) { + for (int i = 0; i < kBlockSizeCount; i++) { + io::ArrayInputStream input(std::get<0>(test).data(), std::get<0>(test).size(), + kBlockSizes[i]); + std::string err_str; + TestLineCollector collector(nullptr, &std::get<1>(test)); + EXPECT_FALSE(ParseSimpleStream(input, "dummy", &collector, &err_str)); + std::string expected_err = + StrCat("error: dummy Line ", std::get<2>(test), ", Rejected '", std::get<1>(test), "'"); + EXPECT_EQ(err_str, expected_err); + } + } +} + +TEST(ObjCHelper, ParseSimple_RejectLinesNoMessage) { + const std::vector> tests = { + std::make_tuple("a\nb\nc", "a", 1), + std::make_tuple("a\nb\nc", "b", 2), + std::make_tuple("a\nb\nc", "c", 3), + std::make_tuple("a\nb\nc\n", "c", 3), + }; + + for (const auto& test : tests) { + for (int i = 0; i < kBlockSizeCount; i++) { + io::ArrayInputStream input(std::get<0>(test).data(), std::get<0>(test).size(), + kBlockSizes[i]); + std::string err_str; + TestLineCollector collector(nullptr, &std::get<1>(test), true /* skip msg */); + EXPECT_FALSE(ParseSimpleStream(input, "dummy", &collector, &err_str)); + std::string expected_err = + StrCat("error: dummy Line ", std::get<2>(test), + ", ConsumeLine failed without setting an error."); + EXPECT_EQ(err_str, expected_err); + } + } +} + // TODO(thomasvl): Should probably add some unittests for all the special cases // of name mangling (class name, field name, enum names). Rather than doing // this with an ObjC test in the objectivec directory, we should be able to diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc similarity index 87% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc index 6abad8bd0..746224ff8 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc @@ -85,9 +85,9 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options) : RepeatedFieldGenerator(descriptor, options) { const FieldDescriptor* key_descriptor = - descriptor->message_type()->FindFieldByName("key"); + descriptor->message_type()->map_key(); const FieldDescriptor* value_descriptor = - descriptor->message_type()->FindFieldByName("value"); + descriptor->message_type()->map_value(); value_field_generator_.reset(FieldGenerator::Make(value_descriptor, options)); // Pull over some variables_ from the value. @@ -96,22 +96,24 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, variables_["default_name"] = value_field_generator_->variable("default_name"); // Build custom field flags. - std::vector field_flags; + std::vector field_flags; field_flags.push_back("GPBFieldMapKey" + GetCapitalizedType(key_descriptor)); // Pull over the current text format custom name values that was calculated. if (variables_["fieldflags"].find("GPBFieldTextFormatNameCustom") != - string::npos) { + std::string::npos) { field_flags.push_back("GPBFieldTextFormatNameCustom"); } // Pull over some info from the value's flags. - const string& value_field_flags = + const std::string& value_field_flags = value_field_generator_->variable("fieldflags"); - if (value_field_flags.find("GPBFieldHasDefaultValue") != string::npos) { + if (value_field_flags.find("GPBFieldHasDefaultValue") != std::string::npos) { field_flags.push_back("GPBFieldHasDefaultValue"); } - if (value_field_flags.find("GPBFieldHasEnumDescriptor") != string::npos) { + if (value_field_flags.find("GPBFieldHasEnumDescriptor") != + std::string::npos) { field_flags.push_back("GPBFieldHasEnumDescriptor"); } + variables_["fieldflags"] = BuildFlagsString(FLAGTYPE_FIELD, field_flags); ObjectiveCType value_objc_type = GetObjectiveCType(value_descriptor); @@ -126,7 +128,7 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, "NSMutableDictionaryvariable("storage_type") + "*>"; } else { - string class_name("GPB"); + std::string class_name("GPB"); class_name += MapEntryTypeName(key_descriptor, true); class_name += MapEntryTypeName(value_descriptor, false); class_name += "Dictionary"; @@ -159,17 +161,27 @@ void MapFieldGenerator::FinishInitialization(void) { } void MapFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls) const { + std::set* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); const FieldDescriptor* value_descriptor = descriptor_->message_type()->FindFieldByName("value"); if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_MESSAGE) { - const string& value_storage_type = + const std::string& value_storage_type = value_field_generator_->variable("storage_type"); fwd_decls->insert("@class " + value_storage_type); } } +void MapFieldGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const { + // Class name is already in "storage_type". + const FieldDescriptor* value_descriptor = + descriptor_->message_type()->FindFieldByName("value"); + if (GetObjectiveCType(value_descriptor) == OBJECTIVECTYPE_MESSAGE) { + fwd_decls->insert(ObjCClassDeclaration( + value_field_generator_->variable("storage_type"))); + } +} } // namespace objectivec } // namespace compiler diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.h similarity index 91% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.h index c3085019e..84eac6183 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_map_field.h @@ -45,7 +45,7 @@ class MapFieldGenerator : public RepeatedFieldGenerator { const Options& options); public: - virtual void FinishInitialization(void); + virtual void FinishInitialization(void) override; MapFieldGenerator(const MapFieldGenerator&) = delete; MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; @@ -54,7 +54,10 @@ class MapFieldGenerator : public RepeatedFieldGenerator { MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); virtual ~MapFieldGenerator(); - virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; + virtual void DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const override; + virtual void DetermineForwardDeclarations( + std::set* fwd_decls) const override; private: std::unique_ptr value_field_generator_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.cc similarity index 89% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.cc index 6731e37a7..3a00113f3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.cc @@ -50,9 +50,6 @@ namespace protobuf { namespace compiler { namespace objectivec { -using internal::WireFormat; -using internal::WireFormatLite; - namespace { struct FieldOrderingByNumber { inline bool operator()(const FieldDescriptor* a, @@ -173,22 +170,21 @@ const FieldDescriptor** SortFieldsByStorageSize(const Descriptor* descriptor) { } } // namespace -MessageGenerator::MessageGenerator(const string& root_classname, +MessageGenerator::MessageGenerator(const std::string& root_classname, const Descriptor* descriptor, const Options& options) : root_classname_(root_classname), descriptor_(descriptor), field_generators_(descriptor, options), class_name_(ClassName(descriptor_)), - deprecated_attribute_( - GetOptionalDeprecatedAttribute(descriptor, descriptor->file(), false, true)) { - + deprecated_attribute_(GetOptionalDeprecatedAttribute( + descriptor, descriptor->file(), false, true)) { for (int i = 0; i < descriptor_->extension_count(); i++) { extension_generators_.emplace_back( new ExtensionGenerator(class_name_, descriptor_->extension(i))); } - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { OneofGenerator* generator = new OneofGenerator(descriptor_->oneof_decl(i)); oneof_generators_.emplace_back(generator); } @@ -220,7 +216,8 @@ void MessageGenerator::GenerateStaticVariablesInitialization( } } -void MessageGenerator::DetermineForwardDeclarations(std::set* fwd_decls) { +void MessageGenerator::DetermineForwardDeclarations( + std::set* fwd_decls) { if (!IsMapEntryMessage(descriptor_)) { for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* fieldDescriptor = descriptor_->field(i); @@ -234,6 +231,31 @@ void MessageGenerator::DetermineForwardDeclarations(std::set* fwd_decls) } } +void MessageGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) { + if (!IsMapEntryMessage(descriptor_)) { + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* fieldDescriptor = descriptor_->field(i); + field_generators_.get(fieldDescriptor) + .DetermineObjectiveCClassDefinitions(fwd_decls); + } + } + + for (const auto& generator : extension_generators_) { + generator->DetermineObjectiveCClassDefinitions(fwd_decls); + } + + for (const auto& generator : nested_message_generators_) { + generator->DetermineObjectiveCClassDefinitions(fwd_decls); + } + + const Descriptor* containing_descriptor = descriptor_->containing_type(); + if (containing_descriptor != NULL) { + std::string containing_class = ClassName(containing_descriptor); + fwd_decls->insert(ObjCClassDeclaration(containing_class)); + } +} + bool MessageGenerator::IncludesOneOfDefinition() const { if (!oneof_generators_.empty()) { return true; @@ -304,7 +326,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) { generator->GenerateCaseEnum(printer); } - string message_comments; + std::string message_comments; SourceLocation location; if (descriptor_->GetSourceLocation(&location)) { message_comments = BuildCommentsString(location, false); @@ -313,16 +335,17 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) { } printer->Print( - "$comments$$deprecated_attribute$@interface $classname$ : GPBMessage\n\n", + "$comments$$deprecated_attribute$GPB_FINAL @interface $classname$ : GPBMessage\n\n", "classname", class_name_, "deprecated_attribute", deprecated_attribute_, "comments", message_comments); - std::vector seen_oneofs(descriptor_->oneof_decl_count(), 0); + std::vector seen_oneofs(oneof_generators_.size(), 0); for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); - if (field->containing_oneof() != NULL) { - const int oneof_index = field->containing_oneof()->index(); + const OneofDescriptor* oneof = field->real_containing_oneof(); + if (oneof) { + const int oneof_index = oneof->index(); if (!seen_oneofs[oneof_index]) { seen_oneofs[oneof_index] = 1; oneof_generators_[oneof_index]->GeneratePublicCasePropertyDeclaration( @@ -393,6 +416,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { SortFieldsByStorageSize(descriptor_)); std::vector sorted_extensions; + sorted_extensions.reserve(descriptor_->extension_range_count()); for (int i = 0; i < descriptor_->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor_->extension_range(i)); } @@ -421,7 +445,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { field_generators_.SetOneofIndexBase(sizeof_has_storage); // sizeof_has_storage needs enough bits for the single fields that aren't in // any oneof, and then one int32 for each oneof (to store the field number). - sizeof_has_storage += descriptor_->oneof_decl_count(); + sizeof_has_storage += oneof_generators_.size(); printer->Print( "\n" @@ -450,18 +474,18 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { TextFormatDecodeData text_format_decode_data; bool has_fields = descriptor_->field_count() > 0; bool need_defaults = field_generators_.DoesAnyFieldHaveNonZeroDefault(); - string field_description_type; + std::string field_description_type; if (need_defaults) { field_description_type = "GPBMessageFieldDescriptionWithDefault"; } else { field_description_type = "GPBMessageFieldDescription"; } if (has_fields) { - printer->Print( - " static $field_description_type$ fields[] = {\n", - "field_description_type", field_description_type); printer->Indent(); printer->Indent(); + printer->Print( + "static $field_description_type$ fields[] = {\n", + "field_description_type", field_description_type); printer->Indent(); for (int i = 0; i < descriptor_->field_count(); ++i) { const FieldGenerator& field_generator = @@ -474,13 +498,13 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { } } printer->Outdent(); + printer->Print( + "};\n"); printer->Outdent(); printer->Outdent(); - printer->Print( - " };\n"); } - std::map vars; + std::map vars; vars["classname"] = class_name_; vars["rootclassname"] = root_classname_; vars["fields"] = has_fields ? "fields" : "NULL"; @@ -491,7 +515,9 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { vars["fields_count"] = "0"; } - std::vector init_flags; + std::vector init_flags; + init_flags.push_back("GPBDescriptorInitializationFlag_UsesClassRefs"); + init_flags.push_back("GPBDescriptorInitializationFlag_Proto3OptionalKnown"); if (need_defaults) { init_flags.push_back("GPBDescriptorInitializationFlag_FieldsWithDefault"); } @@ -511,7 +537,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " fieldCount:$fields_count$\n" " storageSize:sizeof($classname$__storage_)\n" " flags:$init_flags$];\n"); - if (oneof_generators_.size() != 0) { + if (!oneof_generators_.empty()) { printer->Print( " static const char *oneofs[] = {\n"); for (const auto& generator : oneof_generators_) { @@ -526,7 +552,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { "first_has_index", oneof_generators_[0]->HasIndexAsString()); } if (text_format_decode_data.num_entries() != 0) { - const string text_format_data_str(text_format_decode_data.Data()); + const std::string text_format_data_str(text_format_decode_data.Data()); printer->Print( "#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n" " static const char *extraTextFormatInfo ="); @@ -542,7 +568,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " [localDescriptor setupExtraTextInfo:extraTextFormatInfo];\n" "#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS\n"); } - if (sorted_extensions.size() != 0) { + if (!sorted_extensions.empty()) { printer->Print( " static const GPBExtensionRange ranges[] = {\n"); for (int i = 0; i < sorted_extensions.size(); i++) { @@ -556,14 +582,15 @@ void MessageGenerator::GenerateSource(io::Printer* printer) { " count:(uint32_t)(sizeof(ranges) / sizeof(GPBExtensionRange))];\n"); } if (descriptor_->containing_type() != NULL) { - string parent_class_name = ClassName(descriptor_->containing_type()); + std::string containing_class = ClassName(descriptor_->containing_type()); + std::string parent_class_ref = ObjCClass(containing_class); printer->Print( - " [localDescriptor setupContainingMessageClassName:GPBStringifySymbol($parent_name$)];\n", - "parent_name", parent_class_name); + " [localDescriptor setupContainingMessageClass:$parent_class_ref$];\n", + "parent_class_ref", parent_class_ref); } - string suffix_added; + std::string suffix_added; ClassName(descriptor_, &suffix_added); - if (suffix_added.size() > 0) { + if (!suffix_added.empty()) { printer->Print( " [localDescriptor setupMessageClassNameSuffix:@\"$suffix$\"];\n", "suffix", suffix_added); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.h similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.h index 55eda0b8e..01108d29e 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message.h @@ -50,9 +50,8 @@ class EnumGenerator; class MessageGenerator { public: - MessageGenerator(const string& root_classname, - const Descriptor* descriptor, - const Options& options); + MessageGenerator(const std::string& root_classname, + const Descriptor* descriptor, const Options& options); ~MessageGenerator(); MessageGenerator(const MessageGenerator&) = delete; @@ -63,7 +62,8 @@ class MessageGenerator { void GenerateMessageHeader(io::Printer* printer); void GenerateSource(io::Printer* printer); void GenerateExtensionRegistrationSource(io::Printer* printer); - void DetermineForwardDeclarations(std::set* fwd_decls); + void DetermineObjectiveCClassDefinitions(std::set* fwd_decls); + void DetermineForwardDeclarations(std::set* fwd_decls); // Checks if the message or a nested message includes a oneof definition. bool IncludesOneOfDefinition() const; @@ -80,11 +80,11 @@ class MessageGenerator { void GenerateDescriptionOneFieldSource(io::Printer* printer, const FieldDescriptor* field); - const string root_classname_; + const std::string root_classname_; const Descriptor* descriptor_; FieldGeneratorMap field_generators_; - const string class_name_; - const string deprecated_attribute_; + const std::string class_name_; + const std::string deprecated_attribute_; std::vector> extension_generators_; std::vector> enum_generators_; std::vector> nested_message_generators_; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc index 8a0299e7c..299a20b15 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc @@ -44,15 +44,16 @@ namespace objectivec { namespace { void SetMessageVariables(const FieldDescriptor* descriptor, - std::map* variables) { - const string& message_type = ClassName(descriptor->message_type()); + std::map* variables) { + const std::string& message_type = ClassName(descriptor->message_type()); + const std::string& containing_class = + ClassName(descriptor->containing_type()); (*variables)["type"] = message_type; - (*variables)["containing_class"] = ClassName(descriptor->containing_type()); + (*variables)["containing_class"] = containing_class; (*variables)["storage_type"] = message_type; (*variables)["group_or_message"] = (descriptor->type() == FieldDescriptor::TYPE_GROUP) ? "Group" : "Message"; - - (*variables)["dataTypeSpecific_value"] = "GPBStringifySymbol(" + message_type + ")"; + (*variables)["dataTypeSpecific_value"] = ObjCClass(message_type); } } // namespace @@ -66,20 +67,15 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, MessageFieldGenerator::~MessageFieldGenerator() {} void MessageFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls) const { + std::set* fwd_decls) const { ObjCObjFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); } -bool MessageFieldGenerator::WantsHasProperty(void) const { - if (descriptor_->containing_oneof() != NULL) { - // If in a oneof, it uses the oneofcase instead of a has bit. - return false; - } - // In both proto2 & proto3, message fields have a has* property to tell - // when it is a non default value. - return true; +void MessageFieldGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const { + fwd_decls->insert(ObjCClassDeclaration(variable("storage_type"))); } RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( @@ -94,12 +90,16 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() {} void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( - std::set* fwd_decls) const { + std::set* fwd_decls) const { RepeatedFieldGenerator::DetermineForwardDeclarations(fwd_decls); // Class name is already in "storage_type". fwd_decls->insert("@class " + variable("storage_type")); } +void RepeatedMessageFieldGenerator::DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const { + fwd_decls->insert(ObjCClassDeclaration(variable("storage_type"))); +} } // namespace objectivec } // namespace compiler diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.h similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.h index 98d457942..01799a120 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_message_field.h @@ -52,10 +52,12 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete; virtual ~MessageFieldGenerator(); - virtual bool WantsHasProperty(void) const; public: - virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; + virtual void DetermineForwardDeclarations( + std::set* fwd_decls) const override; + virtual void DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const override; }; class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { @@ -71,7 +73,10 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { RepeatedMessageFieldGenerator operator=(const RepeatedMessageFieldGenerator&) = delete; public: - virtual void DetermineForwardDeclarations(std::set* fwd_decls) const; + virtual void DetermineForwardDeclarations( + std::set* fwd_decls) const override; + virtual void DetermineObjectiveCClassDefinitions( + std::set* fwd_decls) const override; }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc index 5b37c4e94..1bef293e2 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc @@ -50,7 +50,7 @@ OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor) const Descriptor* msg_descriptor = descriptor_->containing_type(); variables_["owning_message_class"] = ClassName(msg_descriptor); - string comments; + std::string comments; SourceLocation location; if (descriptor_->GetSourceLocation(&location)) { comments = BuildCommentsString(location, true); @@ -76,10 +76,10 @@ void OneofGenerator::GenerateCaseEnum(io::Printer* printer) { printer->Print( variables_, "$enum_name$_GPBUnsetOneOfCase = 0,\n"); - string enum_name = variables_["enum_name"]; + std::string enum_name = variables_["enum_name"]; for (int j = 0; j < descriptor_->field_count(); j++) { const FieldDescriptor* field = descriptor_->field(j); - string field_name = FieldNameCapitalized(field); + std::string field_name = FieldNameCapitalized(field); printer->Print( "$enum_name$_$field_name$ = $field_number$,\n", "enum_name", enum_name, @@ -120,17 +120,17 @@ void OneofGenerator::GenerateClearFunctionImplementation(io::Printer* printer) { printer->Print( variables_, "void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) {\n" - " GPBDescriptor *descriptor = [message descriptor];\n" + " GPBDescriptor *descriptor = [$owning_message_class$ descriptor];\n" " GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:$raw_index$];\n" - " GPBMaybeClearOneof(message, oneof, $index$, 0);\n" + " GPBClearOneof(message, oneof);\n" "}\n"); } -string OneofGenerator::DescriptorName(void) const { +std::string OneofGenerator::DescriptorName(void) const { return variables_.find("name")->second; } -string OneofGenerator::HasIndexAsString(void) const { +std::string OneofGenerator::HasIndexAsString(void) const { return variables_.find("index")->second; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.h similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.h index 852ef0224..034f07fb3 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_oneof.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_oneof.h @@ -60,12 +60,12 @@ class OneofGenerator { void GeneratePropertyImplementation(io::Printer* printer); void GenerateClearFunctionImplementation(io::Printer* printer); - string DescriptorName(void) const; - string HasIndexAsString(void) const; + std::string DescriptorName(void) const; + std::string HasIndexAsString(void) const; private: const OneofDescriptor* descriptor_; - std::map variables_; + std::map variables_; }; } // namespace objectivec diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc similarity index 97% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc index 0511b37dd..e198c5c18 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc @@ -116,7 +116,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { } void SetPrimitiveVariables(const FieldDescriptor* descriptor, - std::map* variables) { + std::map* variables) { std::string primitive_name = PrimitiveTypeName(descriptor); (*variables)["type"] = primitive_name; (*variables)["storage_type"] = primitive_name; @@ -172,7 +172,7 @@ RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( : RepeatedFieldGenerator(descriptor, options) { SetPrimitiveVariables(descriptor, &variables_); - string base_name = PrimitiveArrayTypeName(descriptor); + std::string base_name = PrimitiveArrayTypeName(descriptor); if (base_name.length()) { variables_["array_storage_type"] = "GPB" + base_name + "Array"; } else { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h index 642f2d632..a9f30f641 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h @@ -52,10 +52,10 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator { PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - virtual int ExtraRuntimeHasBitsNeeded(void) const; - virtual void SetExtraRuntimeHasBitsBase(int index_base); + virtual int ExtraRuntimeHasBitsNeeded(void) const override; + virtual void SetExtraRuntimeHasBitsBase(int index_base) override; }; class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/package_info.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/package_info.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/package_info.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/package_info.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.cc similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.cc index c5bd0a454..49ddfceb1 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.cc @@ -34,22 +34,25 @@ // // Recursive descent FTW. +#include + #include + +#include #include #include - -#include +#include #include #include #include -#include #include #include #include #include #include #include +#include namespace google { namespace protobuf { @@ -94,19 +97,19 @@ std::string MapEntryName(const std::string& field_name) { static const char kSuffix[] = "Entry"; result.reserve(field_name.size() + sizeof(kSuffix)); bool cap_next = true; - for (int i = 0; i < field_name.size(); ++i) { - if (field_name[i] == '_') { + for (const char field_name_char : field_name) { + if (field_name_char == '_') { cap_next = true; } else if (cap_next) { // Note: Do not use ctype.h due to locales. - if ('a' <= field_name[i] && field_name[i] <= 'z') { - result.push_back(field_name[i] - 'a' + 'A'); + if ('a' <= field_name_char && field_name_char <= 'z') { + result.push_back(field_name_char - 'a' + 'A'); } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } cap_next = false; } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } } result.append(kSuffix); @@ -128,8 +131,8 @@ bool IsUpperCamelCase(const std::string& name) { return false; } // Must not contains underscore. - for (int i = 1; i < name.length(); i++) { - if (name[i] == '_') { + for (const char c : name) { + if (c == '_') { return false; } } @@ -137,8 +140,7 @@ bool IsUpperCamelCase(const std::string& name) { } bool IsUpperUnderscore(const std::string& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsUppercase(c) && c != '_' && !IsNumber(c)) { return false; } @@ -147,8 +149,7 @@ bool IsUpperUnderscore(const std::string& name) { } bool IsLowerUnderscore(const std::string& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsLowercase(c) && c != '_' && !IsNumber(c)) { return false; } @@ -241,8 +242,9 @@ bool Parser::ConsumeIdentifier(std::string* output, const char* error) { bool Parser::ConsumeInteger(int* output, const char* error) { if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { - uint64 value = 0; - if (!io::Tokenizer::ParseInteger(input_->current().text, kint32max, + uint64_t value = 0; + if (!io::Tokenizer::ParseInteger(input_->current().text, + std::numeric_limits::max(), &value)) { AddError("Integer out of range."); // We still return true because we did, in fact, parse an integer. @@ -258,19 +260,19 @@ bool Parser::ConsumeInteger(int* output, const char* error) { bool Parser::ConsumeSignedInteger(int* output, const char* error) { bool is_negative = false; - uint64 max_value = kint32max; + uint64_t max_value = std::numeric_limits::max(); if (TryConsume("-")) { is_negative = true; max_value += 1; } - uint64 value = 0; + uint64_t value = 0; DO(ConsumeInteger64(max_value, &value, error)); if (is_negative) value *= -1; *output = value; return true; } -bool Parser::ConsumeInteger64(uint64 max_value, uint64* output, +bool Parser::ConsumeInteger64(uint64_t max_value, uint64_t* output, const char* error) { if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { if (!io::Tokenizer::ParseInteger(input_->current().text, max_value, @@ -294,8 +296,9 @@ bool Parser::ConsumeNumber(double* output, const char* error) { return true; } else if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { // Also accept integers. - uint64 value = 0; - if (!io::Tokenizer::ParseInteger(input_->current().text, kuint64max, + uint64_t value = 0; + if (!io::Tokenizer::ParseInteger(input_->current().text, + std::numeric_limits::max(), &value)) { AddError("Integer out of range."); // We still return true because we did, in fact, parse a number. @@ -765,6 +768,43 @@ bool Parser::ParseMessageDefinition( } } DO(ParseMessageBlock(message, message_location, containing_file)); + + if (syntax_identifier_ == "proto3") { + // Add synthetic one-field oneofs for optional fields, except messages which + // already have presence in proto3. + // + // We have to make sure the oneof names don't conflict with any other + // field or oneof. + std::unordered_set names; + for (const auto& field : message->field()) { + names.insert(field.name()); + } + for (const auto& oneof : message->oneof_decl()) { + names.insert(oneof.name()); + } + + for (auto& field : *message->mutable_field()) { + if (field.proto3_optional()) { + std::string oneof_name = field.name(); + + // Prepend 'XXXXX_' until we are no longer conflicting. + // Avoid prepending a double-underscore because such names are + // reserved in C++. + if (oneof_name.empty() || oneof_name[0] != '_') { + oneof_name = '_' + oneof_name; + } + while (names.count(oneof_name) > 0) { + oneof_name = 'X' + oneof_name; + } + + names.insert(oneof_name); + field.set_oneof_index(message->oneof_decl_size()); + OneofDescriptorProto* oneof = message->add_oneof_decl(); + oneof->set_name(oneof_name); + } + } + } + return true; } @@ -790,8 +830,9 @@ bool IsMessageSetWireFormatMessage(const DescriptorProto& message) { // tag number can only be determined after all options have been parsed. void AdjustExtensionRangesWithMaxEndNumber(DescriptorProto* message) { const bool is_message_set = IsMessageSetWireFormatMessage(*message); - const int max_extension_number = - is_message_set ? kint32max : FieldDescriptor::kMaxNumber + 1; + const int max_extension_number = is_message_set + ? std::numeric_limits::max() + : FieldDescriptor::kMaxNumber + 1; for (int i = 0; i < message->extension_range_size(); ++i) { if (message->extension_range(i).end() == kMaxRangeSentinel) { message->mutable_extension_range(i)->set_end(max_extension_number); @@ -804,8 +845,9 @@ void AdjustExtensionRangesWithMaxEndNumber(DescriptorProto* message) { // tag number can only be determined after all options have been parsed. void AdjustReservedRangesWithMaxEndNumber(DescriptorProto* message) { const bool is_message_set = IsMessageSetWireFormatMessage(*message); - const int max_field_number = - is_message_set ? kint32max : FieldDescriptor::kMaxNumber + 1; + const int max_field_number = is_message_set + ? std::numeric_limits::max() + : FieldDescriptor::kMaxNumber + 1; for (int i = 0; i < message->reserved_range_size(); ++i) { if (message->reserved_range(i).end() == kMaxRangeSentinel) { message->mutable_reserved_range(i)->set_end(max_field_number); @@ -907,10 +949,7 @@ bool Parser::ParseMessageField(FieldDescriptorProto* field, field->set_label(label); if (label == FieldDescriptorProto::LABEL_OPTIONAL && syntax_identifier_ == "proto3") { - AddError( - "Explicit 'optional' labels are disallowed in the Proto3 syntax. " - "To define 'optional' fields in Proto3, simply remove the " - "'optional' label, as fields are 'optional' by default."); + field->set_proto3_optional(true); } } } @@ -1224,11 +1263,11 @@ bool Parser::ParseDefaultAssignment( case FieldDescriptorProto::TYPE_SINT64: case FieldDescriptorProto::TYPE_SFIXED32: case FieldDescriptorProto::TYPE_SFIXED64: { - uint64 max_value = kint64max; + uint64_t max_value = std::numeric_limits::max(); if (field->type() == FieldDescriptorProto::TYPE_INT32 || field->type() == FieldDescriptorProto::TYPE_SINT32 || field->type() == FieldDescriptorProto::TYPE_SFIXED32) { - max_value = kint32max; + max_value = std::numeric_limits::max(); } // These types can be negative. @@ -1238,7 +1277,7 @@ bool Parser::ParseDefaultAssignment( ++max_value; } // Parse the integer to verify that it is not out-of-range. - uint64 value; + uint64_t value; DO(ConsumeInteger64(max_value, &value, "Expected integer for field default value.")); // And stringify it again. @@ -1250,10 +1289,10 @@ bool Parser::ParseDefaultAssignment( case FieldDescriptorProto::TYPE_UINT64: case FieldDescriptorProto::TYPE_FIXED32: case FieldDescriptorProto::TYPE_FIXED64: { - uint64 max_value = kuint64max; + uint64_t max_value = std::numeric_limits::max(); if (field->type() == FieldDescriptorProto::TYPE_UINT32 || field->type() == FieldDescriptorProto::TYPE_FIXED32) { - max_value = kuint32max; + max_value = std::numeric_limits::max(); } // Numeric, not negative. @@ -1261,7 +1300,7 @@ bool Parser::ParseDefaultAssignment( AddError("Unsigned field can't have negative default value."); } // Parse the integer to verify that it is not out-of-range. - uint64 value; + uint64_t value; DO(ConsumeInteger64(max_value, &value, "Expected integer for field default value.")); // And stringify it again. @@ -1295,7 +1334,7 @@ bool Parser::ParseDefaultAssignment( break; case FieldDescriptorProto::TYPE_STRING: - // Note: When file opton java_string_check_utf8 is true, if a + // Note: When file option java_string_check_utf8 is true, if a // non-string representation (eg byte[]) is later supported, it must // be checked for UTF-8-ness. DO(ConsumeString(default_value, @@ -1479,6 +1518,13 @@ bool Parser::ParseOption(Message* options, AddError("Unexpected end of stream while parsing option value."); return false; + case io::Tokenizer::TYPE_WHITESPACE: + case io::Tokenizer::TYPE_NEWLINE: + GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines()) + << "Whitespace tokens were not requested."; + GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace."; + return false; + case io::Tokenizer::TYPE_IDENTIFIER: { value_location.AddPath( UninterpretedOption::kIdentifierValueFieldNumber); @@ -1493,15 +1539,17 @@ bool Parser::ParseOption(Message* options, } case io::Tokenizer::TYPE_INTEGER: { - uint64 value; - uint64 max_value = - is_negative ? static_cast(kint64max) + 1 : kuint64max; + uint64_t value; + uint64_t max_value = + is_negative + ? static_cast(std::numeric_limits::max()) + 1 + : std::numeric_limits::max(); DO(ConsumeInteger64(max_value, &value, "Expected integer.")); if (is_negative) { value_location.AddPath( UninterpretedOption::kNegativeIntValueFieldNumber); uninterpreted_option->set_negative_int_value( - static_cast(-value)); + static_cast(0 - value)); } else { value_location.AddPath( UninterpretedOption::kPositiveIntValueFieldNumber); @@ -1739,12 +1787,12 @@ bool Parser::ParseReserved(EnumDescriptorProto* message, DO(Consume("reserved")); if (LookingAtType(io::Tokenizer::TYPE_STRING)) { LocationRecorder location(message_location, - DescriptorProto::kReservedNameFieldNumber); + EnumDescriptorProto::kReservedNameFieldNumber); location.StartAt(start_token); return ParseReservedNames(message, location); } else { LocationRecorder location(message_location, - DescriptorProto::kReservedRangeFieldNumber); + EnumDescriptorProto::kReservedRangeFieldNumber); location.StartAt(start_token); return ParseReservedNumbers(message, location); } @@ -2172,7 +2220,6 @@ bool Parser::ParseServiceMethod(MethodDescriptorProto* method, return true; } - bool Parser::ParseMethodOptions(const LocationRecorder& parent_location, const FileDescriptorProto* containing_file, const int optionsFieldNumber, @@ -2302,8 +2349,8 @@ bool Parser::ParsePackage(FileDescriptorProto* file, } bool Parser::ParseImport(RepeatedPtrField* dependency, - RepeatedField* public_dependency, - RepeatedField* weak_dependency, + RepeatedField* public_dependency, + RepeatedField* weak_dependency, const LocationRecorder& root_location, const FileDescriptorProto* containing_file) { LocationRecorder location(root_location, diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.h similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.h index e8afdbc4d..b5a5df899 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser.h @@ -37,14 +37,17 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_PARSER_H__ #define GOOGLE_PROTOBUF_COMPILER_PARSER_H__ +#include #include #include #include + #include #include #include #include +// Must be included last. #include namespace google { @@ -172,7 +175,8 @@ class PROTOBUF_EXPORT Parser { bool ConsumeSignedInteger(int* output, const char* error); // Consume a 64-bit integer and store its value in "output". If the value // is greater than max_value, an error will be reported. - bool ConsumeInteger64(uint64 max_value, uint64* output, const char* error); + bool ConsumeInteger64(uint64_t max_value, uint64_t* output, + const char* error); // Consume a number and store its value in "output". This will accept // tokens of either INTEGER or FLOAT type. bool ConsumeNumber(double* output, const char* error); @@ -323,8 +327,8 @@ class PROTOBUF_EXPORT Parser { const LocationRecorder& root_location, const FileDescriptorProto* containing_file); bool ParseImport(RepeatedPtrField* dependency, - RepeatedField* public_dependency, - RepeatedField* weak_dependency, + RepeatedField* public_dependency, + RepeatedField* weak_dependency, const LocationRecorder& root_location, const FileDescriptorProto* containing_file); @@ -519,7 +523,6 @@ class PROTOBUF_EXPORT Parser { return syntax_identifier_ == "proto3"; } - bool ValidateEnum(const EnumDescriptorProto* proto); // ================================================================= diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser_unittest.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser_unittest.cc index 8994cc5a5..6973bc993 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/parser_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/parser_unittest.cc @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -68,8 +69,7 @@ class MockErrorCollector : public io::ErrorCollector { // implements ErrorCollector --------------------------------------- void AddWarning(int line, int column, const std::string& message) override { - strings::SubstituteAndAppend(&warning_, "$0:$1: $2\n", line, column, - message); + strings::SubstituteAndAppend(&warning_, "$0:$1: $2\n", line, column, message); } void AddError(int line, int column, const std::string& message) override { @@ -88,7 +88,7 @@ class MockValidationErrorCollector : public DescriptorPool::ErrorCollector { // implements ErrorCollector --------------------------------------- void AddError(const std::string& filename, const std::string& element_name, const Message* descriptor, ErrorLocation location, - const std::string& message) { + const std::string& message) override { int line, column; if (location == DescriptorPool::ErrorCollector::IMPORT) { source_locations_.FindImport(descriptor, element_name, &line, &column); @@ -1009,6 +1009,43 @@ TEST_F(ParseMessageTest, OptionalLabelProto3) { "}"); } +TEST_F(ParseMessageTest, ExplicitOptionalLabelProto3) { + ExpectParsesTo( + "syntax = 'proto3';\n" + "message TestMessage {\n" + " optional int32 foo = 1;\n" + "}\n", + + "syntax: \"proto3\" " + "message_type {" + " name: \"TestMessage\"" + " field { name:\"foo\" label:LABEL_OPTIONAL type:TYPE_INT32 number:1 " + " proto3_optional: true oneof_index: 0 } " + " oneof_decl { name:\"_foo\" } " + "}"); + + // Handle collisions in the synthetic oneof name. + ExpectParsesTo( + "syntax = 'proto3';\n" + "message TestMessage {\n" + " optional int32 foo = 1;\n" + " oneof _foo {\n" + " int32 __foo = 2;\n" + " }\n" + "}\n", + + "syntax: \"proto3\" " + "message_type {" + " name: \"TestMessage\"" + " field { name:\"foo\" label:LABEL_OPTIONAL type:TYPE_INT32 number:1 " + " proto3_optional: true oneof_index: 1 } " + " field { name:\"__foo\" label:LABEL_OPTIONAL type:TYPE_INT32 number:2 " + " oneof_index: 0 } " + " oneof_decl { name:\"_foo\" } " + " oneof_decl { name:\"X_foo\" } " + "}"); +} + // =================================================================== typedef ParserTest ParseEnumTest; @@ -1575,17 +1612,6 @@ TEST_F(ParseErrorTest, EofInAggregateValue) { "1:0: Unexpected end of stream while parsing aggregate value.\n"); } -TEST_F(ParseErrorTest, ExplicitOptionalLabelProto3) { - ExpectHasErrors( - "syntax = 'proto3';\n" - "message TestMessage {\n" - " optional int32 foo = 1;\n" - "}\n", - "2:11: Explicit 'optional' labels are disallowed in the Proto3 syntax. " - "To define 'optional' fields in Proto3, simply remove the 'optional' " - "label, as fields are 'optional' by default.\n"); -} - // ------------------------------------------------------------------- // Enum errors @@ -2158,7 +2184,7 @@ void SortMessages(FileDescriptorProto* file_descriptor_proto) { void StripFieldTypeName(DescriptorProto* proto) { for (int i = 0; i < proto->field_size(); ++i) { std::string type_name = proto->field(i).type_name(); - std::string::size_type pos = type_name.find_last_of("."); + std::string::size_type pos = type_name.find_last_of('.'); if (pos != std::string::npos) { proto->mutable_field(i)->mutable_type_name()->assign( type_name.begin() + pos + 1, type_name.end()); @@ -2251,6 +2277,11 @@ TEST_F(ParseDescriptorDebugTest, TestCustomOptions) { FileDescriptorProto import_proto; import->CopyTo(&import_proto); ASSERT_TRUE(pool_.BuildFile(import_proto) != NULL); + + FileDescriptorProto any_import; + google::protobuf::Any::descriptor()->file()->CopyTo(&any_import); + ASSERT_TRUE(pool_.BuildFile(any_import) != nullptr); + const FileDescriptor* actual = pool_.BuildFile(parsed); ASSERT_TRUE(actual != NULL); parsed.Clear(); @@ -2557,7 +2588,7 @@ class SourceInfoTest : public ParserTest { return true; } - virtual void TearDown() { + void TearDown() override { EXPECT_TRUE(spans_.empty()) << "Forgot to call HasSpan() for:\n" << spans_.begin()->second->DebugString(); } @@ -3108,6 +3139,43 @@ TEST_F(SourceInfoTest, EnumValues) { EXPECT_TRUE(HasSpan(file_.enum_type(0), "name")); } +TEST_F(SourceInfoTest, EnumReservedRange) { + EXPECT_TRUE( + Parse("enum TestEnum {\n" + " $a$reserved $b$1$c$ to $d$10$e$;$f$\n" + "}")); + + const EnumDescriptorProto::EnumReservedRange& bar = + file_.enum_type(0).reserved_range(0); + + EXPECT_TRUE(HasSpan('a', 'f', file_.enum_type(0), "reserved_range")); + EXPECT_TRUE(HasSpan('b', 'e', bar)); + EXPECT_TRUE(HasSpan('b', 'c', bar, "start")); + EXPECT_TRUE(HasSpan('d', 'e', bar, "end")); + + // Ignore these. + EXPECT_TRUE(HasSpan(file_)); + EXPECT_TRUE(HasSpan(file_.enum_type(0))); + EXPECT_TRUE(HasSpan(file_.enum_type(0), "name")); +} + +TEST_F(SourceInfoTest, EnumReservedName) { + EXPECT_TRUE( + Parse("enum TestEnum {\n" + " $a$reserved $b$'foo'$c$;$d$\n" + "}")); + + const EnumDescriptorProto& bar = file_.enum_type(0); + + EXPECT_TRUE(HasSpan('a', 'd', bar, "reserved_name")); + EXPECT_TRUE(HasSpan('b', 'c', bar, "reserved_name", 0)); + + // Ignore these. + EXPECT_TRUE(HasSpan(file_)); + EXPECT_TRUE(HasSpan(file_.enum_type(0))); + EXPECT_TRUE(HasSpan(file_.enum_type(0), "name")); +} + TEST_F(SourceInfoTest, NestedEnums) { EXPECT_TRUE( Parse("message Foo {\n" diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.cc similarity index 60% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.cc index 41263545b..05f8acad8 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.cc @@ -37,16 +37,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include @@ -58,26 +48,27 @@ const std::string kDescriptorMetadataFile = const std::string kDescriptorDirName = "Google/Protobuf/Internal"; const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal"; const char* const kReservedNames[] = { - "abstract", "and", "array", "as", "break", - "callable", "case", "catch", "class", "clone", - "const", "continue", "declare", "default", "die", - "do", "echo", "else", "elseif", "empty", - "enddeclare", "endfor", "endforeach", "endif", "endswitch", - "endwhile", "eval", "exit", "extends", "final", - "for", "foreach", "function", "global", "goto", - "if", "implements", "include", "include_once", "instanceof", - "insteadof", "interface", "isset", "list", "namespace", - "new", "or", "print", "private", "protected", - "public", "require", "require_once", "return", "static", - "switch", "throw", "trait", "try", "unset", - "use", "var", "while", "xor", "int", - "float", "bool", "string", "true", "false", - "null", "void", "iterable"}; + "abstract", "and", "array", "as", "break", + "callable", "case", "catch", "class", "clone", + "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", + "enddeclare", "endfor", "endforeach", "endif", "endswitch", + "endwhile", "eval", "exit", "extends", "final", + "finally", "fn", "for", "foreach", "function", + "global", "goto", "if", "implements", "include", + "include_once", "instanceof", "insteadof", "interface", "isset", + "list", "match", "namespace", "new", "or", + "print", "private", "protected", "public", "require", + "require_once", "return", "static", "switch", "throw", + "trait", "try", "unset", "use", "var", + "while", "xor", "yield", "int", "float", + "bool", "string", "true", "false", "null", + "void", "iterable"}; const char* const kValidConstantNames[] = { "int", "float", "bool", "string", "true", "false", "null", "void", "iterable", }; -const int kReservedNamesSize = 73; +const int kReservedNamesSize = 77; const int kValidConstantNamesSize = 9; const int kFieldSetter = 1; const int kFieldGetter = 2; @@ -88,35 +79,40 @@ namespace protobuf { namespace compiler { namespace php { +struct Options { + bool is_descriptor = false; + bool aggregate_metadata = false; + bool gen_c_wkt = false; + std::set aggregate_metadata_prefixes; +}; + +namespace { + // Forward decls. -std::string PhpName(const std::string& full_name, bool is_descriptor); -std::string DefaultForField(FieldDescriptor* field); +std::string PhpName(const std::string& full_name, const Options& options); std::string IntToString(int32 value); -std::string FilenameToClassname(const string& filename); +std::string FilenameToClassname(const std::string& filename); std::string GeneratedMetadataFileName(const FileDescriptor* file, - bool is_descriptor); -std::string LabelForField(FieldDescriptor* field); -std::string TypeName(FieldDescriptor* field); -std::string UnderscoresToCamelCase(const string& name, bool cap_first_letter); -std::string BinaryToHex(const string& binary); + const Options& options); +std::string UnderscoresToCamelCase(const std::string& name, + bool cap_first_letter); void Indent(io::Printer* printer); void Outdent(io::Printer* printer); -void GenerateAddFilesToPool(const FileDescriptor* file, - const std::set& aggregate_metadata_prefixes, +void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, io::Printer* printer); void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message, - int is_descriptor); + const Options& options); void GenerateMessageConstructorDocComment(io::Printer* printer, const Descriptor* message, - int is_descriptor); + const Options& options); void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, - int is_descriptor, int function_type); + const Options& options, int function_type); void GenerateWrapperFieldGetterDocComment(io::Printer* printer, const FieldDescriptor* field); void GenerateWrapperFieldSetterDocComment(io::Printer* printer, const FieldDescriptor* field); void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, - int is_descriptor); + const Options& options); void GenerateEnumValueDocComment(io::Printer* printer, const EnumValueDescriptor* value); void GenerateServiceDocComment(io::Printer* printer, @@ -124,12 +120,12 @@ void GenerateServiceDocComment(io::Printer* printer, void GenerateServiceMethodDocComment(io::Printer* printer, const MethodDescriptor* method); -std::string ReservedNamePrefix(const string& classname, +std::string ReservedNamePrefix(const std::string& classname, const FileDescriptor* file) { bool is_reserved = false; - string lower = classname; - transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + std::string lower = classname; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); for (int i = 0; i < kReservedNamesSize; i++) { if (lower == kReservedNames[i]) { @@ -150,8 +146,8 @@ std::string ReservedNamePrefix(const string& classname, } template -std::string DescriptorFullName(const DescriptorType* desc, bool is_descriptor) { - if (is_descriptor) { +std::string DescriptorFullName(const DescriptorType* desc, bool is_internal) { + if (is_internal) { return StringReplace(desc->full_name(), "google.protobuf", "google.protobuf.internal", false); @@ -161,9 +157,9 @@ std::string DescriptorFullName(const DescriptorType* desc, bool is_descriptor) { } template -std::string ClassNamePrefix(const string& classname, +std::string ClassNamePrefix(const std::string& classname, const DescriptorType* desc) { - const string& prefix = (desc->file()->options()).php_class_prefix(); + const std::string& prefix = (desc->file()->options()).php_class_prefix(); if (!prefix.empty()) { return prefix; } @@ -188,18 +184,6 @@ std::string GeneratedClassNameImpl(const ServiceDescriptor* desc) { return ClassNamePrefix(classname, desc) + classname; } -std::string GeneratedClassName(const Descriptor* desc) { - return GeneratedClassNameImpl(desc); -} - -std::string GeneratedClassName(const EnumDescriptor* desc) { - return GeneratedClassNameImpl(desc); -} - -std::string GeneratedClassName(const ServiceDescriptor* desc) { - return GeneratedClassNameImpl(desc); -} - template std::string LegacyGeneratedClassName(const DescriptorType* desc) { std::string classname = desc->name(); @@ -211,9 +195,9 @@ std::string LegacyGeneratedClassName(const DescriptorType* desc) { return ClassNamePrefix(classname, desc) + classname; } -std::string ClassNamePrefix(const string& classname) { - string lower = classname; - transform(lower.begin(), lower.end(), lower.begin(), ::tolower); +std::string ClassNamePrefix(const std::string& classname) { + std::string lower = classname; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); for (int i = 0; i < kReservedNamesSize; i++) { if (lower == kReservedNames[i]) { @@ -224,11 +208,11 @@ std::string ClassNamePrefix(const string& classname) { return ""; } -std::string ConstantNamePrefix(const string& classname) { +std::string ConstantNamePrefix(const std::string& classname) { bool is_reserved = false; - string lower = classname; - transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + std::string lower = classname; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); for (int i = 0; i < kReservedNamesSize; i++) { if (lower == kReservedNames[i]) { @@ -252,9 +236,10 @@ std::string ConstantNamePrefix(const string& classname) { } template -std::string RootPhpNamespace(const DescriptorType* desc, bool is_descriptor) { +std::string RootPhpNamespace(const DescriptorType* desc, + const Options& options) { if (desc->file()->options().has_php_namespace()) { - const string& php_namespace = desc->file()->options().php_namespace(); + const std::string& php_namespace = desc->file()->options().php_namespace(); if (!php_namespace.empty()) { return php_namespace; } @@ -262,15 +247,15 @@ std::string RootPhpNamespace(const DescriptorType* desc, bool is_descriptor) { } if (!desc->file()->package().empty()) { - return PhpName(desc->file()->package(), is_descriptor); + return PhpName(desc->file()->package(), options); } return ""; } template -std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { - string classname = GeneratedClassNameImpl(desc); - string php_namespace = RootPhpNamespace(desc, is_descriptor); +std::string FullClassName(const DescriptorType* desc, const Options& options) { + std::string classname = GeneratedClassNameImpl(desc); + std::string php_namespace = RootPhpNamespace(desc, options); if (!php_namespace.empty()) { return php_namespace + "\\" + classname; } @@ -278,17 +263,25 @@ std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { } template -std::string LegacyFullClassName(const DescriptorType* desc, bool is_descriptor) { - string classname = LegacyGeneratedClassName(desc); - string php_namespace = RootPhpNamespace(desc, is_descriptor); +std::string FullClassName(const DescriptorType* desc, bool is_descriptor) { + Options options; + options.is_descriptor = is_descriptor; + return FullClassName(desc, options); +} + +template +std::string LegacyFullClassName(const DescriptorType* desc, + const Options& options) { + std::string classname = LegacyGeneratedClassName(desc); + std::string php_namespace = RootPhpNamespace(desc, options); if (!php_namespace.empty()) { return php_namespace + "\\" + classname; } return classname; } -std::string PhpName(const std::string& full_name, bool is_descriptor) { - if (is_descriptor) { +std::string PhpName(const std::string& full_name, const Options& options) { + if (options.is_descriptor) { return kDescriptorPackageName; } @@ -337,8 +330,8 @@ std::string DefaultForField(const FieldDescriptor* field) { } std::string GeneratedMetadataFileName(const FileDescriptor* file, - bool is_descriptor) { - const string& proto_file = file->name(); + const Options& options) { + const std::string& proto_file = file->name(); int start_index = 0; int first_index = proto_file.find_first_of("/", start_index); std::string result = ""; @@ -347,7 +340,7 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file, if (proto_file == kEmptyFile) { return kEmptyMetadataFile; } - if (is_descriptor) { + if (options.is_descriptor) { return kDescriptorMetadataFile; } @@ -361,7 +354,7 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file, } if (file->options().has_php_metadata_namespace()) { - const string& php_metadata_namespace = + const std::string& php_metadata_namespace = file->options().php_metadata_namespace(); if (!php_metadata_namespace.empty() && php_metadata_namespace != "\\") { result += php_metadata_namespace; @@ -372,7 +365,7 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file, } } else { result += "GPBMetadata/"; - while (first_index != string::npos) { + while (first_index != std::string::npos) { segment = UnderscoresToCamelCase( file_no_suffix.substr(start_index, first_index - start_index), true); result += ReservedNamePrefix(segment, file) + segment + "/"; @@ -383,7 +376,7 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file, // Append file name. int file_name_start = file_no_suffix.find_last_of("/"); - if (file_name_start == string::npos) { + if (file_name_start == std::string::npos) { file_name_start = 0; } else { file_name_start += 1; @@ -394,10 +387,17 @@ std::string GeneratedMetadataFileName(const FileDescriptor* file, return result + ReservedNamePrefix(segment, file) + segment + ".php"; } +std::string GeneratedMetadataFileName(const FileDescriptor* file, + bool is_descriptor) { + Options options; + options.is_descriptor = is_descriptor; + return GeneratedMetadataFileName(file, options); +} + template std::string GeneratedClassFileName(const DescriptorType* desc, - bool is_descriptor) { - std::string result = FullClassName(desc, is_descriptor); + const Options& options) { + std::string result = FullClassName(desc, options); for (int i = 0; i < result.size(); i++) { if (result[i] == '\\') { result[i] = '/'; @@ -408,8 +408,8 @@ std::string GeneratedClassFileName(const DescriptorType* desc, template std::string LegacyGeneratedClassFileName(const DescriptorType* desc, - bool is_descriptor) { - std::string result = LegacyFullClassName(desc, is_descriptor); + const Options& options) { + std::string result = LegacyFullClassName(desc, options); for (int i = 0; i < result.size(); i++) { if (result[i] == '\\') { @@ -420,8 +420,8 @@ std::string LegacyGeneratedClassFileName(const DescriptorType* desc, } std::string GeneratedServiceFileName(const ServiceDescriptor* service, - bool is_descriptor) { - std::string result = FullClassName(service, is_descriptor) + "Interface"; + const Options& options) { + std::string result = FullClassName(service, options) + "Interface"; for (int i = 0; i < result.size(); i++) { if (result[i] == '\\') { result[i] = '/'; @@ -445,35 +445,12 @@ std::string LabelForField(const FieldDescriptor* field) { } } -std::string TypeName(const FieldDescriptor* field) { - switch (field->type()) { - case FieldDescriptor::TYPE_INT32: return "int32"; - case FieldDescriptor::TYPE_INT64: return "int64"; - case FieldDescriptor::TYPE_UINT32: return "uint32"; - case FieldDescriptor::TYPE_UINT64: return "uint64"; - case FieldDescriptor::TYPE_SINT32: return "sint32"; - case FieldDescriptor::TYPE_SINT64: return "sint64"; - case FieldDescriptor::TYPE_FIXED32: return "fixed32"; - case FieldDescriptor::TYPE_FIXED64: return "fixed64"; - case FieldDescriptor::TYPE_SFIXED32: return "sfixed32"; - case FieldDescriptor::TYPE_SFIXED64: return "sfixed64"; - case FieldDescriptor::TYPE_DOUBLE: return "double"; - case FieldDescriptor::TYPE_FLOAT: return "float"; - case FieldDescriptor::TYPE_BOOL: return "bool"; - case FieldDescriptor::TYPE_ENUM: return "enum"; - case FieldDescriptor::TYPE_STRING: return "string"; - case FieldDescriptor::TYPE_BYTES: return "bytes"; - case FieldDescriptor::TYPE_MESSAGE: return "message"; - case FieldDescriptor::TYPE_GROUP: return "group"; - default: assert(false); return ""; - } -} - -std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) { +std::string PhpSetterTypeName(const FieldDescriptor* field, + const Options& options) { if (field->is_map()) { return "array|\\Google\\Protobuf\\Internal\\MapField"; } - string type; + std::string type; switch (field->type()) { case FieldDescriptor::TYPE_INT32: case FieldDescriptor::TYPE_UINT32: @@ -502,7 +479,7 @@ std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) type = "string"; break; case FieldDescriptor::TYPE_MESSAGE: - type = "\\" + FullClassName(field->message_type(), is_descriptor); + type = "\\" + FullClassName(field->message_type(), options); break; case FieldDescriptor::TYPE_GROUP: return "null"; @@ -519,7 +496,15 @@ std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) return type; } -std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor) { +std::string PhpSetterTypeName(const FieldDescriptor* field, + bool is_descriptor) { + Options options; + options.is_descriptor = is_descriptor; + return PhpSetterTypeName(field, options); +} + +std::string PhpGetterTypeName(const FieldDescriptor* field, + const Options& options) { if (field->is_map()) { return "\\Google\\Protobuf\\Internal\\MapField"; } @@ -544,26 +529,44 @@ std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor) case FieldDescriptor::TYPE_STRING: case FieldDescriptor::TYPE_BYTES: return "string"; case FieldDescriptor::TYPE_MESSAGE: - return "\\" + FullClassName(field->message_type(), is_descriptor); + return "\\" + FullClassName(field->message_type(), options); case FieldDescriptor::TYPE_GROUP: return "null"; default: assert(false); return ""; } } -std::string EnumOrMessageSuffix( - const FieldDescriptor* field, bool is_descriptor) { +std::string PhpGetterTypeName(const FieldDescriptor* field, + bool is_descriptor) { + Options options; + options.is_descriptor = is_descriptor; + return PhpGetterTypeName(field, options); +} + +std::string EnumOrMessageSuffix(const FieldDescriptor* field, + const Options& options) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - return ", '" + DescriptorFullName(field->message_type(), is_descriptor) + "'"; + return ", '" + + DescriptorFullName(field->message_type(), options.is_descriptor) + + "'"; } if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - return ", '" + DescriptorFullName(field->enum_type(), is_descriptor) + "'"; + return ", '" + + DescriptorFullName(field->enum_type(), options.is_descriptor) + "'"; } return ""; } +std::string EnumOrMessageSuffix(const FieldDescriptor* field, + bool is_descriptor) { + Options options; + options.is_descriptor = is_descriptor; + return EnumOrMessageSuffix(field, options); +} + // Converts a name to camel-case. If cap_first_letter is true, capitalize the // first letter. -std::string UnderscoresToCamelCase(const string& name, bool cap_first_letter) { +std::string UnderscoresToCamelCase(const std::string& name, + bool cap_first_letter) { std::string result; for (int i = 0; i < name.size(); i++) { if ('a' <= name[i] && name[i] <= 'z') { @@ -597,27 +600,6 @@ std::string UnderscoresToCamelCase(const string& name, bool cap_first_letter) { return result; } -std::string BinaryToHex(const string& binary) { - string dest; - size_t i; - unsigned char symbol[16] = { - '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 'a', 'b', - 'c', 'd', 'e', 'f', - }; - - dest.resize(binary.size() * 2); - char* append_ptr = &dest[0]; - - for (i = 0; i < binary.size(); i++) { - *append_ptr++ = symbol[(binary[i] & 0xf0) >> 4]; - *append_ptr++ = symbol[binary[i] & 0x0f]; - } - - return dest; -} - void Indent(io::Printer* printer) { printer->Indent(); printer->Indent(); @@ -628,27 +610,23 @@ void Outdent(io::Printer* printer) { } void GenerateField(const FieldDescriptor* field, io::Printer* printer, - bool is_descriptor) { + const Options& options) { if (field->is_repeated()) { - GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); + GenerateFieldDocComment(printer, field, options, kFieldProperty); printer->Print( "private $^name^;\n", "name", field->name()); - } else if (field->containing_oneof()) { + } else if (field->real_containing_oneof()) { // Oneof fields are handled by GenerateOneofField. return; } else { - GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty); + std::string initial_value = + field->has_presence() ? "null" : DefaultForField(field); + GenerateFieldDocComment(printer, field, options, kFieldProperty); printer->Print( - "protected $^name^ = ^default^;\n", + "protected $^name^ = ^initial_value^;\n", "name", field->name(), - "default", DefaultForField(field)); - } - - if (is_descriptor) { - printer->Print( - "private $has_^name^ = false;\n", - "name", field->name()); + "initial_value", initial_value); } } @@ -660,29 +638,72 @@ void GenerateOneofField(const OneofDescriptor* oneof, io::Printer* printer) { "name", oneof->name()); } -void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, +void GenerateFieldAccessor(const FieldDescriptor* field, const Options& options, io::Printer* printer) { - const OneofDescriptor* oneof = field->containing_oneof(); + const OneofDescriptor* oneof = field->real_containing_oneof(); // Generate getter. + GenerateFieldDocComment(printer, field, options, kFieldGetter); + + // deprecation + std::string deprecation_trigger = (field->options().deprecated()) ? "@trigger_error('" + + field->name() + " is deprecated.', E_USER_DEPRECATED);\n " : ""; + + // Emit getter. if (oneof != NULL) { - GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" - " return $this->readOneof(^number^);\n" + " ^deprecation_trigger^return $this->readOneof(^number^);\n" "}\n\n", "camel_name", UnderscoresToCamelCase(field->name(), true), - "number", IntToString(field->number())); + "number", IntToString(field->number()), + "deprecation_trigger", deprecation_trigger); + } else if (field->has_presence() && !field->message_type()) { + printer->Print( + "public function get^camel_name^()\n" + "{\n" + " ^deprecation_trigger^return isset($this->^name^) ? $this->^name^ : ^default_value^;\n" + "}\n\n", + "camel_name", UnderscoresToCamelCase(field->name(), true), + "name", field->name(), + "default_value", DefaultForField(field), + "deprecation_trigger", deprecation_trigger); } else { - GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter); printer->Print( "public function get^camel_name^()\n" "{\n" - " return $this->^name^;\n" + " ^deprecation_trigger^return $this->^name^;\n" "}\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), "name", - field->name()); + "camel_name", UnderscoresToCamelCase(field->name(), true), + "name", field->name(), + "deprecation_trigger", deprecation_trigger); + } + + // Emit hazzers/clear. + if (oneof) { + printer->Print( + "public function has^camel_name^()\n" + "{\n" + " ^deprecation_trigger^return $this->hasOneof(^number^);\n" + "}\n\n", + "camel_name", UnderscoresToCamelCase(field->name(), true), + "number", IntToString(field->number()), + "deprecation_trigger", deprecation_trigger); + } else if (field->has_presence()) { + printer->Print( + "public function has^camel_name^()\n" + "{\n" + " ^deprecation_trigger^return isset($this->^name^);\n" + "}\n\n" + "public function clear^camel_name^()\n" + "{\n" + " ^deprecation_trigger^unset($this->^name^);\n" + "}\n\n", + "camel_name", UnderscoresToCamelCase(field->name(), true), + "name", field->name(), + "default_value", DefaultForField(field), + "deprecation_trigger", deprecation_trigger); } // For wrapper types, generate an additional getXXXUnwrapped getter @@ -694,14 +715,15 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, printer->Print( "public function get^camel_name^Unwrapped()\n" "{\n" - " return $this->readWrapperValue(\"^field_name^\");\n" + " ^deprecation_trigger^return $this->readWrapperValue(\"^field_name^\");\n" "}\n\n", "camel_name", UnderscoresToCamelCase(field->name(), true), - "field_name", field->name()); + "field_name", field->name(), + "deprecation_trigger", deprecation_trigger); } // Generate setter. - GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter); + GenerateFieldDocComment(printer, field, options, kFieldSetter); printer->Print( "public function set^camel_name^($var)\n" "{\n", @@ -709,6 +731,13 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, Indent(printer); + if (field->options().deprecated()) { + printer->Print( + "^deprecation_trigger^", + "deprecation_trigger", deprecation_trigger + ); + } + // Type check. if (field->is_map()) { const Descriptor* map_entry = field->message_type(); @@ -724,12 +753,12 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, printer->Print( ", \\^class_name^);\n", "class_name", - FullClassName(value->message_type(), is_descriptor) + "::class"); + FullClassName(value->message_type(), options) + "::class"); } else if (value->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { printer->Print( ", \\^class_name^);\n", "class_name", - FullClassName(value->enum_type(), is_descriptor) + "::class"); + FullClassName(value->enum_type(), options) + "::class"); } else { printer->Print(");\n"); } @@ -742,23 +771,23 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, printer->Print( ", \\^class_name^);\n", "class_name", - FullClassName(field->message_type(), is_descriptor) + "::class"); + FullClassName(field->message_type(), options) + "::class"); } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { printer->Print( ", \\^class_name^);\n", "class_name", - FullClassName(field->enum_type(), is_descriptor) + "::class"); + FullClassName(field->enum_type(), options) + "::class"); } else { printer->Print(");\n"); } } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { printer->Print( "GPBUtil::checkMessage($var, \\^class_name^::class);\n", - "class_name", LegacyFullClassName(field->message_type(), is_descriptor)); + "class_name", FullClassName(field->message_type(), options)); } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { printer->Print( "GPBUtil::checkEnum($var, \\^class_name^::class);\n", - "class_name", LegacyFullClassName(field->enum_type(), is_descriptor)); + "class_name", FullClassName(field->enum_type(), options)); } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { printer->Print( "GPBUtil::checkString($var, ^utf8^);\n", @@ -784,13 +813,6 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "name", field->name()); } - // Set has bit for proto2 only. - if (is_descriptor) { - printer->Print( - "$this->has_^field_name^ = true;\n", - "field_name", field->name()); - } - printer->Print("\nreturn $this;\n"); Outdent(printer); @@ -813,17 +835,6 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor, "camel_name", UnderscoresToCamelCase(field->name(), true), "field_name", field->name()); } - - // Generate has method for proto2 only. - if (is_descriptor) { - printer->Print( - "public function has^camel_name^()\n" - "{\n" - " return $this->has_^field_name^;\n" - "}\n\n", - "camel_name", UnderscoresToCamelCase(field->name(), true), - "field_name", field->name()); - } } void GenerateEnumToPool(const EnumDescriptor* en, io::Printer* printer) { @@ -855,15 +866,16 @@ void GenerateServiceMethod(const MethodDescriptor* method, ); } -void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, - io::Printer* printer) { +void GenerateMessageToPool(const std::string& name_prefix, + const Descriptor* message, io::Printer* printer) { // Don't generate MapEntry messages -- we use the PHP extension's native // support for map fields instead. if (message->options().map_entry()) { return; } - string class_name = (name_prefix.empty() ? "" : name_prefix + "\\") + - ReservedNamePrefix(message->name(), message->file()) + message->name(); + std::string class_name = + (name_prefix.empty() ? "" : name_prefix + "\\") + + ReservedNamePrefix(message->name(), message->file()) + message->name(); printer->Print( "$pool->addMessage('^message^', " @@ -888,7 +900,7 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, "value", ToUpper(val->type_name()), "number", StrCat(field->number()), "other", EnumOrMessageSuffix(val, true)); - } else if (!field->containing_oneof()) { + } else if (!field->real_containing_oneof()) { printer->Print( "->^label^('^field^', " "\\Google\\Protobuf\\Internal\\GPBType::^type^, ^number^^other^)\n", @@ -901,7 +913,7 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, } // oneofs. - for (int i = 0; i < message->oneof_decl_count(); i++) { + for (int i = 0; i < message->real_oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); printer->Print("->oneof(^name^)\n", "name", oneof->name()); @@ -936,19 +948,15 @@ void GenerateMessageToPool(const string& name_prefix, const Descriptor* message, } } -void GenerateAddFileToPool( - const FileDescriptor* file, - bool is_descriptor, - bool aggregate_metadata, - const std::set& aggregate_metadata_prefixes, - io::Printer* printer) { +void GenerateAddFileToPool(const FileDescriptor* file, const Options& options, + io::Printer* printer) { printer->Print( "public static $is_initialized = false;\n\n" "public static function initOnce() {\n"); Indent(printer); - if (aggregate_metadata) { - GenerateAddFilesToPool(file, aggregate_metadata_prefixes, printer); + if (options.aggregate_metadata) { + GenerateAddFilesToPool(file, options, printer); } else { printer->Print( "$pool = \\Google\\Protobuf\\Internal\\" @@ -957,7 +965,7 @@ void GenerateAddFileToPool( " return;\n" "}\n"); - if (is_descriptor) { + if (options.is_descriptor) { for (int i = 0; i < file->message_type_count(); i++) { GenerateMessageToPool("", file->message_type(i), printer); } @@ -977,7 +985,7 @@ void GenerateAddFileToPool( continue; } std::string dependency_filename = - GeneratedMetadataFileName(file->dependency(i), is_descriptor); + GeneratedMetadataFileName(file->dependency(i), options); printer->Print( "\\^name^::initOnce();\n", "name", FilenameToClassname(dependency_filename)); @@ -989,8 +997,9 @@ void GenerateAddFileToPool( file->CopyTo(file_proto); // Filter out descriptor.proto as it cannot be depended on for now. - RepeatedPtrField* dependency = file_proto->mutable_dependency(); - for (RepeatedPtrField::iterator it = dependency->begin(); + RepeatedPtrField* dependency = + file_proto->mutable_dependency(); + for (RepeatedPtrField::iterator it = dependency->begin(); it != dependency->end(); ++it) { if (*it != kDescriptorFile) { dependency->erase(it); @@ -1007,19 +1016,31 @@ void GenerateAddFileToPool( it->clear_extension(); } - string files_data; + std::string files_data; files.SerializeToString(&files_data); - printer->Print("$pool->internalAddGeneratedFile(hex2bin(\n"); + printer->Print("$pool->internalAddGeneratedFile(\n"); Indent(printer); + printer->Print("'"); + + for (auto ch : files_data) { + switch (ch) { + case '\\': + printer->Print(R"(\\)"); + break; + case '\'': + printer->Print(R"(\')"); + break; + default: + printer->Print("^char^", "char", std::string(1, ch)); + break; + } + } - printer->Print( - "\"^data^\"\n", - "data", BinaryToHex(files_data)); - + printer->Print("'\n"); Outdent(printer); printer->Print( - "), true);\n\n"); + ", true);\n\n"); } printer->Print( "static::$is_initialized = true;\n"); @@ -1062,14 +1083,13 @@ static void AnalyzeDependencyForFile( } } -static bool NeedsUnwrapping( - const FileDescriptor* file, - const std::set& aggregate_metadata_prefixes) { +static bool NeedsUnwrapping(const FileDescriptor* file, + const Options& options) { bool has_aggregate_metadata_prefix = false; - if (aggregate_metadata_prefixes.empty()) { + if (options.aggregate_metadata_prefixes.empty()) { has_aggregate_metadata_prefix = true; } else { - for (const auto& prefix : aggregate_metadata_prefixes) { + for (const auto& prefix : options.aggregate_metadata_prefixes) { if (HasPrefixString(file->package(), prefix)) { has_aggregate_metadata_prefix = true; break; @@ -1080,10 +1100,8 @@ static bool NeedsUnwrapping( return has_aggregate_metadata_prefix; } -void GenerateAddFilesToPool( - const FileDescriptor* file, - const std::set& aggregate_metadata_prefixes, - io::Printer* printer) { +void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, + io::Printer* printer) { printer->Print( "$pool = \\Google\\Protobuf\\Internal\\" "DescriptorPool::getGeneratedPool();\n" @@ -1101,9 +1119,9 @@ void GenerateAddFilesToPool( file, &nodes_without_dependency, &deps, &dependency_count); while (!nodes_without_dependency.empty()) { - auto file = *nodes_without_dependency.begin(); - nodes_without_dependency.erase(file); - for (auto dependent : deps[file]) { + auto file_node = *nodes_without_dependency.begin(); + nodes_without_dependency.erase(file_node); + for (auto dependent : deps[file_node]) { if (dependency_count[dependent] == 1) { dependency_count.erase(dependent); nodes_without_dependency.insert(dependent); @@ -1112,15 +1130,16 @@ void GenerateAddFilesToPool( } } - bool needs_aggregate = NeedsUnwrapping(file, aggregate_metadata_prefixes); + bool needs_aggregate = NeedsUnwrapping(file_node, options); if (needs_aggregate) { auto file_proto = sorted_file_set.add_file(); - file->CopyTo(file_proto); + file_node->CopyTo(file_proto); // Filter out descriptor.proto as it cannot be depended on for now. - RepeatedPtrField* dependency = file_proto->mutable_dependency(); - for (RepeatedPtrField::iterator it = dependency->begin(); + RepeatedPtrField* dependency = + file_proto->mutable_dependency(); + for (RepeatedPtrField::iterator it = dependency->begin(); it != dependency->end(); ++it) { if (*it != kDescriptorFile) { dependency->erase(it); @@ -1137,34 +1156,45 @@ void GenerateAddFilesToPool( it->clear_extension(); } } else { - std::string dependency_filename = - GeneratedMetadataFileName(file, false); + std::string dependency_filename = GeneratedMetadataFileName(file_node, false); printer->Print( "\\^name^::initOnce();\n", "name", FilenameToClassname(dependency_filename)); } } - string files_data; + std::string files_data; sorted_file_set.SerializeToString(&files_data); - printer->Print("$pool->internalAddGeneratedFile(hex2bin(\n"); + printer->Print("$pool->internalAddGeneratedFile(\n"); Indent(printer); + printer->Print("'"); - printer->Print( - "\"^data^\"\n", - "data", BinaryToHex(files_data)); + for (auto ch : files_data) { + switch (ch) { + case '\\': + printer->Print(R"(\\)"); + break; + case '\'': + printer->Print(R"(\')"); + break; + default: + printer->Print("^char^", "char", std::string(1, ch)); + break; + } + } + printer->Print("'\n"); Outdent(printer); printer->Print( - "), true);\n"); + ", true);\n"); printer->Print( "static::$is_initialized = true;\n"); } -void GenerateUseDeclaration(bool is_descriptor, io::Printer* printer) { - if (!is_descriptor) { +void GenerateUseDeclaration(const Options& options, io::Printer* printer) { + if (!options.is_descriptor) { printer->Print( "use Google\\Protobuf\\Internal\\GPBType;\n" "use Google\\Protobuf\\Internal\\RepeatedField;\n" @@ -1188,7 +1218,7 @@ void GenerateHead(const FileDescriptor* file, io::Printer* printer) { "filename", file->name()); } -std::string FilenameToClassname(const string& filename) { +std::string FilenameToClassname(const std::string& filename) { int lastindex = filename.find_last_of("."); std::string result = filename.substr(0, lastindex); for (int i = 0; i < result.size(); i++) { @@ -1199,12 +1229,9 @@ std::string FilenameToClassname(const string& filename) { return result; } -void GenerateMetadataFile(const FileDescriptor* file, - bool is_descriptor, - bool aggregate_metadata, - const std::set& aggregate_metadata_prefixes, +void GenerateMetadataFile(const FileDescriptor* file, const Options& options, GeneratorContext* generator_context) { - std::string filename = GeneratedMetadataFileName(file, is_descriptor); + std::string filename = GeneratedMetadataFileName(file, options); std::unique_ptr output( generator_context->Open(filename)); io::Printer printer(output.get(), '^'); @@ -1214,7 +1241,7 @@ void GenerateMetadataFile(const FileDescriptor* file, std::string fullname = FilenameToClassname(filename); int lastindex = fullname.find_last_of("\\"); - if (lastindex != string::npos) { + if (lastindex != std::string::npos) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); @@ -1231,32 +1258,30 @@ void GenerateMetadataFile(const FileDescriptor* file, } Indent(&printer); - GenerateAddFileToPool(file, is_descriptor, aggregate_metadata, - aggregate_metadata_prefixes, &printer); + GenerateAddFileToPool(file, options, &printer); Outdent(&printer); printer.Print("}\n\n"); } template -void LegacyGenerateClassFile(const FileDescriptor* file, const DescriptorType* desc, - bool is_descriptor, - GeneratorContext* generator_context) { - - std::string filename = LegacyGeneratedClassFileName(desc, is_descriptor); +void LegacyGenerateClassFile(const FileDescriptor* file, + const DescriptorType* desc, const Options& options, + GeneratorContext* generator_context) { + std::string filename = LegacyGeneratedClassFileName(desc, options); std::unique_ptr output( generator_context->Open(filename)); io::Printer printer(output.get(), '^'); GenerateHead(file, &printer); - std::string php_namespace = RootPhpNamespace(desc, is_descriptor); + std::string php_namespace = RootPhpNamespace(desc, options); if (!php_namespace.empty()) { printer.Print( "namespace ^name^;\n\n", "name", php_namespace); } - std::string newname = FullClassName(desc, is_descriptor); + std::string newname = FullClassName(desc, options); printer.Print("if (false) {\n"); Indent(&printer); printer.Print("/**\n"); @@ -1272,13 +1297,14 @@ void LegacyGenerateClassFile(const FileDescriptor* file, const DescriptorType* d "new", GeneratedClassNameImpl(desc)); printer.Print("@trigger_error('^old^ is deprecated and will be removed in " "the next major release. Use ^fullname^ instead', E_USER_DEPRECATED);\n\n", - "old", LegacyFullClassName(desc, is_descriptor), + "old", LegacyFullClassName(desc, options), "fullname", newname); } void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, - bool is_descriptor, GeneratorContext* generator_context) { - std::string filename = GeneratedClassFileName(en, is_descriptor); + const Options& options, + GeneratorContext* generator_context) { + std::string filename = GeneratedClassFileName(en, options); std::unique_ptr output( generator_context->Open(filename)); io::Printer printer(output.get(), '^'); @@ -1288,7 +1314,7 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, std::string fullname = FilenameToClassname(filename); int lastindex = fullname.find_last_of("\\"); - if (lastindex != string::npos) { + if (lastindex != std::string::npos) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); @@ -1298,9 +1324,9 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, printer.Print("use UnexpectedValueException;\n\n"); } - GenerateEnumDocComment(&printer, en, is_descriptor); + GenerateEnumDocComment(&printer, en, options); - if (lastindex != string::npos) { + if (lastindex != std::string::npos) { fullname = fullname.substr(lastindex + 1); } @@ -1368,21 +1394,20 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, Outdent(&printer); printer.Print("}\n\n"); - // write legacy file for backwards compatiblity with nested messages and enums + // write legacy file for backwards compatibility with nested messages and enums if (en->containing_type() != NULL) { printer.Print( "// Adding a class alias for backwards compatibility with the previous class name.\n"); printer.Print( "class_alias(^new^::class, \\^old^::class);\n\n", "new", fullname, - "old", LegacyFullClassName(en, is_descriptor)); - LegacyGenerateClassFile(file, en, is_descriptor, generator_context); + "old", LegacyFullClassName(en, options)); + LegacyGenerateClassFile(file, en, options, generator_context); } } void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, - bool is_descriptor, - bool aggregate_metadata, + const Options& options, GeneratorContext* generator_context) { // Don't generate MapEntry messages -- we use the PHP extension's native // support for map fields instead. @@ -1390,7 +1415,7 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, return; } - std::string filename = GeneratedClassFileName(message, is_descriptor); + std::string filename = GeneratedClassFileName(message, options); std::unique_ptr output( generator_context->Open(filename)); io::Printer printer(output.get(), '^'); @@ -1400,43 +1425,57 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, std::string fullname = FilenameToClassname(filename); int lastindex = fullname.find_last_of("\\"); - if (lastindex != string::npos) { + if (lastindex != std::string::npos) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); } - GenerateUseDeclaration(is_descriptor, &printer); + GenerateUseDeclaration(options, &printer); - GenerateMessageDocComment(&printer, message, is_descriptor); - if (lastindex != string::npos) { + GenerateMessageDocComment(&printer, message, options); + if (lastindex != std::string::npos) { fullname = fullname.substr(lastindex + 1); } + std::string base; + + switch (message->well_known_type()) { + case Descriptor::WELLKNOWNTYPE_ANY: + base = "\\Google\\Protobuf\\Internal\\AnyBase"; + break; + case Descriptor::WELLKNOWNTYPE_TIMESTAMP: + base = "\\Google\\Protobuf\\Internal\\TimestampBase"; + break; + default: + base = "\\Google\\Protobuf\\Internal\\Message"; + break; + } + printer.Print( - "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n" + "class ^name^ extends ^base^\n" "{\n", + "base", base, "name", fullname); Indent(&printer); // Field and oneof definitions. for (int i = 0; i < message->field_count(); i++) { const FieldDescriptor* field = message->field(i); - GenerateField(field, &printer, is_descriptor); + GenerateField(field, &printer, options); } - for (int i = 0; i < message->oneof_decl_count(); i++) { + for (int i = 0; i < message->real_oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); GenerateOneofField(oneof, &printer); } printer.Print("\n"); - GenerateMessageConstructorDocComment(&printer, message, is_descriptor); + GenerateMessageConstructorDocComment(&printer, message, options); printer.Print( "public function __construct($data = NULL) {\n"); Indent(&printer); - std::string metadata_filename = - GeneratedMetadataFileName(file, is_descriptor); + std::string metadata_filename = GeneratedMetadataFileName(file, options); std::string metadata_fullname = FilenameToClassname(metadata_filename); printer.Print( "\\^fullname^::initOnce();\n", @@ -1451,9 +1490,9 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, // Field and oneof accessors. for (int i = 0; i < message->field_count(); i++) { const FieldDescriptor* field = message->field(i); - GenerateFieldAccessor(field, is_descriptor, &printer); + GenerateFieldAccessor(field, options, &printer); } - for (int i = 0; i < message->oneof_decl_count(); i++) { + for (int i = 0; i < message->real_oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); printer.Print( "/**\n" @@ -1470,33 +1509,31 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message, Outdent(&printer); printer.Print("}\n\n"); - // write legacy file for backwards compatiblity with nested messages and enums + // write legacy file for backwards compatibility with nested messages and enums if (message->containing_type() != NULL) { printer.Print( "// Adding a class alias for backwards compatibility with the previous class name.\n"); printer.Print( "class_alias(^new^::class, \\^old^::class);\n\n", "new", fullname, - "old", LegacyFullClassName(message, is_descriptor)); - LegacyGenerateClassFile(file, message, is_descriptor, generator_context); + "old", LegacyFullClassName(message, options)); + LegacyGenerateClassFile(file, message, options, generator_context); } // Nested messages and enums. for (int i = 0; i < message->nested_type_count(); i++) { - GenerateMessageFile(file, message->nested_type(i), is_descriptor, - aggregate_metadata, + GenerateMessageFile(file, message->nested_type(i), options, generator_context); } for (int i = 0; i < message->enum_type_count(); i++) { - GenerateEnumFile(file, message->enum_type(i), is_descriptor, - generator_context); + GenerateEnumFile(file, message->enum_type(i), options, generator_context); } } -void GenerateServiceFile(const FileDescriptor* file, - const ServiceDescriptor* service, bool is_descriptor, - GeneratorContext* generator_context) { - std::string filename = GeneratedServiceFileName(service, is_descriptor); +void GenerateServiceFile( + const FileDescriptor* file, const ServiceDescriptor* service, + const Options& options, GeneratorContext* generator_context) { + std::string filename = GeneratedServiceFileName(service, options); std::unique_ptr output( generator_context->Open(filename)); io::Printer printer(output.get(), '^'); @@ -1508,7 +1545,7 @@ void GenerateServiceFile(const FileDescriptor* file, if (!file->options().php_namespace().empty() || (!file->options().has_php_namespace() && !file->package().empty()) || - lastindex != string::npos) { + lastindex != std::string::npos) { printer.Print( "namespace ^name^;\n\n", "name", fullname.substr(0, lastindex)); @@ -1516,13 +1553,13 @@ void GenerateServiceFile(const FileDescriptor* file, GenerateServiceDocComment(&printer, service); - if (lastindex != string::npos) { - printer.Print( + if (lastindex != std::string::npos) { + printer.Print( "interface ^name^\n" "{\n", "name", fullname.substr(lastindex + 1)); } else { - printer.Print( + printer.Print( "interface ^name^\n" "{\n", "name", fullname); @@ -1540,37 +1577,31 @@ void GenerateServiceFile(const FileDescriptor* file, printer.Print("}\n\n"); } -void GenerateFile(const FileDescriptor* file, bool is_descriptor, - bool aggregate_metadata, - const std::set& aggregate_metadata_prefixes, +void GenerateFile(const FileDescriptor* file, const Options& options, GeneratorContext* generator_context) { - GenerateMetadataFile(file, is_descriptor, aggregate_metadata, - aggregate_metadata_prefixes, generator_context); + GenerateMetadataFile(file, options, generator_context); for (int i = 0; i < file->message_type_count(); i++) { - GenerateMessageFile(file, file->message_type(i), is_descriptor, - aggregate_metadata, + GenerateMessageFile(file, file->message_type(i), options, generator_context); } for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnumFile(file, file->enum_type(i), is_descriptor, - generator_context); + GenerateEnumFile(file, file->enum_type(i), options, generator_context); } if (file->options().php_generic_services()) { for (int i = 0; i < file->service_count(); i++) { - GenerateServiceFile(file, file->service(i), is_descriptor, - generator_context); + GenerateServiceFile(file, file->service(i), options, generator_context); } } } -static string EscapePhpdoc(const string& input) { - string result; +static std::string EscapePhpdoc(const std::string& input) { + std::string result; result.reserve(input.size() * 2); char prev = '*'; - for (string::size_type i = 0; i < input.size(); i++) { + for (std::string::size_type i = 0; i < input.size(); i++) { char c = input[i]; switch (c) { case '*': @@ -1609,8 +1640,9 @@ static string EscapePhpdoc(const string& input) { static void GenerateDocCommentBodyForLocation( io::Printer* printer, const SourceLocation& location, bool trailingNewline, int indentCount) { - string comments = location.leading_comments.empty() ? - location.trailing_comments : location.leading_comments; + std::string comments = location.leading_comments.empty() + ? location.trailing_comments + : location.leading_comments; if (!comments.empty()) { // TODO(teboring): Ideally we should parse the comment text as Markdown and // write it back as HTML, but this requires a Markdown parser. For now @@ -1620,7 +1652,7 @@ static void GenerateDocCommentBodyForLocation( // HTML-escape them so that they don't accidentally close the doc comment. comments = EscapePhpdoc(comments); - std::vector lines = Split(comments, "\n", true); + std::vector lines = Split(comments, "\n", true); while (!lines.empty() && lines.back().empty()) { lines.pop_back(); } @@ -1651,31 +1683,31 @@ static void GenerateDocCommentBody( } } -static string FirstLineOf(const string& value) { - string result = value; +static std::string FirstLineOf(const std::string& value) { + std::string result = value; - string::size_type pos = result.find_first_of('\n'); - if (pos != string::npos) { + std::string::size_type pos = result.find_first_of('\n'); + if (pos != std::string::npos) { result.erase(pos); } return result; } -void GenerateMessageDocComment(io::Printer* printer, - const Descriptor* message, int is_descriptor) { +void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message, + const Options& options) { printer->Print("/**\n"); GenerateDocCommentBody(printer, message); printer->Print( " * Generated from protobuf message ^messagename^\n" " */\n", - "fullname", EscapePhpdoc(FullClassName(message, is_descriptor)), + "fullname", EscapePhpdoc(FullClassName(message, options)), "messagename", EscapePhpdoc(message->full_name())); } void GenerateMessageConstructorDocComment(io::Printer* printer, const Descriptor* message, - int is_descriptor) { + const Options& options) { // In theory we should have slightly different comments for setters, getters, // etc., but in practice everyone already knows the difference between these // so it's redundant information. @@ -1693,7 +1725,7 @@ void GenerateMessageConstructorDocComment(io::Printer* printer, for (int i = 0; i < message->field_count(); i++) { const FieldDescriptor* field = message->field(i); printer->Print(" * @type ^php_type^ $^var^\n", - "php_type", PhpSetterTypeName(field, is_descriptor), + "php_type", PhpSetterTypeName(field, options), "var", field->name()); SourceLocation location; if (field->GetSourceLocation(&location)) { @@ -1715,7 +1747,7 @@ void GenerateServiceDocComment(io::Printer* printer, } void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, - int is_descriptor, int function_type) { + const Options& options, int function_type) { // In theory we should have slightly different comments for setters, getters, // etc., but in practice everyone already knows the difference between these // so it's redundant information. @@ -1731,11 +1763,17 @@ void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field, "def", EscapePhpdoc(FirstLineOf(field->DebugString()))); if (function_type == kFieldSetter) { printer->Print(" * @param ^php_type^ $var\n", - "php_type", PhpSetterTypeName(field, is_descriptor)); + "php_type", PhpSetterTypeName(field, options)); printer->Print(" * @return $this\n"); } else if (function_type == kFieldGetter) { - printer->Print(" * @return ^php_type^\n", - "php_type", PhpGetterTypeName(field, is_descriptor)); + bool can_return_null = field->has_presence() && + field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; + printer->Print(" * @return ^php_type^^maybe_null^\n", + "php_type", PhpGetterTypeName(field, options), + "maybe_null", can_return_null ? "|null" : ""); + } + if (field->options().deprecated()) { + printer->Print(" * @deprecated\n"); } printer->Print(" */\n"); } @@ -1764,7 +1802,7 @@ void GenerateWrapperFieldSetterDocComment(io::Printer* printer, const FieldDescr printer->Print("/**\n"); printer->Print( " * Sets the field by wrapping a primitive type in a ^message_name^ object.\n\n", - "message_name", LegacyFullClassName(field->message_type(), false)); + "message_name", FullClassName(field->message_type(), false)); GenerateDocCommentBody(printer, field); printer->Print( " * Generated from protobuf field ^def^\n", @@ -1776,7 +1814,7 @@ void GenerateWrapperFieldSetterDocComment(io::Printer* printer, const FieldDescr } void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_, - int is_descriptor) { + const Options& options) { printer->Print("/**\n"); GenerateDocCommentBody(printer, enum_); printer->Print( @@ -1796,7 +1834,7 @@ void GenerateEnumValueDocComment(io::Printer* printer, } void GenerateServiceMethodDocComment(io::Printer* printer, - const MethodDescriptor* method) { + const MethodDescriptor* method) { printer->Print("/**\n"); GenerateDocCommentBody(printer, method); printer->Print( @@ -1812,35 +1850,439 @@ void GenerateServiceMethodDocComment(io::Printer* printer, "return_type", EscapePhpdoc(FullClassName(method->output_type(), false))); } -bool Generator::Generate(const FileDescriptor* file, const string& parameter, +std::string FilenameCName(const FileDescriptor* file) { + std::string c_name = file->name(); + c_name = StringReplace(c_name, ".", "_", true); + c_name = StringReplace(c_name, "/", "_", true); + return c_name; +} + +void GenerateCEnum(const EnumDescriptor* desc, io::Printer* printer) { + std::string c_name = desc->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + std::string php_name = FullClassName(desc, Options()); + php_name = StringReplace(php_name, "\\", "\\\\", true); + printer->Print( + "/* $c_name$ */\n" + "\n" + "zend_class_entry* $c_name$_ce;\n" + "\n" + "PHP_METHOD($c_name$, name) {\n" + " $file_c_name$_AddDescriptor();\n" + " const upb_symtab *symtab = DescriptorPool_GetSymbolTable();\n" + " const upb_enumdef *e = upb_symtab_lookupenum(symtab, \"$name$\");\n" + " const char *name;\n" + " zend_long value;\n" + " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"l\", &value) ==\n" + " FAILURE) {\n" + " return;\n" + " }\n" + " name = upb_enumdef_iton(e, value);\n" + " if (!name) {\n" + " zend_throw_exception_ex(NULL, 0,\n" + " \"$php_name$ has no name \"\n" + " \"defined for value \" ZEND_LONG_FMT \".\",\n" + " value);\n" + " return;\n" + " }\n" + " RETURN_STRING(name);\n" + "}\n" + "\n" + "PHP_METHOD($c_name$, value) {\n" + " $file_c_name$_AddDescriptor();\n" + " const upb_symtab *symtab = DescriptorPool_GetSymbolTable();\n" + " const upb_enumdef *e = upb_symtab_lookupenum(symtab, \"$name$\");\n" + " char *name = NULL;\n" + " size_t name_len;\n" + " int32_t num;\n" + " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"s\", &name,\n" + " &name_len) == FAILURE) {\n" + " return;\n" + " }\n" + " if (!upb_enumdef_ntoi(e, name, name_len, &num)) {\n" + " zend_throw_exception_ex(NULL, 0,\n" + " \"$php_name$ has no value \"\n" + " \"defined for name %s.\",\n" + " name);\n" + " return;\n" + " }\n" + " RETURN_LONG(num);\n" + "}\n" + "\n" + "static zend_function_entry $c_name$_phpmethods[] = {\n" + " PHP_ME($c_name$, name, arginfo_lookup, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)\n" + " PHP_ME($c_name$, value, arginfo_lookup, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)\n" + " ZEND_FE_END\n" + "};\n" + "\n" + "static void $c_name$_ModuleInit() {\n" + " zend_class_entry tmp_ce;\n" + "\n" + " INIT_CLASS_ENTRY(tmp_ce, \"$php_name$\",\n" + " $c_name$_phpmethods);\n" + "\n" + " $c_name$_ce = zend_register_internal_class(&tmp_ce);\n", + "name", desc->full_name(), + "file_c_name", FilenameCName(desc->file()), + "c_name", c_name, + "php_name", php_name); + + for (int i = 0; i < desc->value_count(); i++) { + const EnumValueDescriptor* value = desc->value(i); + printer->Print( + " zend_declare_class_constant_long($c_name$_ce, \"$name$\",\n" + " strlen(\"$name$\"), $num$);\n", + "c_name", c_name, + "name", value->name(), + "num", std::to_string(value->number())); + } + + printer->Print( + "}\n" + "\n"); +} + +void GenerateCMessage(const Descriptor* message, io::Printer* printer) { + std::string c_name = message->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + std::string php_name = FullClassName(message, Options()); + php_name = StringReplace(php_name, "\\", "\\\\", true); + printer->Print( + "/* $c_name$ */\n" + "\n" + "zend_class_entry* $c_name$_ce;\n" + "\n" + "static PHP_METHOD($c_name$, __construct) {\n" + " $file_c_name$_AddDescriptor();\n" + " zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU);\n" + "}\n" + "\n", + "file_c_name", FilenameCName(message->file()), + "c_name", c_name); + + for (int i = 0; i < message->field_count(); i++) { + auto field = message->field(i); + printer->Print( + "static PHP_METHOD($c_name$, get$camel_name$) {\n" + " Message* intern = (Message*)Z_OBJ_P(getThis());\n" + " const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef,\n" + " \"$name$\");\n" + " zval ret;\n" + " Message_get(intern, f, &ret);\n" + " RETURN_COPY_VALUE(&ret);\n" + "}\n" + "\n" + "static PHP_METHOD($c_name$, set$camel_name$) {\n" + " Message* intern = (Message*)Z_OBJ_P(getThis());\n" + " const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef,\n" + " \"$name$\");\n" + " zval *val;\n" + " if (zend_parse_parameters(ZEND_NUM_ARGS(), \"z\", &val)\n" + " == FAILURE) {\n" + " return;\n" + " }\n" + " Message_set(intern, f, val);\n" + " RETURN_COPY(getThis());\n" + "}\n" + "\n", + "c_name", c_name, + "name", field->name(), + "camel_name", UnderscoresToCamelCase(field->name(), true)); + } + + for (int i = 0; i < message->real_oneof_decl_count(); i++) { + auto oneof = message->oneof_decl(i); + printer->Print( + "static PHP_METHOD($c_name$, get$camel_name$) {\n" + " Message* intern = (Message*)Z_OBJ_P(getThis());\n" + " const upb_oneofdef *oneof = upb_msgdef_ntooz(intern->desc->msgdef,\n" + " \"$name$\");\n" + " const upb_fielddef *field = upb_msg_whichoneof(intern->msg, oneof);\n" + " RETURN_STRING(field ? upb_fielddef_name(field) : \"\");\n" + "}\n", + "c_name", c_name, + "name", oneof->name(), + "camel_name", UnderscoresToCamelCase(oneof->name(), true)); + } + + switch (message->well_known_type()) { + case Descriptor::WELLKNOWNTYPE_ANY: + printer->Print( + "ZEND_BEGIN_ARG_INFO_EX(arginfo_is, 0, 0, 1)\n" + " ZEND_ARG_INFO(0, proto)\n" + "ZEND_END_ARG_INFO()\n" + "\n" + ); + break; + case Descriptor::WELLKNOWNTYPE_TIMESTAMP: + printer->Print( + "ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1)\n" + " ZEND_ARG_INFO(0, datetime)\n" + "ZEND_END_ARG_INFO()\n" + "\n" + ); + break; + default: + break; + } + + printer->Print( + "static zend_function_entry $c_name$_phpmethods[] = {\n" + " PHP_ME($c_name$, __construct, arginfo_construct, ZEND_ACC_PUBLIC)\n", + "c_name", c_name); + + for (int i = 0; i < message->field_count(); i++) { + auto field = message->field(i); + printer->Print( + " PHP_ME($c_name$, get$camel_name$, arginfo_void, ZEND_ACC_PUBLIC)\n" + " PHP_ME($c_name$, set$camel_name$, arginfo_setter, ZEND_ACC_PUBLIC)\n", + "c_name", c_name, + "camel_name", UnderscoresToCamelCase(field->name(), true)); + } + + for (int i = 0; i < message->real_oneof_decl_count(); i++) { + auto oneof = message->oneof_decl(i); + printer->Print( + " PHP_ME($c_name$, get$camel_name$, arginfo_void, ZEND_ACC_PUBLIC)\n", + "c_name", c_name, + "camel_name", UnderscoresToCamelCase(oneof->name(), true)); + } + + // Extra hand-written functions added to the well-known types. + switch (message->well_known_type()) { + case Descriptor::WELLKNOWNTYPE_ANY: + printer->Print( + " PHP_ME($c_name$, is, arginfo_is, ZEND_ACC_PUBLIC)\n" + " PHP_ME($c_name$, pack, arginfo_setter, ZEND_ACC_PUBLIC)\n" + " PHP_ME($c_name$, unpack, arginfo_void, ZEND_ACC_PUBLIC)\n", + "c_name", c_name); + break; + case Descriptor::WELLKNOWNTYPE_TIMESTAMP: + printer->Print( + " PHP_ME($c_name$, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC)\n" + " PHP_ME($c_name$, toDateTime, arginfo_void, ZEND_ACC_PUBLIC)\n", + "c_name", c_name); + break; + default: + break; + } + + printer->Print( + " ZEND_FE_END\n" + "};\n" + "\n" + "static void $c_name$_ModuleInit() {\n" + " zend_class_entry tmp_ce;\n" + "\n" + " INIT_CLASS_ENTRY(tmp_ce, \"$php_name$\",\n" + " $c_name$_phpmethods);\n" + "\n" + " $c_name$_ce = zend_register_internal_class(&tmp_ce);\n" + " $c_name$_ce->ce_flags |= ZEND_ACC_FINAL;\n" + " $c_name$_ce->create_object = Message_create;\n" + " zend_do_inheritance($c_name$_ce, message_ce);\n" + "}\n" + "\n", + "c_name", c_name, + "php_name", php_name); + + for (int i = 0; i < message->nested_type_count(); i++) { + GenerateCMessage(message->nested_type(i), printer); + } + for (int i = 0; i < message->enum_type_count(); i++) { + GenerateCEnum(message->enum_type(i), printer); + } +} + +void GenerateEnumCInit(const EnumDescriptor* desc, io::Printer* printer) { + std::string c_name = desc->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + + printer->Print( + " $c_name$_ModuleInit();\n", + "c_name", c_name); +} + +void GenerateCInit(const Descriptor* message, io::Printer* printer) { + std::string c_name = message->full_name(); + c_name = StringReplace(c_name, ".", "_", true); + + printer->Print( + " $c_name$_ModuleInit();\n", + "c_name", c_name); + + for (int i = 0; i < message->nested_type_count(); i++) { + GenerateCInit(message->nested_type(i), printer); + } + for (int i = 0; i < message->enum_type_count(); i++) { + GenerateEnumCInit(message->enum_type(i), printer); + } +} + +void GenerateCWellKnownTypes(const std::vector& files, + GeneratorContext* context) { + std::unique_ptr output( + context->Open("../ext/google/protobuf/wkt.inc")); + io::Printer printer(output.get(), '$'); + + printer.Print( + "// This file is generated from the .proto files for the well-known\n" + "// types. Do not edit!\n\n"); + + printer.Print( + "ZEND_BEGIN_ARG_INFO_EX(arginfo_lookup, 0, 0, 1)\n" + " ZEND_ARG_INFO(0, key)\n" + "ZEND_END_ARG_INFO()\n" + "\n" + ); + + for (auto file : files) { + printer.Print( + "static void $c_name$_AddDescriptor();\n", + "c_name", FilenameCName(file)); + } + + for (auto file : files) { + std::string c_name = FilenameCName(file); + std::string metadata_filename = GeneratedMetadataFileName(file, Options()); + std::string metadata_classname = FilenameToClassname(metadata_filename); + std::string metadata_c_name = + StringReplace(metadata_classname, "\\", "_", true); + metadata_classname = StringReplace(metadata_classname, "\\", "\\\\", true); + FileDescriptorProto file_proto; + file->CopyTo(&file_proto); + std::string serialized; + file_proto.SerializeToString(&serialized); + printer.Print( + "/* $filename$ */\n" + "\n" + "zend_class_entry* $metadata_c_name$_ce;\n" + "\n" + "const char $c_name$_descriptor [$size$] = {\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name, + "size", std::to_string(serialized.size())); + + for (size_t i = 0; i < serialized.size();) { + for (size_t j = 0; j < 25 && i < serialized.size(); ++i, ++j) { + printer.Print("'$ch$', ", "ch", CEscape(serialized.substr(i, 1))); + } + printer.Print("\n"); + } + + printer.Print( + "};\n" + "\n" + "static void $c_name$_AddDescriptor() {\n" + " if (DescriptorPool_HasFile(\"$filename$\")) return;\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name); + + for (int i = 0; i < file->dependency_count(); i++) { + std::string dep_c_name = FilenameCName(file->dependency(i)); + printer.Print( + " $dep_c_name$_AddDescriptor();\n", + "dep_c_name", dep_c_name); + } + + printer.Print( + " DescriptorPool_AddDescriptor(\"$filename$\", $c_name$_descriptor,\n" + " sizeof($c_name$_descriptor));\n" + "}\n" + "\n" + "static PHP_METHOD($metadata_c_name$, initOnce) {\n" + " $c_name$_AddDescriptor();\n" + "}\n" + "\n" + "static zend_function_entry $metadata_c_name$_methods[] = {\n" + " PHP_ME($metadata_c_name$, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)\n" + " ZEND_FE_END\n" + "};\n" + "\n" + "static void $metadata_c_name$_ModuleInit() {\n" + " zend_class_entry tmp_ce;\n" + "\n" + " INIT_CLASS_ENTRY(tmp_ce, \"$metadata_classname$\",\n" + " $metadata_c_name$_methods);\n" + "\n" + " $metadata_c_name$_ce = zend_register_internal_class(&tmp_ce);\n" + "}\n" + "\n", + "filename", file->name(), + "c_name", c_name, + "metadata_c_name", metadata_c_name, + "metadata_classname", metadata_classname); + for (int i = 0; i < file->message_type_count(); i++) { + GenerateCMessage(file->message_type(i), &printer); + } + for (int i = 0; i < file->enum_type_count(); i++) { + GenerateCEnum(file->enum_type(i), &printer); + } + } + + printer.Print( + "static void WellKnownTypes_ModuleInit() {\n"); + + for (auto file : files) { + std::string metadata_filename = GeneratedMetadataFileName(file, Options()); + std::string metadata_classname = FilenameToClassname(metadata_filename); + std::string metadata_c_name = + StringReplace(metadata_classname, "\\", "_", true); + printer.Print( + " $metadata_c_name$_ModuleInit();\n", + "metadata_c_name", metadata_c_name); + for (int i = 0; i < file->message_type_count(); i++) { + GenerateCInit(file->message_type(i), &printer); + } + for (int i = 0; i < file->enum_type_count(); i++) { + GenerateEnumCInit(file->enum_type(i), &printer); + } + } + + printer.Print( + "}\n"); +} + +} // namespace + +std::string GeneratedClassName(const Descriptor* desc) { + return GeneratedClassNameImpl(desc); +} + +std::string GeneratedClassName(const EnumDescriptor* desc) { + return GeneratedClassNameImpl(desc); +} + +std::string GeneratedClassName(const ServiceDescriptor* desc) { + return GeneratedClassNameImpl(desc); +} + +bool Generator::Generate(const FileDescriptor* file, + const std::string& parameter, GeneratorContext* generator_context, - string* error) const { - return Generate(file, false, false, std::set(), - generator_context, error); + std::string* error) const { + return Generate(file, Options(), generator_context, error); } -bool Generator::Generate( - const FileDescriptor* file, - bool is_descriptor, - bool aggregate_metadata, - const std::set& aggregate_metadata_prefixes, - GeneratorContext* generator_context, - string* error) const { - if (is_descriptor && file->name() != kDescriptorFile) { +bool Generator::Generate(const FileDescriptor* file, const Options& options, + GeneratorContext* generator_context, + std::string* error) const { + if (options.is_descriptor && file->name() != kDescriptorFile) { *error = "Can only generate PHP code for google/protobuf/descriptor.proto.\n"; return false; } - if (!is_descriptor && file->syntax() != FileDescriptor::SYNTAX_PROTO3) { + if (!options.is_descriptor && file->syntax() != FileDescriptor::SYNTAX_PROTO3) { *error = "Can only generate PHP code for proto3 .proto files.\n" "Please add 'syntax = \"proto3\";' to the top of your .proto file.\n"; return false; } - GenerateFile(file, is_descriptor, aggregate_metadata, - aggregate_metadata_prefixes, generator_context); + GenerateFile(file, options, generator_context); return true; } @@ -1849,34 +2291,31 @@ bool Generator::GenerateAll(const std::vector& files, const std::string& parameter, GeneratorContext* generator_context, std::string* error) const { - bool is_descriptor = false; - bool aggregate_metadata = false; - std::set aggregate_metadata_prefixes; + Options options; - for (const auto& option : Split(parameter, ",")) { - const auto option_pair = Split(option, "="); + for (const auto& option : Split(parameter, ",", true)) { + const std::vector option_pair = Split(option, "=", true); if (HasPrefixString(option_pair[0], "aggregate_metadata")) { - string options_string = option_pair[1]; - const auto options = Split(options_string, "#", false); - aggregate_metadata = true; - for (int i = 0; i < options.size(); i++) { - aggregate_metadata_prefixes.insert(options[i]); - GOOGLE_LOG(INFO) << options[i]; + options.aggregate_metadata = true; + for (const auto& prefix : Split(option_pair[1], "#", false)) { + options.aggregate_metadata_prefixes.emplace(prefix); + GOOGLE_LOG(INFO) << prefix; } - } - if (option_pair[0] == "internal") { - is_descriptor = true; + } else if (option_pair[0] == "internal") { + options.is_descriptor = true; + } else if (option_pair[0] == "internal_generate_c_wkt") { + GenerateCWellKnownTypes(files, generator_context); + } else { + GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; } } for (auto file : files) { - if (!Generate( - file, is_descriptor, aggregate_metadata, - aggregate_metadata_prefixes, - generator_context, error)) { + if (!Generate(file, options, generator_context, error)) { return false; } } + return true; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.h similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.h index ca9d23a46..17cb59c08 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/php/php_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/php/php_generator.h @@ -43,26 +43,31 @@ namespace protobuf { namespace compiler { namespace php { +struct Options; + class PROTOC_EXPORT Generator : public CodeGenerator { public: virtual bool Generate( const FileDescriptor* file, - const string& parameter, + const std::string& parameter, GeneratorContext* generator_context, - string* error) const override; + std::string* error) const override; bool GenerateAll(const std::vector& files, const std::string& parameter, GeneratorContext* generator_context, std::string* error) const override; + + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL; + } + private: bool Generate( const FileDescriptor* file, - bool is_descriptor, - bool aggregate_metadata, - const std::set& aggregate_metadata_prefixes, + const Options& options, GeneratorContext* generator_context, - string* error) const; + std::string* error) const; }; // To skip reserved keywords in php, some generated classname are prefixed. diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.cc similarity index 88% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.cc index 7de3985c5..780996866 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.cc @@ -72,25 +72,36 @@ class GeneratorResponseContext : public GeneratorContext { // implements GeneratorContext -------------------------------------- - virtual io::ZeroCopyOutputStream* Open(const std::string& filename) { + io::ZeroCopyOutputStream* Open(const std::string& filename) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); return new io::StringOutputStream(file->mutable_content()); } - virtual io::ZeroCopyOutputStream* OpenForInsert( - const std::string& filename, const std::string& insertion_point) { + io::ZeroCopyOutputStream* OpenForInsert( + const std::string& filename, + const std::string& insertion_point) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); file->set_insertion_point(insertion_point); return new io::StringOutputStream(file->mutable_content()); } - void ListParsedFiles(std::vector* output) { + io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( + const std::string& filename, const std::string& insertion_point, + const google::protobuf::GeneratedCodeInfo& info) override { + CodeGeneratorResponse::File* file = response_->add_file(); + file->set_name(filename); + file->set_insertion_point(insertion_point); + *file->mutable_generated_code_info() = info; + return new io::StringOutputStream(file->mutable_content()); + } + + void ListParsedFiles(std::vector* output) override { *output = parsed_files_; } - void GetCompilerVersion(Version* version) const { + void GetCompilerVersion(Version* version) const override { *version = compiler_version_; } @@ -132,6 +143,8 @@ bool GenerateCode(const CodeGeneratorRequest& request, bool succeeded = generator.GenerateAll(parsed_files, request.parameter(), &context, &error); + response->set_supported_features(generator.GetSupportedFeatures()); + if (!succeeded && error.empty()) { error = "Code generator returned false but provided no error " @@ -163,6 +176,7 @@ int PluginMain(int argc, char* argv[], const CodeGenerator* generator) { return 1; } + std::string error_msg; CodeGeneratorResponse response; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.h similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.h index 69c5d3f53..7d1bf4508 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.h @@ -78,8 +78,9 @@ class CodeGeneratorResponse; PROTOC_EXPORT int PluginMain(int argc, char* argv[], const CodeGenerator* generator); + // Generates code using the given code generator. Returns true if the code -// generation is successful. If the code geneartion fails, error_msg may be +// generation is successful. If the code generation fails, error_msg may be // populated to describe the failure cause. bool GenerateCode(const CodeGeneratorRequest& request, const CodeGenerator& generator, diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.cc new file mode 100644 index 000000000..e423e851b --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.cc @@ -0,0 +1,1584 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/compiler/plugin.proto + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +PROTOBUF_NAMESPACE_OPEN +namespace compiler { +constexpr Version::Version( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : suffix_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , major_(0) + , minor_(0) + , patch_(0){} +struct VersionDefaultTypeInternal { + constexpr VersionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~VersionDefaultTypeInternal() {} + union { + Version _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT VersionDefaultTypeInternal _Version_default_instance_; +constexpr CodeGeneratorRequest::CodeGeneratorRequest( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : file_to_generate_() + , proto_file_() + , parameter_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , compiler_version_(nullptr){} +struct CodeGeneratorRequestDefaultTypeInternal { + constexpr CodeGeneratorRequestDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~CodeGeneratorRequestDefaultTypeInternal() {} + union { + CodeGeneratorRequest _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_; +constexpr CodeGeneratorResponse_File::CodeGeneratorResponse_File( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , insertion_point_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , content_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , generated_code_info_(nullptr){} +struct CodeGeneratorResponse_FileDefaultTypeInternal { + constexpr CodeGeneratorResponse_FileDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~CodeGeneratorResponse_FileDefaultTypeInternal() {} + union { + CodeGeneratorResponse_File _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; +constexpr CodeGeneratorResponse::CodeGeneratorResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : file_() + , error_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , supported_features_(uint64_t{0u}){} +struct CodeGeneratorResponseDefaultTypeInternal { + constexpr CodeGeneratorResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~CodeGeneratorResponseDefaultTypeInternal() {} + union { + CodeGeneratorResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; +} // namespace compiler +PROTOBUF_NAMESPACE_CLOSE +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[4]; +static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr; + +const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, major_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, minor_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, patch_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, suffix_), + 1, + 2, + 3, + 0, + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, file_to_generate_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, parameter_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, proto_file_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, compiler_version_), + ~0u, + 0, + ~0u, + 1, + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, insertion_point_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, content_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, generated_code_info_), + 0, + 1, + 2, + 3, + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, error_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, supported_features_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, file_), + 0, + 1, + ~0u, +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::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)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_), + reinterpret_cast(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_), +}; + +const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n%google/protobuf/compiler/plugin.proto\022" + "\030google.protobuf.compiler\032 google/protob" + "uf/descriptor.proto\"F\n\007Version\022\r\n\005major\030" + "\001 \001(\005\022\r\n\005minor\030\002 \001(\005\022\r\n\005patch\030\003 \001(\005\022\016\n\006s" + "uffix\030\004 \001(\t\"\272\001\n\024CodeGeneratorRequest\022\030\n\020" + "file_to_generate\030\001 \003(\t\022\021\n\tparameter\030\002 \001(" + "\t\0228\n\nproto_file\030\017 \003(\0132$.google.protobuf." + "FileDescriptorProto\022;\n\020compiler_version\030" + "\003 \001(\0132!.google.protobuf.compiler.Version" + "\"\301\002\n\025CodeGeneratorResponse\022\r\n\005error\030\001 \001(" + "\t\022\032\n\022supported_features\030\002 \001(\004\022B\n\004file\030\017 " + "\003(\01324.google.protobuf.compiler.CodeGener" + "atorResponse.File\032\177\n\004File\022\014\n\004name\030\001 \001(\t\022" + "\027\n\017insertion_point\030\002 \001(\t\022\017\n\007content\030\017 \001(" + "\t\022\?\n\023generated_code_info\030\020 \001(\0132\".google." + "protobuf.GeneratedCodeInfo\"8\n\007Feature\022\020\n" + "\014FEATURE_NONE\020\000\022\033\n\027FEATURE_PROTO3_OPTION" + "AL\020\001BW\n\034com.google.protobuf.compilerB\014Pl" + "uginProtosZ)google.golang.org/protobuf/t" + "ypes/pluginpb" + ; +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = { + &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto = { + false, false, 773, descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto, "google/protobuf/compiler/plugin.proto", + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps, 1, 4, + schemas, file_default_instances, TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets, + file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto, file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter() { + return &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_google_2fprotobuf_2fcompiler_2fplugin_2eproto(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); +PROTOBUF_NAMESPACE_OPEN +namespace compiler { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* CodeGeneratorResponse_Feature_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); + return file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[0]; +} +bool CodeGeneratorResponse_Feature_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_NONE; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_PROTO3_OPTIONAL; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MIN; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MAX; +constexpr int CodeGeneratorResponse::Feature_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +// =================================================================== + +class Version::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_major(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_minor(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_patch(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_suffix(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +Version::Version(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.Version) +} +Version::Version(const Version& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_suffix()) { + suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(), + GetArenaForAllocation()); + } + ::memcpy(&major_, &from.major_, + static_cast(reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); + // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) +} + +inline void Version::SharedCtor() { +suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&major_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); +} + +Version::~Version() { + // @@protoc_insertion_point(destructor:google.protobuf.compiler.Version) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void Version::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + suffix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void Version::ArenaDtor(void* object) { + Version* _this = reinterpret_cast< Version* >(object); + (void)_this; +} +void Version::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Version::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void Version::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + suffix_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x0000000eu) { + ::memset(&major_, 0, static_cast( + reinterpret_cast(&patch_) - + reinterpret_cast(&major_)) + sizeof(patch_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 major = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_major(&has_bits); + major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 minor = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_minor(&has_bits); + minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 patch = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_patch(&has_bits); + patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string suffix = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + auto str = _internal_mutable_suffix(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.Version.suffix"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* Version::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 major = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_major(), target); + } + + // optional int32 minor = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_minor(), target); + } + + // optional int32 patch = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_patch(), target); + } + + // optional string suffix = 4; + if (cached_has_bits & 0x00000001u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_suffix().data(), static_cast(this->_internal_suffix().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.Version.suffix"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_suffix(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.Version) + return target; +} + +size_t Version::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional string suffix = 4; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_suffix()); + } + + // optional int32 major = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_major()); + } + + // optional int32 minor = 2; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_minor()); + } + + // optional int32 patch = 3; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_patch()); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Version::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + Version::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Version::GetClassData() const { return &_class_data_; } + +void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void Version::MergeFrom(const Version& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_suffix(from._internal_suffix()); + } + if (cached_has_bits & 0x00000002u) { + major_ = from.major_; + } + if (cached_has_bits & 0x00000004u) { + minor_ = from.minor_; + } + if (cached_has_bits & 0x00000008u) { + patch_ = from.patch_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void Version::CopyFrom(const Version& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.Version) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Version::IsInitialized() const { + return true; +} + +void Version::InternalSwap(Version* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &suffix_, lhs_arena, + &other->suffix_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Version, patch_) + + sizeof(Version::patch_) + - PROTOBUF_FIELD_OFFSET(Version, major_)>( + reinterpret_cast(&major_), + reinterpret_cast(&other->major_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Version::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, + file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[0]); +} + +// =================================================================== + +class CodeGeneratorRequest::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_parameter(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version(const CodeGeneratorRequest* msg); + static void set_has_compiler_version(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +const ::PROTOBUF_NAMESPACE_ID::compiler::Version& +CodeGeneratorRequest::_Internal::compiler_version(const CodeGeneratorRequest* msg) { + return *msg->compiler_version_; +} +void CodeGeneratorRequest::clear_proto_file() { + proto_file_.Clear(); +} +CodeGeneratorRequest::CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + file_to_generate_(arena), + proto_file_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorRequest) +} +CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _has_bits_(from._has_bits_), + file_to_generate_(from.file_to_generate_), + proto_file_(from.proto_file_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_parameter()) { + parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(), + GetArenaForAllocation()); + } + if (from._internal_has_compiler_version()) { + compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_); + } else { + compiler_version_ = nullptr; + } + // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) +} + +inline void CodeGeneratorRequest::SharedCtor() { +parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +compiler_version_ = nullptr; +} + +CodeGeneratorRequest::~CodeGeneratorRequest() { + // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorRequest) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void CodeGeneratorRequest::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + parameter_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete compiler_version_; +} + +void CodeGeneratorRequest::ArenaDtor(void* object) { + CodeGeneratorRequest* _this = reinterpret_cast< CodeGeneratorRequest* >(object); + (void)_this; +} +void CodeGeneratorRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void CodeGeneratorRequest::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void CodeGeneratorRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + file_to_generate_.Clear(); + proto_file_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + parameter_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(compiler_version_ != nullptr); + compiler_version_->Clear(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated string file_to_generate = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + auto str = _internal_add_file_to_generate(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); + #endif // !NDEBUG + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else + goto handle_unusual; + continue; + // optional string parameter = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_parameter(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .google.protobuf.compiler.Version compiler_version = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_proto_file(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* CodeGeneratorRequest::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated string file_to_generate = 1; + for (int i = 0, n = this->_internal_file_to_generate_size(); i < n; i++) { + const auto& s = this->_internal_file_to_generate(i); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + s.data(), static_cast(s.length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); + target = stream->WriteString(1, s, target); + } + + cached_has_bits = _has_bits_[0]; + // optional string parameter = 2; + if (cached_has_bits & 0x00000001u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_parameter().data(), static_cast(this->_internal_parameter().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorRequest.parameter"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_parameter(), target); + } + + // optional .google.protobuf.compiler.Version compiler_version = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::compiler_version(this), target, stream); + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + for (unsigned int i = 0, + n = static_cast(this->_internal_proto_file_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(15, this->_internal_proto_file(i), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorRequest) + return target; +} + +size_t CodeGeneratorRequest::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated string file_to_generate = 1; + total_size += 1 * + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(file_to_generate_.size()); + for (int i = 0, n = file_to_generate_.size(); i < n; i++) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + file_to_generate_.Get(i)); + } + + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + total_size += 1UL * this->_internal_proto_file_size(); + for (const auto& msg : this->proto_file_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string parameter = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_parameter()); + } + + // optional .google.protobuf.compiler.Version compiler_version = 3; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *compiler_version_); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorRequest::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + CodeGeneratorRequest::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorRequest::GetClassData() const { return &_class_data_; } + +void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + file_to_generate_.MergeFrom(from.file_to_generate_); + proto_file_.MergeFrom(from.proto_file_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_parameter(from._internal_parameter()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_compiler_version()->::PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version()); + } + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorRequest) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorRequest::IsInitialized() const { + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_)) + return false; + return true; +} + +void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + file_to_generate_.InternalSwap(&other->file_to_generate_); + proto_file_.InternalSwap(&other->proto_file_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + ¶meter_, lhs_arena, + &other->parameter_, rhs_arena + ); + swap(compiler_version_, other->compiler_version_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorRequest::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, + file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]); +} + +// =================================================================== + +class CodeGeneratorResponse_File::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_insertion_point(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_content(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info(const CodeGeneratorResponse_File* msg); + static void set_has_generated_code_info(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& +CodeGeneratorResponse_File::_Internal::generated_code_info(const CodeGeneratorResponse_File* msg) { + return *msg->generated_code_info_; +} +void CodeGeneratorResponse_File::clear_generated_code_info() { + if (generated_code_info_ != nullptr) generated_code_info_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +CodeGeneratorResponse_File::CodeGeneratorResponse_File(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) +} +CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_name()) { + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), + GetArenaForAllocation()); + } + insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_insertion_point()) { + insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(), + GetArenaForAllocation()); + } + content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_content()) { + content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(), + GetArenaForAllocation()); + } + if (from._internal_has_generated_code_info()) { + generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from.generated_code_info_); + } else { + generated_code_info_ = nullptr; + } + // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) +} + +inline void CodeGeneratorResponse_File::SharedCtor() { +name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +generated_code_info_ = nullptr; +} + +CodeGeneratorResponse_File::~CodeGeneratorResponse_File() { + // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse.File) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void CodeGeneratorResponse_File::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + insertion_point_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + content_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete generated_code_info_; +} + +void CodeGeneratorResponse_File::ArenaDtor(void* object) { + CodeGeneratorResponse_File* _this = reinterpret_cast< CodeGeneratorResponse_File* >(object); + (void)_this; +} +void CodeGeneratorResponse_File::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void CodeGeneratorResponse_File::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void CodeGeneratorResponse_File::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + insertion_point_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + content_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(generated_code_info_ != nullptr); + generated_code_info_->Clear(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string insertion_point = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_insertion_point(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string content = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + auto str = _internal_mutable_content(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + case 16: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 130)) { + ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* CodeGeneratorResponse_File::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string name = 1; + if (cached_has_bits & 0x00000001u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_name().data(), static_cast(this->_internal_name().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.name"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_name(), target); + } + + // optional string insertion_point = 2; + if (cached_has_bits & 0x00000002u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_insertion_point().data(), static_cast(this->_internal_insertion_point().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_insertion_point(), target); + } + + // optional string content = 15; + if (cached_has_bits & 0x00000004u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_content().data(), static_cast(this->_internal_content().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.content"); + target = stream->WriteStringMaybeAliased( + 15, this->_internal_content(), target); + } + + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 16, _Internal::generated_code_info(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse.File) + return target; +} + +size_t CodeGeneratorResponse_File::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional string name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // optional string insertion_point = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_insertion_point()); + } + + // optional string content = 15; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_content()); + } + + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + if (cached_has_bits & 0x00000008u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *generated_code_info_); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse_File::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + CodeGeneratorResponse_File::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse_File::GetClassData() const { return &_class_data_; } + +void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_name(from._internal_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_insertion_point(from._internal_insertion_point()); + } + if (cached_has_bits & 0x00000004u) { + _internal_set_content(from._internal_content()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_generated_code_info()->::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom(from._internal_generated_code_info()); + } + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorResponse_File::IsInitialized() const { + return true; +} + +void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &name_, lhs_arena, + &other->name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &insertion_point_, lhs_arena, + &other->insertion_point_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &content_, lhs_arena, + &other->content_, rhs_arena + ); + swap(generated_code_info_, other->generated_code_info_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse_File::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, + file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[2]); +} + +// =================================================================== + +class CodeGeneratorResponse::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_error(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_supported_features(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +CodeGeneratorResponse::CodeGeneratorResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), + file_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse) +} +CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + _has_bits_(from._has_bits_), + file_(from.file_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_error()) { + error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(), + GetArenaForAllocation()); + } + supported_features_ = from.supported_features_; + // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) +} + +inline void CodeGeneratorResponse::SharedCtor() { +error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +supported_features_ = uint64_t{0u}; +} + +CodeGeneratorResponse::~CodeGeneratorResponse() { + // @@protoc_insertion_point(destructor:google.protobuf.compiler.CodeGeneratorResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void CodeGeneratorResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + error_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void CodeGeneratorResponse::ArenaDtor(void* object) { + CodeGeneratorResponse* _this = reinterpret_cast< CodeGeneratorResponse* >(object); + (void)_this; +} +void CodeGeneratorResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void CodeGeneratorResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void CodeGeneratorResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + file_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + error_.ClearNonDefaultToEmpty(); + } + supported_features_ = uint64_t{0u}; + _has_bits_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string error = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_error(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + #ifndef NDEBUG + ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.error"); + #endif // !NDEBUG + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint64 supported_features = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_supported_features(&has_bits); + supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_file(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* CodeGeneratorResponse::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string error = 1; + if (cached_has_bits & 0x00000001u) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( + this->_internal_error().data(), static_cast(this->_internal_error().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.error"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_error(), target); + } + + // optional uint64 supported_features = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->_internal_supported_features(), target); + } + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + for (unsigned int i = 0, + n = static_cast(this->_internal_file_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(15, this->_internal_file(i), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse) + return target; +} + +size_t CodeGeneratorResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + total_size += 1UL * this->_internal_file_size(); + for (const auto& msg : this->file_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string error = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_error()); + } + + // optional uint64 supported_features = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_supported_features()); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + CodeGeneratorResponse::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse::GetClassData() const { return &_class_data_; } + +void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + file_.MergeFrom(from.file_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_error(from._internal_error()); + } + if (cached_has_bits & 0x00000002u) { + supported_features_ = from.supported_features_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.compiler.CodeGeneratorResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool CodeGeneratorResponse::IsInitialized() const { + return true; +} + +void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + file_.InternalSwap(&other->file_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &error_, lhs_arena, + &other->error_, rhs_arena + ); + swap(supported_features_, other->supported_features_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata CodeGeneratorResponse::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_getter, &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, + file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[3]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace compiler +PROTOBUF_NAMESPACE_CLOSE +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::Version >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::Version >(arena); +} +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(arena); +} +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(arena); +} +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.h similarity index 51% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.h index 6061e3c6b..95a996b9b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.pb.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 3011000 +#if PROTOBUF_VERSION < 3019000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3011004 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019006 < 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. @@ -25,12 +25,12 @@ #include #include #include -#include -#include +#include #include #include #include // IWYU pragma: export #include // IWYU pragma: export +#include #include #include // @@protoc_insertion_point(includes) @@ -52,47 +52,71 @@ PROTOBUF_NAMESPACE_CLOSE struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto { static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[4] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const uint32_t offsets[]; }; -extern PROTOC_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; +PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; PROTOBUF_NAMESPACE_OPEN namespace compiler { class CodeGeneratorRequest; -class CodeGeneratorRequestDefaultTypeInternal; +struct CodeGeneratorRequestDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_; class CodeGeneratorResponse; -class CodeGeneratorResponseDefaultTypeInternal; +struct CodeGeneratorResponseDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; class CodeGeneratorResponse_File; -class CodeGeneratorResponse_FileDefaultTypeInternal; +struct CodeGeneratorResponse_FileDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; class Version; -class VersionDefaultTypeInternal; +struct VersionDefaultTypeInternal; PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; } // namespace compiler PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN namespace compiler { +enum CodeGeneratorResponse_Feature : int { + CodeGeneratorResponse_Feature_FEATURE_NONE = 0, + CodeGeneratorResponse_Feature_FEATURE_PROTO3_OPTIONAL = 1 +}; +PROTOC_EXPORT bool CodeGeneratorResponse_Feature_IsValid(int value); +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MIN = CodeGeneratorResponse_Feature_FEATURE_NONE; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MAX = CodeGeneratorResponse_Feature_FEATURE_PROTO3_OPTIONAL; +constexpr int CodeGeneratorResponse_Feature_Feature_ARRAYSIZE = CodeGeneratorResponse_Feature_Feature_MAX + 1; + +PROTOC_EXPORT const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* CodeGeneratorResponse_Feature_descriptor(); +template +inline const std::string& CodeGeneratorResponse_Feature_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function CodeGeneratorResponse_Feature_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + CodeGeneratorResponse_Feature_descriptor(), enum_t_value); +} +inline bool CodeGeneratorResponse_Feature_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, CodeGeneratorResponse_Feature* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + CodeGeneratorResponse_Feature_descriptor(), name, value); +} // =================================================================== -class PROTOC_EXPORT Version : +class PROTOC_EXPORT Version final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ { public: - Version(); - virtual ~Version(); + inline Version() : Version(nullptr) {} + ~Version() override; + explicit constexpr Version(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Version(const Version& from); Version(Version&& from) noexcept @@ -105,8 +129,13 @@ class PROTOC_EXPORT Version : return *this; } inline Version& operator=(Version&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -114,24 +143,24 @@ class PROTOC_EXPORT Version : } inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); } inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const Version& default_instance() { + return *internal_default_instance(); } - static const Version& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const Version* internal_default_instance() { return reinterpret_cast( &_Version_default_instance_); @@ -144,57 +173,67 @@ class PROTOC_EXPORT Version : } inline void Swap(Version* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Version* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline Version* New() const final { - return CreateMaybeMessage(nullptr); - } - - Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const Version& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Version& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Version* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.Version"; } + protected: + explicit Version(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); - return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -213,16 +252,14 @@ class PROTOC_EXPORT Version : public: void clear_suffix(); const std::string& suffix() const; - void set_suffix(const std::string& value); - void set_suffix(std::string&& value); - void set_suffix(const char* value); - void set_suffix(const char* value, size_t size); + template + void set_suffix(ArgT0&& arg0, ArgT... args); std::string* mutable_suffix(); - std::string* release_suffix(); + PROTOBUF_NODISCARD std::string* release_suffix(); void set_allocated_suffix(std::string* suffix); private: const std::string& _internal_suffix() const; - void _internal_set_suffix(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const std::string& value); std::string* _internal_mutable_suffix(); public: @@ -232,11 +269,11 @@ class PROTOC_EXPORT Version : bool _internal_has_major() const; public: void clear_major(); - ::PROTOBUF_NAMESPACE_ID::int32 major() const; - void set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t major() const; + void set_major(int32_t value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const; - void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t _internal_major() const; + void _internal_set_major(int32_t value); public: // optional int32 minor = 2; @@ -245,11 +282,11 @@ class PROTOC_EXPORT Version : bool _internal_has_minor() const; public: void clear_minor(); - ::PROTOBUF_NAMESPACE_ID::int32 minor() const; - void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t minor() const; + void set_minor(int32_t value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const; - void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t _internal_minor() const; + void _internal_set_minor(int32_t value); public: // optional int32 patch = 3; @@ -258,33 +295,36 @@ class PROTOC_EXPORT Version : bool _internal_has_patch() const; public: void clear_patch(); - ::PROTOBUF_NAMESPACE_ID::int32 patch() const; - void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t patch() const; + void set_patch(int32_t value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const; - void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + int32_t _internal_patch() const; + void _internal_set_patch(int32_t value); public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_; - ::PROTOBUF_NAMESPACE_ID::int32 major_; - ::PROTOBUF_NAMESPACE_ID::int32 minor_; - ::PROTOBUF_NAMESPACE_ID::int32 patch_; + int32_t major_; + int32_t minor_; + int32_t patch_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorRequest : +class PROTOC_EXPORT CodeGeneratorRequest final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ { public: - CodeGeneratorRequest(); - virtual ~CodeGeneratorRequest(); + inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {} + ~CodeGeneratorRequest() override; + explicit constexpr CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); CodeGeneratorRequest(const CodeGeneratorRequest& from); CodeGeneratorRequest(CodeGeneratorRequest&& from) noexcept @@ -297,8 +337,13 @@ class PROTOC_EXPORT CodeGeneratorRequest : return *this; } inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -306,24 +351,24 @@ class PROTOC_EXPORT CodeGeneratorRequest : } inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); } inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const CodeGeneratorRequest& default_instance() { + return *internal_default_instance(); } - static const CodeGeneratorRequest& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorRequest* internal_default_instance() { return reinterpret_cast( &_CodeGeneratorRequest_default_instance_); @@ -336,57 +381,67 @@ class PROTOC_EXPORT CodeGeneratorRequest : } inline void Swap(CodeGeneratorRequest* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CodeGeneratorRequest* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline CodeGeneratorRequest* New() const final { - return CreateMaybeMessage(nullptr); - } - - CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const CodeGeneratorRequest& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorRequest& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorRequest* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorRequest"; } + protected: + explicit CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); - return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -428,16 +483,16 @@ class PROTOC_EXPORT CodeGeneratorRequest : int _internal_proto_file_size() const; public: void clear_proto_file(); - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_proto_file(); private: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); public: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& proto_file() const; // optional string parameter = 2; @@ -447,16 +502,14 @@ class PROTOC_EXPORT CodeGeneratorRequest : public: void clear_parameter(); const std::string& parameter() const; - void set_parameter(const std::string& value); - void set_parameter(std::string&& value); - void set_parameter(const char* value); - void set_parameter(const char* value, size_t size); + template + void set_parameter(ArgT0&& arg0, ArgT... args); std::string* mutable_parameter(); - std::string* release_parameter(); + PROTOBUF_NODISCARD std::string* release_parameter(); void set_allocated_parameter(std::string* parameter); private: const std::string& _internal_parameter() const; - void _internal_set_parameter(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const std::string& value); std::string* _internal_mutable_parameter(); public: @@ -466,35 +519,41 @@ class PROTOC_EXPORT CodeGeneratorRequest : bool _internal_has_compiler_version() const; public: void clear_compiler_version(); - const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; - PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); - PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); - void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); + void set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); private: - const PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; - PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); public: + void unsafe_arena_set_allocated_compiler_version( + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField file_to_generate_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr parameter_; - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorResponse_File : +class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ { public: - CodeGeneratorResponse_File(); - virtual ~CodeGeneratorResponse_File(); + inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {} + ~CodeGeneratorResponse_File() override; + explicit constexpr CodeGeneratorResponse_File(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from); CodeGeneratorResponse_File(CodeGeneratorResponse_File&& from) noexcept @@ -507,8 +566,13 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : return *this; } inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -516,24 +580,24 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : } inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); } inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const CodeGeneratorResponse_File& default_instance() { + return *internal_default_instance(); } - static const CodeGeneratorResponse_File& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorResponse_File* internal_default_instance() { return reinterpret_cast( &_CodeGeneratorResponse_File_default_instance_); @@ -546,57 +610,67 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : } inline void Swap(CodeGeneratorResponse_File* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CodeGeneratorResponse_File* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline CodeGeneratorResponse_File* New() const final { - return CreateMaybeMessage(nullptr); - } - - CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const CodeGeneratorResponse_File& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse_File& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorResponse_File* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse.File"; } + protected: + explicit CodeGeneratorResponse_File(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); - return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- @@ -606,6 +680,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : kNameFieldNumber = 1, kInsertionPointFieldNumber = 2, kContentFieldNumber = 15, + kGeneratedCodeInfoFieldNumber = 16, }; // optional string name = 1; bool has_name() const; @@ -614,16 +689,14 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : public: void clear_name(); const std::string& name() const; - void set_name(const std::string& value); - void set_name(std::string&& value); - void set_name(const char* value); - void set_name(const char* value, size_t size); + template + void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); - std::string* release_name(); + PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; - void _internal_set_name(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: @@ -634,16 +707,14 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : public: void clear_insertion_point(); const std::string& insertion_point() const; - void set_insertion_point(const std::string& value); - void set_insertion_point(std::string&& value); - void set_insertion_point(const char* value); - void set_insertion_point(const char* value, size_t size); + template + void set_insertion_point(ArgT0&& arg0, ArgT... args); std::string* mutable_insertion_point(); - std::string* release_insertion_point(); + PROTOBUF_NODISCARD std::string* release_insertion_point(); void set_allocated_insertion_point(std::string* insertion_point); private: const std::string& _internal_insertion_point() const; - void _internal_set_insertion_point(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const std::string& value); std::string* _internal_mutable_insertion_point(); public: @@ -654,38 +725,58 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : public: void clear_content(); const std::string& content() const; - void set_content(const std::string& value); - void set_content(std::string&& value); - void set_content(const char* value); - void set_content(const char* value, size_t size); + template + void set_content(ArgT0&& arg0, ArgT... args); std::string* mutable_content(); - std::string* release_content(); + PROTOBUF_NODISCARD std::string* release_content(); void set_allocated_content(std::string* content); private: const std::string& _internal_content() const; - void _internal_set_content(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_content(const std::string& value); std::string* _internal_mutable_content(); public: + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + bool has_generated_code_info() const; + private: + bool _internal_has_generated_code_info() const; + public: + void clear_generated_code_info(); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); + void set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + private: + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); + public: + void unsafe_arena_set_allocated_generated_code_info( + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); + // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr insertion_point_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr content_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorResponse : +class PROTOC_EXPORT CodeGeneratorResponse final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ { public: - CodeGeneratorResponse(); - virtual ~CodeGeneratorResponse(); + inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {} + ~CodeGeneratorResponse() override; + explicit constexpr CodeGeneratorResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); CodeGeneratorResponse(const CodeGeneratorResponse& from); CodeGeneratorResponse(CodeGeneratorResponse&& from) noexcept @@ -698,8 +789,13 @@ class PROTOC_EXPORT CodeGeneratorResponse : return *this; } inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); } else { CopyFrom(from); } @@ -707,24 +803,24 @@ class PROTOC_EXPORT CodeGeneratorResponse : } inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields(); + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); } inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return GetMetadataStatic().descriptor; + return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return GetMetadataStatic().reflection; + return default_instance().GetMetadata().reflection; + } + static const CodeGeneratorResponse& default_instance() { + return *internal_default_instance(); } - static const CodeGeneratorResponse& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const CodeGeneratorResponse* internal_default_instance() { return reinterpret_cast( &_CodeGeneratorResponse_default_instance_); @@ -737,67 +833,108 @@ class PROTOC_EXPORT CodeGeneratorResponse : } inline void Swap(CodeGeneratorResponse* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CodeGeneratorResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- - inline CodeGeneratorResponse* New() const final { - return CreateMaybeMessage(nullptr); - } - - CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; - void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const CodeGeneratorResponse& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - inline void SharedCtor(); - inline void SharedDtor(); + void SharedCtor(); + void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorResponse* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse"; } + protected: + explicit CodeGeneratorResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); private: - inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - private: - static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { - ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); - return ::descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto.file_level_metadata[kIndexInFileMessages]; - } + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - public: + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- typedef CodeGeneratorResponse_File File; + typedef CodeGeneratorResponse_Feature Feature; + static constexpr Feature FEATURE_NONE = + CodeGeneratorResponse_Feature_FEATURE_NONE; + static constexpr Feature FEATURE_PROTO3_OPTIONAL = + CodeGeneratorResponse_Feature_FEATURE_PROTO3_OPTIONAL; + static inline bool Feature_IsValid(int value) { + return CodeGeneratorResponse_Feature_IsValid(value); + } + static constexpr Feature Feature_MIN = + CodeGeneratorResponse_Feature_Feature_MIN; + static constexpr Feature Feature_MAX = + CodeGeneratorResponse_Feature_Feature_MAX; + static constexpr int Feature_ARRAYSIZE = + CodeGeneratorResponse_Feature_Feature_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Feature_descriptor() { + return CodeGeneratorResponse_Feature_descriptor(); + } + template + static inline const std::string& Feature_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Feature_Name."); + return CodeGeneratorResponse_Feature_Name(enum_t_value); + } + static inline bool Feature_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Feature* value) { + return CodeGeneratorResponse_Feature_Parse(name, value); + } + // accessors ------------------------------------------------------- enum : int { kFileFieldNumber = 15, kErrorFieldNumber = 1, + kSupportedFeaturesFieldNumber = 2, }; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; int file_size() const; @@ -805,16 +942,16 @@ class PROTOC_EXPORT CodeGeneratorResponse : int _internal_file_size() const; public: void clear_file(); - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* mutable_file(); private: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); public: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& file() const; // optional string error = 1; @@ -824,28 +961,42 @@ class PROTOC_EXPORT CodeGeneratorResponse : public: void clear_error(); const std::string& error() const; - void set_error(const std::string& value); - void set_error(std::string&& value); - void set_error(const char* value); - void set_error(const char* value, size_t size); + template + void set_error(ArgT0&& arg0, ArgT... args); std::string* mutable_error(); - std::string* release_error(); + PROTOBUF_NODISCARD std::string* release_error(); void set_allocated_error(std::string* error); private: const std::string& _internal_error() const; - void _internal_set_error(const std::string& value); + inline PROTOBUF_ALWAYS_INLINE void _internal_set_error(const std::string& value); std::string* _internal_mutable_error(); public: + // optional uint64 supported_features = 2; + bool has_supported_features() const; + private: + bool _internal_has_supported_features() const; + public: + void clear_supported_features(); + uint64_t supported_features() const; + void set_supported_features(uint64_t value); + private: + uint64_t _internal_supported_features() const; + void _internal_set_supported_features(uint64_t value); + public: + // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse) private: class _Internal; - ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_; + uint64_t supported_features_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // =================================================================== @@ -871,18 +1022,18 @@ inline void Version::clear_major() { major_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const { +inline int32_t Version::_internal_major() const { return major_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const { +inline int32_t Version::major() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major) return _internal_major(); } -inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_major(int32_t value) { _has_bits_[0] |= 0x00000002u; major_ = value; } -inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_major(int32_t value) { _internal_set_major(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major) } @@ -899,18 +1050,18 @@ inline void Version::clear_minor() { minor_ = 0; _has_bits_[0] &= ~0x00000004u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const { +inline int32_t Version::_internal_minor() const { return minor_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const { +inline int32_t Version::minor() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor) return _internal_minor(); } -inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_minor(int32_t value) { _has_bits_[0] |= 0x00000004u; minor_ = value; } -inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_minor(int32_t value) { _internal_set_minor(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor) } @@ -927,18 +1078,18 @@ inline void Version::clear_patch() { patch_ = 0; _has_bits_[0] &= ~0x00000008u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const { +inline int32_t Version::_internal_patch() const { return patch_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const { +inline int32_t Version::patch() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch) return _internal_patch(); } -inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_patch(int32_t value) { _has_bits_[0] |= 0x00000008u; patch_ = value; } -inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_patch(int32_t value) { _internal_set_patch(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch) } @@ -952,49 +1103,35 @@ inline bool Version::has_suffix() const { return _internal_has_suffix(); } inline void Version::clear_suffix() { - suffix_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + suffix_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } inline const std::string& Version::suffix() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix) return _internal_suffix(); } -inline void Version::set_suffix(const std::string& value) { - _internal_set_suffix(value); +template +inline PROTOBUF_ALWAYS_INLINE +void Version::set_suffix(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix) } inline std::string* Version::mutable_suffix() { + std::string* _s = _internal_mutable_suffix(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix) - return _internal_mutable_suffix(); + return _s; } inline const std::string& Version::_internal_suffix() const { - return suffix_.GetNoArena(); + return suffix_.Get(); } inline void Version::_internal_set_suffix(const std::string& value) { _has_bits_[0] |= 0x00000001u; - suffix_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void Version::set_suffix(std::string&& value) { - _has_bits_[0] |= 0x00000001u; - suffix_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.Version.suffix) -} -inline void Version::set_suffix(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000001u; - suffix_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.Version.suffix) -} -inline void Version::set_suffix(const char* value, size_t size) { - _has_bits_[0] |= 0x00000001u; - suffix_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.Version.suffix) + suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* Version::_internal_mutable_suffix() { _has_bits_[0] |= 0x00000001u; - return suffix_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return suffix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* Version::release_suffix() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix) @@ -1002,7 +1139,13 @@ inline std::string* Version::release_suffix() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return suffix_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void Version::set_allocated_suffix(std::string* suffix) { if (suffix != nullptr) { @@ -1010,7 +1153,13 @@ inline void Version::set_allocated_suffix(std::string* suffix) { } else { _has_bits_[0] &= ~0x00000001u; } - suffix_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix); + suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix) } @@ -1029,8 +1178,9 @@ inline void CodeGeneratorRequest::clear_file_to_generate() { file_to_generate_.Clear(); } inline std::string* CodeGeneratorRequest::add_file_to_generate() { + std::string* _s = _internal_add_file_to_generate(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) - return _internal_add_file_to_generate(); + return _s; } inline const std::string& CodeGeneratorRequest::_internal_file_to_generate(int index) const { return file_to_generate_.Get(index); @@ -1044,12 +1194,12 @@ inline std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) { return file_to_generate_.Mutable(index); } inline void CodeGeneratorRequest::set_file_to_generate(int index, const std::string& value) { - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) file_to_generate_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline void CodeGeneratorRequest::set_file_to_generate(int index, std::string&& value) { - // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) file_to_generate_.Mutable(index)->assign(std::move(value)); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); @@ -1101,49 +1251,35 @@ inline bool CodeGeneratorRequest::has_parameter() const { return _internal_has_parameter(); } inline void CodeGeneratorRequest::clear_parameter() { - parameter_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + parameter_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } inline const std::string& CodeGeneratorRequest::parameter() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter) return _internal_parameter(); } -inline void CodeGeneratorRequest::set_parameter(const std::string& value) { - _internal_set_parameter(value); +template +inline PROTOBUF_ALWAYS_INLINE +void CodeGeneratorRequest::set_parameter(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter) } inline std::string* CodeGeneratorRequest::mutable_parameter() { + std::string* _s = _internal_mutable_parameter(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter) - return _internal_mutable_parameter(); + return _s; } inline const std::string& CodeGeneratorRequest::_internal_parameter() const { - return parameter_.GetNoArena(); + return parameter_.Get(); } inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) { _has_bits_[0] |= 0x00000001u; - parameter_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void CodeGeneratorRequest::set_parameter(std::string&& value) { - _has_bits_[0] |= 0x00000001u; - parameter_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -inline void CodeGeneratorRequest::set_parameter(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000001u; - parameter_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorRequest.parameter) -} -inline void CodeGeneratorRequest::set_parameter(const char* value, size_t size) { - _has_bits_[0] |= 0x00000001u; - parameter_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter) + parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() { _has_bits_[0] |= 0x00000001u; - return parameter_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* CodeGeneratorRequest::release_parameter() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter) @@ -1151,7 +1287,13 @@ inline std::string* CodeGeneratorRequest::release_parameter() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return parameter_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) { if (parameter != nullptr) { @@ -1159,7 +1301,13 @@ inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter } else { _has_bits_[0] &= ~0x00000001u; } - parameter_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter); + parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter) } @@ -1170,30 +1318,31 @@ inline int CodeGeneratorRequest::_internal_proto_file_size() const { inline int CodeGeneratorRequest::proto_file_size() const { return _internal_proto_file_size(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* CodeGeneratorRequest::mutable_proto_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return &proto_file_; } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { return proto_file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _internal_proto_file(index); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { return proto_file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) - return _internal_add_proto_file(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& CodeGeneratorRequest::proto_file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_; @@ -1212,41 +1361,71 @@ inline void CodeGeneratorRequest::clear_compiler_version() { if (compiler_version_ != nullptr) compiler_version_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { - const PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; - return p != nullptr ? *p : *reinterpret_cast( - &PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { + const ::PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _internal_compiler_version(); } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { +inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(compiler_version_); + } + compiler_version_ = compiler_version; + if (compiler_version) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) +} +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { + _has_bits_[0] &= ~0x00000002u; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + compiler_version_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; compiler_version_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { _has_bits_[0] |= 0x00000002u; if (compiler_version_ == nullptr) { - auto* p = CreateMaybeMessage(GetArenaNoVirtual()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); compiler_version_ = p; } return compiler_version_; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) - return _internal_mutable_compiler_version(); + return _msg; } -inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); +inline void CodeGeneratorRequest::set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete compiler_version_; } if (compiler_version) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr; + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version); if (message_arena != submessage_arena) { compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, compiler_version, submessage_arena); @@ -1272,49 +1451,35 @@ inline bool CodeGeneratorResponse_File::has_name() const { return _internal_has_name(); } inline void CodeGeneratorResponse_File::clear_name() { - name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } inline const std::string& CodeGeneratorResponse_File::name() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name) return _internal_name(); } -inline void CodeGeneratorResponse_File::set_name(const std::string& value) { - _internal_set_name(value); +template +inline PROTOBUF_ALWAYS_INLINE +void CodeGeneratorResponse_File::set_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name) } inline std::string* CodeGeneratorResponse_File::mutable_name() { + std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name) - return _internal_mutable_name(); + return _s; } inline const std::string& CodeGeneratorResponse_File::_internal_name() const { - return name_.GetNoArena(); + return name_.Get(); } inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) { _has_bits_[0] |= 0x00000001u; - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void CodeGeneratorResponse_File::set_name(std::string&& value) { - _has_bits_[0] |= 0x00000001u; - name_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -inline void CodeGeneratorResponse_File::set_name(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000001u; - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.name) -} -inline void CodeGeneratorResponse_File::set_name(const char* value, size_t size) { - _has_bits_[0] |= 0x00000001u; - name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name) + name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; - return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name) @@ -1322,7 +1487,13 @@ inline std::string* CodeGeneratorResponse_File::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) { if (name != nullptr) { @@ -1330,7 +1501,13 @@ inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) { } else { _has_bits_[0] &= ~0x00000001u; } - name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name); + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name) } @@ -1343,49 +1520,35 @@ inline bool CodeGeneratorResponse_File::has_insertion_point() const { return _internal_has_insertion_point(); } inline void CodeGeneratorResponse_File::clear_insertion_point() { - insertion_point_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + insertion_point_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } inline const std::string& CodeGeneratorResponse_File::insertion_point() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) return _internal_insertion_point(); } -inline void CodeGeneratorResponse_File::set_insertion_point(const std::string& value) { - _internal_set_insertion_point(value); +template +inline PROTOBUF_ALWAYS_INLINE +void CodeGeneratorResponse_File::set_insertion_point(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() { + std::string* _s = _internal_mutable_insertion_point(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) - return _internal_mutable_insertion_point(); + return _s; } inline const std::string& CodeGeneratorResponse_File::_internal_insertion_point() const { - return insertion_point_.GetNoArena(); + return insertion_point_.Get(); } inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) { _has_bits_[0] |= 0x00000002u; - insertion_point_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void CodeGeneratorResponse_File::set_insertion_point(std::string&& value) { - _has_bits_[0] |= 0x00000002u; - insertion_point_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -inline void CodeGeneratorResponse_File::set_insertion_point(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000002u; - insertion_point_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) -} -inline void CodeGeneratorResponse_File::set_insertion_point(const char* value, size_t size) { - _has_bits_[0] |= 0x00000002u; - insertion_point_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) + insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() { _has_bits_[0] |= 0x00000002u; - return insertion_point_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::release_insertion_point() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) @@ -1393,7 +1556,13 @@ inline std::string* CodeGeneratorResponse_File::release_insertion_point() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return insertion_point_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* insertion_point) { if (insertion_point != nullptr) { @@ -1401,7 +1570,13 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::strin } else { _has_bits_[0] &= ~0x00000002u; } - insertion_point_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point); + insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } @@ -1414,49 +1589,35 @@ inline bool CodeGeneratorResponse_File::has_content() const { return _internal_has_content(); } inline void CodeGeneratorResponse_File::clear_content() { - content_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + content_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } inline const std::string& CodeGeneratorResponse_File::content() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content) return _internal_content(); } -inline void CodeGeneratorResponse_File::set_content(const std::string& value) { - _internal_set_content(value); +template +inline PROTOBUF_ALWAYS_INLINE +void CodeGeneratorResponse_File::set_content(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000004u; + content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content) } inline std::string* CodeGeneratorResponse_File::mutable_content() { + std::string* _s = _internal_mutable_content(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content) - return _internal_mutable_content(); + return _s; } inline const std::string& CodeGeneratorResponse_File::_internal_content() const { - return content_.GetNoArena(); + return content_.Get(); } inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) { _has_bits_[0] |= 0x00000004u; - content_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void CodeGeneratorResponse_File::set_content(std::string&& value) { - _has_bits_[0] |= 0x00000004u; - content_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -inline void CodeGeneratorResponse_File::set_content(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000004u; - content_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.File.content) -} -inline void CodeGeneratorResponse_File::set_content(const char* value, size_t size) { - _has_bits_[0] |= 0x00000004u; - content_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content) + content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() { _has_bits_[0] |= 0x00000004u; - return content_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse_File::release_content() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content) @@ -1464,7 +1625,13 @@ inline std::string* CodeGeneratorResponse_File::release_content() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return content_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) { if (content != nullptr) { @@ -1472,10 +1639,104 @@ inline void CodeGeneratorResponse_File::set_allocated_content(std::string* conte } else { _has_bits_[0] &= ~0x00000004u; } - content_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content); + content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content) } +// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; +inline bool CodeGeneratorResponse_File::_internal_has_generated_code_info() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || generated_code_info_ != nullptr); + return value; +} +inline bool CodeGeneratorResponse_File::has_generated_code_info() const { + return _internal_has_generated_code_info(); +} +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) + return _internal_generated_code_info(); +} +inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info( + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); + } + generated_code_info_ = generated_code_info; + if (generated_code_info) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) +} +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { + _has_bits_[0] &= ~0x00000008u; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + generated_code_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { + // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) + _has_bits_[0] &= ~0x00000008u; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + generated_code_info_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { + _has_bits_[0] |= 0x00000008u; + if (generated_code_info_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); + generated_code_info_ = p; + } + return generated_code_info_; +} +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); + // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) + return _msg; +} +inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); + } + if (generated_code_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper< + ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info)); + if (message_arena != submessage_arena) { + generated_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, generated_code_info, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + generated_code_info_ = generated_code_info; + // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) +} + // ------------------------------------------------------------------- // CodeGeneratorResponse @@ -1489,49 +1750,35 @@ inline bool CodeGeneratorResponse::has_error() const { return _internal_has_error(); } inline void CodeGeneratorResponse::clear_error() { - error_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + error_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } inline const std::string& CodeGeneratorResponse::error() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error) return _internal_error(); } -inline void CodeGeneratorResponse::set_error(const std::string& value) { - _internal_set_error(value); +template +inline PROTOBUF_ALWAYS_INLINE +void CodeGeneratorResponse::set_error(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error) } inline std::string* CodeGeneratorResponse::mutable_error() { + std::string* _s = _internal_mutable_error(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error) - return _internal_mutable_error(); + return _s; } inline const std::string& CodeGeneratorResponse::_internal_error() const { - return error_.GetNoArena(); + return error_.Get(); } inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) { _has_bits_[0] |= 0x00000001u; - error_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value); -} -inline void CodeGeneratorResponse::set_error(std::string&& value) { - _has_bits_[0] |= 0x00000001u; - error_.SetNoArena( - &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:google.protobuf.compiler.CodeGeneratorResponse.error) -} -inline void CodeGeneratorResponse::set_error(const char* value) { - GOOGLE_DCHECK(value != nullptr); - _has_bits_[0] |= 0x00000001u; - error_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:google.protobuf.compiler.CodeGeneratorResponse.error) -} -inline void CodeGeneratorResponse::set_error(const char* value, size_t size) { - _has_bits_[0] |= 0x00000001u; - error_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error) + error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse::_internal_mutable_error() { _has_bits_[0] |= 0x00000001u; - return error_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } inline std::string* CodeGeneratorResponse::release_error() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error) @@ -1539,7 +1786,13 @@ inline std::string* CodeGeneratorResponse::release_error() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return error_.ReleaseNonDefaultNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + auto* p = error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse::set_allocated_error(std::string* error) { if (error != nullptr) { @@ -1547,10 +1800,44 @@ inline void CodeGeneratorResponse::set_allocated_error(std::string* error) { } else { _has_bits_[0] &= ~0x00000001u; } - error_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error); + error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error) } +// optional uint64 supported_features = 2; +inline bool CodeGeneratorResponse::_internal_has_supported_features() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool CodeGeneratorResponse::has_supported_features() const { + return _internal_has_supported_features(); +} +inline void CodeGeneratorResponse::clear_supported_features() { + supported_features_ = uint64_t{0u}; + _has_bits_[0] &= ~0x00000002u; +} +inline uint64_t CodeGeneratorResponse::_internal_supported_features() const { + return supported_features_; +} +inline uint64_t CodeGeneratorResponse::supported_features() const { + // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.supported_features) + return _internal_supported_features(); +} +inline void CodeGeneratorResponse::_internal_set_supported_features(uint64_t value) { + _has_bits_[0] |= 0x00000002u; + supported_features_ = value; +} +inline void CodeGeneratorResponse::set_supported_features(uint64_t value) { + _internal_set_supported_features(value); + // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features) +} + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; inline int CodeGeneratorResponse::_internal_file_size() const { return file_.size(); @@ -1561,30 +1848,31 @@ inline int CodeGeneratorResponse::file_size() const { inline void CodeGeneratorResponse::clear_file() { file_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* CodeGeneratorResponse::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) return &file_; } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { return file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) return _internal_file(index); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { return file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) - return _internal_add_file(); + return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& CodeGeneratorResponse::file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) return file_; @@ -1605,6 +1893,16 @@ CodeGeneratorResponse::file() const { } // namespace compiler PROTOBUF_NAMESPACE_CLOSE +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { + return ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + // @@protoc_insertion_point(global_scope) #include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.proto similarity index 92% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.proto index 665e5a725..9242aacc5 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/plugin.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/plugin.proto @@ -50,7 +50,7 @@ package google.protobuf.compiler; option java_package = "com.google.protobuf.compiler"; option java_outer_classname = "PluginProtos"; -option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; +option go_package = "google.golang.org/protobuf/types/pluginpb"; import "google/protobuf/descriptor.proto"; @@ -107,6 +107,16 @@ message CodeGeneratorResponse { // exiting with a non-zero status code. optional string error = 1; + // A bitmask of supported features that the code generator supports. + // This is a bitwise "or" of values from the Feature enum. + optional uint64 supported_features = 2; + + // Sync with code_generator.h. + enum Feature { + FEATURE_NONE = 0; + FEATURE_PROTO3_OPTIONAL = 1; + } + // Represents a single generated file. message File { // The file name, relative to the output directory. The name must not @@ -163,6 +173,11 @@ message CodeGeneratorResponse { // The file contents. optional string content = 15; + + // Information describing the file content being inserted. If an insertion + // point is used, this information will be appropriately offset and inserted + // into the code generation metadata for the generated files. + optional GeneratedCodeInfo generated_code_info = 16; } repeated File file = 15; } diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.cc similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.cc index b20f3fb27..9ad7a33b2 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.cc @@ -69,18 +69,6 @@ namespace python { namespace { -bool StrEndsWith(StringPiece sp, StringPiece x) { - return sp.size() >= x.size() && sp.substr(sp.size() - x.size()) == x; -} - -// Returns a copy of |filename| with any trailing ".protodevel" or ".proto -// suffix stripped. -// TODO(robinson): Unify with copy in compiler/cpp/internal/helpers.cc. -std::string StripProto(const std::string& filename) { - const char* suffix = - StrEndsWith(filename, ".protodevel") ? ".protodevel" : ".proto"; - return StripSuffixString(filename, suffix); -} // Returns the Python module name expected for a given .proto filename. std::string ModuleName(const std::string& filename) { @@ -106,11 +94,12 @@ std::string ModuleAlias(const std::string& filename) { // Keywords reserved by the Python language. const char* const kKeywords[] = { - "False", "None", "True", "and", "as", "assert", "break", - "class", "continue", "def", "del", "elif", "else", "except", - "finally", "for", "from", "global", "if", "import", "in", - "is", "lambda", "nonlocal", "not", "or", "pass", "raise", - "return", "try", "while", "with", "yield", "print", + "False", "None", "True", "and", "as", "assert", + "async", "await", "break", "class", "continue", "def", + "del", "elif", "else", "except", "finally", "for", + "from", "global", "if", "import", "in", "is", + "lambda", "nonlocal", "not", "or", "pass", "raise", + "return", "try", "while", "with", "yield", "print", }; const char* const* kKeywordsEnd = kKeywords + (sizeof(kKeywords) / sizeof(kKeywords[0])); @@ -125,7 +114,7 @@ bool ContainsPythonKeyword(const std::string& module_name) { return false; } -inline bool IsPythonKeyword(const string& name) { +inline bool IsPythonKeyword(const std::string& name) { return (std::find(kKeywords, kKeywordsEnd, name) != kKeywordsEnd); } @@ -183,7 +172,7 @@ void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file, "# -*- coding: utf-8 -*-\n" "# Generated by the protocol buffer compiler. DO NOT EDIT!\n" "# source: $filename$\n" - "\n", + "\"\"\"Generated protocol buffer code.\"\"\"\n", "filename", file->name()); if (HasTopLevelEnums(file)) { printer->Print( @@ -191,6 +180,8 @@ void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file, } printer->Print( "from google.protobuf import descriptor as _descriptor\n" + "from google.protobuf import descriptor_pool as " + "_descriptor_pool\n" "from google.protobuf import message as _message\n" "from google.protobuf import reflection as _reflection\n" "from google.protobuf import symbol_database as " @@ -301,6 +292,10 @@ Generator::Generator() : file_(nullptr) {} Generator::~Generator() {} +uint64_t Generator::GetSupportedFeatures() const { + return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL; +} + bool Generator::Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* context, std::string* error) const { @@ -320,7 +315,6 @@ bool Generator::Generate(const FileDescriptor* file, } } - // Completely serialize all Generate() calls on this instance. The // thread-safety constraints of the CodeGenerator interface aren't clear so // just be as conservative as possible. It's easier to relax this later if @@ -358,12 +352,32 @@ bool Generator::Generate(const FileDescriptor* file, PrintTopLevelEnums(); PrintTopLevelExtensions(); if (pure_python_workable_) { - PrintAllNestedEnumsInFile(); - PrintMessageDescriptors(); - FixForeignFieldsInDescriptors(); + if (GeneratingDescriptorProto()) { + printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // Create enums before message descriptors + PrintAllNestedEnumsInFile(StripPrintDescriptor::kCreate); + PrintMessageDescriptors(StripPrintDescriptor::kCreate); + FixForeignFieldsInDescriptors(); + printer_->Outdent(); + printer_->Print("else:\n"); + printer_->Indent(); + } + // Find the message descriptors first and then use the message + // descriptor to find enums. + PrintMessageDescriptors(StripPrintDescriptor::kFind); + PrintAllNestedEnumsInFile(StripPrintDescriptor::kFind); + if (GeneratingDescriptorProto()) { + printer_->Outdent(); + } } PrintMessages(); if (pure_python_workable_) { + PrintServiceDescriptors(); + + printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // We have to fix up the extensions after the message classes themselves, // since they need to call static RegisterExtension() methods on these // classes. @@ -374,7 +388,11 @@ bool Generator::Generate(const FileDescriptor* file, // custom options that may be unknown when we define the descriptors. // This does not apply to services because they are not used by extensions. FixAllDescriptorOptions(); - PrintServiceDescriptors(); + + // Set serialized_start and serialized_end. + SetSerializedPbInterval(); + + printer_->Outdent(); } if (HasGenericServices(file)) { PrintServices(); @@ -436,45 +454,65 @@ void Generator::PrintFileDescriptor() const { m["package"] = file_->package(); m["syntax"] = StringifySyntax(file_->syntax()); m["options"] = OptionsValue(file_->options().SerializeAsString()); - const char file_descriptor_template[] = - "$descriptor_name$ = _descriptor.FileDescriptor(\n" - " name='$name$',\n" - " package='$package$',\n" - " syntax='$syntax$',\n" - " serialized_options=$options$,\n"; - printer_->Print(m, file_descriptor_template); - printer_->Indent(); - if (pure_python_workable_) { - printer_->Print("serialized_pb=b'$value$'\n", "value", - strings::CHexEscape(file_descriptor_serialized_)); - if (file_->dependency_count() != 0) { - printer_->Print(",\ndependencies=["); - for (int i = 0; i < file_->dependency_count(); ++i) { - std::string module_alias = ModuleAlias(file_->dependency(i)->name()); - printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", - module_alias); + m["serialized_descriptor"] = strings::CHexEscape(file_descriptor_serialized_); + if (GeneratingDescriptorProto()) { + printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // Pure python's AddSerializedFile() depend on the generated + // descriptor_pb2.py thus we can not use AddSerializedFile() when + // generated descriptor.proto for pure python. + const char file_descriptor_template[] = + "$descriptor_name$ = _descriptor.FileDescriptor(\n" + " name='$name$',\n" + " package='$package$',\n" + " syntax='$syntax$',\n" + " serialized_options=$options$,\n" + " create_key=_descriptor._internal_create_key,\n"; + printer_->Print(m, file_descriptor_template); + printer_->Indent(); + if (pure_python_workable_) { + printer_->Print("serialized_pb=b'$value$'\n", "value", + strings::CHexEscape(file_descriptor_serialized_)); + if (file_->dependency_count() != 0) { + printer_->Print(",\ndependencies=["); + for (int i = 0; i < file_->dependency_count(); ++i) { + std::string module_alias = ModuleAlias(file_->dependency(i)->name()); + printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", + module_alias); + } + printer_->Print("]"); } - printer_->Print("]"); - } - if (file_->public_dependency_count() > 0) { - printer_->Print(",\npublic_dependencies=["); - for (int i = 0; i < file_->public_dependency_count(); ++i) { - std::string module_alias = - ModuleAlias(file_->public_dependency(i)->name()); - printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", - module_alias); + if (file_->public_dependency_count() > 0) { + printer_->Print(",\npublic_dependencies=["); + for (int i = 0; i < file_->public_dependency_count(); ++i) { + std::string module_alias = + ModuleAlias(file_->public_dependency(i)->name()); + printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", + module_alias); + } + printer_->Print("]"); } - printer_->Print("]"); + } else { + printer_->Print("serialized_pb=''\n"); } - } else { - printer_->Print("serialized_pb=''\n"); - } - // TODO(falk): Also print options and fix the message_type, enum_type, - // service and extension later in the generation. + // TODO(falk): Also print options and fix the message_type, enum_type, + // service and extension later in the generation. - printer_->Outdent(); - printer_->Print(")\n"); + printer_->Outdent(); + printer_->Print(")\n"); + + printer_->Outdent(); + printer_->Print("else:\n"); + printer_->Indent(); + } + printer_->Print(m, + "$descriptor_name$ = " + "_descriptor_pool.Default().AddSerializedFile(b'$serialized_" + "descriptor$')\n"); + if (GeneratingDescriptorProto()) { + printer_->Outdent(); + } printer_->Print("\n"); } @@ -484,7 +522,7 @@ void Generator::PrintTopLevelEnums() const { std::vector > top_level_enum_values; for (int i = 0; i < file_->enum_type_count(); ++i) { const EnumDescriptor& enum_descriptor = *file_->enum_type(i); - PrintEnum(enum_descriptor); + PrintFindEnum(enum_descriptor); printer_->Print( "$name$ = " "enum_type_wrapper.EnumTypeWrapper($descriptor_name$)", @@ -508,16 +546,17 @@ void Generator::PrintTopLevelEnums() const { } // Prints all enums contained in all message types in |file|. -void Generator::PrintAllNestedEnumsInFile() const { +void Generator::PrintAllNestedEnumsInFile( + StripPrintDescriptor print_mode) const { for (int i = 0; i < file_->message_type_count(); ++i) { - PrintNestedEnums(*file_->message_type(i)); + PrintNestedEnums(*file_->message_type(i), print_mode); } } // Prints a Python statement assigning the appropriate module-level // enum name to a Python EnumDescriptor object equivalent to // enum_descriptor. -void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { +void Generator::PrintCreateEnum(const EnumDescriptor& enum_descriptor) const { std::map m; std::string module_level_descriptor_name = ModuleLevelDescriptorName(enum_descriptor); @@ -531,6 +570,7 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { " full_name='$full_name$',\n" " filename=None,\n" " file=$file$,\n" + " create_key=_descriptor._internal_create_key,\n" " values=[\n"; std::string options_string; enum_descriptor.options().SerializeToString(&options_string); @@ -551,7 +591,6 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { printer_->Print("serialized_options=$options_value$,\n", "options_value", OptionsValue(options_string)); EnumDescriptorProto edp; - PrintSerializedPbInterval(enum_descriptor, edp); printer_->Outdent(); printer_->Print(")\n"); if (pure_python_workable_) { @@ -561,48 +600,74 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { printer_->Print("\n"); } +void Generator::PrintFindEnum(const EnumDescriptor& enum_descriptor) const { + std::map m; + m["descriptor_name"] = ModuleLevelDescriptorName(enum_descriptor); + m["name"] = enum_descriptor.name(); + m["file"] = kDescriptorKey; + if (enum_descriptor.containing_type()) { + m["containing_type"] = + ModuleLevelDescriptorName(*enum_descriptor.containing_type()); + printer_->Print(m, + "$descriptor_name$ = " + "$containing_type$.enum_types_by_name['$name$']\n"); + } else { + printer_->Print( + m, "$descriptor_name$ = $file$.enum_types_by_name['$name$']\n"); + } +} + // Recursively prints enums in nested types within descriptor, then // prints enums contained at the top level in descriptor. -void Generator::PrintNestedEnums(const Descriptor& descriptor) const { +void Generator::PrintNestedEnums(const Descriptor& descriptor, + StripPrintDescriptor print_mode) const { for (int i = 0; i < descriptor.nested_type_count(); ++i) { - PrintNestedEnums(*descriptor.nested_type(i)); + PrintNestedEnums(*descriptor.nested_type(i), print_mode); } for (int i = 0; i < descriptor.enum_type_count(); ++i) { - PrintEnum(*descriptor.enum_type(i)); + if (print_mode == StripPrintDescriptor::kCreate) { + PrintCreateEnum(*descriptor.enum_type(i)); + } else { + PrintFindEnum(*descriptor.enum_type(i)); + } } } void Generator::PrintTopLevelExtensions() const { - const bool is_extension = true; for (int i = 0; i < file_->extension_count(); ++i) { const FieldDescriptor& extension_field = *file_->extension(i); std::string constant_name = extension_field.name() + "_FIELD_NUMBER"; - UpperString(&constant_name); + ToUpper(&constant_name); printer_->Print("$constant_name$ = $number$\n", "constant_name", constant_name, "number", StrCat(extension_field.number())); - printer_->Print("$name$ = ", "name", - ResolveKeyword(extension_field.name())); - PrintFieldDescriptor(extension_field, is_extension); - printer_->Print("\n"); + printer_->Print( + "$resolved_name$ = " + "$file$.extensions_by_name['$name$']\n", + "resolved_name", ResolveKeyword(extension_field.name()), "file", + kDescriptorKey, "name", extension_field.name()); } printer_->Print("\n"); } // Prints Python equivalents of all Descriptors in |file|. -void Generator::PrintMessageDescriptors() const { - for (int i = 0; i < file_->message_type_count(); ++i) { - PrintDescriptor(*file_->message_type(i)); - printer_->Print("\n"); +void Generator::PrintMessageDescriptors(StripPrintDescriptor print_mode) const { + if (print_mode == StripPrintDescriptor::kCreate) { + for (int i = 0; i < file_->message_type_count(); ++i) { + PrintCreateDescriptor(*file_->message_type(i)); + printer_->Print("\n"); + } + } else { + for (int i = 0; i < file_->message_type_count(); ++i) { + PrintFindDescriptor(*file_->message_type(i)); + } } } void Generator::PrintServiceDescriptors() const { for (int i = 0; i < file_->service_count(); ++i) { PrintServiceDescriptor(*file_->service(i)); - AddServiceToFileDescriptor(*file_->service(i)); - printer_->Print("\n"); } } @@ -616,70 +681,19 @@ void Generator::PrintServices() const { void Generator::PrintServiceDescriptor( const ServiceDescriptor& descriptor) const { - printer_->Print("\n"); - std::string service_name = ModuleLevelServiceDescriptorName(descriptor); - std::string options_string; - descriptor.options().SerializeToString(&options_string); - - printer_->Print("$service_name$ = _descriptor.ServiceDescriptor(\n", - "service_name", service_name); - printer_->Indent(); std::map m; + m["service_name"] = ModuleLevelServiceDescriptorName(descriptor); m["name"] = descriptor.name(); - m["full_name"] = descriptor.full_name(); m["file"] = kDescriptorKey; - m["index"] = StrCat(descriptor.index()); - m["options_value"] = OptionsValue(options_string); - const char required_function_arguments[] = - "name='$name$',\n" - "full_name='$full_name$',\n" - "file=$file$,\n" - "index=$index$,\n" - "serialized_options=$options_value$,\n"; - printer_->Print(m, required_function_arguments); - - ServiceDescriptorProto sdp; - PrintSerializedPbInterval(descriptor, sdp); - - printer_->Print("methods=[\n"); - for (int i = 0; i < descriptor.method_count(); ++i) { - const MethodDescriptor* method = descriptor.method(i); - method->options().SerializeToString(&options_string); - - m.clear(); - m["name"] = method->name(); - m["full_name"] = method->full_name(); - m["index"] = StrCat(method->index()); - m["serialized_options"] = CEscape(options_string); - m["input_type"] = ModuleLevelDescriptorName(*(method->input_type())); - m["output_type"] = ModuleLevelDescriptorName(*(method->output_type())); - m["options_value"] = OptionsValue(options_string); - printer_->Print("_descriptor.MethodDescriptor(\n"); - printer_->Indent(); - printer_->Print(m, - "name='$name$',\n" - "full_name='$full_name$',\n" - "index=$index$,\n" - "containing_service=None,\n" - "input_type=$input_type$,\n" - "output_type=$output_type$,\n" - "serialized_options=$options_value$,\n"); - printer_->Outdent(); - printer_->Print("),\n"); - } - - printer_->Outdent(); - printer_->Print("])\n"); - printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name", - service_name); - printer_->Print("\n"); + printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n"); } void Generator::PrintDescriptorKeyAndModuleName( const ServiceDescriptor& descriptor) const { std::string name = ModuleLevelServiceDescriptorName(descriptor); if (!pure_python_workable_) { - name = "'" + descriptor.full_name() + "'"; + name = "_descriptor.ServiceDescriptor(full_name='" + + descriptor.full_name() + "')"; } printer_->Print("$descriptor_key$ = $descriptor_name$,\n", "descriptor_key", kDescriptorKey, "descriptor_name", name); @@ -716,24 +730,27 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const { // to a Python Descriptor object for message_descriptor. // // Mutually recursive with PrintNestedDescriptors(). -void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { - PrintNestedDescriptors(message_descriptor); +void Generator::PrintCreateDescriptor( + const Descriptor& message_descriptor) const { + std::map m; + m["name"] = message_descriptor.name(); + m["full_name"] = message_descriptor.full_name(); + m["file"] = kDescriptorKey; + + PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kCreate); printer_->Print("\n"); printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n", "descriptor_name", ModuleLevelDescriptorName(message_descriptor)); printer_->Indent(); - std::map m; - m["name"] = message_descriptor.name(); - m["full_name"] = message_descriptor.full_name(); - m["file"] = kDescriptorKey; const char required_function_arguments[] = "name='$name$',\n" "full_name='$full_name$',\n" "filename=None,\n" "file=$file$,\n" - "containing_type=None,\n"; + "containing_type=None,\n" + "create_key=_descriptor._internal_create_key,\n"; printer_->Print(m, required_function_arguments); PrintFieldsInDescriptor(message_descriptor); PrintExtensionsInDescriptor(message_descriptor); @@ -782,12 +799,11 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { printer_->Indent(); for (int i = 0; i < message_descriptor.oneof_decl_count(); ++i) { const OneofDescriptor* desc = message_descriptor.oneof_decl(i); - std::map m; + m.clear(); m["name"] = desc->name(); m["full_name"] = desc->full_name(); m["index"] = StrCat(desc->index()); - std::string options_string = - OptionsValue(desc->options().SerializeAsString()); + options_string = OptionsValue(desc->options().SerializeAsString()); if (options_string == "None") { m["serialized_options"] = ""; } else { @@ -796,27 +812,52 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { printer_->Print(m, "_descriptor.OneofDescriptor(\n" " name='$name$', full_name='$full_name$',\n" - " index=$index$, containing_type=None, " + " index=$index$, containing_type=None,\n" + " create_key=_descriptor._internal_create_key,\n" "fields=[]$serialized_options$),\n"); } printer_->Outdent(); printer_->Print("],\n"); - // Serialization of proto - DescriptorProto edp; - PrintSerializedPbInterval(message_descriptor, edp); printer_->Outdent(); printer_->Print(")\n"); } +void Generator::PrintFindDescriptor( + const Descriptor& message_descriptor) const { + std::map m; + m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor); + m["name"] = message_descriptor.name(); + + if (message_descriptor.containing_type()) { + m["containing_type"] = + ModuleLevelDescriptorName(*message_descriptor.containing_type()); + printer_->Print(m, + "$descriptor_name$ = " + "$containing_type$.nested_types_by_name['$name$']\n"); + } else { + m["file"] = kDescriptorKey; + printer_->Print( + m, "$descriptor_name$ = $file$.message_types_by_name['$name$']\n"); + } + + PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kFind); +} + // Prints Python Descriptor objects for all nested types contained in // message_descriptor. // // Mutually recursive with PrintDescriptor(). -void Generator::PrintNestedDescriptors( - const Descriptor& containing_descriptor) const { - for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { - PrintDescriptor(*containing_descriptor.nested_type(i)); +void Generator::PrintNestedDescriptors(const Descriptor& containing_descriptor, + StripPrintDescriptor print_mode) const { + if (print_mode == StripPrintDescriptor::kCreate) { + for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { + PrintCreateDescriptor(*containing_descriptor.nested_type(i)); + } + } else { + for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { + PrintFindDescriptor(*containing_descriptor.nested_type(i)); + } } } @@ -874,7 +915,8 @@ void Generator::PrintMessage(const Descriptor& message_descriptor, if (pure_python_workable_) { m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor); } else { - m["descriptor_name"] = "'" + message_descriptor.full_name() + "'"; + m["descriptor_name"] = "_descriptor.Descriptor(full_name='" + + message_descriptor.full_name() + "')"; } printer_->Print(m, "'$descriptor_key$' : $descriptor_name$,\n"); std::string module_name = ModuleName(file_->name()); @@ -1037,8 +1079,8 @@ std::string Generator::FieldReferencingExpression( return ResolveKeyword(field.name()); } return strings::Substitute("$0.$1['$2']", - ModuleLevelDescriptorName(*containing_type), - python_dict_name, field.name()); + ModuleLevelDescriptorName(*containing_type), + python_dict_name, field.name()); } // Prints containing_type for nested descriptors or enum descriptors. @@ -1056,7 +1098,7 @@ void Generator::FixContainingTypeInDescriptor( } // Prints statements setting the message_type and enum_type fields in the -// Python descriptor objects we've already output in ths file. We must +// Python descriptor objects we've already output in the file. We must // do this in a separate step due to circular references (otherwise, we'd // just set everything in the initial assignment statements). void Generator::FixForeignFieldsInDescriptors() const { @@ -1098,10 +1140,6 @@ void Generator::FixForeignFieldsInExtensions() const { void Generator::FixForeignFieldsInExtension( const FieldDescriptor& extension_field) const { GOOGLE_CHECK(extension_field.is_extension()); - // extension_scope() will be NULL for top-level extensions, which is - // exactly what FixForeignFieldsInField() wants. - FixForeignFieldsInField(extension_field.extension_scope(), extension_field, - "extensions_by_name"); std::map m; // Confusingly, for FieldDescriptors that happen to be extensions, @@ -1144,7 +1182,8 @@ void Generator::PrintEnumValueDescriptor( "_descriptor.EnumValueDescriptor(\n" " name='$name$', index=$index$, number=$number$,\n" " serialized_options=$options$,\n" - " type=None)"); + " type=None,\n" + " create_key=_descriptor._internal_create_key)"); } // Returns a CEscaped string of serialized_options. @@ -1187,7 +1226,8 @@ void Generator::PrintFieldDescriptor(const FieldDescriptor& field, "default_value=$default_value$,\n" " message_type=None, enum_type=None, containing_type=None,\n" " is_extension=$is_extension$, extension_scope=None,\n" - " serialized_options=$serialized_options$$json_name$, file=DESCRIPTOR)"; + " serialized_options=$serialized_options$$json_name$, file=DESCRIPTOR," + " create_key=_descriptor._internal_create_key)"; printer_->Print(m, field_descriptor_decl); } @@ -1250,7 +1290,7 @@ std::string Generator::ModuleLevelDescriptorName( // The C++ implementation doesn't guard against this either. Leaving // it for now... std::string name = NamePrefixedWithNestedTypes(descriptor, "_"); - UpperString(&name); + ToUpper(&name); // Module-private for now. Easy to make public later; almost impossible // to make private later. name = "_" + name; @@ -1280,7 +1320,7 @@ std::string Generator::ModuleLevelMessageName( std::string Generator::ModuleLevelServiceDescriptorName( const ServiceDescriptor& descriptor) const { std::string name = descriptor.name(); - UpperString(&name); + ToUpper(&name); name = "_" + name; if (descriptor.file() != file_) { name = ModuleAlias(descriptor.file()->name()) + "." + name; @@ -1298,7 +1338,8 @@ std::string Generator::ModuleLevelServiceDescriptorName( // template void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, - DescriptorProtoT& proto) const { + DescriptorProtoT& proto, + const std::string& name) const { descriptor.CopyTo(&proto); std::string sp; proto.SerializeToString(&sp); @@ -1306,9 +1347,9 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, GOOGLE_CHECK_GE(offset, 0); printer_->Print( - "serialized_start=$serialized_start$,\n" - "serialized_end=$serialized_end$,\n", - "serialized_start", StrCat(offset), "serialized_end", + "$name$._serialized_start=$serialized_start$\n" + "$name$._serialized_end=$serialized_end$\n", + "name", name, "serialized_start", StrCat(offset), "serialized_end", StrCat(offset + sp.size())); } @@ -1318,16 +1359,62 @@ void PrintDescriptorOptionsFixingCode(const std::string& descriptor, io::Printer* printer) { // Reset the _options to None thus DescriptorBase.GetOptions() can // parse _options again after extensions are registered. - printer->Print("$descriptor$._options = None\n", "descriptor", descriptor); + printer->Print( + "$descriptor$._options = None\n" + "$descriptor$._serialized_options = $serialized_value$\n", + "descriptor", descriptor, "serialized_value", options); } } // namespace +void Generator::SetSerializedPbInterval() const { + // Top level enums. + for (int i = 0; i < file_->enum_type_count(); ++i) { + EnumDescriptorProto proto; + const EnumDescriptor& descriptor = *file_->enum_type(i); + PrintSerializedPbInterval(descriptor, proto, + ModuleLevelDescriptorName(descriptor)); + } + + // Messages. + for (int i = 0; i < file_->message_type_count(); ++i) { + SetMessagePbInterval(*file_->message_type(i)); + } + + // Services. + for (int i = 0; i < file_->service_count(); ++i) { + ServiceDescriptorProto proto; + const ServiceDescriptor& service = *file_->service(i); + PrintSerializedPbInterval(service, proto, + ModuleLevelServiceDescriptorName(service)); + } +} + +void Generator::SetMessagePbInterval(const Descriptor& descriptor) const { + DescriptorProto message_proto; + PrintSerializedPbInterval(descriptor, message_proto, + ModuleLevelDescriptorName(descriptor)); + + // Nested messages. + for (int i = 0; i < descriptor.nested_type_count(); ++i) { + SetMessagePbInterval(*descriptor.nested_type(i)); + } + + for (int i = 0; i < descriptor.enum_type_count(); ++i) { + EnumDescriptorProto proto; + const EnumDescriptor& enum_des = *descriptor.enum_type(i); + PrintSerializedPbInterval(enum_des, proto, + ModuleLevelDescriptorName(enum_des)); + } +} + // Prints expressions that set the options field of all descriptors. void Generator::FixAllDescriptorOptions() const { // Prints an expression that sets the file descriptor's options. std::string file_options = OptionsValue(file_->options().SerializeAsString()); if (file_options != "None") { PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_); + } else { + printer_->Print("DESCRIPTOR._options = None\n"); } // Prints expressions that set the options for all top level enums. for (int i = 0; i < file_->enum_type_count(); ++i) { @@ -1344,6 +1431,10 @@ void Generator::FixAllDescriptorOptions() const { for (int i = 0; i < file_->message_type_count(); ++i) { FixOptionsForMessage(*file_->message_type(i)); } + + for (int i = 0; i < file_->service_count(); ++i) { + FixOptionsForService(*file_->service(i)); + } } void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const { @@ -1378,6 +1469,31 @@ void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const { } } +// Prints expressions that set the options for an service descriptor and its +// value descriptors. +void Generator::FixOptionsForService( + const ServiceDescriptor& service_descriptor) const { + std::string descriptor_name = + ModuleLevelServiceDescriptorName(service_descriptor); + std::string service_options = + OptionsValue(service_descriptor.options().SerializeAsString()); + if (service_options != "None") { + PrintDescriptorOptionsFixingCode(descriptor_name, service_options, + printer_); + } + + for (int i = 0; i < service_descriptor.method_count(); ++i) { + const MethodDescriptor* method = service_descriptor.method(i); + std::string method_options = + OptionsValue(method->options().SerializeAsString()); + if (method_options != "None") { + std::string method_name = + descriptor_name + ".methods_by_name['" + method->name() + "']"; + PrintDescriptorOptionsFixingCode(method_name, method_options, printer_); + } + } +} + // Prints expressions that set the options for field descriptors (including // extensions). void Generator::FixOptionsForField(const FieldDescriptor& field) const { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.h similarity index 85% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.h index 6f299e850..3b4c1323b 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_generator.h @@ -59,6 +59,8 @@ class Printer; namespace compiler { namespace python { +enum class StripPrintDescriptor { kCreate, kFind }; + // CodeGenerator implementation for generated Python protocol buffer classes. // If you create your own protocol compiler binary and you want it to support // Python output, you can do so by registering an instance of this @@ -69,18 +71,21 @@ class PROTOC_EXPORT Generator : public CodeGenerator { virtual ~Generator(); // CodeGenerator methods. - virtual bool Generate(const FileDescriptor* file, - const std::string& parameter, - GeneratorContext* generator_context, - std::string* error) const; + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* generator_context, + std::string* error) const override; + + uint64_t GetSupportedFeatures() const override; private: void PrintImports() const; void PrintFileDescriptor() const; void PrintTopLevelEnums() const; - void PrintAllNestedEnumsInFile() const; - void PrintNestedEnums(const Descriptor& descriptor) const; - void PrintEnum(const EnumDescriptor& enum_descriptor) const; + void PrintAllNestedEnumsInFile(StripPrintDescriptor print_mode) const; + void PrintNestedEnums(const Descriptor& descriptor, + StripPrintDescriptor print_mode) const; + void PrintCreateEnum(const EnumDescriptor& enum_descriptor) const; + void PrintFindEnum(const EnumDescriptor& enum_descriptor) const; void PrintTopLevelExtensions() const; @@ -92,9 +97,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator { const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const; void PrintFieldsInDescriptor(const Descriptor& message_descriptor) const; void PrintExtensionsInDescriptor(const Descriptor& message_descriptor) const; - void PrintMessageDescriptors() const; - void PrintDescriptor(const Descriptor& message_descriptor) const; - void PrintNestedDescriptors(const Descriptor& containing_descriptor) const; + void PrintMessageDescriptors(StripPrintDescriptor print_mode) const; + void PrintCreateDescriptor(const Descriptor& message_descriptor) const; + void PrintFindDescriptor(const Descriptor& message_descriptor) const; + void PrintNestedDescriptors(const Descriptor& containing_descriptor, + StripPrintDescriptor print_mode) const; void PrintMessages() const; void PrintMessage(const Descriptor& message_descriptor, @@ -149,14 +156,19 @@ class PROTOC_EXPORT Generator : public CodeGenerator { template void PrintSerializedPbInterval(const DescriptorT& descriptor, - DescriptorProtoT& proto) const; + DescriptorProtoT& proto, + const std::string& name) const; void FixAllDescriptorOptions() const; void FixOptionsForField(const FieldDescriptor& field) const; void FixOptionsForOneof(const OneofDescriptor& oneof) const; void FixOptionsForEnum(const EnumDescriptor& descriptor) const; + void FixOptionsForService(const ServiceDescriptor& descriptor) const; void FixOptionsForMessage(const Descriptor& descriptor) const; + void SetSerializedPbInterval() const; + void SetMessagePbInterval(const Descriptor& descriptor) const; + void CopyPublicDependenciesAliases(const std::string& copy_from, const FileDescriptor* file) const; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_plugin_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_plugin_unittest.cc similarity index 99% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_plugin_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_plugin_unittest.cc index 8d7ef98b2..76ceef32a 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/python/python_plugin_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/python/python_plugin_unittest.cc @@ -36,13 +36,12 @@ #include +#include +#include #include #include #include #include - -#include -#include #include #include #include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code.proto similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code.proto index 42d82a6ba..70ec9f17a 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package A.B.C; +import "ruby_generated_code_proto2_import.proto"; + message TestMessage { int32 optional_int32 = 1; int64 optional_int64 = 2; @@ -14,6 +16,7 @@ message TestMessage { bytes optional_bytes = 9; TestEnum optional_enum = 10; TestMessage optional_msg = 11; + TestImportedMessage optional_proto2_submessage = 12; repeated int32 repeated_int32 = 21; repeated int64 repeated_int64 = 22; diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb similarity index 95% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb index 7e66d1ecc..256ac7c15 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb @@ -3,6 +3,8 @@ require 'google/protobuf' +require 'ruby_generated_code_proto2_import_pb' + Google::Protobuf::DescriptorPool.generated_pool.build do add_file("ruby_generated_code.proto", :syntax => :proto3) do add_message "A.B.C.TestMessage" do @@ -17,6 +19,7 @@ optional :optional_bytes, :bytes, 9 optional :optional_enum, :enum, 10, "A.B.C.TestEnum" optional :optional_msg, :message, 11, "A.B.C.TestMessage" + optional :optional_proto2_submessage, :message, 12, "A.B.C.TestImportedMessage" repeated :repeated_int32, :int32, 21 repeated :repeated_int64, :int64, 22 repeated :repeated_uint32, :uint32, 23 diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto similarity index 94% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto index 8d3cc13e0..ea7f78363 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto @@ -2,6 +2,8 @@ syntax = "proto2"; package A.B.C; +import "ruby_generated_code_proto2_import.proto"; + message TestMessage { optional int32 optional_int32 = 1 [default = 1]; optional int64 optional_int64 = 2 [default = 2]; @@ -14,6 +16,7 @@ message TestMessage { optional bytes optional_bytes = 9 [default = "\0\1\2\100fubar"]; optional TestEnum optional_enum = 10 [default = A]; optional TestMessage optional_msg = 11; + optional TestImportedMessage optional_proto2_submessage = 12; repeated int32 repeated_int32 = 21; repeated int64 repeated_int64 = 22; diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto new file mode 100644 index 000000000..9ec07381b --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto @@ -0,0 +1,5 @@ +syntax = "proto2"; + +package A.B.C; + +message TestImportedMessage {} diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb similarity index 96% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb index c89738fe8..44d31969e 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb @@ -3,6 +3,8 @@ require 'google/protobuf' +require 'ruby_generated_code_proto2_import_pb' + Google::Protobuf::DescriptorPool.generated_pool.build do add_file("ruby_generated_code_proto2.proto", :syntax => :proto2) do add_message "A.B.C.TestMessage" do @@ -17,6 +19,7 @@ optional :optional_bytes, :bytes, 9, default: "\x00\x01\x02\x40\x66\x75\x62\x61\x72".force_encoding("ASCII-8BIT") optional :optional_enum, :enum, 10, "A.B.C.TestEnum", default: 1 optional :optional_msg, :message, 11, "A.B.C.TestMessage" + optional :optional_proto2_submessage, :message, 12, "A.B.C.TestImportedMessage" repeated :repeated_int32, :int32, 21 repeated :repeated_int64, :int64, 22 repeated :repeated_uint32, :uint32, 23 diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.cc similarity index 82% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.cc index 092cbc37a..46e60f587 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -77,6 +77,10 @@ std::string GetOutputFilename(const std::string& proto_file) { } std::string LabelForField(const FieldDescriptor* field) { + if (field->has_optional_keyword() && + field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3) { + return "proto3_optional"; + } switch (field->label()) { case FieldDescriptor::LABEL_OPTIONAL: return "optional"; case FieldDescriptor::LABEL_REQUIRED: return "required"; @@ -109,7 +113,7 @@ std::string TypeName(const FieldDescriptor* field) { } } -string StringifySyntax(FileDescriptor::Syntax syntax) { +std::string StringifySyntax(FileDescriptor::Syntax syntax) { switch (syntax) { case FileDescriptor::SYNTAX_PROTO2: return "proto2"; @@ -143,7 +147,7 @@ std::string DefaultValueForField(const FieldDescriptor* field) { return NumberToString(field->default_value_enum()->number()); case FieldDescriptor::CPPTYPE_STRING: { std::ostringstream os; - string default_str = field->default_value_string(); + std::string default_str = field->default_value_string(); if (field->type() == FieldDescriptor::TYPE_STRING) { os << "\"" << default_str << "\""; @@ -216,6 +220,11 @@ void GenerateField(const FieldDescriptor* field, io::Printer* printer) { DefaultValueForField(field)); } + if (field->has_json_name()) { + printer->Print(", json_name: \"$json_name$\"", "json_name", + field->json_name()); + } + printer->Print("\n"); } } @@ -238,8 +247,7 @@ void GenerateOneof(const OneofDescriptor* oneof, io::Printer* printer) { bool GenerateMessage(const Descriptor* message, io::Printer* printer, std::string* error) { if (message->extension_range_count() > 0 || message->extension_count() > 0) { - *error = "Extensions are not yet supported for proto2 .proto files."; - return false; + GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; } // Don't generate MapEntry messages -- we use the Ruby extension's native @@ -255,12 +263,12 @@ bool GenerateMessage(const Descriptor* message, io::Printer* printer, for (int i = 0; i < message->field_count(); i++) { const FieldDescriptor* field = message->field(i); - if (!field->containing_oneof()) { + if (!field->real_containing_oneof()) { GenerateField(field, printer); } } - for (int i = 0; i < message->oneof_decl_count(); i++) { + for (int i = 0; i < message->real_oneof_decl_count(); i++) { const OneofDescriptor* oneof = message->oneof_decl(i); GenerateOneof(oneof, printer); } @@ -407,9 +415,9 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { if (file->options().has_ruby_package()) { package_name = file->options().ruby_package(); - // If :: is in the package use the Ruby formated name as-is + // If :: is in the package use the Ruby formatted name as-is // -> A::B::C - // otherwise, use the dot seperator + // otherwise, use the dot separator // -> A.B.C if (package_name.find("::") != std::string::npos) { need_change_to_module = false; @@ -421,15 +429,15 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { package_name = file->package(); } - // Use the appropriate delimter - string delimiter = need_change_to_module ? "." : "::"; + // Use the appropriate delimiter + std::string delimiter = need_change_to_module ? "." : "::"; int delimiter_size = need_change_to_module ? 1 : 2; // Extract each module name and indent while (!package_name.empty()) { size_t dot_index = package_name.find(delimiter); - string component; - if (dot_index == string::npos) { + std::string component; + if (dot_index == std::string::npos) { component = package_name; package_name = ""; } else { @@ -457,111 +465,70 @@ void EndPackageModules(int levels, io::Printer* printer) { } } -bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file, - string* error) { - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - field->message_type()->file() == file) || - (field->type() == FieldDescriptor::TYPE_ENUM && - field->enum_type()->file() == file)) { - *error = "proto3 message field " + field->full_name() + " in file " + - file->name() + " has a dependency on a type from proto2 file " + - file->name() + - ". Ruby doesn't support proto2 yet, so we must fail."; - return true; +bool GenerateDslDescriptor(const FileDescriptor* file, io::Printer* printer, + std::string* error) { + printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n"); + printer->Indent(); + printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n", + "filename", file->name(), "syntax", + StringifySyntax(file->syntax())); + printer->Indent(); + for (int i = 0; i < file->message_type_count(); i++) { + if (!GenerateMessage(file->message_type(i), printer, error)) { + return false; } } - - for (int i = 0; i < message->nested_type_count(); i++) { - if (UsesTypeFromFile(message->nested_type(i), file, error)) { - return true; - } + for (int i = 0; i < file->enum_type_count(); i++) { + GenerateEnum(file->enum_type(i), printer); } - - return false; + printer->Outdent(); + printer->Print("end\n"); + printer->Outdent(); + printer->Print( + "end\n\n"); + return true; } -// Ruby doesn't currently support proto2. This causes a failure even for proto3 -// files that import proto2. But in some cases, the proto2 file is only being -// imported to extend another proto2 message. The prime example is declaring -// custom options by extending FileOptions/FieldOptions/etc. -// -// If the proto3 messages don't have any proto2 submessages, it is safe to omit -// the dependency completely. Users won't be able to use any proto2 extensions, -// but they already couldn't because proto2 messages aren't supported. -// -// If/when we add proto2 support, we should remove this. -bool MaybeEmitDependency(const FileDescriptor* import, - const FileDescriptor* from, - io::Printer* printer, - string* error) { - if (from->syntax() == FileDescriptor::SYNTAX_PROTO3 && - import->syntax() == FileDescriptor::SYNTAX_PROTO2) { - for (int i = 0; i < from->message_type_count(); i++) { - if (UsesTypeFromFile(from->message_type(i), import, error)) { - // Error text was already set by UsesTypeFromFile(). - return false; - } - } - - // Ok to omit this proto2 dependency -- so we won't print anything. - GOOGLE_LOG(WARNING) << "Omitting proto2 dependency '" << import->name() - << "' from proto3 output file '" - << GetOutputFilename(from->name()) - << "' because we don't support proto2 and no proto2 " - "types from that file are being used."; - return true; - } else { - printer->Print( - "require '$name$'\n", "name", GetRequireName(import->name())); - return true; - } +bool GenerateBinaryDescriptor(const FileDescriptor* file, io::Printer* printer, + std::string* error) { + printer->Print( + R"(descriptor_data = File.binread(__FILE__).split("\n__END__\n", 2)[1])"); + printer->Print( + "\nGoogle::Protobuf::DescriptorPool.generated_pool.add_serialized_file(" + "descriptor_data)\n\n"); + return true; } bool GenerateFile(const FileDescriptor* file, io::Printer* printer, - string* error) { + std::string* error) { printer->Print( "# Generated by the protocol buffer compiler. DO NOT EDIT!\n" "# source: $filename$\n" "\n", "filename", file->name()); - printer->Print( - "require 'google/protobuf'\n\n"); + printer->Print("require 'google/protobuf'\n\n"); - for (int i = 0; i < file->dependency_count(); i++) { - if (!MaybeEmitDependency(file->dependency(i), file, printer, error)) { - return false; + if (file->dependency_count() != 0) { + for (int i = 0; i < file->dependency_count(); i++) { + printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name())); } + printer->Print("\n"); } // TODO: Remove this when ruby supports extensions for proto2 syntax. if (file->syntax() == FileDescriptor::SYNTAX_PROTO2 && file->extension_count() > 0) { - *error = "Extensions are not yet supported for proto2 .proto files."; - return false; + GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; } - printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n"); - printer->Indent(); - printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n", - "filename", file->name(), "syntax", - StringifySyntax(file->syntax())); - printer->Indent(); - for (int i = 0; i < file->message_type_count(); i++) { - if (!GenerateMessage(file->message_type(i), printer, error)) { - return false; - } - } - for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnum(file->enum_type(i), printer); + bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto"; + + if (use_raw_descriptor) { + GenerateBinaryDescriptor(file, printer, error); + } else { + GenerateDslDescriptor(file, printer, error); } - printer->Outdent(); - printer->Print("end\n"); - printer->Outdent(); - printer->Print( - "end\n\n"); int levels = GeneratePackageModules(file, printer); for (int i = 0; i < file->message_type_count(); i++) { @@ -571,14 +538,23 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, GenerateEnumAssignment("", file->enum_type(i), printer); } EndPackageModules(levels, printer); + + if (use_raw_descriptor) { + printer->Print("\n__END__\n"); + FileDescriptorProto file_proto; + file->CopyTo(&file_proto); + std::string file_data; + file_proto.SerializeToString(&file_data); + printer->Print("$raw_descriptor$", "raw_descriptor", file_data); + } return true; } bool Generator::Generate( const FileDescriptor* file, - const string& parameter, + const std::string& parameter, GeneratorContext* generator_context, - string* error) const { + std::string* error) const { if (file->syntax() != FileDescriptor::SYNTAX_PROTO3 && file->syntax() != FileDescriptor::SYNTAX_PROTO2) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.h similarity index 90% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.h index 731a81a52..647bb8360 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator.h @@ -49,11 +49,12 @@ namespace ruby { // Ruby output, you can do so by registering an instance of this // CodeGenerator with the CommandLineInterface in your main() function. class PROTOC_EXPORT Generator : public CodeGenerator { - virtual bool Generate( - const FileDescriptor* file, - const string& parameter, - GeneratorContext* generator_context, - string* error) const; + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* generator_context, + std::string* error) const override; + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL; + } }; } // namespace ruby @@ -64,4 +65,3 @@ class PROTOC_EXPORT Generator : public CodeGenerator { #include #endif // GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__ - diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc similarity index 81% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc index d93a68d9a..040b6c981 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc @@ -46,7 +46,7 @@ namespace compiler { namespace ruby { namespace { -string FindRubyTestDir() { +std::string FindRubyTestDir() { return TestSourceDir() + "/google/protobuf/compiler/ruby"; } @@ -57,8 +57,8 @@ string FindRubyTestDir() { // Some day, we may integrate build systems between protoc and the language // extensions to the point where we can do this test in a more automated way. -void RubyTest(string proto_file) { - string ruby_tests = FindRubyTestDir(); +void RubyTest(string proto_file, string import_proto_file = "") { + std::string ruby_tests = FindRubyTestDir(); google::protobuf::compiler::CommandLineInterface cli; cli.SetInputsAreProtoPathRelative(true); @@ -67,7 +67,7 @@ void RubyTest(string proto_file) { cli.RegisterGenerator("--ruby_out", &ruby_generator, ""); // Copy generated_code.proto to the temporary test directory. - string test_input; + std::string test_input; GOOGLE_CHECK_OK(File::GetContents( ruby_tests + proto_file + ".proto", &test_input, @@ -77,10 +77,24 @@ void RubyTest(string proto_file) { test_input, true)); + // Copy generated_code_import.proto to the temporary test directory. + std::string test_import; + if (!import_proto_file.empty()) { + GOOGLE_CHECK_OK(File::GetContents( + ruby_tests + import_proto_file + ".proto", + &test_import, + true)); + GOOGLE_CHECK_OK(File::SetContents( + TestTempDir() + import_proto_file + ".proto", + test_import, + true)); + } + // Invoke the proto compiler (we will be inside TestTempDir() at this point). - string ruby_out = "--ruby_out=" + TestTempDir(); - string proto_path = "--proto_path=" + TestTempDir(); - string proto_target = TestTempDir() + proto_file + ".proto"; + std::string ruby_out = "--ruby_out=" + TestTempDir(); + std::string proto_path = "--proto_path=" + TestTempDir(); + + std::string proto_target = TestTempDir() + proto_file + ".proto"; const char* argv[] = { "protoc", ruby_out.c_str(), @@ -91,12 +105,12 @@ void RubyTest(string proto_file) { EXPECT_EQ(0, cli.Run(4, argv)); // Load the generated output and compare to the expected result. - string output; + std::string output; GOOGLE_CHECK_OK(File::GetContentsAsText( TestTempDir() + proto_file + "_pb.rb", &output, true)); - string expected_output; + std::string expected_output; GOOGLE_CHECK_OK(File::GetContentsAsText( ruby_tests + proto_file + "_pb.rb", &expected_output, @@ -105,11 +119,11 @@ void RubyTest(string proto_file) { } TEST(RubyGeneratorTest, Proto3GeneratorTest) { - RubyTest("/ruby_generated_code"); + RubyTest("/ruby_generated_code", "/ruby_generated_code_proto2_import"); } TEST(RubyGeneratorTest, Proto2GeneratorTest) { - RubyTest("/ruby_generated_code_proto2"); + RubyTest("/ruby_generated_code_proto2", "/ruby_generated_code_proto2_import"); } TEST(RubyGeneratorTest, Proto3ImplicitPackageTest) { diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/scc.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/scc.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/scc.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/scc.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/subprocess.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/subprocess.cc similarity index 98% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/subprocess.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/subprocess.cc index bd6be2b09..7e59cd7d8 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/subprocess.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/subprocess.cc @@ -255,8 +255,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, child_handle_ = NULL; if (exit_code != 0) { - *error = - strings::Substitute("Plugin failed with status code $0.", exit_code); + *error = strings::Substitute("Plugin failed with status code $0.", exit_code); return false; } @@ -274,7 +273,7 @@ std::string Subprocess::Win32ErrorMessage(DWORD error_code) { // WTF? FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, error_code, 0, + NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR)&message, // NOT A BUG! 0, NULL); diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/subprocess.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/subprocess.h similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/subprocess.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/subprocess.h diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/test_plugin.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/test_plugin.cc similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/test_plugin.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/test_plugin.cc diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_output_unittest.sh b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_output_unittest.sh old mode 100644 new mode 100755 similarity index 100% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_output_unittest.sh rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_output_unittest.sh diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.cc similarity index 79% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.cc index 872dd9edd..72e1d7114 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/compiler/zip_writer.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.cc @@ -28,42 +28,15 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Author: ambrose@google.com (Ambrose Feinstein), // kenton@google.com (Kenton Varda) // // Based on http://www.pkware.com/documents/casestudies/APPNOTE.TXT #include + +#include + #include namespace google { @@ -72,9 +45,9 @@ namespace compiler { // January 1, 1980 as a DOS date. // see https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx -static const uint16 kDosEpoch = 1 << 5 | 1; +static const uint16_t kDosEpoch = 1 << 5 | 1; -static const uint32 kCRC32Table[256] = { +static const uint32_t kCRC32Table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, @@ -119,8 +92,8 @@ static const uint32 kCRC32Table[256] = { 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d}; -static uint32 ComputeCRC32(const std::string& buf) { - uint32 x = ~0U; +static uint32_t ComputeCRC32(const std::string& buf) { + uint32_t x = ~0U; for (int i = 0; i < buf.size(); ++i) { unsigned char c = buf[i]; x = kCRC32Table[(x ^ c) & 0xff] ^ (x >> 8); @@ -128,10 +101,10 @@ static uint32 ComputeCRC32(const std::string& buf) { return ~x; } -static void WriteShort(io::CodedOutputStream* out, uint16 val) { - uint8 p[2]; - p[0] = static_cast(val); - p[1] = static_cast(val >> 8); +static void WriteShort(io::CodedOutputStream* out, uint16_t val) { + uint8_t p[2]; + p[0] = static_cast(val); + p[1] = static_cast(val >> 8); out->WriteRaw(p, 2); } @@ -144,7 +117,7 @@ bool ZipWriter::Write(const std::string& filename, FileInfo info; info.name = filename; - uint16 filename_size = filename.size(); + uint16_t filename_size = filename.size(); info.offset = raw_output_->ByteCount(); info.size = contents.size(); info.crc32 = ComputeCRC32(contents); @@ -171,17 +144,17 @@ bool ZipWriter::Write(const std::string& filename, } bool ZipWriter::WriteDirectory() { - uint16 num_entries = files_.size(); - uint32 dir_ofs = raw_output_->ByteCount(); + uint16_t num_entries = files_.size(); + uint32_t dir_ofs = raw_output_->ByteCount(); // write central directory io::CodedOutputStream output(raw_output_); for (int i = 0; i < num_entries; ++i) { const std::string& filename = files_[i].name; - uint16 filename_size = filename.size(); - uint32 crc32 = files_[i].crc32; - uint32 size = files_[i].size; - uint32 offset = files_[i].offset; + uint16_t filename_size = filename.size(); + uint32_t crc32 = files_[i].crc32; + uint32_t size = files_[i].size; + uint32_t offset = files_[i].offset; output.WriteLittleEndian32(0x02014b50); // magic WriteShort(&output, 10); // version made by @@ -202,7 +175,7 @@ bool ZipWriter::WriteDirectory() { output.WriteLittleEndian32(offset); // local header offset output.WriteString(filename); // file name } - uint32 dir_len = output.ByteCount(); + uint32_t dir_len = output.ByteCount(); // write end of central directory marker output.WriteLittleEndian32(0x06054b50); // magic diff --git a/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.h new file mode 100644 index 000000000..0a8a77355 --- /dev/null +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/compiler/zip_writer.h @@ -0,0 +1,65 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) + +#include +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { + +class ZipWriter { + public: + ZipWriter(io::ZeroCopyOutputStream* raw_output); + ~ZipWriter(); + + bool Write(const std::string& filename, const std::string& contents); + bool WriteDirectory(); + + private: + struct FileInfo { + std::string name; + uint32_t offset; + uint32_t size; + uint32_t crc32; + }; + + io::ZeroCopyOutputStream* raw_output_; + std::vector files_; +}; + +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.cc b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.cc similarity index 78% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.cc rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.cc index 6835a3cde..c8ce218a9 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.cc +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.cc @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -74,7 +77,8 @@ namespace google { namespace protobuf { -struct Symbol { +class Symbol { + public: enum Type { NULL_SYMBOL, MESSAGE, @@ -82,69 +86,194 @@ struct Symbol { ONEOF, ENUM, ENUM_VALUE, + ENUM_VALUE_OTHER_PARENT, SERVICE, METHOD, - PACKAGE + PACKAGE, + QUERY_KEY + }; + + Symbol() : ptr_(nullptr) {} + + // Every object we store derives from internal::SymbolBase, where we store the + // symbol type enum. + // Storing in the object can be done without using more space in most cases, + // while storing it in the Symbol type would require 8 bytes. +#define DEFINE_MEMBERS(TYPE, TYPE_CONSTANT, FIELD) \ + explicit Symbol(TYPE* value) : ptr_(value) { \ + value->symbol_type_ = TYPE_CONSTANT; \ + } \ + const TYPE* FIELD() const { \ + return type() == TYPE_CONSTANT ? static_cast(ptr_) : nullptr; \ + } + + DEFINE_MEMBERS(Descriptor, MESSAGE, descriptor) + DEFINE_MEMBERS(FieldDescriptor, FIELD, field_descriptor) + DEFINE_MEMBERS(OneofDescriptor, ONEOF, oneof_descriptor) + DEFINE_MEMBERS(EnumDescriptor, ENUM, enum_descriptor) + DEFINE_MEMBERS(ServiceDescriptor, SERVICE, service_descriptor) + DEFINE_MEMBERS(MethodDescriptor, METHOD, method_descriptor) + + // We use a special node for FileDescriptor. + // It is potentially added to the table with multiple different names, so we + // need a separate place to put the name. + struct Package : internal::SymbolBase { + const std::string* name; + const FileDescriptor* file; }; - Type type; - union { - const Descriptor* descriptor; - const FieldDescriptor* field_descriptor; - const OneofDescriptor* oneof_descriptor; - const EnumDescriptor* enum_descriptor; - const EnumValueDescriptor* enum_value_descriptor; - const ServiceDescriptor* service_descriptor; - const MethodDescriptor* method_descriptor; - const FileDescriptor* package_file_descriptor; + DEFINE_MEMBERS(Package, PACKAGE, package_file_descriptor) + + // Enum values have two different parents. + // We use two different identitied for the same object to determine the two + // different insertions in the map. + static Symbol EnumValue(EnumValueDescriptor* value, int n) { + Symbol s; + internal::SymbolBase* ptr; + if (n == 0) { + ptr = static_cast*>(value); + ptr->symbol_type_ = ENUM_VALUE; + } else { + ptr = static_cast*>(value); + ptr->symbol_type_ = ENUM_VALUE_OTHER_PARENT; + } + s.ptr_ = ptr; + return s; + } + + const EnumValueDescriptor* enum_value_descriptor() const { + return type() == ENUM_VALUE + ? static_cast( + static_cast*>(ptr_)) + : type() == ENUM_VALUE_OTHER_PARENT + ? static_cast( + static_cast*>(ptr_)) + : nullptr; + } + + // Not a real symbol. + // Only used for heterogeneous lookups and never actually inserted in the + // tables. + struct QueryKey : internal::SymbolBase { + StringPiece name; + const void* parent; + int field_number; }; + DEFINE_MEMBERS(QueryKey, QUERY_KEY, query_key); +#undef DEFINE_MEMBERS - inline Symbol() : type(NULL_SYMBOL) { descriptor = nullptr; } - inline bool IsNull() const { return type == NULL_SYMBOL; } - inline bool IsType() const { return type == MESSAGE || type == ENUM; } - inline bool IsAggregate() const { - return type == MESSAGE || type == PACKAGE || type == ENUM || - type == SERVICE; + Type type() const { + return ptr_ == nullptr ? NULL_SYMBOL + : static_cast(ptr_->symbol_type_); } - -#define CONSTRUCTOR(TYPE, TYPE_CONSTANT, FIELD) \ - inline explicit Symbol(const TYPE* value) { \ - type = TYPE_CONSTANT; \ - this->FIELD = value; \ + bool IsNull() const { return type() == NULL_SYMBOL; } + bool IsType() const { return type() == MESSAGE || type() == ENUM; } + bool IsAggregate() const { + return type() == MESSAGE || type() == PACKAGE || type() == ENUM || + type() == SERVICE; } - CONSTRUCTOR(Descriptor, MESSAGE, descriptor) - CONSTRUCTOR(FieldDescriptor, FIELD, field_descriptor) - CONSTRUCTOR(OneofDescriptor, ONEOF, oneof_descriptor) - CONSTRUCTOR(EnumDescriptor, ENUM, enum_descriptor) - CONSTRUCTOR(EnumValueDescriptor, ENUM_VALUE, enum_value_descriptor) - CONSTRUCTOR(ServiceDescriptor, SERVICE, service_descriptor) - CONSTRUCTOR(MethodDescriptor, METHOD, method_descriptor) - CONSTRUCTOR(FileDescriptor, PACKAGE, package_file_descriptor) -#undef CONSTRUCTOR - const FileDescriptor* GetFile() const { - switch (type) { - case NULL_SYMBOL: + switch (type()) { + case MESSAGE: + return descriptor()->file(); + case FIELD: + return field_descriptor()->file(); + case ONEOF: + return oneof_descriptor()->containing_type()->file(); + case ENUM: + return enum_descriptor()->file(); + case ENUM_VALUE: + return enum_value_descriptor()->type()->file(); + case SERVICE: + return service_descriptor()->file(); + case METHOD: + return method_descriptor()->service()->file(); + case PACKAGE: + return package_file_descriptor()->file; + default: return nullptr; + } + } + + StringPiece full_name() const { + switch (type()) { case MESSAGE: - return descriptor->file(); + return descriptor()->full_name(); case FIELD: - return field_descriptor->file(); + return field_descriptor()->full_name(); case ONEOF: - return oneof_descriptor->containing_type()->file(); + return oneof_descriptor()->full_name(); case ENUM: - return enum_descriptor->file(); + return enum_descriptor()->full_name(); case ENUM_VALUE: - return enum_value_descriptor->type()->file(); + return enum_value_descriptor()->full_name(); case SERVICE: - return service_descriptor->file(); + return service_descriptor()->full_name(); case METHOD: - return method_descriptor->service()->file(); + return method_descriptor()->full_name(); case PACKAGE: - return package_file_descriptor; + return *package_file_descriptor()->name; + case QUERY_KEY: + return query_key()->name; + default: + GOOGLE_CHECK(false); } - return nullptr; + return ""; } + + std::pair parent_name_key() const { + const auto or_file = [&](const void* p) { return p ? p : GetFile(); }; + switch (type()) { + case MESSAGE: + return {or_file(descriptor()->containing_type()), descriptor()->name()}; + case FIELD: { + auto* field = field_descriptor(); + return {or_file(field->is_extension() ? field->extension_scope() + : field->containing_type()), + field->name()}; + } + case ONEOF: + return {oneof_descriptor()->containing_type(), + oneof_descriptor()->name()}; + case ENUM: + return {or_file(enum_descriptor()->containing_type()), + enum_descriptor()->name()}; + case ENUM_VALUE: + return {or_file(enum_value_descriptor()->type()->containing_type()), + enum_value_descriptor()->name()}; + case ENUM_VALUE_OTHER_PARENT: + return {enum_value_descriptor()->type(), + enum_value_descriptor()->name()}; + case SERVICE: + return {GetFile(), service_descriptor()->name()}; + case METHOD: + return {method_descriptor()->service(), method_descriptor()->name()}; + case QUERY_KEY: + return {query_key()->parent, query_key()->name}; + default: + GOOGLE_CHECK(false); + } + return {}; + } + + std::pair parent_number_key() const { + switch (type()) { + case FIELD: + return {field_descriptor()->containing_type(), + field_descriptor()->number()}; + case ENUM_VALUE: + return {enum_value_descriptor()->type(), + enum_value_descriptor()->number()}; + case QUERY_KEY: + return {query_key()->parent, query_key()->field_number}; + default: + GOOGLE_CHECK(false); + } + return {}; + } + + private: + const internal::SymbolBase* ptr_; }; const FieldDescriptor::CppType @@ -232,7 +361,7 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) { static const char* const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty"; -#if !defined(_MSC_VER) || _MSC_VER >= 1900 +#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912) const int FieldDescriptor::kMaxNumber; const int FieldDescriptor::kFirstReservedNumber; const int FieldDescriptor::kLastReservedNumber; @@ -254,14 +383,14 @@ std::string ToCamelCase(const std::string& input, bool lower_first) { std::string result; result.reserve(input.size()); - for (int i = 0; i < input.size(); i++) { - if (input[i] == '_') { + for (char character : input) { + if (character == '_') { capitalize_next = true; } else if (capitalize_next) { - result.push_back(ToUpper(input[i])); + result.push_back(ToUpper(character)); capitalize_next = false; } else { - result.push_back(input[i]); + result.push_back(character); } } @@ -278,14 +407,14 @@ std::string ToJsonName(const std::string& input) { std::string result; result.reserve(input.size()); - for (int i = 0; i < input.size(); i++) { - if (input[i] == '_') { + for (char character : input) { + if (character == '_') { capitalize_next = true; } else if (capitalize_next) { - result.push_back(ToUpper(input[i])); + result.push_back(ToUpper(character)); capitalize_next = false; } else { - result.push_back(input[i]); + result.push_back(character); } } @@ -297,14 +426,14 @@ std::string EnumValueToPascalCase(const std::string& input) { std::string result; result.reserve(input.size()); - for (int i = 0; i < input.size(); i++) { - if (input[i] == '_') { + for (char character : input) { + if (character == '_') { next_upper = true; } else { if (next_upper) { - result.push_back(ToUpper(input[i])); + result.push_back(ToUpper(character)); } else { - result.push_back(ToLower(input[i])); + result.push_back(ToLower(character)); } next_upper = false; } @@ -318,9 +447,9 @@ class PrefixRemover { public: PrefixRemover(StringPiece prefix) { // Strip underscores and lower-case the prefix. - for (int i = 0; i < prefix.size(); i++) { - if (prefix[i] != '_') { - prefix_ += ascii_tolower(prefix[i]); + for (char character : prefix) { + if (character != '_') { + prefix_ += ascii_tolower(character); } } } @@ -383,22 +512,10 @@ class PrefixRemover { // hash-maps for each object. // // The keys to these hash-maps are (parent, name) or (parent, number) pairs. -// -// TODO(kenton): Use StringPiece rather than const char* in keys? It would -// be a lot cleaner but we'd just have to convert it back to const char* -// for the open source release. -typedef std::pair PointerStringPair; - -struct PointerStringPairEqual { - inline bool operator()(const PointerStringPair& a, - const PointerStringPair& b) const { - return a.first == b.first && strcmp(a.second, b.second) == 0; - } -}; +typedef std::pair PointerStringPair; typedef std::pair DescriptorIntPair; -typedef std::pair EnumIntPair; #define HASH_MAP std::unordered_map #define HASH_SET std::unordered_set @@ -419,16 +536,16 @@ struct PointerIntegerPairHash { static const size_t min_buckets = 8; #endif inline bool operator()(const PairType& a, const PairType& b) const { - return a.first < b.first || (a.first == b.first && a.second < b.second); + return a < b; } }; struct PointerStringPairHash { size_t operator()(const PointerStringPair& p) const { static const size_t prime = 16777619; - hash cstring_hash; + hash string_hash; return reinterpret_cast(p.first) * prime ^ - static_cast(cstring_hash(p.second)); + static_cast(string_hash(p.second)); } #ifdef _MSC_VER @@ -438,39 +555,62 @@ struct PointerStringPairHash { #endif inline bool operator()(const PointerStringPair& a, const PointerStringPair& b) const { - if (a.first < b.first) return true; - if (a.first > b.first) return false; - return strcmp(a.second, b.second) < 0; + return a < b; } }; const Symbol kNullSymbol; -typedef HASH_MAP, streq> - SymbolsByNameMap; +struct SymbolByFullNameHash { + size_t operator()(Symbol s) const { + return HASH_FXN{}(s.full_name()); + } +}; +struct SymbolByFullNameEq { + bool operator()(Symbol a, Symbol b) const { + return a.full_name() == b.full_name(); + } +}; +using SymbolsByNameSet = + HASH_SET; -typedef HASH_MAP - SymbolsByParentMap; +struct SymbolByParentHash { + size_t operator()(Symbol s) const { + return PointerStringPairHash{}(s.parent_name_key()); + } +}; +struct SymbolByParentEq { + bool operator()(Symbol a, Symbol b) const { + return a.parent_name_key() == b.parent_name_key(); + } +}; +using SymbolsByParentSet = + HASH_SET; -typedef HASH_MAP, - streq> +typedef HASH_MAP> FilesByNameMap; typedef HASH_MAP + PointerStringPairHash> FieldsByNameMap; -typedef HASH_MAP, - std::equal_to> - FieldsByNumberMap; +struct FieldsByNumberHash { + size_t operator()(Symbol s) const { + return PointerIntegerPairHash>{}( + s.parent_number_key()); + } +}; +struct FieldsByNumberEq { + bool operator()(Symbol a, Symbol b) const { + return a.parent_number_key() == b.parent_number_key(); + } +}; +using FieldsByNumberSet = + HASH_SET; +using EnumValuesByNumberSet = FieldsByNumberSet; -typedef HASH_MAP, - std::equal_to> - EnumValuesByNumberMap; // This is a map rather than a hash-map, since we use it to iterate // through all the extensions that extend a given Descriptor, and an // ordered data structure that implements lower_bound is convenient @@ -485,16 +625,15 @@ std::set* NewAllowedProto3Extendee() { const char* kOptionNames[] = { "FileOptions", "MessageOptions", "FieldOptions", "EnumOptions", "EnumValueOptions", "ServiceOptions", "MethodOptions", "OneofOptions"}; - for (int i = 0; i < GOOGLE_ARRAYSIZE(kOptionNames); ++i) { + for (const char* option_name : kOptionNames) { // descriptor.proto has a different package name in opensource. We allow // both so the opensource protocol compiler can also compile internal // proto3 files with custom options. See: b/27567912 allowed_proto3_extendees->insert(std::string("google.protobuf.") + - kOptionNames[i]); + option_name); // Split the word to trick the opensource processing scripts so they - // will keep the origial package name. - allowed_proto3_extendees->insert(std::string("proto") + "2." + - kOptionNames[i]); + // will keep the original package name. + allowed_proto3_extendees->insert(std::string("proto") + "2." + option_name); } return allowed_proto3_extendees; } @@ -510,6 +649,403 @@ bool AllowedExtendeeInProto3(const std::string& name) { allowed_proto3_extendees->end(); } +// This bump allocator arena is optimized for the use case of this file. It is +// mostly optimized for memory usage, since these objects are expected to live +// for the entirety of the program. +// +// Some differences from other arenas: +// - It has a fixed number of non-trivial types it can hold. This allows +// tracking the allocations with a single byte. In contrast, google::protobuf::Arena +// uses 16 bytes per non-trivial object created. +// - It has some extra metadata for rollbacks. This is necessary for +// implementing the API below. This metadata is flushed at the end and would +// not cause persistent memory usage. +// - It tries to squeeze every byte of out the blocks. If an allocation is too +// large for the current block we move the block to a secondary area where we +// can still use it for smaller objects. This complicates rollback logic but +// makes it much more memory efficient. +// +// The allocation strategy is as follows: +// - Memory is allocated from the front, with a forced 8 byte alignment. +// - Metadata is allocated from the back, one byte per element. +// - The metadata encodes one of two things: +// * For types we want to track, the index into KnownTypes. +// * For raw memory blocks, the size of the block (in 8 byte increments +// to allow for a larger limit). +// - When the raw data is too large to represent in the metadata byte, we +// allocate this memory separately in the heap and store an OutOfLineAlloc +// object instead. These come from large array allocations and alike. +// +// Blocks are kept in 3 areas: +// - `current_` is the one we are currently allocating from. When we need to +// allocate a block that doesn't fit there, we make a new block and move the +// old `current_` to one of the areas below. +// - Blocks that have no more usable space left (ie less than 9 bytes) are +// stored in `full_blocks_`. +// - Blocks that have some usable space are categorized in +// `small_size_blocks_` depending on how much space they have left. +// See `kSmallSizes` to see which sizes we track. +// +class TableArena { + public: + // Allocate a block on `n` bytes, with no destructor information saved. + void* AllocateMemory(uint32_t n) { + uint32_t tag = SizeToRawTag(n) + kFirstRawTag; + if (tag > 255) { + // We can't fit the size, use an OutOfLineAlloc. + return Create(OutOfLineAlloc{::operator new(n), n})->ptr; + } + + return AllocRawInternal(n, static_cast(tag)); + } + + // Allocate and construct an element of type `T` as if by + // `T(std::forward(args...))`. + // The object is registered for destruction, if its destructor is not trivial. + template + T* Create(Args&&... args) { + static_assert(alignof(T) <= 8, ""); + return ::new (AllocRawInternal(sizeof(T), TypeTag(KnownTypes{}))) + T(std::forward(args)...); + } + + TableArena() {} + + TableArena(const TableArena&) = delete; + TableArena& operator=(const TableArena&) = delete; + + ~TableArena() { + // Uncomment this to debug usage statistics of the arena blocks. + // PrintUsageInfo(); + + for (Block* list : GetLists()) { + while (list != nullptr) { + Block* b = list; + list = list->next; + b->VisitBlock(DestroyVisitor{}); + b->Destroy(); + } + } + } + + + // This function exists for debugging only. + // It can be called from the destructor to dump some info in the tests to + // inspect the usage of the arena. + void PrintUsageInfo() const { + const auto print_histogram = [](Block* b, int size) { + std::map unused_space_count; + int count = 0; + for (; b != nullptr; b = b->next) { + ++unused_space_count[b->space_left()]; + ++count; + } + if (size > 0) { + fprintf(stderr, " Blocks `At least %d`", size); + } else { + fprintf(stderr, " Blocks `full`"); + } + fprintf(stderr, ": %d blocks.\n", count); + for (auto p : unused_space_count) { + fprintf(stderr, " space=%4u, count=%3u\n", p.first, p.second); + } + }; + + fprintf(stderr, "TableArena unused space histogram:\n"); + fprintf(stderr, " Current: %u\n", + current_ != nullptr ? current_->space_left() : 0); + print_histogram(full_blocks_, 0); + for (size_t i = 0; i < kSmallSizes.size(); ++i) { + print_histogram(small_size_blocks_[i], kSmallSizes[i]); + } + } + + // Current allocation count. + // This can be used for checkpointing. + size_t num_allocations() const { return num_allocations_; } + + // Rollback the latest allocations until we reach back to `checkpoint` + // num_allocations. + void RollbackTo(size_t checkpoint) { + while (num_allocations_ > checkpoint) { + GOOGLE_DCHECK(!rollback_info_.empty()); + auto& info = rollback_info_.back(); + Block* b = info.block; + + VisitAlloc(b->data(), &b->start_offset, &b->end_offset, DestroyVisitor{}, + KnownTypes{}); + if (--info.count == 0) { + rollback_info_.pop_back(); + } + --num_allocations_; + } + + // Reconstruct the lists and destroy empty blocks. + auto lists = GetLists(); + current_ = full_blocks_ = nullptr; + small_size_blocks_.fill(nullptr); + + for (Block* list : lists) { + while (list != nullptr) { + Block* b = list; + list = list->next; + + if (b->start_offset == 0) { + // This is empty, free it. + b->Destroy(); + } else { + RelocateToUsedList(b); + } + } + } + } + + // Clear all rollback information. Reduces memory usage. + // Trying to rollback past num_allocations() is now impossible. + void ClearRollbackData() { + rollback_info_.clear(); + rollback_info_.shrink_to_fit(); + } + + private: + static constexpr size_t RoundUp(size_t n) { return (n + 7) & ~7; } + + using Tag = unsigned char; + + void* AllocRawInternal(uint32_t size, Tag tag) { + GOOGLE_DCHECK_GT(size, 0); + size = RoundUp(size); + + Block* to_relocate = nullptr; + Block* to_use = nullptr; + + for (size_t i = 0; i < kSmallSizes.size(); ++i) { + if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) { + to_use = to_relocate = PopBlock(small_size_blocks_[i]); + break; + } + } + + if (to_relocate != nullptr) { + // We found one in the loop. + } else if (current_ != nullptr && size + 1 <= current_->space_left()) { + to_use = current_; + } else { + // No space left anywhere, make a new block. + to_relocate = current_; + // For now we hardcode the size to one page. Note that the maximum we can + // allocate in the block according to the limits of Tag is less than 2k, + // so this can fit anything that Tag can represent. + constexpr size_t kBlockSize = 4096; + to_use = current_ = ::new (::operator new(kBlockSize)) Block(kBlockSize); + GOOGLE_DCHECK_GE(current_->space_left(), size + 1); + } + + ++num_allocations_; + if (!rollback_info_.empty() && rollback_info_.back().block == to_use) { + ++rollback_info_.back().count; + } else { + rollback_info_.push_back({to_use, 1}); + } + + void* p = to_use->Allocate(size, tag); + if (to_relocate != nullptr) { + RelocateToUsedList(to_relocate); + } + return p; + } + + static void OperatorDelete(void* p, size_t s) { +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + ::operator delete(p, s); +#else + ::operator delete(p); +#endif + } + + struct OutOfLineAlloc { + void* ptr; + uint32_t size; + }; + + template + struct TypeList { + static constexpr Tag kSize = static_cast(sizeof...(T)); + }; + + template + static void RunVisitor(char* p, uint16_t* start, Visitor visit) { + *start -= RoundUp(sizeof(T)); + visit(reinterpret_cast(p + *start)); + } + + // Visit the allocation at the passed location. + // It updates start/end to be after the visited object. + // This allows visiting a whole block by calling the function in a loop. + template + static void VisitAlloc(char* p, uint16_t* start, uint16_t* end, Visitor visit, + TypeList) { + const Tag tag = static_cast(p[*end]); + if (tag >= kFirstRawTag) { + // Raw memory. Skip it. + *start -= TagToSize(tag); + } else { + using F = void (*)(char*, uint16_t*, Visitor); + static constexpr F kFuncs[] = {&RunVisitor...}; + kFuncs[tag](p, start, visit); + } + ++*end; + } + + template + static constexpr Tag TypeTag(TypeList) { + return 0; + } + + template < + typename U, typename T, typename... Ts, + typename = typename std::enable_if::value>::type> + static constexpr Tag TypeTag(TypeList) { + return 1 + TypeTag(TypeList{}); + } + + template + static constexpr Tag TypeTag(TypeList<>) { + static_assert(std::is_trivially_destructible::value, ""); + return SizeToRawTag(sizeof(U)); + } + + using KnownTypes = + TypeList, std::array, + std::array, std::array, + FileDescriptorTables, SourceCodeInfo, FileOptions, + MessageOptions, FieldOptions, ExtensionRangeOptions, + OneofOptions, EnumOptions, EnumValueOptions, ServiceOptions, + MethodOptions>; + static constexpr Tag kFirstRawTag = KnownTypes::kSize; + + + struct DestroyVisitor { + template + void operator()(T* p) { + p->~T(); + } + void operator()(OutOfLineAlloc* p) { OperatorDelete(p->ptr, p->size); } + }; + + static uint32_t SizeToRawTag(size_t n) { return (RoundUp(n) / 8) - 1; } + + static uint32_t TagToSize(Tag tag) { + GOOGLE_DCHECK_GE(tag, kFirstRawTag); + return static_cast(tag - kFirstRawTag + 1) * 8; + } + + struct Block { + uint16_t start_offset; + uint16_t end_offset; + uint16_t capacity; + Block* next; + + // `allocated_size` is the total size of the memory block allocated. + // The `Block` structure is constructed at the start and the rest of the + // memory is used as the payload of the `Block`. + explicit Block(uint32_t allocated_size) { + start_offset = 0; + end_offset = capacity = + reinterpret_cast(this) + allocated_size - data(); + next = nullptr; + } + + char* data() { + return reinterpret_cast(this) + RoundUp(sizeof(Block)); + } + + uint32_t memory_used() { + return data() + capacity - reinterpret_cast(this); + } + uint32_t space_left() const { return end_offset - start_offset; } + + void* Allocate(uint32_t n, Tag tag) { + GOOGLE_DCHECK_LE(n + 1, space_left()); + void* p = data() + start_offset; + start_offset += n; + data()[--end_offset] = tag; + return p; + } + + void Destroy() { OperatorDelete(this, memory_used()); } + + void PrependTo(Block*& list) { + next = list; + list = this; + } + + template + void VisitBlock(Visitor visit) { + for (uint16_t s = start_offset, e = end_offset; s != 0;) { + VisitAlloc(data(), &s, &e, visit, KnownTypes{}); + } + } + }; + + Block* PopBlock(Block*& list) { + Block* res = list; + list = list->next; + return res; + } + + void RelocateToUsedList(Block* to_relocate) { + if (current_ == nullptr) { + current_ = to_relocate; + current_->next = nullptr; + return; + } else if (current_->space_left() < to_relocate->space_left()) { + std::swap(current_, to_relocate); + current_->next = nullptr; + } + + for (int i = kSmallSizes.size(); --i >= 0;) { + if (to_relocate->space_left() >= 1 + kSmallSizes[i]) { + to_relocate->PrependTo(small_size_blocks_[i]); + return; + } + } + + to_relocate->PrependTo(full_blocks_); + } + + static constexpr std::array kSmallSizes = { + {// Sizes for pointer arrays. + 8, 16, 24, 32, + // Sizes for string arrays (for descriptor names). + // The most common array sizes are 2 and 3. + 2 * sizeof(std::string), 3 * sizeof(std::string)}}; + + // Helper function to iterate all lists. + std::array GetLists() const { + std::array res; + res[0] = current_; + res[1] = full_blocks_; + std::copy(small_size_blocks_.begin(), small_size_blocks_.end(), &res[2]); + return res; + } + + Block* current_ = nullptr; + std::array small_size_blocks_ = {{}}; + Block* full_blocks_ = nullptr; + + size_t num_allocations_ = 0; + struct RollbackInfo { + Block* block; + size_t count; + }; + std::vector rollback_info_; +}; + +constexpr std::array TableArena::kSmallSizes; + } // anonymous namespace // =================================================================== @@ -579,21 +1115,27 @@ class DescriptorPool::Tables { // set of extensions numbers from fallback_database_. HASH_SET extensions_loaded_from_db_; + // Maps type name to Descriptor::WellKnownType. This is logically global + // and const, but we make it a member here to simplify its construction and + // destruction. This only has 20-ish entries and is one per DescriptorPool, + // so the overhead is small. + HASH_MAP well_known_types_; + // ----------------------------------------------------------------- // Finding items. // Find symbols. This returns a null Symbol (symbol.IsNull() is true) // if not found. - inline Symbol FindSymbol(const std::string& key) const; + inline Symbol FindSymbol(StringPiece key) const; // This implements the body of DescriptorPool::Find*ByName(). It should // really be a private method of DescriptorPool, but that would require // declaring Symbol in descriptor.h, which would drag all kinds of other // stuff into the header. Yay C++. - Symbol FindByNameHelper(const DescriptorPool* pool, const std::string& name); + Symbol FindByNameHelper(const DescriptorPool* pool, StringPiece name); // These return nullptr if not found. - inline const FileDescriptor* FindFile(const std::string& key) const; + inline const FileDescriptor* FindFile(StringPiece key) const; inline const FieldDescriptor* FindExtension(const Descriptor* extendee, int number) const; inline void FindAllExtensions(const Descriptor* extendee, @@ -627,14 +1169,37 @@ class DescriptorPool::Tables { // Allocate a string which will be destroyed when the pool is destroyed. // The string is initialized to the given value for convenience. - std::string* AllocateString(const std::string& value); - - // Allocate empty string which will be destroyed when the pool is destroyed. - std::string* AllocateEmptyString(); - - // Allocate a internal::call_once which will be destroyed when the pool is - // destroyed. - internal::once_flag* AllocateOnceDynamic(); + const std::string* AllocateString(StringPiece value); + + // Copy the input into a NUL terminated string whose lifetime is managed by + // the pool. + const char* Strdup(StringPiece value); + + // Allocates an array of strings which will be destroyed when the pool is + // destroyed. The array is initialized with the input values. + template + const std::string* AllocateStringArray(In&&... values); + + struct FieldNamesResult { + std::string* array; + int lowercase_index; + int camelcase_index; + int json_index; + }; + // Allocate all 5 names of the field: + // name, full name, lowercase, camelcase and json. + // This function will dedup the strings when possible. + // The resulting array contains `name` at index 0, `full_name` at index 1 and + // the other 3 indices are specified in the result. + FieldNamesResult AllocateFieldNames(const std::string& name, + const std::string& scope, + const std::string* opt_json_name); + + // Create an object that will be deleted when the pool is destroyed. + // The object is value initialized, and its destructor will be called if + // non-trivial. + template + Type* Create(); // Allocate a protocol message object. Some older versions of GCC have // trouble understanding explicit template instantiations in some cases, so @@ -649,34 +1214,22 @@ class DescriptorPool::Tables { private: // All other memory allocated in the pool. Must be first as other objects can // point into these. - std::vector> allocations_; - std::vector> strings_; - std::vector> messages_; - std::vector> once_dynamics_; - std::vector> file_tables_; + TableArena arena_; - SymbolsByNameMap symbols_by_name_; + SymbolsByNameSet symbols_by_name_; FilesByNameMap files_by_name_; ExtensionsGroupedByDescriptorMap extensions_; struct CheckPoint { explicit CheckPoint(const Tables* tables) - : strings_before_checkpoint(tables->strings_.size()), - messages_before_checkpoint(tables->messages_.size()), - once_dynamics_before_checkpoint(tables->once_dynamics_.size()), - file_tables_before_checkpoint(tables->file_tables_.size()), - allocations_before_checkpoint(tables->allocations_.size()), + : arena_before_checkpoint(tables->arena_.num_allocations()), pending_symbols_before_checkpoint( tables->symbols_after_checkpoint_.size()), pending_files_before_checkpoint( tables->files_after_checkpoint_.size()), pending_extensions_before_checkpoint( tables->extensions_after_checkpoint_.size()) {} - int strings_before_checkpoint; - int messages_before_checkpoint; - int once_dynamics_before_checkpoint; - int file_tables_before_checkpoint; - int allocations_before_checkpoint; + int arena_before_checkpoint; int pending_symbols_before_checkpoint; int pending_files_before_checkpoint; int pending_extensions_before_checkpoint; @@ -711,21 +1264,17 @@ class FileDescriptorTables { // ----------------------------------------------------------------- // Finding items. - // Find symbols. These return a null Symbol (symbol.IsNull() is true) - // if not found. + // Returns a null Symbol (symbol.IsNull() is true) if not found. inline Symbol FindNestedSymbol(const void* parent, - const std::string& name) const; - inline Symbol FindNestedSymbolOfType(const void* parent, - const std::string& name, - const Symbol::Type type) const; + StringPiece name) const; // These return nullptr if not found. inline const FieldDescriptor* FindFieldByNumber(const Descriptor* parent, int number) const; inline const FieldDescriptor* FindFieldByLowercaseName( - const void* parent, const std::string& lowercase_name) const; + const void* parent, StringPiece lowercase_name) const; inline const FieldDescriptor* FindFieldByCamelcaseName( - const void* parent, const std::string& camelcase_name) const; + const void* parent, StringPiece camelcase_name) const; inline const EnumValueDescriptor* FindEnumValueByNumber( const EnumDescriptor* parent, int number) const; // This creates a new EnumValueDescriptor if not found, in a thread-safe way. @@ -741,8 +1290,8 @@ class FileDescriptorTables { // as it will be used as a key in the symbols_by_parent_ map without copying. bool AddAliasUnderParent(const void* parent, const std::string& name, Symbol symbol); - bool AddFieldByNumber(const FieldDescriptor* field); - bool AddEnumValueByNumber(const EnumValueDescriptor* value); + bool AddFieldByNumber(FieldDescriptor* field); + bool AddEnumValueByNumber(EnumValueDescriptor* value); // Adds the field to the lowercase_name and camelcase_name maps. Never // fails because we allow duplicates; the first field by the name wins. @@ -773,16 +1322,16 @@ class FileDescriptorTables { const FileDescriptorTables* tables); void FieldsByCamelcaseNamesLazyInitInternal() const; - SymbolsByParentMap symbols_by_parent_; + SymbolsByParentSet symbols_by_parent_; mutable FieldsByNameMap fields_by_lowercase_name_; std::unique_ptr fields_by_lowercase_name_tmp_; mutable internal::once_flag fields_by_lowercase_name_once_; mutable FieldsByNameMap fields_by_camelcase_name_; std::unique_ptr fields_by_camelcase_name_tmp_; mutable internal::once_flag fields_by_camelcase_name_once_; - FieldsByNumberMap fields_by_number_; // Not including extensions. - EnumValuesByNumberMap enum_values_by_number_; - mutable EnumValuesByNumberMap unknown_enum_values_by_number_ + FieldsByNumberSet fields_by_number_; // Not including extensions. + EnumValuesByNumberSet enum_values_by_number_; + mutable EnumValuesByNumberSet unknown_enum_values_by_number_ PROTOBUF_GUARDED_BY(unknown_enum_values_mu_); // Populated on first request to save space, hence constness games. @@ -794,27 +1343,32 @@ class FileDescriptorTables { mutable internal::WrappedMutex unknown_enum_values_mu_; }; -DescriptorPool::Tables::Tables() - // Start some hash-map and hash-set objects with a small # of buckets - : known_bad_files_(3), - known_bad_symbols_(3), - extensions_loaded_from_db_(3), - symbols_by_name_(3), - files_by_name_(3) {} +DescriptorPool::Tables::Tables() { + well_known_types_.insert({ + {"google.protobuf.DoubleValue", Descriptor::WELLKNOWNTYPE_DOUBLEVALUE}, + {"google.protobuf.FloatValue", Descriptor::WELLKNOWNTYPE_FLOATVALUE}, + {"google.protobuf.Int64Value", Descriptor::WELLKNOWNTYPE_INT64VALUE}, + {"google.protobuf.UInt64Value", Descriptor::WELLKNOWNTYPE_UINT64VALUE}, + {"google.protobuf.Int32Value", Descriptor::WELLKNOWNTYPE_INT32VALUE}, + {"google.protobuf.UInt32Value", Descriptor::WELLKNOWNTYPE_UINT32VALUE}, + {"google.protobuf.StringValue", Descriptor::WELLKNOWNTYPE_STRINGVALUE}, + {"google.protobuf.BytesValue", Descriptor::WELLKNOWNTYPE_BYTESVALUE}, + {"google.protobuf.BoolValue", Descriptor::WELLKNOWNTYPE_BOOLVALUE}, + {"google.protobuf.Any", Descriptor::WELLKNOWNTYPE_ANY}, + {"google.protobuf.FieldMask", Descriptor::WELLKNOWNTYPE_FIELDMASK}, + {"google.protobuf.Duration", Descriptor::WELLKNOWNTYPE_DURATION}, + {"google.protobuf.Timestamp", Descriptor::WELLKNOWNTYPE_TIMESTAMP}, + {"google.protobuf.Value", Descriptor::WELLKNOWNTYPE_VALUE}, + {"google.protobuf.ListValue", Descriptor::WELLKNOWNTYPE_LISTVALUE}, + {"google.protobuf.Struct", Descriptor::WELLKNOWNTYPE_STRUCT}, + }); +} DescriptorPool::Tables::~Tables() { GOOGLE_DCHECK(checkpoints_.empty()); } FileDescriptorTables::FileDescriptorTables() - // Initialize all the hash tables to start out with a small # of buckets. - : symbols_by_parent_(3), - fields_by_lowercase_name_(3), - fields_by_lowercase_name_tmp_(new FieldsByNameMap()), - fields_by_camelcase_name_(3), - fields_by_camelcase_name_tmp_(new FieldsByNameMap()), - fields_by_number_(3), - enum_values_by_number_(3), - unknown_enum_values_by_number_(3), - locations_by_path_(3) {} + : fields_by_lowercase_name_tmp_(new FieldsByNameMap()), + fields_by_camelcase_name_tmp_(new FieldsByNameMap()) {} FileDescriptorTables::~FileDescriptorTables() {} @@ -837,6 +1391,7 @@ void DescriptorPool::Tables::ClearLastCheckpoint() { symbols_after_checkpoint_.clear(); files_after_checkpoint_.clear(); extensions_after_checkpoint_.clear(); + arena_.ClearRollbackData(); } } @@ -844,15 +1399,17 @@ void DescriptorPool::Tables::RollbackToLastCheckpoint() { GOOGLE_DCHECK(!checkpoints_.empty()); const CheckPoint& checkpoint = checkpoints_.back(); - for (int i = checkpoint.pending_symbols_before_checkpoint; + for (size_t i = checkpoint.pending_symbols_before_checkpoint; i < symbols_after_checkpoint_.size(); i++) { - symbols_by_name_.erase(symbols_after_checkpoint_[i]); + Symbol::QueryKey name; + name.name = symbols_after_checkpoint_[i]; + symbols_by_name_.erase(Symbol(&name)); } - for (int i = checkpoint.pending_files_before_checkpoint; + for (size_t i = checkpoint.pending_files_before_checkpoint; i < files_after_checkpoint_.size(); i++) { files_by_name_.erase(files_after_checkpoint_[i]); } - for (int i = checkpoint.pending_extensions_before_checkpoint; + for (size_t i = checkpoint.pending_extensions_before_checkpoint; i < extensions_after_checkpoint_.size(); i++) { extensions_.erase(extensions_after_checkpoint_[i]); } @@ -863,46 +1420,30 @@ void DescriptorPool::Tables::RollbackToLastCheckpoint() { extensions_after_checkpoint_.resize( checkpoint.pending_extensions_before_checkpoint); - strings_.resize(checkpoint.strings_before_checkpoint); - messages_.resize(checkpoint.messages_before_checkpoint); - once_dynamics_.resize(checkpoint.once_dynamics_before_checkpoint); - file_tables_.resize(checkpoint.file_tables_before_checkpoint); - allocations_.resize(checkpoint.allocations_before_checkpoint); + arena_.RollbackTo(checkpoint.arena_before_checkpoint); checkpoints_.pop_back(); } // ------------------------------------------------------------------- -inline Symbol DescriptorPool::Tables::FindSymbol(const std::string& key) const { - const Symbol* result = FindOrNull(symbols_by_name_, key.c_str()); - if (result == nullptr) { - return kNullSymbol; - } else { - return *result; - } +inline Symbol DescriptorPool::Tables::FindSymbol(StringPiece key) const { + Symbol::QueryKey name; + name.name = key; + auto it = symbols_by_name_.find(Symbol(&name)); + return it == symbols_by_name_.end() ? kNullSymbol : *it; } inline Symbol FileDescriptorTables::FindNestedSymbol( - const void* parent, const std::string& name) const { - const Symbol* result = FindOrNull( - symbols_by_parent_, PointerStringPair(parent, name.c_str())); - if (result == nullptr) { - return kNullSymbol; - } else { - return *result; - } -} - -inline Symbol FileDescriptorTables::FindNestedSymbolOfType( - const void* parent, const std::string& name, - const Symbol::Type type) const { - Symbol result = FindNestedSymbol(parent, name); - if (result.type != type) return kNullSymbol; - return result; + const void* parent, StringPiece name) const { + Symbol::QueryKey query; + query.name = name; + query.parent = parent; + auto it = symbols_by_parent_.find(Symbol(&query)); + return it == symbols_by_parent_.end() ? kNullSymbol : *it; } Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool, - const std::string& name) { + StringPiece name) { if (pool->mutex_ != nullptr) { // Fast path: the Symbol is already cached. This is just a hash lookup. ReaderMutexLock lock(pool->mutex_); @@ -934,13 +1475,25 @@ Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool, } inline const FileDescriptor* DescriptorPool::Tables::FindFile( - const std::string& key) const { - return FindPtrOrNull(files_by_name_, key.c_str()); + StringPiece key) const { + return FindPtrOrNull(files_by_name_, key); } inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber( const Descriptor* parent, int number) const { - return FindPtrOrNull(fields_by_number_, std::make_pair(parent, number)); + // If `number` is within the sequential range, just index into the parent + // without doing a table lookup. + if (parent != nullptr && // + 1 <= number && number <= parent->sequential_field_limit_) { + return parent->field(number - 1); + } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + + auto it = fields_by_number_.find(Symbol(&query)); + return it == fields_by_number_.end() ? nullptr : it->field_descriptor(); } const void* FileDescriptorTables::FindParentForFieldsByMap( @@ -962,22 +1515,22 @@ void FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic( } void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const { - for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); - it != fields_by_number_.end(); it++) { - PointerStringPair lowercase_key(FindParentForFieldsByMap(it->second), - it->second->lowercase_name().c_str()); - InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, - it->second); + for (Symbol symbol : symbols_by_parent_) { + const FieldDescriptor* field = symbol.field_descriptor(); + if (!field) continue; + PointerStringPair lowercase_key(FindParentForFieldsByMap(field), + field->lowercase_name().c_str()); + InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field); } } inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName( - const void* parent, const std::string& lowercase_name) const { + const void* parent, StringPiece lowercase_name) const { internal::call_once( fields_by_lowercase_name_once_, &FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic, this); return FindPtrOrNull(fields_by_lowercase_name_, - PointerStringPair(parent, lowercase_name.c_str())); + PointerStringPair(parent, lowercase_name)); } void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic( @@ -986,28 +1539,41 @@ void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic( } void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const { - for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); - it != fields_by_number_.end(); it++) { - PointerStringPair camelcase_key(FindParentForFieldsByMap(it->second), - it->second->camelcase_name().c_str()); - InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, - it->second); + for (Symbol symbol : symbols_by_parent_) { + const FieldDescriptor* field = symbol.field_descriptor(); + if (!field) continue; + PointerStringPair camelcase_key(FindParentForFieldsByMap(field), + field->camelcase_name().c_str()); + InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field); } } inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName( - const void* parent, const std::string& camelcase_name) const { + const void* parent, StringPiece camelcase_name) const { internal::call_once( fields_by_camelcase_name_once_, FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic, this); return FindPtrOrNull(fields_by_camelcase_name_, - PointerStringPair(parent, camelcase_name.c_str())); + PointerStringPair(parent, camelcase_name)); } inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber( const EnumDescriptor* parent, int number) const { - return FindPtrOrNull(enum_values_by_number_, - std::make_pair(parent, number)); + // If `number` is within the sequential range, just index into the parent + // without doing a table lookup. + const int base = parent->value(0)->number(); + if (base <= number && + number <= static_cast(base) + parent->sequential_value_limit_) { + return parent->value(number - base); + } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + + auto it = enum_values_by_number_.find(Symbol(&query)); + return it == enum_values_by_number_.end() ? nullptr + : it->enum_value_descriptor(); } inline const EnumValueDescriptor* @@ -1015,29 +1581,33 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( const EnumDescriptor* parent, int number) const { // First try, with map of compiled-in values. { - const EnumValueDescriptor* desc = FindPtrOrNull( - enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + const auto* value = FindEnumValueByNumber(parent, number); + if (value != nullptr) { + return value; } } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + // Second try, with reader lock held on unknown enum values: common case. { ReaderMutexLock l(&unknown_enum_values_mu_); - const EnumValueDescriptor* desc = FindPtrOrNull( - unknown_enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + auto it = unknown_enum_values_by_number_.find(Symbol(&query)); + if (it != unknown_enum_values_by_number_.end() && + it->enum_value_descriptor() != nullptr) { + return it->enum_value_descriptor(); } } // If not found, try again with writer lock held, and create new descriptor if // necessary. { WriterMutexLock l(&unknown_enum_values_mu_); - const EnumValueDescriptor* desc = FindPtrOrNull( - unknown_enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + auto it = unknown_enum_values_by_number_.find(Symbol(&query)); + if (it != unknown_enum_values_by_number_.end() && + it->enum_value_descriptor() != nullptr) { + return it->enum_value_descriptor(); } // Create an EnumValueDescriptor dynamically. We don't insert it into the @@ -1046,17 +1616,21 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( // later. std::string enum_value_name = StringPrintf("UNKNOWN_ENUM_VALUE_%s_%d", parent->name().c_str(), number); - DescriptorPool::Tables* tables = const_cast( - DescriptorPool::generated_pool()->tables_.get()); - EnumValueDescriptor* result = tables->Allocate(); - result->name_ = tables->AllocateString(enum_value_name); - result->full_name_ = - tables->AllocateString(parent->full_name() + "." + enum_value_name); + auto* pool = DescriptorPool::generated_pool(); + auto* tables = const_cast(pool->tables_.get()); + EnumValueDescriptor* result; + { + // Must lock the pool because we will do allocations in the shared arena. + MutexLockMaybe l2(pool->mutex_); + result = tables->Allocate(); + result->all_names_ = tables->AllocateStringArray( + enum_value_name, + StrCat(parent->full_name(), ".", enum_value_name)); + } result->number_ = number; result->type_ = parent; result->options_ = &EnumValueOptions::default_instance(); - InsertIfNotPresent(&unknown_enum_values_by_number_, - std::make_pair(parent, number), result); + unknown_enum_values_by_number_.insert(Symbol::EnumValue(result, 0)); return result; } } @@ -1080,7 +1654,8 @@ inline void DescriptorPool::Tables::FindAllExtensions( bool DescriptorPool::Tables::AddSymbol(const std::string& full_name, Symbol symbol) { - if (InsertIfNotPresent(&symbols_by_name_, full_name.c_str(), symbol)) { + GOOGLE_DCHECK_EQ(full_name, symbol.full_name()); + if (symbols_by_name_.insert(symbol).second) { symbols_after_checkpoint_.push_back(full_name.c_str()); return true; } else { @@ -1091,12 +1666,13 @@ bool DescriptorPool::Tables::AddSymbol(const std::string& full_name, bool FileDescriptorTables::AddAliasUnderParent(const void* parent, const std::string& name, Symbol symbol) { - PointerStringPair by_parent_key(parent, name.c_str()); - return InsertIfNotPresent(&symbols_by_parent_, by_parent_key, symbol); + GOOGLE_DCHECK_EQ(name, symbol.parent_name_key().second); + GOOGLE_DCHECK_EQ(parent, symbol.parent_name_key().first); + return symbols_by_parent_.insert(symbol).second; } bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) { - if (InsertIfNotPresent(&files_by_name_, file->name().c_str(), file)) { + if (InsertIfNotPresent(&files_by_name_, file->name(), file)) { files_after_checkpoint_.push_back(file->name().c_str()); return true; } else { @@ -1138,15 +1714,30 @@ void FileDescriptorTables::AddFieldByStylizedNames( } } -bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) { - DescriptorIntPair key(field->containing_type(), field->number()); - return InsertIfNotPresent(&fields_by_number_, key, field); +bool FileDescriptorTables::AddFieldByNumber(FieldDescriptor* field) { + // Skip fields that are at the start of the sequence. + if (field->containing_type() != nullptr && field->number() >= 1 && + field->number() <= field->containing_type()->sequential_field_limit_) { + if (field->is_extension()) { + // Conflicts with the field that already exists in the sequential range. + return false; + } + // Only return true if the field at that index matches. Otherwise it + // conflicts with the existing field in the sequential range. + return field->containing_type()->field(field->number() - 1) == field; + } + + return fields_by_number_.insert(Symbol(field)).second; } -bool FileDescriptorTables::AddEnumValueByNumber( - const EnumValueDescriptor* value) { - EnumIntPair key(value->type(), value->number()); - return InsertIfNotPresent(&enum_values_by_number_, key, value); +bool FileDescriptorTables::AddEnumValueByNumber(EnumValueDescriptor* value) { + // Skip values that are at the start of the sequence. + const int base = value->type()->value(0)->number(); + if (base <= value->number() && + value->number() <= + static_cast(base) + value->type()->sequential_value_limit_) + return true; + return enum_values_by_number_.insert(Symbol::EnumValue(value, 0)).second; } bool DescriptorPool::Tables::AddExtension(const FieldDescriptor* field) { @@ -1171,46 +1762,115 @@ Type* DescriptorPool::Tables::AllocateArray(int count) { return reinterpret_cast(AllocateBytes(sizeof(Type) * count)); } -std::string* DescriptorPool::Tables::AllocateString(const std::string& value) { - std::string* result = new std::string(value); - strings_.emplace_back(result); - return result; +const std::string* DescriptorPool::Tables::AllocateString( + StringPiece value) { + return arena_.Create(value); } -std::string* DescriptorPool::Tables::AllocateEmptyString() { - std::string* result = new std::string(); - strings_.emplace_back(result); - return result; +const char* DescriptorPool::Tables::Strdup(StringPiece value) { + char* p = AllocateArray(static_cast(value.size() + 1)); + memcpy(p, value.data(), value.size()); + p[value.size()] = 0; + return p; } -internal::once_flag* DescriptorPool::Tables::AllocateOnceDynamic() { - internal::once_flag* result = new internal::once_flag(); - once_dynamics_.emplace_back(result); +template +const std::string* DescriptorPool::Tables::AllocateStringArray(In&&... values) { + auto& array = *arena_.Create>(); + array = {{std::string(std::forward(values))...}}; + return array.data(); +} + +DescriptorPool::Tables::FieldNamesResult +DescriptorPool::Tables::AllocateFieldNames(const std::string& name, + const std::string& scope, + const std::string* opt_json_name) { + std::string lowercase_name = name; + LowerString(&lowercase_name); + + std::string camelcase_name = ToCamelCase(name, /* lower_first = */ true); + std::string json_name; + if (opt_json_name != nullptr) { + json_name = *opt_json_name; + } else { + json_name = ToJsonName(name); + } + + const bool lower_eq_name = lowercase_name == name; + const bool camel_eq_name = camelcase_name == name; + const bool json_eq_name = json_name == name; + const bool json_eq_camel = json_name == camelcase_name; + + const int total_count = 2 + (lower_eq_name ? 0 : 1) + + (camel_eq_name ? 0 : 1) + + (json_eq_name || json_eq_camel ? 0 : 1); + FieldNamesResult result{nullptr, 0, 0, 0}; + // We use std::array to allow handling of the destruction of the strings. + switch (total_count) { + case 2: + result.array = arena_.Create>()->data(); + break; + case 3: + result.array = arena_.Create>()->data(); + break; + case 4: + result.array = arena_.Create>()->data(); + break; + case 5: + result.array = arena_.Create>()->data(); + break; + } + + result.array[0] = name; + if (scope.empty()) { + result.array[1] = name; + } else { + result.array[1] = StrCat(scope, ".", name); + } + int index = 2; + if (lower_eq_name) { + result.lowercase_index = 0; + } else { + result.lowercase_index = index; + result.array[index++] = std::move(lowercase_name); + } + + if (camel_eq_name) { + result.camelcase_index = 0; + } else { + result.camelcase_index = index; + result.array[index++] = std::move(camelcase_name); + } + + if (json_eq_name) { + result.json_index = 0; + } else if (json_eq_camel) { + result.json_index = result.camelcase_index; + } else { + result.json_index = index; + result.array[index] = std::move(json_name); + } + return result; } +template +Type* DescriptorPool::Tables::Create() { + return arena_.Create(); +} + template Type* DescriptorPool::Tables::AllocateMessage(Type* /* dummy */) { - Type* result = new Type; - messages_.emplace_back(result); - return result; + return arena_.Create(); } FileDescriptorTables* DescriptorPool::Tables::AllocateFileTables() { - FileDescriptorTables* result = new FileDescriptorTables; - file_tables_.emplace_back(result); - return result; + return arena_.Create(); } void* DescriptorPool::Tables::AllocateBytes(int size) { - // TODO(kenton): Would it be worthwhile to implement this in some more - // sophisticated way? Probably not for the open source release, but for - // internal use we could easily plug in one of our existing memory pool - // allocators... if (size == 0) return nullptr; - - allocations_.emplace_back(new char[size]); - return allocations_.back().get(); + return arena_.AllocateMemory(size); } void FileDescriptorTables::BuildLocationsByPath( @@ -1283,15 +1943,16 @@ void DescriptorPool::InternalDontEnforceDependencies() { enforce_dependencies_ = false; } -void DescriptorPool::AddUnusedImportTrackFile(const std::string& file_name) { - unused_import_track_files_.insert(file_name); +void DescriptorPool::AddUnusedImportTrackFile(ConstStringParam file_name, + bool is_error) { + unused_import_track_files_[std::string(file_name)] = is_error; } void DescriptorPool::ClearUnusedImportTrackFiles() { unused_import_track_files_.clear(); } -bool DescriptorPool::InternalIsFileLoaded(const std::string& filename) const { +bool DescriptorPool::InternalIsFileLoaded(ConstStringParam filename) const { MutexLockMaybe lock(mutex_); return tables_->FindFile(filename) != nullptr; } @@ -1315,6 +1976,10 @@ DescriptorPool* NewGeneratedPool() { } // anonymous namespace +DescriptorDatabase* DescriptorPool::internal_generated_database() { + return GeneratedDatabase(); +} + DescriptorPool* DescriptorPool::internal_generated_pool() { static DescriptorPool* generated_pool = internal::OnShutdownDelete(NewGeneratedPool()); @@ -1364,7 +2029,7 @@ void DescriptorPool::InternalAddGeneratedFile( // there's nothing more important to do (read: never). const FileDescriptor* DescriptorPool::FindFileByName( - const std::string& name) const { + ConstStringParam name) const { MutexLockMaybe lock(mutex_); if (fallback_database_ != nullptr) { tables_->known_bad_symbols_.clear(); @@ -1384,7 +2049,7 @@ const FileDescriptor* DescriptorPool::FindFileByName( } const FileDescriptor* DescriptorPool::FindFileContainingSymbol( - const std::string& symbol_name) const { + ConstStringParam symbol_name) const { MutexLockMaybe lock(mutex_); if (fallback_database_ != nullptr) { tables_->known_bad_symbols_.clear(); @@ -1405,61 +2070,55 @@ const FileDescriptor* DescriptorPool::FindFileContainingSymbol( } const Descriptor* DescriptorPool::FindMessageTypeByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::MESSAGE) ? result.descriptor : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).descriptor(); } const FieldDescriptor* DescriptorPool::FindFieldByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - if (result.type == Symbol::FIELD && - !result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; + ConstStringParam name) const { + if (const FieldDescriptor* field = + tables_->FindByNameHelper(this, name).field_descriptor()) { + if (!field->is_extension()) { + return field; + } } + return nullptr; } const FieldDescriptor* DescriptorPool::FindExtensionByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - if (result.type == Symbol::FIELD && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; + ConstStringParam name) const { + if (const FieldDescriptor* field = + tables_->FindByNameHelper(this, name).field_descriptor()) { + if (field->is_extension()) { + return field; + } } + return nullptr; } const OneofDescriptor* DescriptorPool::FindOneofByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ONEOF) ? result.oneof_descriptor : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).oneof_descriptor(); } const EnumDescriptor* DescriptorPool::FindEnumTypeByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ENUM) ? result.enum_descriptor : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).enum_descriptor(); } const EnumValueDescriptor* DescriptorPool::FindEnumValueByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ENUM_VALUE) ? result.enum_value_descriptor - : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).enum_value_descriptor(); } const ServiceDescriptor* DescriptorPool::FindServiceByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::SERVICE) ? result.service_descriptor : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).service_descriptor(); } const MethodDescriptor* DescriptorPool::FindMethodByName( - const std::string& name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::METHOD) ? result.method_descriptor : nullptr; + ConstStringParam name) const { + return tables_->FindByNameHelper(this, name).method_descriptor(); } const FieldDescriptor* DescriptorPool::FindExtensionByNumber( @@ -1514,7 +2173,7 @@ const FieldDescriptor* DescriptorPool::InternalFindExtensionByNumberNoLock( } const FieldDescriptor* DescriptorPool::FindExtensionByPrintableName( - const Descriptor* extendee, const std::string& printable_name) const { + const Descriptor* extendee, ConstStringParam printable_name) const { if (extendee->extension_range_count() == 0) return nullptr; const FieldDescriptor* result = FindExtensionByName(printable_name); if (result != nullptr && result->containing_type() == extendee) { @@ -1556,8 +2215,7 @@ void DescriptorPool::FindAllExtensions( std::vector numbers; if (fallback_database_->FindAllExtensionNumbers(extendee->full_name(), &numbers)) { - for (int i = 0; i < numbers.size(); ++i) { - int number = numbers[i]; + for (int number : numbers) { if (tables_->FindExtension(extendee, number) == nullptr) { TryFindExtensionInFallbackDatabase(extendee, number); } @@ -1585,7 +2243,7 @@ const FieldDescriptor* Descriptor::FindFieldByNumber(int key) const { } const FieldDescriptor* Descriptor::FindFieldByLowercaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = file()->tables_->FindFieldByLowercaseName(this, key); if (result == nullptr || result->is_extension()) { @@ -1596,7 +2254,7 @@ const FieldDescriptor* Descriptor::FindFieldByLowercaseName( } const FieldDescriptor* Descriptor::FindFieldByCamelcaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = file()->tables_->FindFieldByCamelcaseName(this, key); if (result == nullptr || result->is_extension()) { @@ -1606,41 +2264,25 @@ const FieldDescriptor* Descriptor::FindFieldByCamelcaseName( } } -const FieldDescriptor* Descriptor::FindFieldByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && !result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } +const FieldDescriptor* Descriptor::FindFieldByName(ConstStringParam key) const { + const FieldDescriptor* field = + file()->tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && !field->is_extension() ? field : nullptr; } -const OneofDescriptor* Descriptor::FindOneofByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ONEOF); - if (!result.IsNull()) { - return result.oneof_descriptor; - } else { - return nullptr; - } +const OneofDescriptor* Descriptor::FindOneofByName(ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).oneof_descriptor(); } const FieldDescriptor* Descriptor::FindExtensionByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + const FieldDescriptor* field = + file()->tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && field->is_extension() ? field : nullptr; } const FieldDescriptor* Descriptor::FindExtensionByLowercaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = file()->tables_->FindFieldByLowercaseName(this, key); if (result == nullptr || !result->is_extension()) { @@ -1651,7 +2293,7 @@ const FieldDescriptor* Descriptor::FindExtensionByLowercaseName( } const FieldDescriptor* Descriptor::FindExtensionByCamelcaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = file()->tables_->FindFieldByCamelcaseName(this, key); if (result == nullptr || !result->is_extension()) { @@ -1661,48 +2303,35 @@ const FieldDescriptor* Descriptor::FindExtensionByCamelcaseName( } } -const Descriptor* Descriptor::FindNestedTypeByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); - if (!result.IsNull()) { - return result.descriptor; - } else { - return nullptr; - } +const Descriptor* Descriptor::FindNestedTypeByName(ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).descriptor(); } const EnumDescriptor* Descriptor::FindEnumTypeByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); - if (!result.IsNull()) { - return result.enum_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).enum_descriptor(); } const EnumValueDescriptor* Descriptor::FindEnumValueByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).enum_value_descriptor(); +} + +const FieldDescriptor* Descriptor::map_key() const { + if (!options().map_entry()) return nullptr; + GOOGLE_DCHECK_EQ(field_count(), 2); + return field(0); +} + +const FieldDescriptor* Descriptor::map_value() const { + if (!options().map_entry()) return nullptr; + GOOGLE_DCHECK_EQ(field_count(), 2); + return field(1); } const EnumValueDescriptor* EnumDescriptor::FindValueByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).enum_value_descriptor(); } const EnumValueDescriptor* EnumDescriptor::FindValueByNumber(int key) const { @@ -1715,69 +2344,39 @@ const EnumValueDescriptor* EnumDescriptor::FindValueByNumberCreatingIfUnknown( } const MethodDescriptor* ServiceDescriptor::FindMethodByName( - const std::string& key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::METHOD); - if (!result.IsNull()) { - return result.method_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return file()->tables_->FindNestedSymbol(this, key).method_descriptor(); } const Descriptor* FileDescriptor::FindMessageTypeByName( - const std::string& key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); - if (!result.IsNull()) { - return result.descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return tables_->FindNestedSymbol(this, key).descriptor(); } const EnumDescriptor* FileDescriptor::FindEnumTypeByName( - const std::string& key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); - if (!result.IsNull()) { - return result.enum_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return tables_->FindNestedSymbol(this, key).enum_descriptor(); } const EnumValueDescriptor* FileDescriptor::FindEnumValueByName( - const std::string& key) const { - Symbol result = - tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return tables_->FindNestedSymbol(this, key).enum_value_descriptor(); } const ServiceDescriptor* FileDescriptor::FindServiceByName( - const std::string& key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::SERVICE); - if (!result.IsNull()) { - return result.service_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + return tables_->FindNestedSymbol(this, key).service_descriptor(); } const FieldDescriptor* FileDescriptor::FindExtensionByName( - const std::string& key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } + ConstStringParam key) const { + const FieldDescriptor* field = + tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && field->is_extension() ? field : nullptr; } const FieldDescriptor* FileDescriptor::FindExtensionByLowercaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = tables_->FindFieldByLowercaseName(this, key); if (result == nullptr || !result->is_extension()) { return nullptr; @@ -1787,7 +2386,7 @@ const FieldDescriptor* FileDescriptor::FindExtensionByLowercaseName( } const FieldDescriptor* FileDescriptor::FindExtensionByCamelcaseName( - const std::string& key) const { + ConstStringParam key) const { const FieldDescriptor* result = tables_->FindFieldByCamelcaseName(this, key); if (result == nullptr || !result->is_extension()) { return nullptr; @@ -1844,22 +2443,23 @@ EnumDescriptor::FindReservedRangeContainingNumber(int number) const { // ------------------------------------------------------------------- bool DescriptorPool::TryFindFileInFallbackDatabase( - const std::string& name) const { + StringPiece name) const { if (fallback_database_ == nullptr) return false; - if (tables_->known_bad_files_.count(name) > 0) return false; + auto name_string = std::string(name); + if (tables_->known_bad_files_.count(name_string) > 0) return false; FileDescriptorProto file_proto; - if (!fallback_database_->FindFileByName(name, &file_proto) || + if (!fallback_database_->FindFileByName(name_string, &file_proto) || BuildFileFromDatabase(file_proto) == nullptr) { - tables_->known_bad_files_.insert(name); + tables_->known_bad_files_.insert(std::move(name_string)); return false; } return true; } -bool DescriptorPool::IsSubSymbolOfBuiltType(const std::string& name) const { - std::string prefix = name; +bool DescriptorPool::IsSubSymbolOfBuiltType(StringPiece name) const { + auto prefix = std::string(name); for (;;) { std::string::size_type dot_pos = prefix.find_last_of('.'); if (dot_pos == std::string::npos) { @@ -1869,7 +2469,7 @@ bool DescriptorPool::IsSubSymbolOfBuiltType(const std::string& name) const { Symbol symbol = tables_->FindSymbol(prefix); // If the symbol type is anything other than PACKAGE, then its complete // definition is already known. - if (!symbol.IsNull() && symbol.type != Symbol::PACKAGE) { + if (!symbol.IsNull() && symbol.type() != Symbol::PACKAGE) { return true; } } @@ -1881,10 +2481,11 @@ bool DescriptorPool::IsSubSymbolOfBuiltType(const std::string& name) const { } bool DescriptorPool::TryFindSymbolInFallbackDatabase( - const std::string& name) const { + StringPiece name) const { if (fallback_database_ == nullptr) return false; - if (tables_->known_bad_symbols_.count(name) > 0) return false; + auto name_string = std::string(name); + if (tables_->known_bad_symbols_.count(name_string) > 0) return false; FileDescriptorProto file_proto; if ( // We skip looking in the fallback database if the name is a sub-symbol @@ -1906,7 +2507,7 @@ bool DescriptorPool::TryFindSymbolInFallbackDatabase( IsSubSymbolOfBuiltType(name) // Look up file containing this symbol in fallback database. - || !fallback_database_->FindFileContainingSymbol(name, &file_proto) + || !fallback_database_->FindFileContainingSymbol(name_string, &file_proto) // Check if we've already built this file. If so, it apparently doesn't // contain the symbol we're looking for. Some DescriptorDatabases @@ -1915,7 +2516,7 @@ bool DescriptorPool::TryFindSymbolInFallbackDatabase( // Build the file. || BuildFileFromDatabase(file_proto) == nullptr) { - tables_->known_bad_symbols_.insert(name); + tables_->known_bad_symbols_.insert(std::move(name_string)); return false; } @@ -1949,7 +2550,7 @@ bool DescriptorPool::TryFindExtensionInFallbackDatabase( // =================================================================== bool FieldDescriptor::is_map_message_type() const { - return message_type_->options().map_entry(); + return type_descriptor_.message_type->options().map_entry(); } std::string FieldDescriptor::DefaultValueAsString( @@ -1957,26 +2558,19 @@ std::string FieldDescriptor::DefaultValueAsString( GOOGLE_CHECK(has_default_value()) << "No default value"; switch (cpp_type()) { case CPPTYPE_INT32: - return StrCat(default_value_int32()); - break; + return StrCat(default_value_int32_t()); case CPPTYPE_INT64: - return StrCat(default_value_int64()); - break; + return StrCat(default_value_int64_t()); case CPPTYPE_UINT32: - return StrCat(default_value_uint32()); - break; + return StrCat(default_value_uint32_t()); case CPPTYPE_UINT64: - return StrCat(default_value_uint64()); - break; + return StrCat(default_value_uint64_t()); case CPPTYPE_FLOAT: return SimpleFtoa(default_value_float()); - break; case CPPTYPE_DOUBLE: return SimpleDtoa(default_value_double()); - break; case CPPTYPE_BOOL: return default_value_bool() ? "true" : "false"; - break; case CPPTYPE_STRING: if (quote_string_type) { return "\"" + CEscape(default_value_string()) + "\""; @@ -1987,10 +2581,8 @@ std::string FieldDescriptor::DefaultValueAsString( return default_value_string(); } } - break; case CPPTYPE_ENUM: return default_value_enum()->name(); - break; case CPPTYPE_MESSAGE: GOOGLE_LOG(DFATAL) << "Messages can't have default values!"; break; @@ -2117,7 +2709,9 @@ void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { if (has_json_name_) { proto->set_json_name(json_name()); } - + if (proto3_optional_) { + proto->set_proto3_optional(true); + } // Some compilers do not allow static_cast directly between two enum types, // so we must cast to int first. proto->set_label(static_cast( @@ -2251,34 +2845,35 @@ bool RetrieveOptionsAssumingRightPool( const Reflection* reflection = options.GetReflection(); std::vector fields; reflection->ListFields(options, &fields); - for (int i = 0; i < fields.size(); i++) { + for (const FieldDescriptor* field : fields) { int count = 1; bool repeated = false; - if (fields[i]->is_repeated()) { - count = reflection->FieldSize(options, fields[i]); + if (field->is_repeated()) { + count = reflection->FieldSize(options, field); repeated = true; } for (int j = 0; j < count; j++) { std::string fieldval; - if (fields[i]->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { std::string tmp; TextFormat::Printer printer; + printer.SetExpandAny(true); printer.SetInitialIndentLevel(depth + 1); - printer.PrintFieldValueToString(options, fields[i], repeated ? j : -1, + printer.PrintFieldValueToString(options, field, repeated ? j : -1, &tmp); fieldval.append("{\n"); fieldval.append(tmp); fieldval.append(depth * 2, ' '); fieldval.append("}"); } else { - TextFormat::PrintFieldValueToString(options, fields[i], - repeated ? j : -1, &fieldval); + TextFormat::PrintFieldValueToString(options, field, repeated ? j : -1, + &fieldval); } std::string name; - if (fields[i]->is_extension()) { - name = "(." + fields[i]->full_name() + ")"; + if (field->is_extension()) { + name = "(." + field->full_name() + ")"; } else { - name = fields[i]->name(); + name = field->name(); } option_entries->push_back(name + " = " + fieldval); } @@ -2307,7 +2902,12 @@ bool RetrieveOptions(int depth, const Message& options, DynamicMessageFactory factory; std::unique_ptr dynamic_options( factory.GetPrototype(option_descriptor)->New()); - if (dynamic_options->ParseFromString(options.SerializeAsString())) { + std::string serialized = options.SerializeAsString(); + io::CodedInputStream input( + reinterpret_cast(serialized.c_str()), + serialized.size()); + input.SetExtensionRegistry(pool, &factory); + if (dynamic_options->ParseFromCodedStream(&input)) { return RetrieveOptionsAssumingRightPool(depth, *dynamic_options, option_entries); } else { @@ -2335,9 +2935,8 @@ bool FormatLineOptions(int depth, const Message& options, std::string prefix(depth * 2, ' '); std::vector all_options; if (RetrieveOptions(depth, options, pool, &all_options)) { - for (int i = 0; i < all_options.size(); i++) { - strings::SubstituteAndAppend(output, "$0option $1;\n", prefix, - all_options[i]); + for (const std::string& option : all_options) { + strings::SubstituteAndAppend(output, "$0option $1;\n", prefix, option); } } return !all_options.empty(); @@ -2367,8 +2966,9 @@ class SourceLocationCommentPrinter { void AddPreComment(std::string* output) { if (have_source_loc_) { // Detached leading comments. - for (int i = 0; i < source_loc_.leading_detached_comments.size(); ++i) { - *output += FormatComment(source_loc_.leading_detached_comments[i]); + for (const std::string& leading_detached_comment : + source_loc_.leading_detached_comments) { + *output += FormatComment(leading_detached_comment); *output += "\n"; } // Attached leading comments. @@ -2390,8 +2990,7 @@ class SourceLocationCommentPrinter { StripWhitespace(&stripped_comment); std::vector lines = Split(stripped_comment, "\n"); std::string output; - for (int i = 0; i < lines.size(); ++i) { - const std::string& line = lines[i]; + for (const std::string& line : lines) { strings::SubstituteAndAppend(&output, "$0// $1\n", prefix_, line); } return output; @@ -2422,7 +3021,7 @@ std::string FileDescriptor::DebugStringWithOptions( debug_string_options); syntax_comment.AddPreComment(&contents); strings::SubstituteAndAppend(&contents, "syntax = \"$0\";\n\n", - SyntaxName(syntax())); + SyntaxName(syntax())); syntax_comment.AddPostComment(&contents); } @@ -2439,13 +3038,13 @@ std::string FileDescriptor::DebugStringWithOptions( for (int i = 0; i < dependency_count(); i++) { if (public_dependencies.count(i) > 0) { strings::SubstituteAndAppend(&contents, "import public \"$0\";\n", - dependency(i)->name()); + dependency(i)->name()); } else if (weak_dependencies.count(i) > 0) { strings::SubstituteAndAppend(&contents, "import weak \"$0\";\n", - dependency(i)->name()); + dependency(i)->name()); } else { strings::SubstituteAndAppend(&contents, "import \"$0\";\n", - dependency(i)->name()); + dependency(i)->name()); } } @@ -2496,10 +3095,9 @@ std::string FileDescriptor::DebugStringWithOptions( if (i > 0) contents.append("}\n\n"); containing_type = extension(i)->containing_type(); strings::SubstituteAndAppend(&contents, "extend .$0 {\n", - containing_type->full_name()); + containing_type->full_name()); } - extension(i)->DebugString(1, FieldDescriptor::PRINT_LABEL, &contents, - debug_string_options); + extension(i)->DebugString(1, &contents, debug_string_options); } if (extension_count() > 0) contents.append("}\n\n"); @@ -2566,9 +3164,8 @@ void Descriptor::DebugString(int depth, std::string* contents, enum_type(i)->DebugString(depth, contents, debug_string_options); } for (int i = 0; i < field_count(); i++) { - if (field(i)->containing_oneof() == nullptr) { - field(i)->DebugString(depth, FieldDescriptor::PRINT_LABEL, contents, - debug_string_options); + if (field(i)->real_containing_oneof() == nullptr) { + field(i)->DebugString(depth, contents, debug_string_options); } else if (field(i)->containing_oneof()->field(0) == field(i)) { // This is the first field in this oneof, so print the whole oneof. field(i)->containing_oneof()->DebugString(depth, contents, @@ -2578,8 +3175,8 @@ void Descriptor::DebugString(int depth, std::string* contents, for (int i = 0; i < extension_range_count(); i++) { strings::SubstituteAndAppend(contents, "$0 extensions $1 to $2;\n", prefix, - extension_range(i)->start, - extension_range(i)->end - 1); + extension_range(i)->start, + extension_range(i)->end - 1); } // Group extensions by what they extend, so they can be printed out together. @@ -2589,10 +3186,9 @@ void Descriptor::DebugString(int depth, std::string* contents, if (i > 0) strings::SubstituteAndAppend(contents, "$0 }\n", prefix); containing_type = extension(i)->containing_type(); strings::SubstituteAndAppend(contents, "$0 extend .$1 {\n", prefix, - containing_type->full_name()); + containing_type->full_name()); } - extension(i)->DebugString(depth + 1, FieldDescriptor::PRINT_LABEL, contents, - debug_string_options); + extension(i)->DebugString(depth + 1, contents, debug_string_options); } if (extension_count() > 0) strings::SubstituteAndAppend(contents, "$0 }\n", prefix); @@ -2603,9 +3199,11 @@ void Descriptor::DebugString(int depth, std::string* contents, const Descriptor::ReservedRange* range = reserved_range(i); if (range->end == range->start + 1) { strings::SubstituteAndAppend(contents, "$0, ", range->start); + } else if (range->end > FieldDescriptor::kMaxNumber) { + strings::SubstituteAndAppend(contents, "$0 to max, ", range->start); } else { strings::SubstituteAndAppend(contents, "$0 to $1, ", range->start, - range->end - 1); + range->end - 1); } } contents->replace(contents->size() - 2, 2, ";\n"); @@ -2615,7 +3213,7 @@ void Descriptor::DebugString(int depth, std::string* contents, strings::SubstituteAndAppend(contents, "$0 reserved ", prefix); for (int i = 0; i < reserved_name_count(); i++) { strings::SubstituteAndAppend(contents, "\"$0\", ", - CEscape(reserved_name(i))); + CEscape(reserved_name(i))); } contents->replace(contents->size() - 2, 2, ";\n"); } @@ -2635,10 +3233,10 @@ std::string FieldDescriptor::DebugStringWithOptions( int depth = 0; if (is_extension()) { strings::SubstituteAndAppend(&contents, "extend .$0 {\n", - containing_type()->full_name()); + containing_type()->full_name()); depth = 1; } - DebugString(depth, PRINT_LABEL, &contents, debug_string_options); + DebugString(depth, &contents, debug_string_options); if (is_extension()) { contents.append("}\n"); } @@ -2658,7 +3256,7 @@ std::string FieldDescriptor::FieldTypeNameDebugString() const { } void FieldDescriptor::DebugString( - int depth, PrintLabelFlag print_label_flag, std::string* contents, + int depth, std::string* contents, const DebugStringOptions& debug_string_options) const { std::string prefix(depth * 2, ' '); std::string field_type; @@ -2673,20 +3271,12 @@ void FieldDescriptor::DebugString( field_type = FieldTypeNameDebugString(); } - bool print_label = true; - // Determine whether to omit label: - // 1. For an optional field, omit label if it's in oneof or in proto3. - // 2. For a repeated field, omit label if it's a map. - if (is_optional() && (print_label_flag == OMIT_LABEL || - file()->syntax() == FileDescriptor::SYNTAX_PROTO3)) { - print_label = false; - } else if (is_map()) { - print_label = false; - } - std::string label; - if (print_label) { - label = kLabelToName[this->label()]; - label.push_back(' '); + std::string label = StrCat(kLabelToName[this->label()], " "); + + // Label is omitted for maps, oneof, and plain proto3 fields. + if (is_map() || real_containing_oneof() || + (is_optional() && !has_optional_keyword())) { + label.clear(); } SourceLocationCommentPrinter comment_printer(this, prefix, @@ -2701,12 +3291,12 @@ void FieldDescriptor::DebugString( if (has_default_value()) { bracketed = true; strings::SubstituteAndAppend(contents, " [default = $0", - DefaultValueAsString(true)); + DefaultValueAsString(true)); } if (has_json_name_) { if (!bracketed) { bracketed = true; - contents->append("["); + contents->append(" ["); } else { contents->append(", "); } @@ -2771,8 +3361,7 @@ void OneofDescriptor::DebugString( } else { contents->append("\n"); for (int i = 0; i < field_count(); i++) { - field(i)->DebugString(depth, FieldDescriptor::OMIT_LABEL, contents, - debug_string_options); + field(i)->DebugString(depth, contents, debug_string_options); } strings::SubstituteAndAppend(contents, "$0}\n", prefix); } @@ -2815,9 +3404,11 @@ void EnumDescriptor::DebugString( const EnumDescriptor::ReservedRange* range = reserved_range(i); if (range->end == range->start) { strings::SubstituteAndAppend(contents, "$0, ", range->start); + } else if (range->end == INT_MAX) { + strings::SubstituteAndAppend(contents, "$0 to max, ", range->start); } else { strings::SubstituteAndAppend(contents, "$0 to $1, ", range->start, - range->end); + range->end); } } contents->replace(contents->size() - 2, 2, ";\n"); @@ -2827,7 +3418,7 @@ void EnumDescriptor::DebugString( strings::SubstituteAndAppend(contents, "$0 reserved ", prefix); for (int i = 0; i < reserved_name_count(); i++) { strings::SubstituteAndAppend(contents, "\"$0\", ", - CEscape(reserved_name(i))); + CEscape(reserved_name(i))); } contents->replace(contents->size() - 2, 2, ";\n"); } @@ -2933,7 +3524,7 @@ void MethodDescriptor::DebugString( if (FormatLineOptions(depth, options(), service()->file()->pool(), &formatted_options)) { strings::SubstituteAndAppend(contents, " {\n$0$1}\n", formatted_options, - prefix); + prefix); } else { contents->append(";\n"); } @@ -2950,7 +3541,7 @@ bool FileDescriptor::GetSourceLocation(const std::vector& path, if (source_code_info_) { if (const SourceCodeInfo_Location* loc = tables_->GetSourceLocation(path, source_code_info_)) { - const RepeatedField& span = loc->span(); + const RepeatedField& span = loc->span(); if (span.size() == 3 || span.size() == 4) { out_location->start_line = span.Get(0); out_location->start_column = span.Get(1); @@ -3246,10 +3837,10 @@ class DescriptorBuilder { // Like AddSymbol(), but succeeds if the symbol is already defined as long // as the existing definition is also a package (because it's OK to define // the same package in two different files). Also adds all parents of the - // packgae to the symbol table (e.g. AddPackage("foo.bar", ...) will add + // package to the symbol table (e.g. AddPackage("foo.bar", ...) will add // "foo.bar" and "foo" to the table). void AddPackage(const std::string& name, const Message& proto, - const FileDescriptor* file); + FileDescriptor* file); // Checks that the symbol name contains only alphanumeric characters and // underscores. Records an error otherwise. @@ -3283,25 +3874,26 @@ class DescriptorBuilder { DescriptorT* descriptor, const std::vector& options_path, const std::string& option_name); - // Allocate string on the string pool and initialize it to full proto name. + // Allocates an array of two strings, the first one is a copy of `proto_name`, + // and the second one is the full name. // Full proto name is "scope.proto_name" if scope is non-empty and // "proto_name" otherwise. - std::string* AllocateNameString(const std::string& scope, - const std::string& proto_name); + const std::string* AllocateNameStrings(const std::string& scope, + const std::string& proto_name); // These methods all have the same signature for the sake of the BUILD_ARRAY // macro, below. void BuildMessage(const DescriptorProto& proto, const Descriptor* parent, Descriptor* result); void BuildFieldOrExtension(const FieldDescriptorProto& proto, - const Descriptor* parent, FieldDescriptor* result, + Descriptor* parent, FieldDescriptor* result, bool is_extension); - void BuildField(const FieldDescriptorProto& proto, const Descriptor* parent, + void BuildField(const FieldDescriptorProto& proto, Descriptor* parent, FieldDescriptor* result) { BuildFieldOrExtension(proto, parent, result, false); } - void BuildExtension(const FieldDescriptorProto& proto, - const Descriptor* parent, FieldDescriptor* result) { + void BuildExtension(const FieldDescriptorProto& proto, Descriptor* parent, + FieldDescriptor* result) { BuildFieldOrExtension(proto, parent, result, true); } void BuildExtensionRange(const DescriptorProto::ExtensionRange& proto, @@ -3415,13 +4007,13 @@ class DescriptorBuilder { // Convenience functions to set an int field the right way, depending on // its wire type (a single int CppType can represent multiple wire types). - void SetInt32(int number, int32 value, FieldDescriptor::Type type, + void SetInt32(int number, int32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetInt64(int number, int64 value, FieldDescriptor::Type type, + void SetInt64(int number, int64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt32(int number, uint32 value, FieldDescriptor::Type type, + void SetUInt32(int number, uint32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt64(int number, uint64 value, FieldDescriptor::Type type, + void SetUInt64(int number, uint64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); // A helper function that adds an error at the specified location of the @@ -3436,7 +4028,11 @@ class DescriptorBuilder { // A helper function that adds an error at the location of the option name // and returns false. bool AddNameError(const std::string& msg) { +#ifdef PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ + return true; +#else // PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ return AddOptionError(DescriptorPool::ErrorCollector::OPTION_NAME, msg); +#endif // PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ } // A helper function that adds an error at the location of the option name @@ -3493,7 +4089,7 @@ class DescriptorBuilder { return pool->enforce_weak_; } static inline bool get_is_placeholder(const Descriptor* descriptor) { - return descriptor->is_placeholder_; + return descriptor != nullptr && descriptor->is_placeholder_; } static inline void assert_mutex_held(const DescriptorPool* pool) { if (pool->mutex_ != nullptr) { @@ -3517,6 +4113,9 @@ class DescriptorBuilder { const EnumDescriptorProto& proto); void ValidateEnumValueOptions(EnumValueDescriptor* enum_value, const EnumValueDescriptorProto& proto); + void ValidateExtensionRangeOptions( + const std::string& full_name, Descriptor::ExtensionRange* extension_range, + const DescriptorProto_ExtensionRange& proto); void ValidateServiceOptions(ServiceDescriptor* service, const ServiceDescriptorProto& proto); void ValidateMethodOptions(MethodDescriptor* method, @@ -3732,7 +4331,7 @@ Symbol DescriptorBuilder::FindSymbol(const std::string& name, bool build_it) { return result; } - if (result.type == Symbol::PACKAGE) { + if (result.type() == Symbol::PACKAGE) { // Arg, this is overcomplicated. The symbol is a package name. It could // be that the package was defined in multiple files. result.GetFile() // returns the first file we saw that used this package. We've determined @@ -3843,16 +4442,16 @@ Symbol DescriptorBuilder::LookupSymbol( return result; } -static bool ValidateQualifiedName(const std::string& name) { +static bool ValidateQualifiedName(StringPiece name) { bool last_was_period = false; - for (int i = 0; i < name.size(); i++) { + for (char character : name) { // I don't trust isalnum() due to locales. :( - if (('a' <= name[i] && name[i] <= 'z') || - ('A' <= name[i] && name[i] <= 'Z') || - ('0' <= name[i] && name[i] <= '9') || (name[i] == '_')) { + if (('a' <= character && character <= 'z') || + ('A' <= character && character <= 'Z') || + ('0' <= character && character <= '9') || (character == '_')) { last_was_period = false; - } else if (name[i] == '.') { + } else if (character == '.') { if (last_was_period) return false; last_was_period = true; } else { @@ -3863,36 +4462,35 @@ static bool ValidateQualifiedName(const std::string& name) { return !name.empty() && !last_was_period; } -Symbol DescriptorPool::NewPlaceholder(const std::string& name, +Symbol DescriptorPool::NewPlaceholder(StringPiece name, PlaceholderType placeholder_type) const { MutexLockMaybe lock(mutex_); return NewPlaceholderWithMutexHeld(name, placeholder_type); } Symbol DescriptorPool::NewPlaceholderWithMutexHeld( - const std::string& name, PlaceholderType placeholder_type) const { + StringPiece name, PlaceholderType placeholder_type) const { if (mutex_) { mutex_->AssertHeld(); } // Compute names. - const std::string* placeholder_full_name; - const std::string* placeholder_name; + StringPiece placeholder_full_name; + StringPiece placeholder_name; const std::string* placeholder_package; if (!ValidateQualifiedName(name)) return kNullSymbol; if (name[0] == '.') { // Fully-qualified. - placeholder_full_name = tables_->AllocateString(name.substr(1)); + placeholder_full_name = name.substr(1); } else { - placeholder_full_name = tables_->AllocateString(name); + placeholder_full_name = name; } - std::string::size_type dotpos = placeholder_full_name->find_last_of('.'); + std::string::size_type dotpos = placeholder_full_name.find_last_of('.'); if (dotpos != std::string::npos) { placeholder_package = - tables_->AllocateString(placeholder_full_name->substr(0, dotpos)); - placeholder_name = - tables_->AllocateString(placeholder_full_name->substr(dotpos + 1)); + tables_->AllocateString(placeholder_full_name.substr(0, dotpos)); + placeholder_name = placeholder_full_name.substr(dotpos + 1); } else { placeholder_package = &internal::GetEmptyString(); placeholder_name = placeholder_full_name; @@ -3900,7 +4498,7 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // Create the placeholders. FileDescriptor* placeholder_file = NewPlaceholderFileWithMutexHeld( - *placeholder_full_name + ".placeholder.proto"); + StrCat(placeholder_full_name, ".placeholder.proto")); placeholder_file->package_ = placeholder_package; if (placeholder_type == PLACEHOLDER_ENUM) { @@ -3910,8 +4508,8 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( EnumDescriptor* placeholder_enum = &placeholder_file->enum_types_[0]; memset(static_cast(placeholder_enum), 0, sizeof(*placeholder_enum)); - placeholder_enum->full_name_ = placeholder_full_name; - placeholder_enum->name_ = placeholder_name; + placeholder_enum->all_names_ = + tables_->AllocateStringArray(placeholder_name, placeholder_full_name); placeholder_enum->file_ = placeholder_file; placeholder_enum->options_ = &EnumOptions::default_instance(); placeholder_enum->is_placeholder_ = true; @@ -3920,18 +4518,18 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // Enums must have at least one value. placeholder_enum->value_count_ = 1; placeholder_enum->values_ = tables_->AllocateArray(1); + // Disable fast-path lookup for this enum. + placeholder_enum->sequential_value_limit_ = -1; EnumValueDescriptor* placeholder_value = &placeholder_enum->values_[0]; memset(static_cast(placeholder_value), 0, sizeof(*placeholder_value)); - placeholder_value->name_ = tables_->AllocateString("PLACEHOLDER_VALUE"); // Note that enum value names are siblings of their type, not children. - placeholder_value->full_name_ = - placeholder_package->empty() - ? placeholder_value->name_ - : tables_->AllocateString(*placeholder_package + - ".PLACEHOLDER_VALUE"); + placeholder_value->all_names_ = tables_->AllocateStringArray( + "PLACEHOLDER_VALUE", placeholder_package->empty() + ? "PLACEHOLDER_VALUE" + : *placeholder_package + ".PLACEHOLDER_VALUE"); placeholder_value->number_ = 0; placeholder_value->type_ = placeholder_enum; @@ -3946,8 +4544,8 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( memset(static_cast(placeholder_message), 0, sizeof(*placeholder_message)); - placeholder_message->full_name_ = placeholder_full_name; - placeholder_message->name_ = placeholder_name; + placeholder_message->all_names_ = + tables_->AllocateStringArray(placeholder_name, placeholder_full_name); placeholder_message->file_ = placeholder_file; placeholder_message->options_ = &MessageOptions::default_instance(); placeholder_message->is_placeholder_ = true; @@ -3961,6 +4559,7 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // kMaxNumber + 1 because ExtensionRange::end is exclusive. placeholder_message->extension_ranges_->end = FieldDescriptor::kMaxNumber + 1; + placeholder_message->extension_ranges_->options_ = nullptr; } return Symbol(placeholder_message); @@ -3968,13 +4567,13 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( } FileDescriptor* DescriptorPool::NewPlaceholderFile( - const std::string& name) const { + StringPiece name) const { MutexLockMaybe lock(mutex_); return NewPlaceholderFileWithMutexHeld(name); } FileDescriptor* DescriptorPool::NewPlaceholderFileWithMutexHeld( - const std::string& name) const { + StringPiece name) const { if (mutex_) { mutex_->AssertHeld(); } @@ -3988,7 +4587,7 @@ FileDescriptor* DescriptorPool::NewPlaceholderFileWithMutexHeld( placeholder->tables_ = &FileDescriptorTables::GetEmptyInstance(); placeholder->source_code_info_ = &SourceCodeInfo::default_instance(); placeholder->is_placeholder_ = true; - placeholder->syntax_ = FileDescriptor::SYNTAX_PROTO2; + placeholder->syntax_ = FileDescriptor::SYNTAX_UNKNOWN; placeholder->finished_building_ = true; // All other fields are zero or nullptr. @@ -4002,6 +4601,11 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name, // Use its file as the parent instead. if (parent == nullptr) parent = file_; + if (full_name.find('\0') != std::string::npos) { + AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + full_name + "\" contains null character."); + return false; + } if (tables_->AddSymbol(full_name, symbol)) { if (!file_tables_->AddAliasUnderParent(parent, name, symbol)) { // This is only possible if there was already an error adding something of @@ -4032,39 +4636,48 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name, // Symbol seems to have been defined in a different file. AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, "\"" + full_name + "\" is already defined in file \"" + - other_file->name() + "\"."); + (other_file == nullptr ? "null" : other_file->name()) + + "\"."); } return false; } } void DescriptorBuilder::AddPackage(const std::string& name, - const Message& proto, - const FileDescriptor* file) { - if (tables_->AddSymbol(name, Symbol(file))) { - // Success. Also add parent package, if any. + const Message& proto, FileDescriptor* file) { + if (name.find('\0') != std::string::npos) { + AddError(name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + name + "\" contains null character."); + return; + } + + Symbol existing_symbol = tables_->FindSymbol(name); + // It's OK to redefine a package. + if (existing_symbol.IsNull()) { + auto* package = tables_->AllocateArray(1); + // If the name is the package name, then it is already in the arena. + // If not, copy it there. It came from the call to AddPackage below. + package->name = + &name == &file->package() ? &name : tables_->AllocateString(name); + package->file = file; + tables_->AddSymbol(*package->name, Symbol(package)); + // Also add parent package, if any. std::string::size_type dot_pos = name.find_last_of('.'); if (dot_pos == std::string::npos) { // No parents. ValidateSymbolName(name, name, proto); } else { // Has parent. - std::string* parent_name = - tables_->AllocateString(name.substr(0, dot_pos)); - AddPackage(*parent_name, proto, file); + AddPackage(name.substr(0, dot_pos), proto, file); ValidateSymbolName(name.substr(dot_pos + 1), name, proto); } - } else { - Symbol existing_symbol = tables_->FindSymbol(name); - // It's OK to redefine a package. - if (existing_symbol.type != Symbol::PACKAGE) { - // Symbol seems to have been defined in a different file. - AddError(name, proto, DescriptorPool::ErrorCollector::NAME, - "\"" + name + - "\" is already defined (as something other than " - "a package) in file \"" + - existing_symbol.GetFile()->name() + "\"."); - } + } else if (existing_symbol.type() != Symbol::PACKAGE) { + // Symbol seems to have been defined in a different file. + AddError(name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + name + + "\" is already defined (as something other than " + "a package) in file \"" + + existing_symbol.GetFile()->name() + "\"."); } } @@ -4075,11 +4688,11 @@ void DescriptorBuilder::ValidateSymbolName(const std::string& name, AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, "Missing name."); } else { - for (int i = 0; i < name.size(); i++) { + for (char character : name) { // I don't trust isalnum() due to locales. :( - if ((name[i] < 'a' || 'z' < name[i]) && - (name[i] < 'A' || 'Z' < name[i]) && - (name[i] < '0' || '9' < name[i]) && (name[i] != '_')) { + if ((character < 'a' || 'z' < character) && + (character < 'A' || 'Z' < character) && + (character < '0' || '9' < character) && (character != '_')) { AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME, "\"" + name + "\" is not a valid identifier."); } @@ -4159,12 +4772,12 @@ void DescriptorBuilder::AllocateOptionsImpl( if (!unknown_fields.empty()) { // Can not use options->GetDescriptor() which may case deadlock. Symbol msg_symbol = tables_->FindSymbol(option_name); - if (msg_symbol.type == Symbol::MESSAGE) { + if (msg_symbol.type() == Symbol::MESSAGE) { for (int i = 0; i < unknown_fields.field_count(); ++i) { assert_mutex_held(pool_); const FieldDescriptor* field = pool_->InternalFindExtensionByNumberNoLock( - msg_symbol.descriptor, unknown_fields.field(i).number()); + msg_symbol.descriptor(), unknown_fields.field(i).number()); if (field) { unused_dependency_.erase(field->file()); } @@ -4185,13 +4798,13 @@ void DescriptorBuilder::AllocateOptionsImpl( void DescriptorBuilder::AddRecursiveImportError( const FileDescriptorProto& proto, int from_here) { std::string error_message("File recursively imports itself: "); - for (int i = from_here; i < tables_->pending_files_.size(); i++) { + for (size_t i = from_here; i < tables_->pending_files_.size(); i++) { error_message.append(tables_->pending_files_[i]); error_message.append(" -> "); } error_message.append(proto.name()); - if (from_here < tables_->pending_files_.size() - 1) { + if (static_cast(from_here) < tables_->pending_files_.size() - 1) { AddError(tables_->pending_files_[from_here + 1], proto, DescriptorPool::ErrorCollector::IMPORT, error_message); } else { @@ -4264,7 +4877,7 @@ const FileDescriptor* DescriptorBuilder::BuildFile( // mid-file, but that's pretty ugly, and I'm pretty sure there are // some languages out there that do not allow recursive dependencies // at all. - for (int i = 0; i < tables_->pending_files_.size(); i++) { + for (size_t i = 0; i < tables_->pending_files_.size(); i++) { if (tables_->pending_files_[i] == proto.name()) { AddRecursiveImportError(proto, i); return nullptr; @@ -4354,6 +4967,12 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( } result->pool_ = pool_; + if (result->name().find('\0') != std::string::npos) { + AddError(result->name(), proto, DescriptorPool::ErrorCollector::NAME, + "\"" + result->name() + "\" contains null character."); + return nullptr; + } + // Add to tables. if (!tables_->AddFile(result)) { AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER, @@ -4371,18 +4990,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependency_count_ = proto.dependency_size(); result->dependencies_ = tables_->AllocateArray(proto.dependency_size()); - if (pool_->lazily_build_dependencies_) { - result->dependencies_once_ = tables_->AllocateOnceDynamic(); - result->dependencies_names_ = - tables_->AllocateArray(proto.dependency_size()); - if (proto.dependency_size() > 0) { - memset(result->dependencies_names_, 0, - sizeof(*result->dependencies_names_) * proto.dependency_size()); - } - } else { - result->dependencies_once_ = nullptr; - result->dependencies_names_ = nullptr; - } + result->dependencies_once_ = nullptr; unused_dependency_.clear(); std::set weak_deps; for (int i = 0; i < proto.weak_dependency_size(); ++i) { @@ -4428,8 +5036,19 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependencies_[i] = dependency; if (pool_->lazily_build_dependencies_ && !dependency) { - result->dependencies_names_[i] = - tables_->AllocateString(proto.dependency(i)); + if (result->dependencies_once_ == nullptr) { + result->dependencies_once_ = + tables_->Create(); + result->dependencies_once_->dependencies_names = + tables_->AllocateArray(proto.dependency_size()); + if (proto.dependency_size() > 0) { + std::fill_n(result->dependencies_once_->dependencies_names, + proto.dependency_size(), nullptr); + } + } + + result->dependencies_once_->dependencies_names[i] = + tables_->Strdup(proto.dependency(i)); } } @@ -4489,9 +5108,8 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( BUILD_ARRAY(proto, result, extension, BuildExtension, nullptr); // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result); } @@ -4532,8 +5150,10 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( // Again, see comments at InternalSetLazilyBuildDependencies about error - // checking. - if (!unused_dependency_.empty() && !pool_->lazily_build_dependencies_) { + // checking. Also, don't log unused dependencies if there were previous + // errors, since the results might be inaccurate. + if (!had_errors_ && !unused_dependency_.empty() && + !pool_->lazily_build_dependencies_) { LogUnusedDependency(proto, result); } @@ -4545,16 +5165,14 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( } -std::string* DescriptorBuilder::AllocateNameString( +const std::string* DescriptorBuilder::AllocateNameStrings( const std::string& scope, const std::string& proto_name) { - std::string* full_name; if (scope.empty()) { - full_name = tables_->AllocateString(proto_name); + return tables_->AllocateStringArray(proto_name, proto_name); } else { - full_name = tables_->AllocateEmptyString(); - *full_name = StrCat(scope, ".", proto_name); + return tables_->AllocateStringArray(proto_name, + StrCat(scope, ".", proto_name)); } - return full_name; } void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, @@ -4562,15 +5180,32 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, Descriptor* result) { const std::string& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - std::string* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); + result->all_names_ = AllocateNameStrings(scope, proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; result->file_ = file_; result->containing_type_ = parent; result->is_placeholder_ = false; result->is_unqualified_placeholder_ = false; + result->well_known_type_ = Descriptor::WELLKNOWNTYPE_UNSPECIFIED; + + auto it = pool_->tables_->well_known_types_.find(result->full_name()); + if (it != pool_->tables_->well_known_types_.end()) { + result->well_known_type_ = it->second; + } + + // Calculate the continuous sequence of fields. + // These can be fast-path'd during lookup and don't need to be added to the + // tables. + // We use uint16_t to save space for sequential_field_limit_, so stop before + // overflowing it. Worst case, we are not taking full advantage on huge + // messages, but it is unlikely. + result->sequential_field_limit_ = 0; + for (int i = 0; i < std::numeric_limits::max() && + i < proto.field_size() && proto.field(i).number() == i + 1; + ++i) { + result->sequential_field_limit_ = i + 1; + } // Build oneofs first so that fields and extension ranges can refer to them. BUILD_ARRAY(proto, result, oneof_decl, BuildOneof, result); @@ -4592,9 +5227,8 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, } // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, DescriptorProto::kOptionsFieldNumber, "google.protobuf.MessageOptions"); @@ -4610,9 +5244,9 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, AddError(result->full_name(), proto.reserved_range(i), DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Reserved range $0 to $1 overlaps with " - "already-defined range $2 to $3.", - range2.start(), range2.end() - 1, - range1.start(), range1.end() - 1)); + "already-defined range $2 to $3.", + range2.start(), range2.end() - 1, + range1.start(), range1.end() - 1)); } } } @@ -4624,11 +5258,12 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, reserved_name_set.insert(name); } else { AddError(name, proto, DescriptorPool::ErrorCollector::NAME, - strings::Substitute( - "Field name \"$0\" is reserved multiple times.", name)); + strings::Substitute("Field name \"$0\" is reserved multiple times.", + name)); } } + for (int i = 0; i < result->field_count(); i++) { const FieldDescriptor* field = result->field(i); for (int j = 0; j < result->extension_range_count(); j++) { @@ -4648,7 +5283,7 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, AddError(field->full_name(), proto.reserved_range(j), DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Field \"$0\" uses reserved number $1.", - field->name(), field->number())); + field->name(), field->number())); } } if (reserved_name_set.find(field->name()) != reserved_name_set.end()) { @@ -4657,10 +5292,11 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, DescriptorPool::ErrorCollector::NAME, strings::Substitute("Field name \"$0\" is reserved.", field->name())); } + } // Check that extension ranges don't overlap and don't include - // reserved field numbers. + // reserved field numbers or names. for (int i = 0; i < result->extension_range_count(); i++) { const Descriptor::ExtensionRange* range1 = result->extension_range(i); for (int j = 0; j < result->reserved_range_count(); j++) { @@ -4669,9 +5305,9 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, AddError(result->full_name(), proto.extension_range(i), DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Extension range $0 to $1 overlaps with " - "reserved range $2 to $3.", - range1->start, range1->end - 1, - range2->start, range2->end - 1)); + "reserved range $2 to $3.", + range1->start, range1->end - 1, range2->start, + range2->end - 1)); } } for (int j = i + 1; j < result->extension_range_count(); j++) { @@ -4680,54 +5316,48 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, AddError(result->full_name(), proto.extension_range(i), DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Extension range $0 to $1 overlaps with " - "already-defined range $2 to $3.", - range2->start, range2->end - 1, - range1->start, range1->end - 1)); + "already-defined range $2 to $3.", + range2->start, range2->end - 1, range1->start, + range1->end - 1)); } } } } void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, - const Descriptor* parent, + Descriptor* parent, FieldDescriptor* result, bool is_extension) { const std::string& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - std::string* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + // We allocate all names in a single array, and dedup them. + // We remember the indices for the potentially deduped values. + auto all_names = tables_->AllocateFieldNames( + proto.name(), scope, + proto.has_json_name() ? &proto.json_name() : nullptr); + result->all_names_ = all_names.array; + result->lowercase_name_index_ = all_names.lowercase_index; + result->camelcase_name_index_ = all_names.camelcase_index; + result->json_name_index_ = all_names.json_index; + + ValidateSymbolName(proto.name(), result->full_name(), proto); + result->file_ = file_; result->number_ = proto.number(); result->is_extension_ = is_extension; + result->is_oneof_ = false; + result->proto3_optional_ = proto.proto3_optional(); - // If .proto files follow the style guide then the name should already be - // lower-cased. If that's the case we can just reuse the string we - // already allocated rather than allocate a new one. - std::string lowercase_name(proto.name()); - LowerString(&lowercase_name); - if (lowercase_name == proto.name()) { - result->lowercase_name_ = result->name_; - } else { - result->lowercase_name_ = tables_->AllocateString(lowercase_name); + if (proto.proto3_optional() && + file_->syntax() != FileDescriptor::SYNTAX_PROTO3) { + AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "The [proto3_optional=true] option may only be set on proto3" + "fields, not " + + result->full_name()); } - // Don't bother with the above optimization for camel-case names since - // .proto files that follow the guide shouldn't be using names in this - // format, so the optimization wouldn't help much. - result->camelcase_name_ = - tables_->AllocateString(ToCamelCase(proto.name(), - /* lower_first = */ true)); - - if (proto.has_json_name()) { - result->has_json_name_ = true; - result->json_name_ = tables_->AllocateString(proto.json_name()); - } else { - result->has_json_name_ = false; - result->json_name_ = tables_->AllocateString(ToJsonName(proto.name())); - } + result->has_json_name_ = proto.has_json_name(); // Some compilers do not allow static_cast directly between two enum types, // so we must cast to int first. @@ -4736,28 +5366,24 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, result->label_ = static_cast( implicit_cast(proto.label())); - // An extension cannot have a required field (b/13365836). - if (result->is_extension_ && - result->label_ == FieldDescriptor::LABEL_REQUIRED) { - AddError(result->full_name(), proto, - // Error location `TYPE`: we would really like to indicate - // `LABEL`, but the `ErrorLocation` enum has no entry for this, and - // we don't necessarily know about all implementations of the - // `ErrorCollector` interface to extend them to handle the new - // error location type properly. - DescriptorPool::ErrorCollector::TYPE, - "The extension " + result->full_name() + " cannot be required."); + if (result->label_ == FieldDescriptor::LABEL_REQUIRED) { + // An extension cannot have a required field (b/13365836). + if (result->is_extension_) { + AddError(result->full_name(), proto, + // Error location `TYPE`: we would really like to indicate + // `LABEL`, but the `ErrorLocation` enum has no entry for this, + // and we don't necessarily know about all implementations of the + // `ErrorCollector` interface to extend them to handle the new + // error location type properly. + DescriptorPool::ErrorCollector::TYPE, + "The extension " + result->full_name() + " cannot be required."); + } } // Some of these may be filled in when cross-linking. result->containing_type_ = nullptr; - result->extension_scope_ = nullptr; - result->message_type_ = nullptr; - result->enum_type_ = nullptr; - result->type_name_ = nullptr; result->type_once_ = nullptr; result->default_value_enum_ = nullptr; - result->default_value_enum_name_ = nullptr; result->has_default_value_ = proto.has_default_value(); if (proto.has_default_value() && result->is_repeated()) { @@ -4771,19 +5397,19 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, char* end_pos = nullptr; switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_ = + result->default_value_int32_t_ = strtol(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_ = + result->default_value_int64_t_ = strto64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_ = + result->default_value_uint32_t_ = strtoul(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_ = + result->default_value_uint64_t_ = strtou64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_FLOAT: @@ -4845,6 +5471,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, DescriptorPool::ErrorCollector::DEFAULT_VALUE, "Messages can't have default values."); result->has_default_value_ = false; + result->default_generated_instance_ = nullptr; break; } @@ -4863,16 +5490,16 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, // No explicit default value switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_ = 0; + result->default_value_int32_t_ = 0; break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_ = 0; + result->default_value_int64_t_ = 0; break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_ = 0; + result->default_value_uint32_t_ = 0; break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_ = 0; + result->default_value_uint64_t_ = 0; break; case FieldDescriptor::CPPTYPE_FLOAT: result->default_value_float_ = 0.0f; @@ -4891,6 +5518,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, result->default_value_string_ = &internal::GetEmptyString(); break; case FieldDescriptor::CPPTYPE_MESSAGE: + result->default_generated_instance_ = nullptr; break; } } @@ -4910,7 +5538,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, // on extension numbers. AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Field numbers cannot be greater than $0.", - FieldDescriptor::kMaxNumber)); + FieldDescriptor::kMaxNumber)); } else if (result->number() >= FieldDescriptor::kFirstReservedNumber && result->number() <= FieldDescriptor::kLastReservedNumber) { AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, @@ -4928,16 +5556,13 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, "FieldDescriptorProto.extendee not set for extension field."); } - result->extension_scope_ = parent; + result->scope_.extension_scope = parent; if (proto.has_oneof_index()) { AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "FieldDescriptorProto.oneof_index should not be set for " "extensions."); } - - // Fill in later (maybe). - result->containing_oneof_ = nullptr; } else { if (proto.has_extendee()) { AddError(result->full_name(), proto, @@ -4953,21 +5578,19 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, strings::Substitute("FieldDescriptorProto.oneof_index $0 is " - "out of range for type \"$1\".", - proto.oneof_index(), parent->name())); - result->containing_oneof_ = nullptr; + "out of range for type \"$1\".", + proto.oneof_index(), parent->name())); } else { - result->containing_oneof_ = parent->oneof_decl(proto.oneof_index()); + result->is_oneof_ = true; + result->scope_.containing_oneof = + parent->oneof_decl(proto.oneof_index()); } - } else { - result->containing_oneof_ = nullptr; } } // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, FieldDescriptorProto::kOptionsFieldNumber, "google.protobuf.FieldOptions"); @@ -4997,9 +5620,8 @@ void DescriptorBuilder::BuildExtensionRange( "Extension range end number must be greater than start number."); } - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { std::vector options_path; parent->GetLocationPath(&options_path); options_path.push_back(DescriptorProto::kExtensionRangeFieldNumber); @@ -5041,12 +5663,8 @@ void DescriptorBuilder::BuildReservedRange( void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto, Descriptor* parent, OneofDescriptor* result) { - std::string* full_name = - AllocateNameString(parent->full_name(), proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(parent->full_name(), proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); result->containing_type_ = parent; @@ -5136,11 +5754,9 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, EnumDescriptor* result) { const std::string& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - std::string* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(scope, proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); result->file_ = file_; result->containing_type_ = parent; result->is_placeholder_ = false; @@ -5153,6 +5769,21 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, "Enums must contain at least one value."); } + // Calculate the continuous sequence of the labels. + // These can be fast-path'd during lookup and don't need to be added to the + // tables. + // We use uint16_t to save space for sequential_value_limit_, so stop before + // overflowing it. Worst case, we are not taking full advantage on huge + // enums, but it is unlikely. + for (int i = 0; + i < std::numeric_limits::max() && i < proto.value_size() && + // We do the math in int64_t to avoid overflows. + proto.value(i).number() == + static_cast(i) + proto.value(0).number(); + ++i) { + result->sequential_value_limit_ = i; + } + BUILD_ARRAY(proto, result, value, BuildEnumValue, result); BUILD_ARRAY(proto, result, reserved_range, BuildReservedRange, result); @@ -5169,9 +5800,8 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, CheckEnumValueUniqueness(proto, result); // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, EnumDescriptorProto::kOptionsFieldNumber, "google.protobuf.EnumOptions"); @@ -5189,9 +5819,9 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, AddError(result->full_name(), proto.reserved_range(i), DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Reserved range $0 to $1 overlaps with " - "already-defined range $2 to $3.", - range2.start(), range2.end(), - range1.start(), range1.end())); + "already-defined range $2 to $3.", + range2.start(), range2.end(), range1.start(), + range1.end())); } } } @@ -5203,8 +5833,8 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, reserved_name_set.insert(name); } else { AddError(name, proto, DescriptorPool::ErrorCollector::NAME, - strings::Substitute( - "Enum value \"$0\" is reserved multiple times.", name)); + strings::Substitute("Enum value \"$0\" is reserved multiple times.", + name)); } } @@ -5213,11 +5843,10 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, for (int j = 0; j < result->reserved_range_count(); j++) { const EnumDescriptor::ReservedRange* range = result->reserved_range(j); if (range->start <= value->number() && value->number() <= range->end) { - AddError( - value->full_name(), proto.reserved_range(j), - DescriptorPool::ErrorCollector::NUMBER, - strings::Substitute("Enum value \"$0\" uses reserved number $1.", - value->name(), value->number())); + AddError(value->full_name(), proto.reserved_range(j), + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Enum value \"$0\" uses reserved number $1.", + value->name(), value->number())); } } if (reserved_name_set.find(value->name()) != reserved_name_set.end()) { @@ -5232,25 +5861,24 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, const EnumDescriptor* parent, EnumValueDescriptor* result) { - result->name_ = tables_->AllocateString(proto.name()); - result->number_ = proto.number(); - result->type_ = parent; - // Note: full_name for enum values is a sibling to the parent's name, not a // child of it. - std::string* full_name = tables_->AllocateEmptyString(); - size_t scope_len = parent->full_name_->size() - parent->name_->size(); - full_name->reserve(scope_len + result->name_->size()); - full_name->append(parent->full_name_->data(), scope_len); - full_name->append(*result->name_); - result->full_name_ = full_name; + std::string full_name; + size_t scope_len = parent->full_name().size() - parent->name().size(); + full_name.reserve(scope_len + proto.name().size()); + full_name.append(parent->full_name().data(), scope_len); + full_name.append(proto.name()); + + result->all_names_ = + tables_->AllocateStringArray(proto.name(), std::move(full_name)); + result->number_ = proto.number(); + result->type_ = parent; - ValidateSymbolName(proto.name(), *full_name, proto); + ValidateSymbolName(proto.name(), result->full_name(), proto); // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, EnumValueDescriptorProto::kOptionsFieldNumber, "google.protobuf.EnumValueOptions"); @@ -5261,14 +5889,14 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, // parent->containing_type() as the value's parent. bool added_to_outer_scope = AddSymbol(result->full_name(), parent->containing_type(), result->name(), - proto, Symbol(result)); + proto, Symbol::EnumValue(result, 0)); // However, we also want to be able to search for values within a single // enum type, so we add it as a child of the enum type itself, too. // Note: This could fail, but if it does, the error has already been // reported by the above AddSymbol() call, so we ignore the return code. - bool added_to_inner_scope = - file_tables_->AddAliasUnderParent(parent, result->name(), Symbol(result)); + bool added_to_inner_scope = file_tables_->AddAliasUnderParent( + parent, result->name(), Symbol::EnumValue(result, 1)); if (added_to_inner_scope && !added_to_outer_scope) { // This value did not conflict with any values defined in the same enum, @@ -5304,19 +5932,15 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto, const void* /* dummy */, ServiceDescriptor* result) { - std::string* full_name = AllocateNameString(file_->package(), proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(file_->package(), proto.name()); result->file_ = file_; + ValidateSymbolName(proto.name(), result->full_name(), proto); BUILD_ARRAY(proto, result, method, BuildMethod, result); // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, ServiceDescriptorProto::kOptionsFieldNumber, "google.protobuf.ServiceOptions"); @@ -5329,23 +5953,18 @@ void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto, void DescriptorBuilder::BuildMethod(const MethodDescriptorProto& proto, const ServiceDescriptor* parent, MethodDescriptor* result) { - result->name_ = tables_->AllocateString(proto.name()); result->service_ = parent; + result->all_names_ = AllocateNameStrings(parent->full_name(), proto.name()); - std::string* full_name = - AllocateNameString(parent->full_name(), *result->name_); - result->full_name_ = full_name; - - ValidateSymbolName(proto.name(), *full_name, proto); + ValidateSymbolName(proto.name(), result->full_name(), proto); // These will be filled in when cross-linking. result->input_type_.Init(); result->output_type_.Init(); // Copy options. - if (!proto.has_options()) { - result->options_ = nullptr; // Will set to default_instance later. - } else { + result->options_ = nullptr; // Set to default_instance later if necessary. + if (proto.has_options()) { AllocateOptions(proto.options(), result, MethodDescriptorProto::kOptionsFieldNumber, "google.protobuf.MethodOptions"); @@ -5435,11 +6054,23 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, } // Must go through oneof_decls_ array to get a non-const version of the // OneofDescriptor. - ++message->oneof_decls_[oneof_decl->index()].field_count_; + auto& out_oneof_decl = message->oneof_decls_[oneof_decl->index()]; + if (out_oneof_decl.field_count_ == 0) { + out_oneof_decl.fields_ = message->field(i); + } + + if (!had_errors_) { + // Verify that they are contiguous. + // This is assumed by OneofDescriptor::field(i). + // But only if there are no errors. + GOOGLE_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_, + message->field(i)); + } + ++out_oneof_decl.field_count_; } } - // Then allocate the arrays. + // Then verify the sizes. for (int i = 0; i < message->oneof_decl_count(); i++) { OneofDescriptor* oneof_decl = &message->oneof_decls_[i]; @@ -5449,31 +6080,51 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, "Oneof must have at least one field."); } - oneof_decl->fields_ = tables_->AllocateArray( - oneof_decl->field_count_); - oneof_decl->field_count_ = 0; - if (oneof_decl->options_ == nullptr) { oneof_decl->options_ = &OneofOptions::default_instance(); } } - // Then fill them in. for (int i = 0; i < message->field_count(); i++) { - const OneofDescriptor* oneof_decl = message->field(i)->containing_oneof(); - if (oneof_decl != nullptr) { - OneofDescriptor* mutable_oneof_decl = - &message->oneof_decls_[oneof_decl->index()]; - message->fields_[i].index_in_oneof_ = mutable_oneof_decl->field_count_; - mutable_oneof_decl->fields_[mutable_oneof_decl->field_count_++] = - message->field(i); + const FieldDescriptor* field = message->field(i); + if (field->proto3_optional_) { + if (!field->containing_oneof() || + !field->containing_oneof()->is_synthetic()) { + AddError(message->full_name(), proto.field(i), + DescriptorPool::ErrorCollector::OTHER, + "Fields with proto3_optional set must be " + "a member of a one-field oneof"); + } + } + } + + // Synthetic oneofs must be last. + int first_synthetic = -1; + for (int i = 0; i < message->oneof_decl_count(); i++) { + const OneofDescriptor* oneof = message->oneof_decl(i); + if (oneof->is_synthetic()) { + if (first_synthetic == -1) { + first_synthetic = i; + } + } else { + if (first_synthetic != -1) { + AddError(message->full_name(), proto.oneof_decl(i), + DescriptorPool::ErrorCollector::OTHER, + "Synthetic oneofs must be after all other oneofs"); + } } } + + if (first_synthetic == -1) { + message->real_oneof_decl_count_ = message->oneof_decl_count_; + } else { + message->real_oneof_decl_count_ = first_synthetic; + } } void DescriptorBuilder::CrossLinkExtensionRange( Descriptor::ExtensionRange* range, - const DescriptorProto::ExtensionRange& proto) { + const DescriptorProto::ExtensionRange& /*proto*/) { if (range->options_ == nullptr) { range->options_ = &ExtensionRangeOptions::default_instance(); } @@ -5497,13 +6148,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, DescriptorPool::ErrorCollector::EXTENDEE, proto.extendee()); return; - } else if (extendee.type != Symbol::MESSAGE) { + } else if (extendee.type() != Symbol::MESSAGE) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::EXTENDEE, "\"" + proto.extendee() + "\" is not a message type."); return; } - field->containing_type_ = extendee.descriptor; + field->containing_type_ = extendee.descriptor(); const Descriptor::ExtensionRange* extension_range = field->containing_type()->FindExtensionRangeContainingNumber( @@ -5519,9 +6170,9 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("\"$0\" does not declare $1 as an " - "extension number.", - field->containing_type()->full_name(), - field->number())); + "extension number.", + field->containing_type()->full_name(), + field->number())); } } } @@ -5544,7 +6195,7 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, proto.has_default_value(); // In case of weak fields we force building the dependency. We need to know - // if the type exist or not. If it doesnt exist we substitute Empty which + // if the type exist or not. If it doesn't exist we substitute Empty which // should only be done if the type can't be found in the generated pool. // TODO(gerbens) Ideally we should query the database directly to check // if weak fields exist or not so that we don't need to force building @@ -5564,12 +6215,12 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, // Save the symbol names for later for lookup, and allocate the once // object needed for the accessors. std::string name = proto.type_name(); - field->type_once_ = tables_->AllocateOnceDynamic(); - field->type_name_ = tables_->AllocateString(name); - if (proto.has_default_value()) { - field->default_value_enum_name_ = - tables_->AllocateString(proto.default_value()); - } + field->type_once_ = tables_->Create(); + field->type_descriptor_.lazy_type_name = tables_->Strdup(name); + field->lazy_default_value_enum_name_ = + proto.has_default_value() ? tables_->Strdup(proto.default_value()) + : nullptr; + // AddFieldByNumber and AddExtension are done later in this function, // and can/must be done if the field type was not found. The related // error checking is not necessary when in lazily_build_dependencies_ @@ -5597,9 +6248,9 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, if (!proto.has_type()) { // Choose field type based on symbol. - if (type.type == Symbol::MESSAGE) { + if (type.type() == Symbol::MESSAGE) { field->type_ = FieldDescriptor::TYPE_MESSAGE; - } else if (type.type == Symbol::ENUM) { + } else if (type.type() == Symbol::ENUM) { field->type_ = FieldDescriptor::TYPE_ENUM; } else { AddError(field->full_name(), proto, @@ -5610,13 +6261,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, } if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - if (type.type != Symbol::MESSAGE) { + field->type_descriptor_.message_type = type.descriptor(); + if (field->type_descriptor_.message_type == nullptr) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "\"" + proto.type_name() + "\" is not a message type."); return; } - field->message_type_ = type.descriptor; if (field->has_default_value()) { AddError(field->full_name(), proto, @@ -5624,13 +6275,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, "Messages can't have default values."); } } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - if (type.type != Symbol::ENUM) { + field->type_descriptor_.enum_type = type.enum_descriptor(); + if (field->type_descriptor_.enum_type == nullptr) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "\"" + proto.type_name() + "\" is not an enum type."); return; } - field->enum_type_ = type.enum_descriptor; if (field->enum_type()->is_placeholder_) { // We can't look up default values for placeholder types. We'll have @@ -5652,13 +6303,14 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, // We can't just use field->enum_type()->FindValueByName() here // because that locks the pool's mutex, which we have already locked // at this point. - Symbol default_value = LookupSymbolNoPlaceholder( - proto.default_value(), field->enum_type()->full_name()); - - if (default_value.type == Symbol::ENUM_VALUE && - default_value.enum_value_descriptor->type() == - field->enum_type()) { - field->default_value_enum_ = default_value.enum_value_descriptor; + const EnumValueDescriptor* default_value = + LookupSymbolNoPlaceholder(proto.default_value(), + field->enum_type()->full_name()) + .enum_value_descriptor(); + + if (default_value != nullptr && + default_value->type() == field->enum_type()) { + field->default_value_enum_ = default_value; } else { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::DEFAULT_VALUE, @@ -5702,16 +6354,16 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Extension number $0 has already been used " - "in \"$1\" by extension \"$2\".", - field->number(), containing_type_name, - conflicting_field->full_name())); + "in \"$1\" by extension \"$2\".", + field->number(), containing_type_name, + conflicting_field->full_name())); } else { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER, strings::Substitute("Field number $0 has already been used in " - "\"$1\" by field \"$2\".", - field->number(), containing_type_name, - conflicting_field->name())); + "\"$1\" by field \"$2\".", + field->number(), containing_type_name, + conflicting_field->name())); } } else { if (field->is_extension()) { @@ -5786,12 +6438,12 @@ void DescriptorBuilder::CrossLinkMethod(MethodDescriptor* method, } else { method->input_type_.SetLazy(proto.input_type(), file_); } - } else if (input_type.type != Symbol::MESSAGE) { + } else if (input_type.type() != Symbol::MESSAGE) { AddError(method->full_name(), proto, DescriptorPool::ErrorCollector::INPUT_TYPE, "\"" + proto.input_type() + "\" is not a message type."); } else { - method->input_type_.Set(input_type.descriptor); + method->input_type_.Set(input_type.descriptor()); } Symbol output_type = @@ -5806,12 +6458,12 @@ void DescriptorBuilder::CrossLinkMethod(MethodDescriptor* method, } else { method->output_type_.SetLazy(proto.output_type(), file_); } - } else if (output_type.type != Symbol::MESSAGE) { + } else if (output_type.type() != Symbol::MESSAGE) { AddError(method->full_name(), proto, DescriptorPool::ErrorCollector::OUTPUT_TYPE, "\"" + proto.output_type() + "\" is not a message type."); } else { - method->output_type_.Set(output_type.descriptor); + method->output_type_.Set(output_type.descriptor()); } } @@ -5875,12 +6527,12 @@ void DescriptorBuilder::ValidateProto3(FileDescriptor* file, static std::string ToLowercaseWithoutUnderscores(const std::string& name) { std::string result; - for (int i = 0; i < name.size(); ++i) { - if (name[i] != '_') { - if (name[i] >= 'A' && name[i] <= 'Z') { - result.push_back(name[i] - 'A' + 'a'); + for (char character : name) { + if (character != '_') { + if (character >= 'A' && character <= 'Z') { + result.push_back(character - 'A' + 'a'); } else { - result.push_back(name[i]); + result.push_back(character); } } } @@ -5951,7 +6603,8 @@ void DescriptorBuilder::ValidateProto3Field(FieldDescriptor* field, } if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM && field->enum_type() && - field->enum_type()->file()->syntax() != FileDescriptor::SYNTAX_PROTO3) { + field->enum_type()->file()->syntax() != FileDescriptor::SYNTAX_PROTO3 && + field->enum_type()->file()->syntax() != FileDescriptor::SYNTAX_UNKNOWN) { // Proto3 messages can only use Proto3 enum types; otherwise we can't // guarantee that the default value is zero. AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, @@ -5982,18 +6635,21 @@ void DescriptorBuilder::ValidateMessageOptions(Descriptor* message, VALIDATE_OPTIONS_FROM_ARRAY(message, enum_type, Enum); VALIDATE_OPTIONS_FROM_ARRAY(message, extension, Field); - const int64 max_extension_range = - static_cast(message->options().message_set_wire_format() - ? kint32max - : FieldDescriptor::kMaxNumber); + const int64_t max_extension_range = + static_cast(message->options().message_set_wire_format() + ? std::numeric_limits::max() + : FieldDescriptor::kMaxNumber); for (int i = 0; i < message->extension_range_count(); ++i) { if (message->extension_range(i)->end > max_extension_range + 1) { - AddError( - message->full_name(), proto.extension_range(i), - DescriptorPool::ErrorCollector::NUMBER, - strings::Substitute("Extension numbers cannot be greater than $0.", - max_extension_range)); + AddError(message->full_name(), proto.extension_range(i), + DescriptorPool::ErrorCollector::NUMBER, + strings::Substitute("Extension numbers cannot be greater than $0.", + max_extension_range)); } + + ValidateExtensionRangeOptions(message->full_name(), + message->extension_ranges_ + i, + proto.extension_range(i)); } } @@ -6060,7 +6716,7 @@ void DescriptorBuilder::ValidateFieldOptions( // json_name option is not allowed on extension fields. Note that the // json_name field in FieldDescriptorProto is always populated by protoc - // when it sends descriptor data to plugins (caculated from field name if + // when it sends descriptor data to plugins (calculated from field name if // the option is not explicitly set) so we can't rely on its presence to // determine whether the json_name option is set on the field. Here we // compare it against the default calculated json_name value and consider @@ -6108,6 +6764,14 @@ void DescriptorBuilder::ValidateEnumValueOptions( const EnumValueDescriptorProto& /* proto */) { // Nothing to do so far. } + +void DescriptorBuilder::ValidateExtensionRangeOptions( + const std::string& full_name, Descriptor::ExtensionRange* extension_range, + const DescriptorProto_ExtensionRange& proto) { + (void)full_name; // Parameter is used by Google-internal code. + (void)extension_range; // Parameter is used by Google-internal code. +} + void DescriptorBuilder::ValidateServiceOptions( ServiceDescriptor* service, const ServiceDescriptorProto& proto) { if (IsLite(service->file()) && @@ -6145,8 +6809,8 @@ bool DescriptorBuilder::ValidateMapEntry(FieldDescriptor* field, return false; } - const FieldDescriptor* key = message->field(0); - const FieldDescriptor* value = message->field(1); + const FieldDescriptor* key = message->map_key(); + const FieldDescriptor* value = message->map_value(); if (key->label() != FieldDescriptor::LABEL_OPTIONAL || key->number() != 1 || key->name() != "key") { return false; @@ -6382,6 +7046,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions( options->GetReflection()->Swap(unparsed_options.get(), options); } } + return !failed; } @@ -6413,9 +7078,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // the file that defines the option, not descriptor.proto itself. Symbol symbol = builder_->FindSymbolNotEnforcingDeps( options->GetDescriptor()->full_name()); - if (!symbol.IsNull() && symbol.type == Symbol::MESSAGE) { - options_descriptor = symbol.descriptor; - } else { + options_descriptor = symbol.descriptor(); + if (options_descriptor == nullptr) { // The options message's descriptor was not in the builder's pool, so use // the standard version from the generated pool. We're not holding the // generated pool's mutex, so we can search it the straightforward way. @@ -6451,9 +7115,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // mutex, and the latter method locks it again. symbol = builder_->LookupSymbol(name_part, options_to_interpret_->name_scope); - if (!symbol.IsNull() && symbol.type == Symbol::FIELD) { - field = symbol.field_descriptor; - } + field = symbol.field_descriptor(); // If we don't find the field then the field's descriptor was not in the // builder's pool, but there's no point in looking in the generated // pool. We require that you import the file that defines any extensions @@ -6624,10 +7286,10 @@ void DescriptorBuilder::OptionInterpreter::UpdateSourceCodeInfo( if (matched) { // see if this location is in the range to remove bool loc_matches = true; - if (loc->path_size() < pathv.size()) { + if (loc->path_size() < static_cast(pathv.size())) { loc_matches = false; } else { - for (int j = 0; j < pathv.size(); j++) { + for (size_t j = 0; j < pathv.size(); j++) { if (loc->path(j) != pathv[j]) { loc_matches = false; break; @@ -6767,7 +7429,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT32: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast(kint32max)) { + static_cast(std::numeric_limits::max())) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -6777,7 +7439,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } } else if (uninterpreted_option_->has_negative_int_value()) { if (uninterpreted_option_->negative_int_value() < - static_cast(kint32min)) { + static_cast(std::numeric_limits::min())) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -6794,7 +7456,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT64: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast(kint64max)) { + static_cast(std::numeric_limits::max())) { return AddValueError("Value out of range for int64 option \"" + option_field->full_name() + "\"."); } else { @@ -6814,7 +7476,8 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_UINT32: if (uninterpreted_option_->has_positive_int_value()) { - if (uninterpreted_option_->positive_int_value() > kuint32max) { + if (uninterpreted_option_->positive_int_value() > + std::numeric_limits::max()) { return AddValueError("Value out of range for uint32 option \"" + option_field->name() + "\"."); } else { @@ -6878,7 +7541,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } case FieldDescriptor::CPPTYPE_BOOL: - uint64 value; + uint64_t value; if (!uninterpreted_option_->has_identifier_value()) { return AddValueError( "Value must be identifier for boolean option " @@ -6923,15 +7586,15 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( // the pool's mutex, and the latter method locks it again. Symbol symbol = builder_->FindSymbolNotEnforcingDeps(fully_qualified_name); - if (!symbol.IsNull() && symbol.type == Symbol::ENUM_VALUE) { - if (symbol.enum_value_descriptor->type() != enum_type) { + if (auto* candicate_descriptor = symbol.enum_value_descriptor()) { + if (candicate_descriptor->type() != enum_type) { return AddValueError( "Enum type \"" + enum_type->full_name() + "\" has no value named \"" + value_name + "\" for option \"" + option_field->full_name() + "\". This appears to be a value from a sibling type."); } else { - enum_value = symbol.enum_value_descriptor; + enum_value = candicate_descriptor; } } } else { @@ -6948,11 +7611,11 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( "option \"" + option_field->full_name() + "\"."); } else { - // Sign-extension is not a problem, since we cast directly from int32 to - // uint64, without first going through uint32. + // Sign-extension is not a problem, since we cast directly from int32_t + // to uint64_t, without first going through uint32_t. unknown_fields->AddVarint( option_field->number(), - static_cast(static_cast(enum_value->number()))); + static_cast(static_cast(enum_value->number()))); } break; } @@ -6984,18 +7647,28 @@ class DescriptorBuilder::OptionInterpreter::AggregateOptionFinder public: DescriptorBuilder* builder_; + const Descriptor* FindAnyType(const Message& /*message*/, + const std::string& prefix, + const std::string& name) const override { + if (prefix != internal::kTypeGoogleApisComPrefix && + prefix != internal::kTypeGoogleProdComPrefix) { + return nullptr; + } + assert_mutex_held(builder_->pool_); + return builder_->FindSymbol(name).descriptor(); + } + const FieldDescriptor* FindExtension(Message* message, const std::string& name) const override { assert_mutex_held(builder_->pool_); const Descriptor* descriptor = message->GetDescriptor(); Symbol result = builder_->LookupSymbolNoPlaceholder(name, descriptor->full_name()); - if (result.type == Symbol::FIELD && - result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else if (result.type == Symbol::MESSAGE && + if (auto* field = result.field_descriptor()) { + return field; + } else if (result.type() == Symbol::MESSAGE && descriptor->options().message_set_wire_format()) { - const Descriptor* foreign_type = result.descriptor; + const Descriptor* foreign_type = result.descriptor(); // The text format allows MessageSet items to be specified using // the type name, rather than the extension identifier. If the symbol // lookup returned a Message, and the enclosing Message has @@ -7084,16 +7757,16 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( } void DescriptorBuilder::OptionInterpreter::SetInt32( - int number, int32 value, FieldDescriptor::Type type, + int number, int32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT32: - unknown_fields->AddVarint(number, - static_cast(static_cast(value))); + unknown_fields->AddVarint( + number, static_cast(static_cast(value))); break; case FieldDescriptor::TYPE_SFIXED32: - unknown_fields->AddFixed32(number, static_cast(value)); + unknown_fields->AddFixed32(number, static_cast(value)); break; case FieldDescriptor::TYPE_SINT32: @@ -7108,15 +7781,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt32( } void DescriptorBuilder::OptionInterpreter::SetInt64( - int number, int64 value, FieldDescriptor::Type type, + int number, int64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT64: - unknown_fields->AddVarint(number, static_cast(value)); + unknown_fields->AddVarint(number, static_cast(value)); break; case FieldDescriptor::TYPE_SFIXED64: - unknown_fields->AddFixed64(number, static_cast(value)); + unknown_fields->AddFixed64(number, static_cast(value)); break; case FieldDescriptor::TYPE_SINT64: @@ -7131,15 +7804,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt64( } void DescriptorBuilder::OptionInterpreter::SetUInt32( - int number, uint32 value, FieldDescriptor::Type type, + int number, uint32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT32: - unknown_fields->AddVarint(number, static_cast(value)); + unknown_fields->AddVarint(number, static_cast(value)); break; case FieldDescriptor::TYPE_FIXED32: - unknown_fields->AddFixed32(number, static_cast(value)); + unknown_fields->AddFixed32(number, static_cast(value)); break; default: @@ -7149,7 +7822,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt32( } void DescriptorBuilder::OptionInterpreter::SetUInt64( - int number, uint64 value, FieldDescriptor::Type type, + int number, uint64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT64: @@ -7168,22 +7841,31 @@ void DescriptorBuilder::OptionInterpreter::SetUInt64( void DescriptorBuilder::LogUnusedDependency(const FileDescriptorProto& proto, const FileDescriptor* result) { + (void)result; // Parameter is used by Google-internal code. if (!unused_dependency_.empty()) { + auto itr = pool_->unused_import_track_files_.find(proto.name()); + bool is_error = + itr != pool_->unused_import_track_files_.end() && itr->second; for (std::set::const_iterator it = unused_dependency_.begin(); it != unused_dependency_.end(); ++it) { - // Log warnings for unused imported files. std::string error_message = "Import " + (*it)->name() + " is unused."; - AddWarning((*it)->name(), proto, DescriptorPool::ErrorCollector::IMPORT, + if (is_error) { + AddError((*it)->name(), proto, DescriptorPool::ErrorCollector::IMPORT, error_message); + } else { + AddWarning((*it)->name(), proto, DescriptorPool::ErrorCollector::IMPORT, + error_message); + } } } } -Symbol DescriptorPool::CrossLinkOnDemandHelper(const std::string& name, +Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name, bool expecting_enum) const { - std::string lookup_name = name; + (void)expecting_enum; // Parameter is used by Google-internal code. + auto lookup_name = std::string(name); if (!lookup_name.empty() && lookup_name[0] == '.') { lookup_name = lookup_name.substr(1); } @@ -7197,39 +7879,39 @@ Symbol DescriptorPool::CrossLinkOnDemandHelper(const std::string& name, // enum_type_, message_type_, and default_value_enum_ appropriately. void FieldDescriptor::InternalTypeOnceInit() const { GOOGLE_CHECK(file()->finished_building_ == true); - if (type_name_) { - Symbol result = file()->pool()->CrossLinkOnDemandHelper( - *type_name_, type_ == FieldDescriptor::TYPE_ENUM); - if (result.type == Symbol::MESSAGE) { - type_ = FieldDescriptor::TYPE_MESSAGE; - message_type_ = result.descriptor; - } else if (result.type == Symbol::ENUM) { - type_ = FieldDescriptor::TYPE_ENUM; - enum_type_ = result.enum_descriptor; - } - } - if (enum_type_ && !default_value_enum_) { - if (default_value_enum_name_) { + const EnumDescriptor* enum_type = nullptr; + Symbol result = file()->pool()->CrossLinkOnDemandHelper( + type_descriptor_.lazy_type_name, type_ == FieldDescriptor::TYPE_ENUM); + if (result.type() == Symbol::MESSAGE) { + type_ = FieldDescriptor::TYPE_MESSAGE; + type_descriptor_.message_type = result.descriptor(); + } else if (result.type() == Symbol::ENUM) { + type_ = FieldDescriptor::TYPE_ENUM; + enum_type = type_descriptor_.enum_type = result.enum_descriptor(); + } + + if (enum_type) { + if (lazy_default_value_enum_name_) { // Have to build the full name now instead of at CrossLink time, - // because enum_type_ may not be known at the time. - std::string name = enum_type_->full_name(); + // because enum_type may not be known at the time. + std::string name = enum_type->full_name(); // Enum values reside in the same scope as the enum type. std::string::size_type last_dot = name.find_last_of('.'); if (last_dot != std::string::npos) { - name = name.substr(0, last_dot) + "." + *default_value_enum_name_; + name = name.substr(0, last_dot) + "." + lazy_default_value_enum_name_; } else { - name = *default_value_enum_name_; + name = lazy_default_value_enum_name_; } Symbol result = file()->pool()->CrossLinkOnDemandHelper(name, true); - if (result.type == Symbol::ENUM_VALUE) { - default_value_enum_ = result.enum_value_descriptor; - } + default_value_enum_ = result.enum_value_descriptor(); + } else { + default_value_enum_ = nullptr; } if (!default_value_enum_) { // We use the first defined value as the default // if a default is not explicitly defined. - GOOGLE_CHECK(enum_type_->value_count()); - default_value_enum_ = enum_type_->value(0); + GOOGLE_CHECK(enum_type->value_count()); + default_value_enum_ = enum_type->value(0); } } } @@ -7245,14 +7927,16 @@ const Descriptor* FieldDescriptor::message_type() const { if (type_once_) { internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); } - return message_type_; + return type_ == TYPE_MESSAGE || type_ == TYPE_GROUP + ? type_descriptor_.message_type + : nullptr; } const EnumDescriptor* FieldDescriptor::enum_type() const { if (type_once_) { internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); } - return enum_type_; + return type_ == TYPE_ENUM ? type_descriptor_.enum_type : nullptr; } const EnumValueDescriptor* FieldDescriptor::default_value_enum() const { @@ -7273,9 +7957,10 @@ const std::string& FieldDescriptor::PrintableNameForExtension() const { void FileDescriptor::InternalDependenciesOnceInit() const { GOOGLE_CHECK(finished_building_ == true); + auto* names = dependencies_once_->dependencies_names; for (int i = 0; i < dependency_count(); i++) { - if (dependencies_names_[i]) { - dependencies_[i] = pool_->FindFileByName(*dependencies_names_[i]); + if (names[i]) { + dependencies_[i] = pool_->FindFileByName(names[i]); } } } @@ -7288,62 +7973,53 @@ const FileDescriptor* FileDescriptor::dependency(int index) const { if (dependencies_once_) { // Do once init for all indices, as it's unlikely only a single index would // be called, and saves on internal::call_once allocations. - internal::call_once(*dependencies_once_, + internal::call_once(dependencies_once_->once, FileDescriptor::DependenciesOnceInit, this); } return dependencies_[index]; } const Descriptor* MethodDescriptor::input_type() const { - return input_type_.Get(); + return input_type_.Get(service()); } const Descriptor* MethodDescriptor::output_type() const { - return output_type_.Get(); + return output_type_.Get(service()); } namespace internal { void LazyDescriptor::Set(const Descriptor* descriptor) { - GOOGLE_CHECK(!name_); GOOGLE_CHECK(!once_); - GOOGLE_CHECK(!file_); descriptor_ = descriptor; } -void LazyDescriptor::SetLazy(const std::string& name, +void LazyDescriptor::SetLazy(StringPiece name, const FileDescriptor* file) { // verify Init() has been called and Set hasn't been called yet. GOOGLE_CHECK(!descriptor_); - GOOGLE_CHECK(!file_); - GOOGLE_CHECK(!name_); GOOGLE_CHECK(!once_); GOOGLE_CHECK(file && file->pool_); GOOGLE_CHECK(file->pool_->lazily_build_dependencies_); GOOGLE_CHECK(!file->finished_building_); - file_ = file; - name_ = file->pool_->tables_->AllocateString(name); - once_ = file->pool_->tables_->AllocateOnceDynamic(); + once_ = file->pool_->tables_->Create(); + lazy_name_ = file->pool_->tables_->Strdup(name); } -void LazyDescriptor::Once() { +void LazyDescriptor::Once(const ServiceDescriptor* service) { if (once_) { - internal::call_once(*once_, LazyDescriptor::OnceStatic, this); + internal::call_once(*once_, [&] { + auto* file = service->file(); + GOOGLE_CHECK(file->finished_building_); + descriptor_ = + file->pool_->CrossLinkOnDemandHelper(lazy_name_, false).descriptor(); + }); } } -void LazyDescriptor::OnceStatic(LazyDescriptor* lazy) { lazy->OnceInternal(); } - -void LazyDescriptor::OnceInternal() { - GOOGLE_CHECK(file_->finished_building_); - if (!descriptor_ && name_) { - Symbol result = file_->pool_->CrossLinkOnDemandHelper(*name_, false); - if (!result.IsNull() && result.type == Symbol::MESSAGE) { - descriptor_ = result.descriptor; - } - } -} } // namespace internal } // namespace protobuf } // namespace google + +#include diff --git a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.h b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.h similarity index 84% rename from cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.h rename to cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.h index 422e444e2..0eeee54ac 100644 --- a/cdk/extra/protobuf/protobuf-3.11.4/src/google/protobuf/descriptor.h +++ b/cdk/extra/protobuf/protobuf-3.19.6/src/google/protobuf/descriptor.h @@ -54,14 +54,18 @@ #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__ #define GOOGLE_PROTOBUF_DESCRIPTOR_H__ +#include +#include #include #include #include #include + #include +#include #include #include - +#include #include // TYPE_BOOL is defined in the MacOS's ConditionalMacros.h. @@ -118,7 +122,7 @@ class Reflection; // Defined in descriptor.cc class DescriptorBuilder; class FileDescriptorTables; -struct Symbol; +class Symbol; // Defined in unknown_field_set.h. class UnknownField; @@ -179,15 +183,14 @@ struct DebugStringOptions { // which is needed when a pool has lazily_build_dependencies_ set. // Must be instantiated as mutable in a descriptor. namespace internal { + class PROTOBUF_EXPORT LazyDescriptor { public: // Init function to be called at init time of a descriptor containing // a LazyDescriptor. void Init() { descriptor_ = nullptr; - name_ = nullptr; once_ = nullptr; - file_ = nullptr; } // Sets the value of the descriptor if it is known during the descriptor @@ -201,26 +204,39 @@ class PROTOBUF_EXPORT LazyDescriptor { // build time if the symbol wasn't found and building of the file containing // that type is delayed because lazily_build_dependencies_ is set on the pool. // Should not be called after Set() has been called. - void SetLazy(const std::string& name, const FileDescriptor* file); + void SetLazy(StringPiece name, const FileDescriptor* file); // Returns the current value of the descriptor, thread-safe. If SetLazy(...) // has been called, will do a one-time cross link of the type specified, // building the descriptor file that contains the type if necessary. - inline const Descriptor* Get() { - Once(); + inline const Descriptor* Get(const ServiceDescriptor* service) { + Once(service); return descriptor_; } private: - static void OnceStatic(LazyDescriptor* lazy); - void OnceInternal(); - void Once(); + void Once(const ServiceDescriptor* service); - const Descriptor* descriptor_; - const std::string* name_; + union { + const Descriptor* descriptor_; + const char* lazy_name_; + }; internal::once_flag* once_; - const FileDescriptor* file_; }; + +class PROTOBUF_EXPORT SymbolBase { + private: + friend class google::protobuf::Symbol; + uint8_t symbol_type_; +}; + +// Some types have more than one SymbolBase because they have multiple +// identities in the table. We can't have duplicate direct bases, so we use this +// intermediate base to do so. +// See BuildEnumValue for details. +template +class PROTOBUF_EXPORT SymbolBaseN : public SymbolBase {}; + } // namespace internal // Describes a type of protocol message, or a particular group within a @@ -228,7 +244,7 @@ class PROTOBUF_EXPORT LazyDescriptor { // Message::GetDescriptor(). Generated message classes also have a // static method called descriptor() which returns the type's descriptor. // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT Descriptor { +class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { public: typedef DescriptorProto Proto; @@ -264,7 +280,7 @@ class PROTOBUF_EXPORT Descriptor { // isn't, the result may be garbage. void CopyTo(DescriptorProto* proto) const; - // Write the contents of this decriptor in a human-readable form. Output + // Write the contents of this descriptor in a human-readable form. Output // will be suitable for re-parsing. std::string DebugString() const; @@ -277,6 +293,36 @@ class PROTOBUF_EXPORT Descriptor { // with AllowUnknownDependencies() set. bool is_placeholder() const; + enum WellKnownType { + WELLKNOWNTYPE_UNSPECIFIED, // Not a well-known type. + + // Wrapper types. + WELLKNOWNTYPE_DOUBLEVALUE, // google.protobuf.DoubleValue + WELLKNOWNTYPE_FLOATVALUE, // google.protobuf.FloatValue + WELLKNOWNTYPE_INT64VALUE, // google.protobuf.Int64Value + WELLKNOWNTYPE_UINT64VALUE, // google.protobuf.UInt64Value + WELLKNOWNTYPE_INT32VALUE, // google.protobuf.Int32Value + WELLKNOWNTYPE_UINT32VALUE, // google.protobuf.UInt32Value + WELLKNOWNTYPE_STRINGVALUE, // google.protobuf.StringValue + WELLKNOWNTYPE_BYTESVALUE, // google.protobuf.BytesValue + WELLKNOWNTYPE_BOOLVALUE, // google.protobuf.BoolValue + + // Other well known types. + WELLKNOWNTYPE_ANY, // google.protobuf.Any + WELLKNOWNTYPE_FIELDMASK, // google.protobuf.FieldMask + WELLKNOWNTYPE_DURATION, // google.protobuf.Duration + WELLKNOWNTYPE_TIMESTAMP, // google.protobuf.Timestamp + WELLKNOWNTYPE_VALUE, // google.protobuf.Value + WELLKNOWNTYPE_LISTVALUE, // google.protobuf.ListValue + WELLKNOWNTYPE_STRUCT, // google.protobuf.Struct + + // New well-known types may be added in the future. + // Please make sure any switch() statements have a 'default' case. + __WELLKNOWNTYPE__DO_NOT_USE__ADD_DEFAULT_INSTEAD__, + }; + + WellKnownType well_known_type() const; + // Field stuff ----------------------------------------------------- // The number of fields in this message type. @@ -289,29 +335,33 @@ class PROTOBUF_EXPORT Descriptor { // exists. const FieldDescriptor* FindFieldByNumber(int number) const; // Looks up a field by name. Returns nullptr if no such field exists. - const FieldDescriptor* FindFieldByName(const std::string& name) const; + const FieldDescriptor* FindFieldByName(ConstStringParam name) const; // Looks up a field by lowercased name (as returned by lowercase_name()). // This lookup may be ambiguous if multiple field names differ only by case, // in which case the field returned is chosen arbitrarily from the matches. const FieldDescriptor* FindFieldByLowercaseName( - const std::string& lowercase_name) const; + ConstStringParam lowercase_name) const; // Looks up a field by camel-case name (as returned by camelcase_name()). // This lookup may be ambiguous if multiple field names differ in a way that // leads them to have identical camel-case names, in which case the field // returned is chosen arbitrarily from the matches. const FieldDescriptor* FindFieldByCamelcaseName( - const std::string& camelcase_name) const; + ConstStringParam camelcase_name) const; // The number of oneofs in this message type. int oneof_decl_count() const; + // The number of oneofs in this message type, excluding synthetic oneofs. + // Real oneofs always come first, so iterating up to real_oneof_decl_cout() + // will yield all real oneofs. + int real_oneof_decl_count() const; // Get a oneof by index, where 0 <= index < oneof_decl_count(). // These are returned in the order they were defined in the .proto file. const OneofDescriptor* oneof_decl(int index) const; // Looks up a oneof by name. Returns nullptr if no such oneof exists. - const OneofDescriptor* FindOneofByName(const std::string& name) const; + const OneofDescriptor* FindOneofByName(ConstStringParam name) const; // Nested type stuff ----------------------------------------------- @@ -323,7 +373,7 @@ class PROTOBUF_EXPORT Descriptor { // Looks up a nested type by name. Returns nullptr if no such nested type // exists. - const Descriptor* FindNestedTypeByName(const std::string& name) const; + const Descriptor* FindNestedTypeByName(ConstStringParam name) const; // Enum stuff ------------------------------------------------------ @@ -335,11 +385,11 @@ class PROTOBUF_EXPORT Descriptor { // Looks up an enum type by name. Returns nullptr if no such enum type // exists. - const EnumDescriptor* FindEnumTypeByName(const std::string& name) const; + const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const; // Looks up an enum value by name, among all enum types in this message. // Returns nullptr if no such value exists. - const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const; + const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const; // Extensions ------------------------------------------------------ @@ -372,8 +422,30 @@ class PROTOBUF_EXPORT Descriptor { // Returns nullptr if no extension range contains the given number. const ExtensionRange* FindExtensionRangeContainingNumber(int number) const; - // The number of extensions -- extending *other* messages -- that were - // defined nested within this message type's scope. + // The number of extensions defined nested within this message type's scope. + // See doc: + // https://developers.google.com/protocol-buffers/docs/proto#nested-extensions + // + // Note that the extensions may be extending *other* messages. + // + // For example: + // message M1 { + // extensions 1 to max; + // } + // + // message M2 { + // extend M1 { + // optional int32 foo = 1; + // } + // } + // + // In this case, + // DescriptorPool::generated_pool() + // ->FindMessageTypeByName("M2") + // ->extension(0) + // will return "foo", even though "foo" is an extension of M1. + // To find all known extensions of a given message, instead use + // DescriptorPool::FindAllExtensions. int extension_count() const; // Get an extension by index, where 0 <= index < extension_count(). // These are returned in the order they were defined in the .proto file. @@ -381,17 +453,17 @@ class PROTOBUF_EXPORT Descriptor { // Looks up a named extension (which extends some *other* message type) // defined within this message type's scope. - const FieldDescriptor* FindExtensionByName(const std::string& name) const; + const FieldDescriptor* FindExtensionByName(ConstStringParam name) const; // Similar to FindFieldByLowercaseName(), but finds extensions defined within // this message type's scope. const FieldDescriptor* FindExtensionByLowercaseName( - const std::string& name) const; + ConstStringParam name) const; // Similar to FindFieldByCamelcaseName(), but finds extensions defined within // this message type's scope. const FieldDescriptor* FindExtensionByCamelcaseName( - const std::string& name) const; + ConstStringParam name) const; // Reserved fields ------------------------------------------------- @@ -421,7 +493,7 @@ class PROTOBUF_EXPORT Descriptor { const std::string& reserved_name(int index) const; // Returns true if the field name is reserved. - bool IsReservedName(const std::string& name) const; + bool IsReservedName(ConstStringParam name) const; // Source Location --------------------------------------------------- @@ -430,7 +502,18 @@ class PROTOBUF_EXPORT Descriptor { // |*out_location| unchanged iff location information was not available. bool GetSourceLocation(SourceLocation* out_location) const; + // Maps -------------------------------------------------------------- + + // Returns the FieldDescriptor for the "key" field. If this isn't a map entry + // field, returns nullptr. + const FieldDescriptor* map_key() const; + + // Returns the FieldDescriptor for the "value" field. If this isn't a map + // entry field, returns nullptr. + const FieldDescriptor* map_value() const; + private: + friend class Symbol; typedef MessageOptions OptionsType; // Allows tests to test CopyTo(proto, true). @@ -455,8 +538,26 @@ class PROTOBUF_EXPORT Descriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + // True if this is a placeholder for an unknown type. + bool is_placeholder_ : 1; + // True if this is a placeholder and the type name wasn't fully-qualified. + bool is_unqualified_placeholder_ : 1; + // Well known type. Stored like this to conserve space. + uint8_t well_known_type_ : 5; + + // This points to the last field _number_ that is part of the sequence + // starting at 1, where + // `desc->field(i)->number() == i + 1` + // A value of `0` means no field matches. That is, there are no fields or the + // first field is not field `1`. + // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^16 + // sequentially numbered fields in a message. + uint16_t sequential_field_limit_; + + int field_count_; + + // all_names_ = [name, full_name] + const std::string* all_names_; const FileDescriptor* file_; const Descriptor* containing_type_; const MessageOptions* options_; @@ -471,8 +572,8 @@ class PROTOBUF_EXPORT Descriptor { ReservedRange* reserved_ranges_; const std::string** reserved_names_; - int field_count_; int oneof_decl_count_; + int real_oneof_decl_count_; int nested_type_count_; int enum_type_count_; int extension_range_count_; @@ -480,11 +581,6 @@ class PROTOBUF_EXPORT Descriptor { int reserved_range_count_; int reserved_name_count_; - // True if this is a placeholder for an unknown type. - bool is_placeholder_; - // True if this is a placeholder and the type name wasn't fully-qualified. - bool is_unqualified_placeholder_; - // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in descriptor.cc // and update them to initialize the field. @@ -495,6 +591,7 @@ class PROTOBUF_EXPORT Descriptor { friend class DescriptorPool; friend class EnumDescriptor; friend class FieldDescriptor; + friend class FileDescriptorTables; friend class OneofDescriptor; friend class MethodDescriptor; friend class FileDescriptor; @@ -512,7 +609,7 @@ class PROTOBUF_EXPORT Descriptor { // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or // DescriptorPool::FindExtensionByPrintableName(). // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT FieldDescriptor { +class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { public: typedef FieldDescriptorProto Proto; @@ -629,6 +726,19 @@ class PROTOBUF_EXPORT FieldDescriptor { bool is_map() const; // shorthand for type() == TYPE_MESSAGE && // message_type()->options().map_entry() + // Returns true if this field was syntactically written with "optional" in the + // .proto file. Excludes singular proto3 fields that do not have a label. + bool has_optional_keyword() const; + + // Returns true if this field tracks presence, ie. does the field + // distinguish between "unset" and "present with default value." + // This includes required, optional, and oneof fields. It excludes maps, + // repeated fields, and singular proto3 fields without "optional". + // + // For fields where has_presence() == true, the return value of + // Reflection::HasField() is semantically meaningful. + bool has_presence() const; + // Index of this field within the message's field array, or the file or // extension scope's extensions array. int index() const; @@ -642,16 +752,20 @@ class PROTOBUF_EXPORT FieldDescriptor { // Get the field default value if cpp_type() == CPPTYPE_INT32. If no // explicit default was defined, the default is 0. - int32 default_value_int32() const; + int32_t default_value_int32_t() const; + int32_t default_value_int32() const { return default_value_int32_t(); } // Get the field default value if cpp_type() == CPPTYPE_INT64. If no // explicit default was defined, the default is 0. - int64 default_value_int64() const; + int64_t default_value_int64_t() const; + int64_t default_value_int64() const { return default_value_int64_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no // explicit default was defined, the default is 0. - uint32 default_value_uint32() const; + uint32_t default_value_uint32_t() const; + uint32_t default_value_uint32() const { return default_value_uint32_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no // explicit default was defined, the default is 0. - uint64 default_value_uint64() const; + uint64_t default_value_uint64_t() const; + uint64_t default_value_uint64() const { return default_value_uint64_t(); } // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no // explicit default was defined, the default is 0.0. float default_value_float() const; @@ -678,6 +792,10 @@ class PROTOBUF_EXPORT FieldDescriptor { // nullptr. const OneofDescriptor* containing_oneof() const; + // If the field is a member of a non-synthetic oneof, returns the descriptor + // for the oneof, otherwise returns nullptr. + const OneofDescriptor* real_containing_oneof() const; + // If the field is a member of a oneof, returns the index in that oneof. int index_in_oneof() const; @@ -746,24 +864,24 @@ class PROTOBUF_EXPORT FieldDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef FieldOptions OptionsType; // Allows access to GetLocationPath for annotations. friend class io::Printer; friend class compiler::cpp::Formatter; + friend class Reflection; // Fill the json_name field of FieldDescriptorProto. void CopyJsonNameTo(FieldDescriptorProto* proto) const; // See Descriptor::DebugString(). - enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL }; - void DebugString(int depth, PrintLabelFlag print_label_flag, - std::string* contents, + void DebugString(int depth, std::string* contents, const DebugStringOptions& options) const; // formats the default value appropriately and returns it as a string. // Must have a default value to call this. If quote_string_type is true, then - // types of CPPTYPE_STRING whill be surrounded by quotes and CEscaped. + // types of CPPTYPE_STRING will be surrounded by quotes and CEscaped. std::string DefaultValueAsString(bool quote_string_type) const; // Helper function that returns the field type name for DebugString. @@ -776,49 +894,67 @@ class PROTOBUF_EXPORT FieldDescriptor { // Returns true if this is a map message type. bool is_map_message_type() const; - const std::string* name_; - const std::string* full_name_; - const std::string* lowercase_name_; - const std::string* camelcase_name_; - // If has_json_name_ is true, it's the value specified by the user. - // Otherwise, it has the same value as camelcase_name_. - const std::string* json_name_; + bool has_default_value_ : 1; + bool proto3_optional_ : 1; + // Whether the user has specified the json_name field option in the .proto + // file. + bool has_json_name_ : 1; + bool is_extension_ : 1; + bool is_oneof_ : 1; + + // Actually a `Label` but stored as uint8_t to save space. + uint8_t label_ : 2; + + // Actually a `Type`, but stored as uint8_t to save space. + mutable uint8_t type_; + + // Logically: + // all_names_ = [name, full_name, lower, camel, json] + // However: + // duplicates will be omitted, so lower/camel/json might be in the same + // position. + // We store the true offset for each name here, and the bit width must be + // large enough to account for the worst case where all names are present. + uint8_t lowercase_name_index_ : 2; + uint8_t camelcase_name_index_ : 2; + uint8_t json_name_index_ : 3; + // Sadly, `number_` located here to reduce padding. Unrelated to all_names_ + // and its indices above. + int number_; + const std::string* all_names_; const FileDescriptor* file_; + internal::once_flag* type_once_; static void TypeOnceInit(const FieldDescriptor* to_init); void InternalTypeOnceInit() const; - mutable Type type_; - Label label_; - bool has_default_value_; - // Whether the user has specified the json_name field option in the .proto - // file. - bool has_json_name_; - bool is_extension_; - int number_; - int index_in_oneof_; const Descriptor* containing_type_; - const OneofDescriptor* containing_oneof_; - const Descriptor* extension_scope_; - mutable const Descriptor* message_type_; - mutable const EnumDescriptor* enum_type_; + union { + const OneofDescriptor* containing_oneof; + const Descriptor* extension_scope; + } scope_; + union { + mutable const Descriptor* message_type; + mutable const EnumDescriptor* enum_type; + const char* lazy_type_name; + } type_descriptor_; const FieldOptions* options_; - const std::string* type_name_; - const std::string* default_value_enum_name_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in // descriptor.cc and update them to initialize the field. union { - int32 default_value_int32_; - int64 default_value_int64_; - uint32 default_value_uint32_; - uint64 default_value_uint64_; + int32_t default_value_int32_t_; + int64_t default_value_int64_t_; + uint32_t default_value_uint32_t_; + uint64_t default_value_uint64_t_; float default_value_float_; double default_value_double_; bool default_value_bool_; mutable const EnumValueDescriptor* default_value_enum_; + const char* lazy_default_value_enum_name_; const std::string* default_value_string_; + mutable std::atomic default_generated_instance_; }; static const CppType kTypeToCppTypeMap[MAX_TYPE + 1]; @@ -840,7 +976,7 @@ class PROTOBUF_EXPORT FieldDescriptor { // Describes a oneof defined in a message type. -class PROTOBUF_EXPORT OneofDescriptor { +class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { public: typedef OneofDescriptorProto Proto; @@ -850,6 +986,10 @@ class PROTOBUF_EXPORT OneofDescriptor { // Index of this oneof within the message's oneof array. int index() const; + // Returns whether this oneof was inserted by the compiler to wrap a proto3 + // optional field. If this returns true, code generators should *not* emit it. + bool is_synthetic() const; + // The .proto file in which this oneof was defined. Never nullptr. const FileDescriptor* file() const; // The Descriptor for the message containing this oneof. @@ -880,6 +1020,7 @@ class PROTOBUF_EXPORT OneofDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef OneofOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -894,12 +1035,13 @@ class PROTOBUF_EXPORT OneofDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; - const Descriptor* containing_type_; int field_count_; - const FieldDescriptor** fields_; + + // all_names_ = [name, full_name] + const std::string* all_names_; + const Descriptor* containing_type_; const OneofOptions* options_; + const FieldDescriptor* fields_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() @@ -915,7 +1057,7 @@ class PROTOBUF_EXPORT OneofDescriptor { // Describes an enum type defined in a .proto file. To get the EnumDescriptor // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool // to construct your own descriptors. -class PROTOBUF_EXPORT EnumDescriptor { +class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { public: typedef EnumDescriptorProto Proto; @@ -939,7 +1081,7 @@ class PROTOBUF_EXPORT EnumDescriptor { const EnumValueDescriptor* value(int index) const; // Looks up a value by name. Returns nullptr if no such value exists. - const EnumValueDescriptor* FindValueByName(const std::string& name) const; + const EnumValueDescriptor* FindValueByName(ConstStringParam name) const; // Looks up a value by number. Returns nullptr if no such value exists. If // multiple values have this number, the first one defined is returned. const EnumValueDescriptor* FindValueByNumber(int number) const; @@ -997,7 +1139,7 @@ class PROTOBUF_EXPORT EnumDescriptor { const std::string& reserved_name(int index) const; // Returns true if the field name is reserved. - bool IsReservedName(const std::string& name) const; + bool IsReservedName(ConstStringParam name) const; // Source Location --------------------------------------------------- @@ -1007,12 +1149,16 @@ class PROTOBUF_EXPORT EnumDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumOptions OptionsType; // Allows access to GetLocationPath for annotations. friend class io::Printer; friend class compiler::cpp::Formatter; + // Allow access to FindValueByNumberCreatingIfUnknown. + friend class descriptor_unittest::DescriptorTest; + // Looks up a value by number. If the value does not exist, dynamically // creates a new EnumValueDescriptor for that value, assuming that it was // unknown. If a new descriptor is created, this is done in a thread-safe way, @@ -1032,18 +1178,27 @@ class PROTOBUF_EXPORT EnumDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; - const FileDescriptor* file_; - const Descriptor* containing_type_; - const EnumOptions* options_; - // True if this is a placeholder for an unknown type. - bool is_placeholder_; + bool is_placeholder_ : 1; // True if this is a placeholder and the type name wasn't fully-qualified. - bool is_unqualified_placeholder_; + bool is_unqualified_placeholder_ : 1; + + // This points to the last value _index_ that is part of the sequence starting + // with the first label, where + // `enum->value(i)->number() == enum->value(0)->number() + i` + // We measure relative to the first label to adapt to enum labels starting at + // 0 or 1. + // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^15 + // sequentially numbered labels in an enum. + int16_t sequential_value_limit_; int value_count_; + + // all_names_ = [name, full_name] + const std::string* all_names_; + const FileDescriptor* file_; + const Descriptor* containing_type_; + const EnumOptions* options_; EnumValueDescriptor* values_; int reserved_range_count_; @@ -1060,6 +1215,7 @@ class PROTOBUF_EXPORT EnumDescriptor { friend class DescriptorBuilder; friend class Descriptor; friend class FieldDescriptor; + friend class FileDescriptorTables; friend class EnumValueDescriptor; friend class FileDescriptor; friend class DescriptorPool; @@ -1072,7 +1228,8 @@ class PROTOBUF_EXPORT EnumDescriptor { // for its type, then use EnumDescriptor::FindValueByName() or // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct // your own descriptors. -class PROTOBUF_EXPORT EnumValueDescriptor { +class PROTOBUF_EXPORT EnumValueDescriptor : private internal::SymbolBaseN<0>, + private internal::SymbolBaseN<1> { public: typedef EnumValueDescriptorProto Proto; @@ -1115,6 +1272,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumValueOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1129,9 +1287,9 @@ class PROTOBUF_EXPORT EnumValueDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; int number_; + // all_names_ = [name, full_name] + const std::string* all_names_; const EnumDescriptor* type_; const EnumValueOptions* options_; // IMPORTANT: If you add a new field, make sure to search for all instances @@ -1144,12 +1302,13 @@ class PROTOBUF_EXPORT EnumValueDescriptor { friend class EnumDescriptor; friend class DescriptorPool; friend class FileDescriptorTables; + friend class Reflection; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumValueDescriptor); }; // Describes an RPC service. Use DescriptorPool to construct your own // descriptors. -class PROTOBUF_EXPORT ServiceDescriptor { +class PROTOBUF_EXPORT ServiceDescriptor : private internal::SymbolBase { public: typedef ServiceDescriptorProto Proto; @@ -1176,7 +1335,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { const MethodDescriptor* method(int index) const; // Look up a MethodDescriptor by name. - const MethodDescriptor* FindMethodByName(const std::string& name) const; + const MethodDescriptor* FindMethodByName(ConstStringParam name) const; // See Descriptor::CopyTo(). void CopyTo(ServiceDescriptorProto* proto) const; @@ -1194,6 +1353,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef ServiceOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1208,8 +1368,8 @@ class PROTOBUF_EXPORT ServiceDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + // all_names_ = [name, full_name] + const std::string* all_names_; const FileDescriptor* file_; const ServiceOptions* options_; MethodDescriptor* methods_; @@ -1231,7 +1391,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { // a service, first get its ServiceDescriptor, then call // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your // own descriptors. -class PROTOBUF_EXPORT MethodDescriptor { +class PROTOBUF_EXPORT MethodDescriptor : private internal::SymbolBase { public: typedef MethodDescriptorProto Proto; @@ -1280,6 +1440,7 @@ class PROTOBUF_EXPORT MethodDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef MethodOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1294,14 +1455,14 @@ class PROTOBUF_EXPORT MethodDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector* output) const; - const std::string* name_; - const std::string* full_name_; + bool client_streaming_; + bool server_streaming_; + // all_names_ = [name, full_name] + const std::string* all_names_; const ServiceDescriptor* service_; mutable internal::LazyDescriptor input_type_; mutable internal::LazyDescriptor output_type_; const MethodOptions* options_; - bool client_streaming_; - bool server_streaming_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate() and AllocateArray() in // descriptor.cc and update them to initialize the field. @@ -1396,26 +1557,27 @@ class PROTOBUF_EXPORT FileDescriptor { Syntax syntax() const; static const char* SyntaxName(Syntax syntax); - // Find a top-level message type by name. Returns nullptr if not found. - const Descriptor* FindMessageTypeByName(const std::string& name) const; + // Find a top-level message type by name (not full_name). Returns nullptr if + // not found. + const Descriptor* FindMessageTypeByName(ConstStringParam name) const; // Find a top-level enum type by name. Returns nullptr if not found. - const EnumDescriptor* FindEnumTypeByName(const std::string& name) const; + const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const; // Find an enum value defined in any top-level enum by name. Returns nullptr // if not found. - const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const; + const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const; // Find a service definition by name. Returns nullptr if not found. - const ServiceDescriptor* FindServiceByName(const std::string& name) const; + const ServiceDescriptor* FindServiceByName(ConstStringParam name) const; // Find a top-level extension definition by name. Returns nullptr if not // found. - const FieldDescriptor* FindExtensionByName(const std::string& name) const; + const FieldDescriptor* FindExtensionByName(ConstStringParam name) const; // Similar to FindExtensionByName(), but searches by lowercased-name. See // Descriptor::FindFieldByLowercaseName(). const FieldDescriptor* FindExtensionByLowercaseName( - const std::string& name) const; + ConstStringParam name) const; // Similar to FindExtensionByName(), but searches by camelcased-name. See // Descriptor::FindFieldByCamelcaseName(). const FieldDescriptor* FindExtensionByCamelcaseName( - const std::string& name) const; + ConstStringParam name) const; // See Descriptor::CopyTo(). // Notes: @@ -1458,28 +1620,38 @@ class PROTOBUF_EXPORT FileDescriptor { const std::string* name_; const std::string* package_; const DescriptorPool* pool_; - internal::once_flag* dependencies_once_; + + // Data required to do lazy initialization. + struct PROTOBUF_EXPORT LazyInitData { +#ifndef SWIG + internal::once_flag once; +#endif + const char** dependencies_names; + }; + + LazyInitData* dependencies_once_; static void DependenciesOnceInit(const FileDescriptor* to_init); void InternalDependenciesOnceInit() const; - // These are arranged to minimze padding on 64-bit. + // These are arranged to minimize padding on 64-bit. int dependency_count_; int public_dependency_count_; int weak_dependency_count_; int message_type_count_; int enum_type_count_; int service_count_; - int extension_count_; - Syntax syntax_; - bool is_placeholder_; + bool is_placeholder_; // Indicates the FileDescriptor is completed building. Used to verify // that type accessor functions that can possibly build a dependent file // aren't called during the process of building the file. bool finished_building_; + // Actually a `Syntax` but stored as uint8_t to save space. + uint8_t syntax_; + // This one is here to fill the padding. + int extension_count_; mutable const FileDescriptor** dependencies_; - const std::string** dependencies_names_; int* public_dependencies_; int* weak_dependencies_; Descriptor* message_types_; @@ -1578,28 +1750,28 @@ class PROTOBUF_EXPORT DescriptorPool { // Find a FileDescriptor in the pool by file name. Returns nullptr if not // found. - const FileDescriptor* FindFileByName(const std::string& name) const; + const FileDescriptor* FindFileByName(ConstStringParam name) const; // Find the FileDescriptor in the pool which defines the given symbol. // If any of the Find*ByName() methods below would succeed, then this is // equivalent to calling that method and calling the result's file() method. // Otherwise this returns nullptr. const FileDescriptor* FindFileContainingSymbol( - const std::string& symbol_name) const; + ConstStringParam symbol_name) const; // Looking up descriptors ------------------------------------------ // These find descriptors by fully-qualified name. These will find both // top-level descriptors and nested descriptors. They return nullptr if not // found. - const Descriptor* FindMessageTypeByName(const std::string& name) const; - const FieldDescriptor* FindFieldByName(const std::string& name) const; - const FieldDescriptor* FindExtensionByName(const std::string& name) const; - const OneofDescriptor* FindOneofByName(const std::string& name) const; - const EnumDescriptor* FindEnumTypeByName(const std::string& name) const; - const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const; - const ServiceDescriptor* FindServiceByName(const std::string& name) const; - const MethodDescriptor* FindMethodByName(const std::string& name) const; + const Descriptor* FindMessageTypeByName(ConstStringParam name) const; + const FieldDescriptor* FindFieldByName(ConstStringParam name) const; + const FieldDescriptor* FindExtensionByName(ConstStringParam name) const; + const OneofDescriptor* FindOneofByName(ConstStringParam name) const; + const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const; + const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const; + const ServiceDescriptor* FindServiceByName(ConstStringParam name) const; + const MethodDescriptor* FindMethodByName(ConstStringParam name) const; // Finds an extension of the given type by number. The extendee must be // a member of this DescriptorPool or one of its underlays. @@ -1612,7 +1784,7 @@ class PROTOBUF_EXPORT DescriptorPool { // or one of its underlays. Returns nullptr if there is no known message // extension with the given printable name. const FieldDescriptor* FindExtensionByPrintableName( - const Descriptor* extendee, const std::string& printable_name) const; + const Descriptor* extendee, ConstStringParam printable_name) const; // Finds extensions of extendee. The extensions will be appended to // out in an undefined order. Only extensions defined directly in @@ -1752,6 +1924,11 @@ class PROTOBUF_EXPORT DescriptorPool { // the underlay takes precedence. static DescriptorPool* internal_generated_pool(); + // For internal use only: Gets a non-const pointer to the generated + // descriptor database. + // Only used for testing. + static DescriptorDatabase* internal_generated_database(); + // For internal use only: Changes the behavior of BuildFile() such that it // allows the file to make reference to message types declared in other files // which it did not officially declare as dependencies. @@ -1761,7 +1938,7 @@ class PROTOBUF_EXPORT DescriptorPool { // Delay the building of dependencies of a file descriptor until absolutely // necessary, like when message_type() is called on a field that is defined // in that dependency's file. This will cause functional issues if a proto - // or one of it's dependencies has errors. Should only be enabled for the + // or one of its dependencies has errors. Should only be enabled for the // generated_pool_ (because no descriptor build errors are guaranteed by // the compilation generation process), testing, or if a lack of descriptor // build errors can be guaranteed for a pool. @@ -1780,11 +1957,12 @@ class PROTOBUF_EXPORT DescriptorPool { // For internal (unit test) use only: Returns true if a FileDescriptor has // been constructed for the given file, false otherwise. Useful for testing // lazy descriptor initialization behavior. - bool InternalIsFileLoaded(const std::string& filename) const; + bool InternalIsFileLoaded(ConstStringParam filename) const; // Add a file to unused_import_track_files_. DescriptorBuilder will log - // warnings for those files if there is any unused import. - void AddUnusedImportTrackFile(const std::string& file_name); + // warnings or errors for those files if there is any unused import. + void AddUnusedImportTrackFile(ConstStringParam file_name, + bool is_error = false); void ClearUnusedImportTrackFiles(); private: @@ -1802,14 +1980,14 @@ class PROTOBUF_EXPORT DescriptorPool { // Return true if the given name is a sub-symbol of any non-package // descriptor that already exists in the descriptor pool. (The full // definition of such types is already known.) - bool IsSubSymbolOfBuiltType(const std::string& name) const; + bool IsSubSymbolOfBuiltType(StringPiece name) const; // Tries to find something in the fallback database and link in the // corresponding proto file. Returns true if successful, in which case // the caller should search for the thing again. These are declared // const because they are called by (semantically) const methods. - bool TryFindFileInFallbackDatabase(const std::string& name) const; - bool TryFindSymbolInFallbackDatabase(const std::string& name) const; + bool TryFindFileInFallbackDatabase(StringPiece name) const; + bool TryFindSymbolInFallbackDatabase(StringPiece name) const; bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type, int field_number) const; @@ -1830,13 +2008,12 @@ class PROTOBUF_EXPORT DescriptorPool { // symbol is defined if necessary. Will create a placeholder if the type // doesn't exist in the fallback database, or the file doesn't build // successfully. - Symbol CrossLinkOnDemandHelper(const std::string& name, + Symbol CrossLinkOnDemandHelper(StringPiece name, bool expecting_enum) const; // Create a placeholder FileDescriptor of the specified name - FileDescriptor* NewPlaceholderFile(const std::string& name) const; - FileDescriptor* NewPlaceholderFileWithMutexHeld( - const std::string& name) const; + FileDescriptor* NewPlaceholderFile(StringPiece name) const; + FileDescriptor* NewPlaceholderFileWithMutexHeld(StringPiece name) const; enum PlaceholderType { PLACEHOLDER_MESSAGE, @@ -1844,9 +2021,9 @@ class PROTOBUF_EXPORT DescriptorPool { PLACEHOLDER_EXTENDABLE_MESSAGE }; // Create a placeholder Descriptor of the specified name - Symbol NewPlaceholder(const std::string& name, + Symbol NewPlaceholder(StringPiece name, PlaceholderType placeholder_type) const; - Symbol NewPlaceholderWithMutexHeld(const std::string& name, + Symbol NewPlaceholderWithMutexHeld(StringPiece name, PlaceholderType placeholder_type) const; // If fallback_database_ is nullptr, this is nullptr. Otherwise, this is a @@ -1868,7 +2045,10 @@ class PROTOBUF_EXPORT DescriptorPool { bool allow_unknown_; bool enforce_weak_; bool disallow_enforce_utf8_; - std::set unused_import_track_files_; + + // Set of files to track for unused imports. The bool value when true means + // unused imports are treated as errors (and as warnings when false). + std::map unused_import_track_files_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorPool); }; @@ -1884,6 +2064,11 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \ inline const std::string& CLASS::FIELD() const { return *FIELD##_; } +// Name and full name are stored in a single array to save space. +#define PROTOBUF_DEFINE_NAME_ACCESSOR(CLASS) \ + inline const std::string& CLASS::name() const { return all_names_[0]; } \ + inline const std::string& CLASS::full_name() const { return all_names_[1]; } + // Arrays take an index parameter, obviously. #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \ inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; } @@ -1891,13 +2076,13 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \ inline const TYPE& CLASS::options() const { return *options_; } -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(Descriptor) PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int) PROTOBUF_DEFINE_ACCESSOR(Descriptor, oneof_decl_count, int) +PROTOBUF_DEFINE_ACCESSOR(Descriptor, real_oneof_decl_count, int) PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int) PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int) @@ -1920,40 +2105,30 @@ PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, json_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(FieldDescriptor) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, - const OneofDescriptor*) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32, int32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64, int64) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32_t, int32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64_t, int64_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32_t, uint32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64_t, uint64_t) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(OneofDescriptor, field, const FieldDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) @@ -1966,22 +2141,19 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, reserved_range, const EnumDescriptor::ReservedRange*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumValueDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(ServiceDescriptor) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(MethodDescriptor) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) @@ -2013,6 +2185,10 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, extension, // A few accessors differ from the macros... +inline Descriptor::WellKnownType Descriptor::well_known_type() const { + return static_cast(well_known_type_); +} + inline bool Descriptor::IsExtensionNumber(int number) const { return FindExtensionRangeContainingNumber(number) != nullptr; } @@ -2021,9 +2197,9 @@ inline bool Descriptor::IsReservedNumber(int number) const { return FindReservedRangeContainingNumber(number) != nullptr; } -inline bool Descriptor::IsReservedName(const std::string& name) const { +inline bool Descriptor::IsReservedName(ConstStringParam name) const { for (int i = 0; i < reserved_name_count(); i++) { - if (name == reserved_name(i)) { + if (name == static_cast(reserved_name(i))) { return true; } } @@ -2040,9 +2216,9 @@ inline bool EnumDescriptor::IsReservedNumber(int number) const { return FindReservedRangeContainingNumber(number) != nullptr; } -inline bool EnumDescriptor::IsReservedName(const std::string& name) const { +inline bool EnumDescriptor::IsReservedName(ConstStringParam name) const { for (int i = 0; i < reserved_name_count(); i++) { - if (name == reserved_name(i)) { + if (name == static_cast(reserved_name(i))) { return true; } } @@ -2055,11 +2231,41 @@ inline const std::string& EnumDescriptor::reserved_name(int index) const { return *reserved_names_[index]; } +inline const std::string& FieldDescriptor::lowercase_name() const { + return all_names_[lowercase_name_index_]; +} + +inline const std::string& FieldDescriptor::camelcase_name() const { + return all_names_[camelcase_name_index_]; +} + +inline const std::string& FieldDescriptor::json_name() const { + return all_names_[json_name_index_]; +} + +inline const OneofDescriptor* FieldDescriptor::containing_oneof() const { + return is_oneof_ ? scope_.containing_oneof : nullptr; +} + +inline int FieldDescriptor::index_in_oneof() const { + GOOGLE_DCHECK(is_oneof_); + return static_cast(this - scope_.containing_oneof->field(0)); +} + +inline const Descriptor* FieldDescriptor::extension_scope() const { + GOOGLE_CHECK(is_extension_); + return scope_.extension_scope; +} + +inline FieldDescriptor::Label FieldDescriptor::label() const { + return static_cast